View | Details | Raw Unified | Return to bug 213237
Collapse All | Expand All

(-)dev/if_ndis/if_ndis.c (-36 / +45 lines)
Lines 147-153 Link Here
147
static funcptr ndis_linksts_wrap;
147
static funcptr ndis_linksts_wrap;
148
static funcptr ndis_linksts_done_wrap;
148
static funcptr ndis_linksts_done_wrap;
149
static funcptr ndis_ticktask_wrap;
149
static funcptr ndis_ticktask_wrap;
150
static funcptr ndis_starttask_wrap;
150
static funcptr ndis_ifstarttask_wrap;
151
static funcptr ndis_resettask_wrap;
151
static funcptr ndis_resettask_wrap;
152
static funcptr ndis_inputtask_wrap;
152
static funcptr ndis_inputtask_wrap;
153
153
Lines 162-172 Link Here
162
	const struct ieee80211_bpf_params *);
162
	const struct ieee80211_bpf_params *);
163
static void ndis_update_mcast	(struct ieee80211com *);
163
static void ndis_update_mcast	(struct ieee80211com *);
164
static void ndis_update_promisc	(struct ieee80211com *);
164
static void ndis_update_promisc	(struct ieee80211com *);
165
static void ndis_start		(struct ifnet *);
165
static void ndis_ifstart	(struct ifnet *);
166
static void ndis_starttask	(device_object *, void *);
166
static void ndis_ifstarttask	(device_object *, void *);
167
static void ndis_resettask	(device_object *, void *);
167
static void ndis_resettask	(device_object *, void *);
168
static void ndis_inputtask	(device_object *, void *);
168
static void ndis_inputtask	(device_object *, void *);
169
static int ndis_ioctl		(struct ifnet *, u_long, caddr_t);
169
static int ndis_ifioctl		(struct ifnet *, u_long, caddr_t);
170
static int ndis_newstate	(struct ieee80211vap *, enum ieee80211_state,
170
static int ndis_newstate	(struct ieee80211vap *, enum ieee80211_state,
171
	int);
171
	int);
172
static int ndis_nettype_chan	(uint32_t);
172
static int ndis_nettype_chan	(uint32_t);
Lines 246-252 Link Here
246
		    &ndis_linksts_done_wrap, 1, WINDRV_WRAP_STDCALL);
246
		    &ndis_linksts_done_wrap, 1, WINDRV_WRAP_STDCALL);
247
		windrv_wrap((funcptr)ndis_ticktask, &ndis_ticktask_wrap,
247
		windrv_wrap((funcptr)ndis_ticktask, &ndis_ticktask_wrap,
248
		    2, WINDRV_WRAP_STDCALL);
248
		    2, WINDRV_WRAP_STDCALL);
249
		windrv_wrap((funcptr)ndis_starttask, &ndis_starttask_wrap,
249
		windrv_wrap((funcptr)ndis_ifstarttask, &ndis_ifstarttask_wrap,
250
		    2, WINDRV_WRAP_STDCALL);
250
		    2, WINDRV_WRAP_STDCALL);
251
		windrv_wrap((funcptr)ndis_resettask, &ndis_resettask_wrap,
251
		windrv_wrap((funcptr)ndis_resettask, &ndis_resettask_wrap,
252
		    2, WINDRV_WRAP_STDCALL);
252
		    2, WINDRV_WRAP_STDCALL);
Lines 268-274 Link Here
268
		windrv_unwrap(ndis_linksts_wrap);
268
		windrv_unwrap(ndis_linksts_wrap);
269
		windrv_unwrap(ndis_linksts_done_wrap);
269
		windrv_unwrap(ndis_linksts_done_wrap);
270
		windrv_unwrap(ndis_ticktask_wrap);
270
		windrv_unwrap(ndis_ticktask_wrap);
271
		windrv_unwrap(ndis_starttask_wrap);
271
		windrv_unwrap(ndis_ifstarttask_wrap);
272
		windrv_unwrap(ndis_resettask_wrap);
272
		windrv_unwrap(ndis_resettask_wrap);
273
		windrv_unwrap(ndis_inputtask_wrap);
273
		windrv_unwrap(ndis_inputtask_wrap);
274
		break;
274
		break;
Lines 292-302 Link Here
292
	int			len, mclistsz, error;
292
	int			len, mclistsz, error;
293
	uint8_t			*mclist;
293
	uint8_t			*mclist;
294
294
295
	ifp = sc->ifp;
296
295
297
	if (!NDIS_INITIALIZED(sc))
296
	if (!NDIS_INITIALIZED(sc))
298
		return;
297
		return;
299
298
299
	if (sc->ndis_80211)
300
		return;
301
302
	ifp = sc->ifp;
300
	if (ifp->if_flags & IFF_ALLMULTI || ifp->if_flags & IFF_PROMISC) {
303
	if (ifp->if_flags & IFF_ALLMULTI || ifp->if_flags & IFF_PROMISC) {
301
		sc->ndis_filter |= NDIS_PACKET_TYPE_ALL_MULTICAST;
304
		sc->ndis_filter |= NDIS_PACKET_TYPE_ALL_MULTICAST;
302
		len = sizeof(sc->ndis_filter);
305
		len = sizeof(sc->ndis_filter);
Lines 368-380 Link Here
368
	struct ifnet		*ifp;
375
	struct ifnet		*ifp;
369
	int			len, error;
376
	int			len, error;
370
377
371
	ifp = sc->ifp;
372
373
	if (!NDIS_INITIALIZED(sc))
378
	if (!NDIS_INITIALIZED(sc))
374
		return (EINVAL);
379
		return (EINVAL);
375
380
381
	if (sc->ndis_80211)
382
		return (EINVAL);
376
	/* See if there's anything to set. */
383
	/* See if there's anything to set. */
377
384
385
	ifp = sc->ifp;
378
	error = ndis_probe_offload(sc);
386
	error = ndis_probe_offload(sc);
379
	if (error)
387
	if (error)
380
		return (error);
388
		return (error);
Lines 965-972 Link Here
965
	if_initname(ifp, device_get_name(sc->ndis_dev),
999
	if_initname(ifp, device_get_name(sc->ndis_dev),
966
	    device_get_unit(sc->ndis_dev));
1000
	    device_get_unit(sc->ndis_dev));
967
	ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;
1001
	ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;
968
	ifp->if_ioctl = ndis_ioctl;
1002
	ifp->if_ioctl = ndis_ifioctl;
969
	ifp->if_start = ndis_start;
1003
	ifp->if_start = ndis_ifstart;
970
	ifp->if_init = ndis_init;
1004
	ifp->if_init = ndis_init;
971
	ifp->if_baudrate = 10000000;
1005
	ifp->if_baudrate = 10000000;
972
	IFQ_SET_MAXLEN(&ifp->if_snd, 50);
1006
	IFQ_SET_MAXLEN(&ifp->if_snd, 50);
Lines 1560-1578 Link Here
1560
	sc->ndis_txarray[idx] = NULL;
1584
	sc->ndis_txarray[idx] = NULL;
1561
	sc->ndis_txpending++;
1585
	sc->ndis_txpending++;
1562
1586
1563
	if (status == NDIS_STATUS_SUCCESS)
1587
	if (!sc->ndis_80211) {
1564
		if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1);
1588
		struct ifnet		*ifp = sc->ifp;
1565
	else
1589
		if (status == NDIS_STATUS_SUCCESS)
1566
		if_inc_counter(ifp, IFCOUNTER_OERRORS, 1);
1590
			if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1);
1567
1591
		else
1592
			if_inc_counter(ifp, IFCOUNTER_OERRORS, 1);
1593
		ifp->if_drv_flags &= ~IFF_DRV_OACTIVE;
1594
	}
1568
	sc->ndis_tx_timer = 0;
1595
	sc->ndis_tx_timer = 0;
1569
	ifp->if_drv_flags &= ~IFF_DRV_OACTIVE;
1570
1596
1571
	NDIS_UNLOCK(sc);
1597
	NDIS_UNLOCK(sc);
1572
1598
1573
	IoQueueWorkItem(sc->ndis_startitem,
1599
	if (!sc->ndis_80211)
1574
	    (io_workitem_func)ndis_starttask_wrap,
1600
		IoQueueWorkItem(sc->ndis_startitem,
1575
	    WORKQUEUE_CRITICAL, ifp);
1601
		    (io_workitem_func)ndis_ifstarttask_wrap,
1602
		    WORKQUEUE_CRITICAL, sc);
1603
	DPRINTF(("%s: ndis_ifstarttask_wrap sc=%p\n", __func__, sc));
1576
}
1604
}
1577
1605
1578
static void
1606
static void
Lines 1635-1643 Link Here
1635
		IoQueueWorkItem(sc->ndis_tickitem, 
1671
		IoQueueWorkItem(sc->ndis_tickitem, 
1636
		    (io_workitem_func)ndis_ticktask_wrap,
1672
		    (io_workitem_func)ndis_ticktask_wrap,
1637
		    WORKQUEUE_CRITICAL, sc);
1673
		    WORKQUEUE_CRITICAL, sc);
1638
		IoQueueWorkItem(sc->ndis_startitem,
1674
		if (!sc->ndis_80211)
1639
		    (io_workitem_func)ndis_starttask_wrap,
1675
			IoQueueWorkItem(sc->ndis_startitem,
1640
		    WORKQUEUE_CRITICAL, ifp);
1676
			    (io_workitem_func)ndis_ifstarttask_wrap,
1677
			    WORKQUEUE_CRITICAL, sc);
1641
		break;
1678
		break;
1642
	case NDIS_STATUS_MEDIA_DISCONNECT:
1679
	case NDIS_STATUS_MEDIA_DISCONNECT:
1643
		if (sc->ndis_link)
1680
		if (sc->ndis_link)
Lines 1672-1680 Link Here
1672
		IoQueueWorkItem(sc->ndis_resetitem,
1709
		IoQueueWorkItem(sc->ndis_resetitem,
1673
		    (io_workitem_func)ndis_resettask_wrap,
1710
		    (io_workitem_func)ndis_resettask_wrap,
1674
		    WORKQUEUE_CRITICAL, sc);
1711
		    WORKQUEUE_CRITICAL, sc);
1675
		IoQueueWorkItem(sc->ndis_startitem,
1712
		if (!sc->ndis_80211)
1676
		    (io_workitem_func)ndis_starttask_wrap,
1713
			IoQueueWorkItem(sc->ndis_startitem,
1677
		    WORKQUEUE_CRITICAL, sc->ifp);
1714
			    (io_workitem_func)ndis_ifstarttask_wrap,
1715
			    WORKQUEUE_CRITICAL, sc);
1678
	}
1716
	}
1679
1717
1680
	callout_reset(&sc->ndis_stat_callout, hz, ndis_tick, sc);
1718
	callout_reset(&sc->ndis_stat_callout, hz, ndis_tick, sc);
Lines 1796-1811 Link Here
1796
}
1834
}
1797
1835
1798
static void
1836
static void
1799
ndis_starttask(d, arg)
1837
ndis_ifstarttask(device_object *d, void *arg)
1800
	device_object		*d;
1801
	void			*arg;
1802
{
1838
{
1803
	struct ifnet		*ifp;
1839
	struct ndis_softc	*sc = arg;
1840
	DPRINTF(("%s: sc=%p, ifp=%p\n", __func__, sc, sc->ifp));
1841
	if (sc->ndis_80211)
1842
		return;
1804
1843
1805
	ifp = arg;
1844
	struct ifnet		*ifp = sc->ifp;
1806
1807
	if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd))
1845
	if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd))
1808
		ndis_start(ifp);
1846
		ndis_ifstart(ifp);
1809
}
1847
}
1810
1848
1811
/*
1849
/*
Lines 1821-1826 Link Here
1821
 * will do the mapping themselves on a buffer by buffer basis.
1859
 * will do the mapping themselves on a buffer by buffer basis.
1822
 */
1860
 */
1823
static void
1861
static void
1824
ndis_start(ifp)
1862
ndis_ifstart(struct ifnet *ifp)
1825
	struct ifnet		*ifp;
1826
{
1863
{
Lines 2880-2886 Link Here
2880
}
2928
}
2881
2929
2882
static int
2930
static int
2883
ndis_ioctl(ifp, command, data)
2931
ndis_ifioctl(ifp, command, data)
2884
	struct ifnet		*ifp;
2932
	struct ifnet		*ifp;
2885
	u_long			command;
2933
	u_long			command;
2886
	caddr_t			data;
2934
	caddr_t			data;
(-)dev/if_ndis/if_ndisvar.h (+1 lines)
Lines 152-157 Link Here
152
};
152
};
153
153
154
struct ndis_softc {
154
struct ndis_softc {
155
#define        NDISUSB_GET_IFNET(ndis_softc) ( (ndis_softc)->ndis_80211 ? NULL : (ndis_softc)->ifp )
155
	u_int			ndis_80211:1,
156
	u_int			ndis_80211:1,
156
				ndis_link:1,
157
				ndis_link:1,
157
				ndis_running:1;
158
				ndis_running:1;
(-)compat/ndis/kern_ndis.c (-8 / +11 lines)
Lines 210-217 Link Here
210
210
211
	block = adapter;
211
	block = adapter;
212
	sc = device_get_softc(block->nmb_physdeviceobj->do_devext);
212
	sc = device_get_softc(block->nmb_physdeviceobj->do_devext);
213
	ifp = sc->ifp;
213
	ifp = NDISUSB_GET_IFNET(sc);
214
	if (ifp->if_flags & IFF_DEBUG)
214
	if ( ifp && ifp->if_flags & IFF_DEBUG)
215
		device_printf(sc->ndis_dev, "status: %x\n", status);
215
		device_printf(sc->ndis_dev, "status: %x\n", status);
216
}
216
}
217
217
Lines 225-232 Link Here
225
225
226
	block = adapter;
226
	block = adapter;
227
	sc = device_get_softc(block->nmb_physdeviceobj->do_devext);
227
	sc = device_get_softc(block->nmb_physdeviceobj->do_devext);
228
	ifp = sc->ifp;
228
	ifp = NDISUSB_GET_IFNET(sc);
229
	if (ifp->if_flags & IFF_DEBUG)
229
	if (ifp && ifp->if_flags & IFF_DEBUG)
230
		device_printf(sc->ndis_dev, "status complete\n");
230
		device_printf(sc->ndis_dev, "status complete\n");
231
}
231
}
232
232
Lines 264-272 Link Here
264
264
265
	block = adapter;
265
	block = adapter;
266
	sc = device_get_softc(block->nmb_physdeviceobj->do_devext);
266
	sc = device_get_softc(block->nmb_physdeviceobj->do_devext);
267
	ifp = sc->ifp;
267
	ifp = NDISUSB_GET_IFNET(sc);
268
268
269
	if (ifp->if_flags & IFF_DEBUG)
269
	if (ifp && ifp->if_flags & IFF_DEBUG)
270
		device_printf(sc->ndis_dev, "reset done...\n");
270
		device_printf(sc->ndis_dev, "reset done...\n");
271
	KeSetEvent(&block->nmb_resetevent, IO_NO_INCREMENT, FALSE);
271
	KeSetEvent(&block->nmb_resetevent, IO_NO_INCREMENT, FALSE);
272
}
272
}
Lines 285-290 Link Here
285
		return (EINVAL);
285
		return (EINVAL);
286
286
287
	sc = arg;
287
	sc = arg;
288
	/*
289
	device_printf(sc->ndis_dev, "ndis_create_sysctls() sc=%p\n", sc);
290
	*/
288
	vals = sc->ndis_regvals;
291
	vals = sc->ndis_regvals;
289
292
290
	TAILQ_INIT(&sc->ndis_cfglist_head);
293
	TAILQ_INIT(&sc->ndis_cfglist_head);
Lines 698-705 Link Here
698
	 */
701
	 */
699
702
700
	eh = mtod((*m0), struct ether_header *);
703
	eh = mtod((*m0), struct ether_header *);
701
	ifp = ((struct ndis_softc *)p->np_softc)->ifp;
704
	ifp = NDISUSB_GET_IFNET((struct ndis_softc *)p->np_softc);
702
	if (totlen > ETHER_MAX_FRAME(ifp, eh->ether_type, FALSE)) {
705
	if (ifp && totlen > ETHER_MAX_FRAME(ifp, eh->ether_type, FALSE)) {
703
		diff = totlen - ETHER_MAX_FRAME(ifp, eh->ether_type, FALSE);
706
		diff = totlen - ETHER_MAX_FRAME(ifp, eh->ether_type, FALSE);
704
		totlen -= diff;
707
		totlen -= diff;
705
		m->m_len -= diff;
708
		m->m_len -= diff;
(-)compat/ndis/subr_ndis.c (-3 / +8 lines)
Lines 626-631 Link Here
626
626
627
	block = (ndis_miniport_block *)cfg;
627
	block = (ndis_miniport_block *)cfg;
628
	sc = device_get_softc(block->nmb_physdeviceobj->do_devext);
628
	sc = device_get_softc(block->nmb_physdeviceobj->do_devext);
629
	/*
630
	device_printf(sc->ndis_dev, "NdisReadConfiguration sc=%p\n", sc);
631
	*/
629
632
630
	if (key->us_len == 0 || key->us_buf == NULL) {
633
	if (key->us_len == 0 || key->us_buf == NULL) {
631
		*status = NDIS_STATUS_FAILURE;
634
		*status = NDIS_STATUS_FAILURE;
Lines 984-990 Link Here
984
	dev = block->nmb_physdeviceobj->do_devext;
987
	dev = block->nmb_physdeviceobj->do_devext;
985
	drv = block->nmb_deviceobj->do_drvobj;
988
	drv = block->nmb_deviceobj->do_drvobj;
986
	sc = device_get_softc(dev);
989
	sc = device_get_softc(dev);
987
	ifp = sc->ifp;
990
	ifp = NDISUSB_GET_IFNET(sc);
988
991
989
	if (ifp != NULL && ifp->if_flags & IFF_DEBUG) {
992
	if (ifp != NULL && ifp->if_flags & IFF_DEBUG) {
990
		error = pe_get_message((vm_offset_t)drv->dro_driverstart,
993
		error = pe_get_message((vm_offset_t)drv->dro_driverstart,
Lines 1304-1320 Link Here
1304
	ndis_handle		adapter;
1307
	ndis_handle		adapter;
1305
{
1308
{
1306
	struct ndis_softc	*sc;
1309
	struct ndis_softc	*sc;
1310
	struct ifnet		*ifp;
1307
	ndis_miniport_block	*block;
1311
	ndis_miniport_block	*block;
1308
	uint8_t			empty[] = { 0, 0, 0, 0, 0, 0 };
1312
	uint8_t			empty[] = { 0, 0, 0, 0, 0, 0 };
1309
1313
1310
	block = (ndis_miniport_block *)adapter;
1314
	block = (ndis_miniport_block *)adapter;
1311
	sc = device_get_softc(block->nmb_physdeviceobj->do_devext);
1315
	sc = device_get_softc(block->nmb_physdeviceobj->do_devext);
1312
	if (sc->ifp == NULL) {
1316
	ifp = NDISUSB_GET_IFNET(sc);
1317
	if (ifp == NULL) {
1313
		*status = NDIS_STATUS_FAILURE;
1318
		*status = NDIS_STATUS_FAILURE;
1314
		return;
1319
		return;
1315
	}
1320
	}
1316
1321
1317
	if (sc->ifp->if_addr == NULL ||
1322
	if (ifp->if_addr == NULL ||
1318
	    bcmp(IF_LLADDR(sc->ifp), empty, ETHER_ADDR_LEN) == 0)
1323
	    bcmp(IF_LLADDR(sc->ifp), empty, ETHER_ADDR_LEN) == 0)
1319
		*status = NDIS_STATUS_FAILURE;
1324
		*status = NDIS_STATUS_FAILURE;
1320
	else {
1325
	else {

Return to bug 213237