Changeset View
Changeset View
Standalone View
Standalone View
dev/if_ndis/if_ndis.c
Show First 20 Lines • Show All 1,126 Lines • ▼ Show 20 Lines | ndis_detach(device_t dev) | ||||
if (sc->ndis_iftype == PCIBus) | if (sc->ndis_iftype == PCIBus) | ||||
bus_dma_tag_destroy(sc->ndis_parent_tag); | bus_dma_tag_destroy(sc->ndis_parent_tag); | ||||
return (0); | return (0); | ||||
} | } | ||||
int | int | ||||
ndis_suspend(dev) | ndis_suspend(device_t dev) | ||||
device_t dev; | |||||
{ | { | ||||
#ifdef notdef | |||||
struct ndis_softc *sc; | struct ndis_softc *sc; | ||||
struct ifnet *ifp; | |||||
sc = device_get_softc(dev); | sc = device_get_softc(dev); | ||||
ifp = sc->ifp; | |||||
#ifdef notdef | |||||
if (NDIS_INITIALIZED(sc)) | if (NDIS_INITIALIZED(sc)) | ||||
ndis_stop(sc); | ndis_stop(sc); | ||||
#endif | #endif | ||||
return (0); | return (0); | ||||
} | } | ||||
int | int | ||||
ndis_resume(dev) | ndis_resume(device_t dev) | ||||
device_t dev; | |||||
{ | { | ||||
struct ndis_softc *sc; | struct ndis_softc *sc; | ||||
struct ifnet *ifp; | |||||
sc = device_get_softc(dev); | sc = device_get_softc(dev); | ||||
ifp = sc->ifp; | |||||
if (NDIS_INITIALIZED(sc)) | if (NDIS_INITIALIZED(sc)) | ||||
ndis_init(sc); | ndis_init(sc); | ||||
return (0); | return (0); | ||||
} | } | ||||
/* | /* | ||||
▲ Show 20 Lines • Show All 218 Lines • ▼ Show 20 Lines | |||||
* | * | ||||
* If the driver hands us a packet with a status of NDIS_STATUS_RESOURCES, | * If the driver hands us a packet with a status of NDIS_STATUS_RESOURCES, | ||||
* this means the driver is running out of packet/buffer resources and | * this means the driver is running out of packet/buffer resources and | ||||
* wants to maintain ownership of the packet. In this case, we have to | * wants to maintain ownership of the packet. In this case, we have to | ||||
* copy the packet data into local storage and let the driver keep the | * copy the packet data into local storage and let the driver keep the | ||||
* packet. | * packet. | ||||
*/ | */ | ||||
static void | static void | ||||
ndis_rxeof(adapter, packets, pktcnt) | ndis_rxeof(ndis_handle adapter, ndis_packet **packets, uint32_t pktcnt) | ||||
ndis_handle adapter; | |||||
ndis_packet **packets; | |||||
uint32_t pktcnt; | |||||
{ | { | ||||
struct ndis_softc *sc; | struct ndis_softc *sc; | ||||
ndis_miniport_block *block; | ndis_miniport_block *block; | ||||
ndis_packet *p; | ndis_packet *p; | ||||
uint32_t s; | uint32_t s; | ||||
ndis_tcpip_csum *csum; | ndis_tcpip_csum *csum; | ||||
struct ifnet *ifp; | struct ifnet *ifp; | ||||
struct mbuf *m0, *m; | struct mbuf *m0, *m; | ||||
▲ Show 20 Lines • Show All 134 Lines • ▼ Show 20 Lines | |||||
ndis_txeof(adapter, packet, status) | ndis_txeof(adapter, packet, status) | ||||
ndis_handle adapter; | ndis_handle adapter; | ||||
ndis_packet *packet; | ndis_packet *packet; | ||||
ndis_status status; | ndis_status status; | ||||
{ | { | ||||
struct ndis_softc *sc; | struct ndis_softc *sc; | ||||
ndis_miniport_block *block; | ndis_miniport_block *block; | ||||
struct ifnet *ifp; | |||||
int idx; | int idx; | ||||
struct mbuf *m; | struct mbuf *m; | ||||
block = (ndis_miniport_block *)adapter; | block = (ndis_miniport_block *)adapter; | ||||
sc = device_get_softc(block->nmb_physdeviceobj->do_devext); | sc = device_get_softc(block->nmb_physdeviceobj->do_devext); | ||||
ifp = sc->ifp; | |||||
m = packet->np_m0; | m = packet->np_m0; | ||||
idx = packet->np_txidx; | idx = packet->np_txidx; | ||||
if (sc->ndis_sc) | if (sc->ndis_sc) | ||||
bus_dmamap_unload(sc->ndis_ttag, sc->ndis_tmaps[idx]); | bus_dmamap_unload(sc->ndis_ttag, sc->ndis_tmaps[idx]); | ||||
ndis_free_packet(packet); | ndis_free_packet(packet); | ||||
m_freem(m); | m_freem(m); | ||||
Show All 13 Lines | ndis_txeof(adapter, packet, status) | ||||
sc->ndis_tx_timer = 0; | sc->ndis_tx_timer = 0; | ||||
NDIS_UNLOCK(sc); | NDIS_UNLOCK(sc); | ||||
if (!sc->ndis_80211) | if (!sc->ndis_80211) | ||||
IoQueueWorkItem(sc->ndis_startitem, | IoQueueWorkItem(sc->ndis_startitem, | ||||
(io_workitem_func)ndis_ifstarttask_wrap, | (io_workitem_func)ndis_ifstarttask_wrap, | ||||
WORKQUEUE_CRITICAL, sc); | WORKQUEUE_CRITICAL, sc); | ||||
DPRINTF(("%s: ndis_ifstarttask_wrap sc=%p\n", __func__, sc)); | |||||
} | } | ||||
static void | static void | ||||
ndis_linksts(adapter, status, sbuf, slen) | ndis_linksts(adapter, status, sbuf, slen) | ||||
ndis_handle adapter; | ndis_handle adapter; | ||||
ndis_status status; | ndis_status status; | ||||
void *sbuf; | void *sbuf; | ||||
uint32_t slen; | uint32_t slen; | ||||
▲ Show 20 Lines • Show All 456 Lines • ▼ Show 20 Lines | ndis_80211parent(struct ieee80211com *ic) | ||||
} else if (sc->ndis_running) | } else if (sc->ndis_running) | ||||
ndis_stop(sc); | ndis_stop(sc); | ||||
/*NDIS_UNLOCK(sc);*/ | /*NDIS_UNLOCK(sc);*/ | ||||
} | } | ||||
static void | static void | ||||
ndis_init(void *xsc) | ndis_init(void *xsc) | ||||
{ | { | ||||
struct ndis_softc *sc = xsc; | struct ndis_softc *sc = xsc; | ||||
int i, len, error; | int i, len, error; | ||||
/* | /* | ||||
* Avoid reintializing the link unnecessarily. | * Avoid reintializing the link unnecessarily. | ||||
* This should be dealt with in a better way by | * This should be dealt with in a better way by | ||||
* fixing the upper layer modules so they don't | * fixing the upper layer modules so they don't | ||||
* call ifp->if_init() quite as often. | * call ifp->if_init() quite as often. | ||||
*/ | */ | ||||
▲ Show 20 Lines • Show All 627 Lines • ▼ Show 20 Lines | #endif | ||||
if (rval) | if (rval) | ||||
device_printf (sc->ndis_dev, "set ssid failed: %d\n", rval); | device_printf (sc->ndis_dev, "set ssid failed: %d\n", rval); | ||||
return; | return; | ||||
} | } | ||||
static int | static int | ||||
ndis_get_bssid_list(sc, bl) | ndis_get_bssid_list(struct ndis_softc *sc, ndis_80211_bssid_list_ex **bl) | ||||
struct ndis_softc *sc; | |||||
ndis_80211_bssid_list_ex **bl; | |||||
{ | { | ||||
int len, error; | int len, error; | ||||
len = sizeof(uint32_t) + (sizeof(ndis_wlan_bssid_ex) * 16); | len = sizeof(uint32_t) + (sizeof(ndis_wlan_bssid_ex) * 16); | ||||
*bl = malloc(len, M_DEVBUF, M_NOWAIT | M_ZERO); | *bl = malloc(len, M_DEVBUF, M_NOWAIT | M_ZERO); | ||||
if (*bl == NULL) | if (*bl == NULL) | ||||
return (ENOMEM); | return (ENOMEM); | ||||
▲ Show 20 Lines • Show All 442 Lines • ▼ Show 20 Lines | ndis_add_key(struct ieee80211vap *vap, const struct ieee80211_key *key) | ||||
if (error) | if (error) | ||||
return (0); | return (0); | ||||
return (1); | return (1); | ||||
} | } | ||||
static void | static void | ||||
ndis_resettask(d, arg) | ndis_resettask(device_object *d, void *arg) | ||||
device_object *d; | |||||
void *arg; | |||||
{ | { | ||||
struct ndis_softc *sc; | struct ndis_softc *sc = arg; | ||||
sc = arg; | |||||
ndis_reset_nic(sc); | ndis_reset_nic(sc); | ||||
} | } | ||||
/* | /* | ||||
* Stop the adapter and free any mbufs allocated to the | * Stop the adapter and free any mbufs allocated to the | ||||
* RX and TX lists. | * RX and TX lists. | ||||
*/ | */ | ||||
static void | static void | ||||
Show All 31 Lines | ndis_stop(struct ndis_softc *sc) | ||||
NDIS_UNLOCK(sc); | NDIS_UNLOCK(sc); | ||||
} | } | ||||
/* | /* | ||||
* Stop all chip I/O so that the kernel's probe routines don't | * Stop all chip I/O so that the kernel's probe routines don't | ||||
* get confused by errant DMAs when rebooting. | * get confused by errant DMAs when rebooting. | ||||
*/ | */ | ||||
void | void | ||||
ndis_shutdown(dev) | ndis_shutdown(device_t dev) | ||||
device_t dev; | |||||
{ | { | ||||
struct ndis_softc *sc; | struct ndis_softc *sc; | ||||
sc = device_get_softc(dev); | sc = device_get_softc(dev); | ||||
ndis_stop(sc); | ndis_stop(sc); | ||||
} | } | ||||
static int | static int | ||||
▲ Show 20 Lines • Show All 203 Lines • Show Last 20 Lines |