==== //depot/projects/wifi/sys/conf/files#38 - /usr/home/kmacy/p4/sam_wifi/sys/conf/files ==== @@ -1568,7 +1568,8 @@ net80211/ieee80211_proto.c optional wlan net80211/ieee80211_regdomain.c optional wlan net80211/ieee80211_scan.c optional wlan +net80211/ieee80211_ifp_freebsd.c optional wlan_ifp net80211/ieee80211_scan_ap.c optional wlan_scan_ap net80211/ieee80211_scan_sta.c optional wlan_scan_sta net80211/ieee80211_xauth.c optional wlan_xauth ==== //depot/projects/wifi/sys/dev/ral/if_ral_pci.c#4 - /usr/home/kmacy/p4/sam_wifi/sys/dev/ral/if_ral_pci.c ==== @@ -60,6 +60,7 @@ MODULE_DEPEND(ral, pci, 1, 1, 1); MODULE_DEPEND(ral, wlan, 1, 1, 1); +MODULE_DEPEND(ral, wlan_ifp, 1, 1, 1); struct ral_pci_ident { uint16_t vendor; @@ -82,23 +83,20 @@ void (*shutdown)(void *); void (*suspend)(void *); void (*resume)(void *); - void (*intr)(void *); } ral_rt2560_opns = { rt2560_attach, rt2560_detach, rt2560_stop, rt2560_stop, - rt2560_resume, - rt2560_intr + rt2560_resume }, ral_rt2661_opns = { rt2661_attach, rt2661_detach, rt2661_shutdown, rt2661_suspend, - rt2661_resume, - rt2661_intr + rt2661_resume }; struct ral_pci_softc { @@ -112,7 +110,6 @@ int mem_rid; struct resource *irq; struct resource *mem; - void *sc_ih; }; static int ral_pci_probe(device_t); @@ -193,28 +190,10 @@ sc->sc_st = rman_get_bustag(psc->mem); sc->sc_sh = rman_get_bushandle(psc->mem); - psc->irq_rid = 0; - psc->irq = bus_alloc_resource_any(dev, SYS_RES_IRQ, &psc->irq_rid, - RF_ACTIVE | RF_SHAREABLE); - if (psc->irq == NULL) { - device_printf(dev, "could not allocate interrupt resource\n"); - return ENXIO; - } - error = (*psc->sc_opns->attach)(dev, pci_get_device(dev)); if (error != 0) return error; - /* - * Hook our interrupt after all initialization is complete. - */ - error = bus_setup_intr(dev, psc->irq, INTR_TYPE_NET | INTR_MPSAFE, - psc->sc_opns->intr, psc, &psc->sc_ih); - if (error != 0) { - device_printf(dev, "could not set up interrupt\n"); - return error; - } - return 0; } @@ -226,8 +205,6 @@ (*psc->sc_opns->detach)(psc); bus_generic_detach(dev); - bus_teardown_intr(dev, psc->irq, psc->sc_ih); - bus_release_resource(dev, SYS_RES_IRQ, psc->irq_rid, psc->irq); bus_release_resource(dev, SYS_RES_MEMORY, psc->mem_rid, psc->mem); ==== //depot/projects/wifi/sys/dev/ral/rt2661.c#4 - /usr/home/kmacy/p4/sam_wifi/sys/dev/ral/rt2661.c ==== @@ -98,6 +98,10 @@ static uint16_t rt2661_eeprom_read(struct rt2661_softc *, uint8_t); static void rt2661_rx_intr(struct rt2661_softc *); static void rt2661_tx_intr(struct rt2661_softc *); +static int rt2661_intr_fast(struct ieee80211com *); +static void rt2661_intr(struct ieee80211com *); +static void rt2661_intr_tx(struct ieee80211com *); + static void rt2661_tx_dma_intr(struct rt2661_softc *, struct rt2661_tx_ring *); static void rt2661_mcu_beacon_expire(struct rt2661_softc *); @@ -107,6 +111,7 @@ static void rt2661_scan_start(struct ieee80211com *); static void rt2661_scan_end(struct ieee80211com *); static void rt2661_set_channel(struct ieee80211com *); +static void rt2661_intr_enable(struct ieee80211com *); static uint16_t rt2661_txtime(int, int, uint32_t); static uint8_t rt2661_rxrate(struct rt2661_rx_desc *); static uint8_t rt2661_plcp_signal(int); @@ -120,7 +125,7 @@ static int rt2661_tx_mgt(struct rt2661_softc *, struct mbuf *, struct ieee80211_node *); static void rt2661_start(struct ifnet *); -static void rt2661_watchdog(void *); +static void rt2661_watchdog(struct ieee80211com *); static int rt2661_reset(struct ifnet *); static int rt2661_ioctl(struct ifnet *, u_long, caddr_t); static void rt2661_bbp_write(struct rt2661_softc *, uint8_t, @@ -151,7 +156,6 @@ static int rt2661_bbp_init(struct rt2661_softc *); static void rt2661_init(void *); static void rt2661_stop(void *); -static void rt2661_stop_locked(struct rt2661_softc *); static int rt2661_load_microcode(struct rt2661_softc *, const uint8_t *, int); #ifdef notyet @@ -210,12 +214,6 @@ sc->sc_dev = dev; - mtx_init(&sc->sc_mtx, device_get_nameunit(dev), MTX_NETWORK_LOCK, - MTX_DEF | MTX_RECURSE); - - callout_init_mtx(&sc->watchdog_ch, &sc->sc_mtx, 0); - callout_init(&sc->rssadapt_ch, CALLOUT_MPSAFE); - /* wait for NIC to initialize */ for (ntries = 0; ntries < 1000; ntries++) { if ((val = RAL_READ(sc, RT2661_MAC_CSR0)) != 0) @@ -226,7 +224,7 @@ device_printf(sc->sc_dev, "timeout waiting for NIC to initialize\n"); error = EIO; - goto fail1; + return (error); } /* retrieve RF rev. no and various other things from EEPROM */ @@ -256,7 +254,7 @@ error = rt2661_load_microcode(sc, ucode, size); if (error != 0) { device_printf(sc->sc_dev, "could not load 8051 microcode\n"); - goto fail1; + return (error); } /* @@ -290,18 +288,22 @@ error = ENOMEM; goto fail4; } + ic->ic_if_init = rt2661_init; + ic->ic_if_ioctl = rt2661_ioctl; + ic->ic_if_start = rt2661_start; + ic->ic_if_watchdog = rt2661_watchdog; + ic->ic_intr_fast = rt2661_intr_fast; + ic->ic_intr_tx = rt2661_intr_tx; + ic->ic_intr = rt2661_intr; + ic->ic_intr_enable = rt2661_intr_enable; - ifp->if_softc = sc; if_initname(ifp, device_get_name(dev), device_get_unit(dev)); ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; - ifp->if_init = rt2661_init; - ifp->if_ioctl = rt2661_ioctl; - ifp->if_start = rt2661_start; IFQ_SET_MAXLEN(&ifp->if_snd, IFQ_MAXLEN); ifp->if_snd.ifq_drv_maxlen = IFQ_MAXLEN; IFQ_SET_READY(&ifp->if_snd); - ic->ic_ifp = ifp; + ic->ic_phytype = IEEE80211_T_OFDM; /* not only, but not used */ ic->ic_opmode = IEEE80211_M_STA; /* default to BSS mode */ ic->ic_state = IEEE80211_S_INIT; @@ -326,7 +328,14 @@ setbit(&bands, IEEE80211_MODE_11A); ieee80211_init_channels(ic, 0, CTRY_DEFAULT, bands, 0, 1); + error = ieee80211_ifp_attach(ifp, ic, sc, dev); + if (error != 0) { + ieee80211_ifp_detach(ic); + return (error); + } + ieee80211_callout_init(ic, &sc->rssadapt_ch, 0); ieee80211_ifattach(ic); + ic->ic_node_alloc = rt2661_node_alloc; /* ic->ic_wme.wme_update = rt2661_wme_update;*/ ic->ic_scan_start = rt2661_scan_start; @@ -372,7 +381,6 @@ fail3: rt2661_free_tx_ring(sc, &sc->mgtq); fail2: while (--ac >= 0) rt2661_free_tx_ring(sc, &sc->txq[ac]); -fail1: mtx_destroy(&sc->sc_mtx); return error; } @@ -385,11 +393,11 @@ struct ifnet *ifp = ic->ic_ifp; rt2661_stop(sc); - callout_stop(&sc->watchdog_ch); callout_stop(&sc->rssadapt_ch); bpfdetach(ifp); ieee80211_ifdetach(ic); + ieee80211_ifp_detach(ic); rt2661_free_tx_ring(sc, &sc->txq[0]); rt2661_free_tx_ring(sc, &sc->txq[1]); @@ -400,8 +408,6 @@ if_free(ifp); - mtx_destroy(&sc->sc_mtx); - return 0; } @@ -409,7 +415,9 @@ rt2661_shutdown(void *xsc) { struct rt2661_softc *sc = xsc; - + /* + * XXX deal with locking here + */ rt2661_stop(sc); } @@ -417,16 +425,22 @@ rt2661_suspend(void *xsc) { struct rt2661_softc *sc = xsc; - + /* + * XXX deal with locking here + */ rt2661_stop(sc); } void rt2661_resume(void *xsc) { - struct rt2661_softc *sc = xsc; + struct ieee80211com *ic = xsc; + struct rt2661_softc *sc = ic->ic_softc; struct ifnet *ifp = sc->sc_ic.ic_ifp; + /* + * XXX deal with locking here + */ if (ifp->if_flags & IFF_UP) { ifp->if_init(ifp->if_softc); if (ifp->if_drv_flags & IFF_DRV_RUNNING) @@ -741,7 +755,7 @@ static int rt2661_media_change(struct ifnet *ifp) { - struct rt2661_softc *sc = ifp->if_softc; + struct ieee80211com *ic = ifp->if_softc; int error; error = ieee80211_media_change(ifp); @@ -749,7 +763,7 @@ return error; if ((ifp->if_flags & IFF_UP) && (ifp->if_drv_flags & IFF_DRV_RUNNING)) - rt2661_init(sc); + ieee80211_if_init(ic); return 0; } @@ -775,18 +789,14 @@ struct rt2661_softc *sc = arg; struct ieee80211com *ic = &sc->sc_ic; - RAL_LOCK(sc); - ieee80211_iterate_nodes(&ic->ic_sta, rt2661_iter_func, arg); callout_reset(&sc->rssadapt_ch, hz / 10, rt2661_update_rssadapt, sc); - - RAL_UNLOCK(sc); } static int rt2661_newstate(struct ieee80211com *ic, enum ieee80211_state nstate, int arg) { - struct rt2661_softc *sc = ic->ic_ifp->if_softc; + struct rt2661_softc *sc = ic->ic_softc; enum ieee80211_state ostate; struct ieee80211_node *ni; uint32_t tmp; @@ -803,6 +813,7 @@ tmp = RAL_READ(sc, RT2661_TXRX_CSR9); RAL_WRITE(sc, RT2661_TXRX_CSR9, tmp & ~0x00ffffff); } + break; case IEEE80211_S_RUN: ni = ic->ic_bss; @@ -892,6 +903,8 @@ return val; } + + static void rt2661_tx_intr(struct rt2661_softc *sc) { @@ -959,8 +972,7 @@ if (++txq->stat >= txq->count) /* faster than % count */ txq->stat = 0; } - - sc->sc_tx_timer = 0; + ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; rt2661_start(ifp); } @@ -1108,8 +1120,7 @@ bpf_mtap2(sc->sc_drvbpf, tap, sc->sc_rxtap_len, m); } - sc->sc_flags |= RAL_INPUT_RUNNING; - RAL_UNLOCK(sc); + wh = mtod(m, struct ieee80211_frame *); ni = ieee80211_find_rxnode(ic, (struct ieee80211_frame_min *)wh); @@ -1119,8 +1130,6 @@ /* give rssi to the rate adatation algorithm */ rn = (struct rt2661_node *)ni; - RAL_LOCK(sc); - sc->sc_flags &= ~RAL_INPUT_RUNNING; ral_rssadapt_input(ic, ni, &rn->rssadapt, rt2661_get_rssi(sc, desc->rssi)); @@ -1165,52 +1174,21 @@ RAL_WRITE(sc, RT2661_M2H_CMD_DONE_CSR, 0xffffffff); } -void -rt2661_intr(void *arg) +static void +rt2661_intr(struct ieee80211com *ic) { - struct rt2661_softc *sc = arg; - struct ifnet *ifp = sc->sc_ifp; + struct rt2661_softc *sc = ic->ic_softc; uint32_t r1, r2; - RAL_LOCK(sc); + r1 = sc->sc_intflags; + r2 = sc->sc_mcu_intflags; - /* disable MAC and MCU interrupts */ - RAL_WRITE(sc, RT2661_INT_MASK_CSR, 0xffffff7f); - RAL_WRITE(sc, RT2661_MCU_INT_MASK_CSR, 0xffffffff); - - /* don't re-enable interrupts if we're shutting down */ - if (!(ifp->if_drv_flags & IFF_DRV_RUNNING)) { - RAL_UNLOCK(sc); - return; - } - - r1 = RAL_READ(sc, RT2661_INT_SOURCE_CSR); - RAL_WRITE(sc, RT2661_INT_SOURCE_CSR, r1); - - r2 = RAL_READ(sc, RT2661_MCU_INT_SOURCE_CSR); - RAL_WRITE(sc, RT2661_MCU_INT_SOURCE_CSR, r2); - if (r1 & RT2661_MGT_DONE) rt2661_tx_dma_intr(sc, &sc->mgtq); if (r1 & RT2661_RX_DONE) rt2661_rx_intr(sc); - if (r1 & RT2661_TX0_DMA_DONE) - rt2661_tx_dma_intr(sc, &sc->txq[0]); - - if (r1 & RT2661_TX1_DMA_DONE) - rt2661_tx_dma_intr(sc, &sc->txq[1]); - - if (r1 & RT2661_TX2_DMA_DONE) - rt2661_tx_dma_intr(sc, &sc->txq[2]); - - if (r1 & RT2661_TX3_DMA_DONE) - rt2661_tx_dma_intr(sc, &sc->txq[3]); - - if (r1 & RT2661_TX_DONE) - rt2661_tx_intr(sc); - if (r2 & RT2661_MCU_CMD_DONE) rt2661_mcu_cmd_intr(sc); @@ -1220,11 +1198,6 @@ if (r2 & RT2661_MCU_WAKEUP) rt2661_mcu_wakeup(sc); - /* re-enable MAC and MCU interrupts */ - RAL_WRITE(sc, RT2661_INT_MASK_CSR, 0x0000ff10); - RAL_WRITE(sc, RT2661_MCU_INT_MASK_CSR, 0); - - RAL_UNLOCK(sc); } /* quickly determine if a given rate is CCK or OFDM */ @@ -1716,20 +1689,16 @@ static void rt2661_start(struct ifnet *ifp) { - struct rt2661_softc *sc = ifp->if_softc; - struct ieee80211com *ic = &sc->sc_ic; + struct ieee80211com *ic = ifp->if_softc; + struct rt2661_softc *sc = ic->ic_softc; struct mbuf *m0; struct ether_header *eh; struct ieee80211_node *ni; int ac; - RAL_LOCK(sc); - /* prevent management frames from being sent if we're not ready */ - if (!(ifp->if_drv_flags & IFF_DRV_RUNNING)) { - RAL_UNLOCK(sc); + if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0 || sc->sc_invalid) return; - } for (;;) { IF_POLL(&ic->ic_mgtq, m0); @@ -1806,28 +1775,18 @@ break; } } - - sc->sc_tx_timer = 5; - callout_reset(&sc->watchdog_ch, hz, rt2661_watchdog, sc); } - RAL_UNLOCK(sc); } static void -rt2661_watchdog(void *arg) +rt2661_watchdog(struct ieee80211com *ic) { - struct rt2661_softc *sc = (struct rt2661_softc *)arg; + struct rt2661_softc *sc = ic->ic_softc; - if (sc->sc_tx_timer > 0) { - if (--sc->sc_tx_timer == 0) { - device_printf(sc->sc_dev, "device timeout\n"); - rt2661_init(sc); - sc->sc_ifp->if_oerrors++; - return; - } - callout_reset(&sc->watchdog_ch, hz, rt2661_watchdog, sc); - } + device_printf(sc->sc_dev, "device timeout\n"); + rt2661_init(sc); + sc->sc_ifp->if_oerrors++; } /* @@ -1838,8 +1797,8 @@ static int rt2661_reset(struct ifnet *ifp) { - struct rt2661_softc *sc = ifp->if_softc; - struct ieee80211com *ic = &sc->sc_ic; + struct ieee80211com *ic = ifp->if_softc; + struct rt2661_softc *sc = ic->ic_softc; if (ic->ic_opmode != IEEE80211_M_MONITOR) return ENETRESET; @@ -1852,8 +1811,9 @@ static int rt2661_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) { - struct rt2661_softc *sc = ifp->if_softc; - struct ieee80211com *ic = &sc->sc_ic; + struct ieee80211com *ic = ifp->if_softc; + struct rt2661_softc *sc = ic->ic_softc; + int error = 0; switch (cmd) { @@ -2230,7 +2190,8 @@ static int rt2661_wme_update(struct ieee80211com *ic) { - struct rt2661_softc *sc = ic->ic_ifp->if_softc; + + struct rt2661_softc *sc = ic->ic_softc; const struct wmeParams *wmep; wmep = ic->ic_wme.wme_chanParams.cap_wmeParams; @@ -2273,8 +2234,8 @@ static void rt2661_update_slot(struct ifnet *ifp) { - struct rt2661_softc *sc = ifp->if_softc; - struct ieee80211com *ic = &sc->sc_ic; + struct ieee80211com *ic = ifp->if_softc; + struct rt2661_softc *sc = ic->ic_softc; uint8_t slottime; uint32_t tmp; @@ -2428,10 +2389,8 @@ uint32_t tmp, sta[3]; int i, ntries; - RAL_LOCK(sc); + rt2661_stop(sc); - rt2661_stop_locked(sc); - /* initialize Tx rings */ RAL_WRITE(sc, RT2661_AC1_BASE_CSR, sc->txq[1].physaddr); RAL_WRITE(sc, RT2661_AC0_BASE_CSR, sc->txq[0].physaddr); @@ -2490,14 +2449,12 @@ } if (ntries == 1000) { printf("timeout waiting for BBP/RF to wakeup\n"); - rt2661_stop_locked(sc); - RAL_UNLOCK(sc); + rt2661_stop(sc); return; } if (rt2661_bbp_init(sc) != 0) { - rt2661_stop_locked(sc); - RAL_UNLOCK(sc); + rt2661_stop(sc); return; } @@ -2531,13 +2488,10 @@ /* clear any pending interrupt */ RAL_WRITE(sc, RT2661_INT_SOURCE_CSR, 0xffffffff); - /* enable interrupts */ - RAL_WRITE(sc, RT2661_INT_MASK_CSR, 0x0000ff10); - RAL_WRITE(sc, RT2661_MCU_INT_MASK_CSR, 0); + rt2661_intr_enable(ic); /* kick Rx */ RAL_WRITE(sc, RT2661_RX_CNTL_CSR, 1); - RAL_UNLOCK(sc); ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; ifp->if_drv_flags |= IFF_DRV_RUNNING; @@ -2556,26 +2510,12 @@ rt2661_stop(void *priv) { struct rt2661_softc *sc = priv; - - RAL_LOCK(sc); - rt2661_stop_locked(sc); - RAL_UNLOCK(sc); -} - -void -rt2661_stop_locked(struct rt2661_softc *sc) -{ struct ieee80211com *ic = &sc->sc_ic; struct ifnet *ifp = ic->ic_ifp; uint32_t tmp; - volatile int *flags = &sc->sc_flags; - while (*flags & RAL_INPUT_RUNNING) { - msleep(sc, &sc->sc_mtx, 0, "ralrunning", hz/10); - } - if (ifp->if_drv_flags & IFF_DRV_RUNNING) { - sc->sc_tx_timer = 0; + ic->ic_tx_timer = 0; ifp->if_drv_flags &= ~(IFF_DRV_RUNNING | IFF_DRV_OACTIVE); ieee80211_new_state(ic, IEEE80211_S_INIT, -1); @@ -2868,7 +2808,7 @@ rt2661_scan_start(struct ieee80211com *ic) { struct ifnet *ifp = ic->ic_ifp; - struct rt2661_softc *sc = ifp->if_softc; + struct rt2661_softc *sc = ic->ic_softc; uint32_t tmp; /* abort TSF synchronization */ @@ -2880,8 +2820,7 @@ static void rt2661_scan_end(struct ieee80211com *ic) { - struct ifnet *ifp = ic->ic_ifp; - struct rt2661_softc *sc = ifp->if_softc; + struct rt2661_softc *sc = ic->ic_softc; rt2661_enable_tsf_sync(sc); /* XXX keep local copy */ @@ -2891,11 +2830,71 @@ static void rt2661_set_channel(struct ieee80211com *ic) { + struct rt2661_softc *sc = ic->ic_softc; + + rt2661_set_chan(sc, ic->ic_curchan); +} + +static int +rt2661_intr_fast(struct ieee80211com *ic) +{ + struct rt2661_softc *sc = ic->ic_softc; struct ifnet *ifp = ic->ic_ifp; - struct rt2661_softc *sc = ifp->if_softc; + int rc = 0; + + /* disable MAC and MCU interrupts */ + RAL_WRITE(sc, RT2661_INT_MASK_CSR, 0xffffff7f); + RAL_WRITE(sc, RT2661_MCU_INT_MASK_CSR, 0xffffffff); + + /* don't re-enable interrupts if we're shutting down */ + if (!(ifp->if_drv_flags & IFF_DRV_RUNNING)) { + return (rc); + } + + sc->sc_intflags = RAL_READ(sc, RT2661_INT_SOURCE_CSR); + RAL_WRITE(sc, RT2661_INT_SOURCE_CSR, sc->sc_intflags); + + sc->sc_mcu_intflags = RAL_READ(sc, RT2661_MCU_INT_SOURCE_CSR); + RAL_WRITE(sc, RT2661_MCU_INT_SOURCE_CSR, sc->sc_mcu_intflags); + + if (sc->sc_intflags & RAL_TX_DONE) + rc |= IEEE80211_INTR_TX; + + if ((sc->sc_intflags & RAL_INTR_OTHER) || + (sc->sc_mcu_intflags & RAL_MCU_INTR_OTHER)) + rc |= IEEE80211_INTR_OTHER; + + return (rc); +} + +static void +rt2661_intr_tx(struct ieee80211com *ic) +{ + struct rt2661_softc *sc = ic->ic_softc; + uint32_t r1 = sc->sc_intflags; + + if (r1 & RT2661_TX0_DMA_DONE) + rt2661_tx_dma_intr(sc, &sc->txq[0]); + + if (r1 & RT2661_TX1_DMA_DONE) + rt2661_tx_dma_intr(sc, &sc->txq[1]); + + if (r1 & RT2661_TX2_DMA_DONE) + rt2661_tx_dma_intr(sc, &sc->txq[2]); + + if (r1 & RT2661_TX3_DMA_DONE) + rt2661_tx_dma_intr(sc, &sc->txq[3]); + + if (r1 & RT2661_TX_DONE) + rt2661_tx_intr(sc); +} - RAL_LOCK(sc); - rt2661_set_chan(sc, ic->ic_curchan); - RAL_UNLOCK(sc); +static void +rt2661_intr_enable(struct ieee80211com *ic) +{ + struct rt2661_softc *sc = ic->ic_softc; + /* enable MAC and MCU interrupts */ + RAL_WRITE(sc, RT2661_INT_MASK_CSR, 0x0000ff10); + RAL_WRITE(sc, RT2661_MCU_INT_MASK_CSR, 0); } ==== //depot/projects/wifi/sys/dev/ral/rt2661var.h#4 - /usr/home/kmacy/p4/sam_wifi/sys/dev/ral/rt2661var.h ==== @@ -99,13 +99,8 @@ bus_space_tag_t sc_st; bus_space_handle_t sc_sh; - struct mtx sc_mtx; - - struct callout watchdog_ch; struct callout rssadapt_ch; - int sc_tx_timer; - struct ieee80211_channel *sc_curchan; uint8_t rf_rev; @@ -158,8 +153,10 @@ } sc_txtapu; #define sc_txtap sc_txtapu.th int sc_txtap_len; -#define RAL_INPUT_RUNNING 1 - int sc_flags; + + uint32_t sc_intflags; + uint32_t sc_mcu_intflags; + uint32_t sc_invalid; }; int rt2661_attach(device_t, int); @@ -167,7 +164,8 @@ void rt2661_shutdown(void *); void rt2661_suspend(void *); void rt2661_resume(void *); -void rt2661_intr(void *); -#define RAL_LOCK(sc) mtx_lock(&(sc)->sc_mtx) -#define RAL_UNLOCK(sc) mtx_unlock(&(sc)->sc_mtx) +#define RAL_TX_DONE (RT2661_TX0_DMA_DONE | RT2661_TX1_DMA_DONE | RT2661_TX2_DMA_DONE \ + | RT2661_TX3_DMA_DONE | RT2661_TX_DONE) +#define RAL_INTR_OTHER (RT2661_MGT_DONE | RT2661_RX_DONE) +#define RAL_MCU_INTR_OTHER (RT2661_MCU_CMD_DONE | RT2661_MCU_BEACON_EXPIRE | RT2661_MCU_WAKEUP) ==== //depot/projects/wifi/sys/net80211/ieee80211.c#36 - /usr/home/kmacy/p4/sam_wifi/sys/net80211/ieee80211.c ==== @@ -238,7 +238,15 @@ ic->ic_bintval = IEEE80211_BINTVAL_DEFAULT; ic->ic_bmissthreshold = IEEE80211_HWBMISS_DEFAULT; ic->ic_dtim_period = IEEE80211_DTIM_DEFAULT; - IEEE80211_LOCK_INIT(ic, "ieee80211com"); + /* + * Unless we decide to integrate the ieee80211 ifp interface + * it will be common to recurse on the ic lock as a result of + * it being acquired first in an ifp routine + */ + if (ic->ic_iifp_inuse) + IEEE80211_LOCK_RECURSE_INIT(ic, "ieee80211com"); + else + IEEE80211_LOCK_INIT(ic, "ieee80211com"); IEEE80211_BEACON_LOCK_INIT(ic, "beacon"); ic->ic_lintval = ic->ic_bintval; ==== //depot/projects/wifi/sys/net80211/ieee80211_freebsd.h#20 - /usr/home/kmacy/p4/sam_wifi/sys/net80211/ieee80211_freebsd.h ==== @@ -35,6 +35,8 @@ typedef struct mtx ieee80211_com_lock_t; #define IEEE80211_LOCK_INIT(_ic, _name) \ mtx_init(&(_ic)->ic_comlock, _name, "802.11 com lock", MTX_DEF) +#define IEEE80211_LOCK_RECURSE_INIT(_ic, _name) \ + mtx_init(&(_ic)->ic_comlock, _name, "802.11 com lock", MTX_DEF|MTX_RECURSE) #define IEEE80211_LOCK_DESTROY(_ic) mtx_destroy(&(_ic)->ic_comlock) #define IEEE80211_LOCK(_ic) mtx_lock(&(_ic)->ic_comlock) #define IEEE80211_UNLOCK(_ic) mtx_unlock(&(_ic)->ic_comlock) ==== //depot/projects/wifi/sys/net80211/ieee80211_input.c#77 - /usr/home/kmacy/p4/sam_wifi/sys/net80211/ieee80211_input.c ==== @@ -741,8 +741,11 @@ ieee80211_free_node(sta); } } - if (m1 != NULL) + if (m1 != NULL) { + IEEE80211_IIFP_UNLOCK(ic); IF_HANDOFF(&ifp->if_snd, m1, ifp); + IEEE80211_IIFP_LOCK(ic); + } } if (m != NULL) { m->m_pkthdr.rcvif = ifp; @@ -751,7 +754,9 @@ m->m_pkthdr.ether_vtag = ni->ni_vlan; m->m_flags |= M_VLANTAG; } + IEEE80211_IIFP_UNLOCK(ic); (*ifp->if_input)(ifp, m); + IEEE80211_IIFP_LOCK(ic); } } ==== //depot/projects/wifi/sys/net80211/ieee80211_var.h#43 - /usr/home/kmacy/p4/sam_wifi/sys/net80211/ieee80211_var.h ==== @@ -59,6 +59,7 @@ #include #include #include +#include #define IEEE80211_TXPOWER_MAX 100 /* .5 dbM (XXX units?) */ #define IEEE80211_TXPOWER_MIN 0 /* kill radio */ @@ -224,6 +225,12 @@ const struct ieee80211_authenticator *ic_auth; struct eapolcom *ic_ec; + /* + * Interface for supporting experimental miniport interface + */ + struct ieee80211com_ifp ic_iifp; + int ic_iifp_inuse; + /* send/recv 802.11 management frame */ int (*ic_send_mgmt)(struct ieee80211com *, struct ieee80211_node *, int, int);