diff --git a/sys/dev/netif/ath/ath/if_ath.c b/sys/dev/netif/ath/ath/if_ath.c index d98bda5..1156043 100644 --- a/sys/dev/netif/ath/ath/if_ath.c +++ b/sys/dev/netif/ath/ath/if_ath.c @@ -452,10 +452,6 @@ ath_attach(u_int16_t devid, struct ath_softc *sc) if_printf(ifp, "failed to allocate descriptors: %d\n", error); goto bad; } -#ifdef __FreeBSD__ - callout_init_mtx(&sc->sc_cal_ch, &sc->sc_mtx, 0); - callout_init_mtx(&sc->sc_wd_ch, &sc->sc_mtx, 0); -#endif callout_init(&sc->sc_cal_ch); callout_init(&sc->sc_wd_ch); @@ -871,12 +867,12 @@ ath_vap_create(struct ieee80211com *ic, uint8_t mac[IEEE80211_ADDR_LEN]; int ic_opmode, needbeacon, error; - avp = (struct ath_vap *) kmalloc(sizeof(struct ath_vap), - M_80211_VAP, M_WAITOK | M_ZERO); + avp = kmalloc(sizeof(struct ath_vap), + M_80211_VAP, M_WAITOK | M_ZERO); needbeacon = 0; IEEE80211_ADDR_COPY(mac, mac0); - ATH_LOCK(sc); + ifnet_serialize_all(ic->ic_ifp); ic_opmode = opmode; /* default to opmode of new vap */ switch (opmode) { case IEEE80211_M_STA: @@ -971,10 +967,10 @@ ath_vap_create(struct ieee80211com *ic, vap = &avp->av_vap; /* XXX can't hold mutex across if_alloc */ - ATH_UNLOCK(sc); + ifnet_deserialize_all(ic->ic_ifp); error = ieee80211_vap_setup(ic, vap, name, unit, opmode, flags, - bssid, mac); - ATH_LOCK(sc); + bssid, mac); + ifnet_serialize_all(ic->ic_ifp); if (error != 0) { device_printf(sc->sc_dev, "%s: error %d creating vap\n", __func__, error); @@ -1080,7 +1076,7 @@ ath_vap_create(struct ieee80211com *ic, */ sc->sc_swbmiss = 1; } - ATH_UNLOCK(sc); + ifnet_deserialize_all(ic->ic_ifp); /* complete setup */ ieee80211_vap_attach(vap, ath_media_change, ieee80211_media_status); @@ -1090,7 +1086,7 @@ bad2: ath_hal_setbssidmask(sc->sc_ah, sc->sc_hwbssidmask); bad: kfree(avp, M_80211_VAP); - ATH_UNLOCK(sc); + ifnet_deserialize_all(ic->ic_ifp); return NULL; } @@ -1103,6 +1099,7 @@ ath_vap_delete(struct ieee80211vap *vap) struct ath_hal *ah = sc->sc_ah; struct ath_vap *avp = ATH_VAP(vap); + ifnet_serialize_all(ifp); if (ifp->if_flags & IFF_RUNNING) { /* * Quiesce the hardware while we remove the vap. In @@ -1113,14 +1110,15 @@ ath_vap_delete(struct ieee80211vap *vap) ath_draintxq(sc); /* stop xmit side */ ath_stoprecv(sc); /* stop recv side */ } + ifnet_deserialize_all(ifp); ieee80211_vap_detach(vap); - ATH_LOCK(sc); /* * Reclaim beacon state. Note this must be done before * the vap instance is reclaimed as we may have a reference * to it in the buffer for the beacon frame. */ + ifnet_serialize_all(ifp); if (avp->av_bcbuf != NULL) { if (avp->av_bslot != -1) { sc->sc_bslot[avp->av_bslot] = NULL; @@ -1162,7 +1160,6 @@ ath_vap_delete(struct ieee80211vap *vap) sc->sc_swbmiss = 0; } #endif - ATH_UNLOCK(sc); kfree(avp, M_80211_VAP); if (ifp->if_flags & IFF_RUNNING) { @@ -1183,6 +1180,7 @@ ath_vap_delete(struct ieee80211vap *vap) } ath_hal_intrset(ah, sc->sc_imask); } + ifnet_deserialize_all(ifp); } void @@ -1240,6 +1238,7 @@ ath_resume(struct ath_softc *sc) * Must reset the chip before we reload the * keycache as we were powered down on suspend. */ + ifnet_serialize_all(ifp); ath_hal_reset(ah, sc->sc_opmode, sc->sc_curchan != NULL ? sc->sc_curchan : ic->ic_curchan, AH_FALSE, &status); @@ -1265,6 +1264,7 @@ ath_resume(struct ath_softc *sc) HAL_GPIO_MUX_MAC_NETWORK_LED); ath_hal_gpioset(ah, sc->sc_ledpin, !sc->sc_ledon); } + ifnet_deserialize_all(ifp); } void @@ -1290,16 +1290,21 @@ ath_intr(void *arg) struct ath_hal *ah = sc->sc_ah; HAL_INT status; + ifnet_serialize_all(ifp); + if (sc->sc_invalid) { /* * The hardware is not ready/present, don't touch anything. * Note this can happen early on if the IRQ is shared. */ DPRINTF(sc, ATH_DEBUG_ANY, "%s: invalid; ignored\n", __func__); + ifnet_deserialize_all(ifp); return; } - if (!ath_hal_intrpend(ah)) /* shared irq, not for us */ + if (!ath_hal_intrpend(ah)) { /* shared irq, not for us */ + ifnet_deserialize_all(ifp); return; + } if ((ifp->if_flags & IFF_UP) == 0 || (ifp->if_flags & IFF_RUNNING) == 0) { HAL_INT status; @@ -1308,6 +1313,7 @@ ath_intr(void *arg) __func__, ifp->if_flags); ath_hal_getisr(ah, &status); /* clear ISR */ ath_hal_intrset(ah, 0); /* disable further intr's */ + ifnet_deserialize_all(ifp); return; } /* @@ -1397,6 +1403,7 @@ ath_intr(void *arg) sc->sc_stats.ast_rxorn++; } } + ifnet_deserialize_all(ifp); } static void @@ -1409,6 +1416,7 @@ ath_fatal_proc(void *arg, int pending) void *sp; if_printf(ifp, "hardware error; resetting\n"); + ifnet_serialize_all(ifp); /* * Fatal errors are unrecoverable. Typically these * are caused by DMA errors. Collect h/w state from @@ -1422,6 +1430,7 @@ ath_fatal_proc(void *arg, int pending) state[4], state[5]); } ath_reset(ifp); + ifnet_deserialize_all(ifp); } static void @@ -1479,11 +1488,13 @@ ath_bmiss_proc(void *arg, int pending) DPRINTF(sc, ATH_DEBUG_ANY, "%s: pending %u\n", __func__, pending); + ifnet_serialize_all(ifp); if (ath_hal_gethangstate(sc->sc_ah, 0xff, &hangs) && hangs != 0) { if_printf(ifp, "bb hang detected (0x%x), reseting\n", hangs); ath_reset(ifp); } else ieee80211_beacon_miss(ifp->if_l2com); + ifnet_deserialize_all(ifp); } /* @@ -1521,7 +1532,6 @@ ath_init(void *arg) DPRINTF(sc, ATH_DEBUG_ANY, "%s: if_flags 0x%x\n", __func__, ifp->if_flags); - ATH_LOCK(sc); /* * Stop anything previously setup. This is safe * whether this is the first time through or not. @@ -1539,7 +1549,6 @@ ath_init(void *arg) if (!ath_hal_reset(ah, sc->sc_opmode, ic->ic_curchan, AH_FALSE, &status)) { if_printf(ifp, "unable to reset hardware; hal status %u\n", status); - ATH_UNLOCK(sc); return; } ath_chan_change(sc, ic->ic_curchan); @@ -1562,7 +1571,6 @@ ath_init(void *arg) */ if (ath_startrecv(sc) != 0) { if_printf(ifp, "unable to start recv logic\n"); - ATH_UNLOCK(sc); return; } @@ -1583,8 +1591,6 @@ ath_init(void *arg) callout_reset(&sc->sc_wd_ch, hz, ath_watchdog, sc); ath_hal_intrset(ah, sc->sc_imask); - ATH_UNLOCK(sc); - #ifdef ATH_TX99_DIAG if (sc->sc_tx99 != NULL) sc->sc_tx99->start(sc->sc_tx99); @@ -1602,7 +1608,6 @@ ath_stop_locked(struct ifnet *ifp) DPRINTF(sc, ATH_DEBUG_ANY, "%s: invalid %u if_flags 0x%x\n", __func__, sc->sc_invalid, ifp->if_flags); - ATH_LOCK_ASSERT(sc); if (ifp->if_flags & IFF_RUNNING) { /* * Shutdown the hardware and driver: @@ -1648,11 +1653,9 @@ ath_stop_locked(struct ifnet *ifp) static void ath_stop(struct ifnet *ifp) { - struct ath_softc *sc = ifp->if_softc; - - ATH_LOCK(sc); + ifnet_serialize_all(ifp); ath_stop_locked(ifp); - ATH_UNLOCK(sc); + ifnet_deserialize_all(ifp); } /* @@ -2439,8 +2442,10 @@ ath_update_promisc(struct ifnet *ifp) u_int32_t rfilt; /* configure rx filter */ + ifnet_serialize_all(ifp); rfilt = ath_calcrxfilter(sc); ath_hal_setrxfilter(sc->sc_ah, rfilt); + ifnet_deserialize_all(ifp); DPRINTF(sc, ATH_DEBUG_MODE, "%s: RX filter 0x%x\n", __func__, rfilt); } @@ -2452,6 +2457,7 @@ ath_update_mcast(struct ifnet *ifp) u_int32_t mfilt[2]; /* calculate and install multicast filter */ + ifnet_serialize_all(ifp); if ((ifp->if_flags & IFF_ALLMULTI) == 0) { struct ifmultiaddr *ifma; /* @@ -2481,6 +2487,7 @@ ath_update_mcast(struct ifnet *ifp) } else mfilt[0] = mfilt[1] = ~0; ath_hal_setmcastfilter(sc->sc_ah, mfilt[0], mfilt[1]); + ifnet_deserialize_all(ifp); DPRINTF(sc, ATH_DEBUG_MODE, "%s: MC filter %08x:%08x\n", __func__, mfilt[0], mfilt[1]); } @@ -2503,7 +2510,9 @@ ath_mode_init(struct ath_softc *sc) ath_hal_setmac(ah, IF_LLADDR(ifp)); /* calculate and install multicast filter */ + ifnet_deserialize_all(ifp); ath_update_mcast(ifp); + ifnet_serialize_all(ifp); } /* @@ -2554,11 +2563,13 @@ ath_updateslot(struct ifnet *ifp) * immediately. For other operation we defer the change * until beacon updates have propagated to the stations. */ + ifnet_serialize_all(ifp); if (ic->ic_opmode == IEEE80211_M_HOSTAP || ic->ic_opmode == IEEE80211_M_MBSS) sc->sc_updateslot = UPDATE; else ath_setslottime(sc); + ifnet_deserialize_all(ifp); } /* @@ -3065,8 +3076,10 @@ ath_bstuck_proc(void *arg, int pending) if_printf(ifp, "stuck beacon; resetting (bmiss count %u)\n", sc->sc_bmisscount); + ifnet_serialize_all(ifp); sc->sc_stats.ast_bstuck++; ath_reset(ifp); + ifnet_deserialize_all(ifp); } /* @@ -3514,7 +3527,9 @@ ath_node_alloc(struct ieee80211vap *vap, const uint8_t mac[IEEE80211_ADDR_LEN]) /* XXX stat+msg */ return NULL; } + ifnet_serialize_all(ic->ic_ifp); ath_rate_node_init(sc, an); + ifnet_deserialize_all(ic->ic_ifp); DPRINTF(sc, ATH_DEBUG_NODE, "%s: an %p\n", __func__, an); return &an->an_node; @@ -3528,7 +3543,9 @@ ath_node_free(struct ieee80211_node *ni) DPRINTF(sc, ATH_DEBUG_NODE, "%s: ni %p\n", __func__, ni); + ifnet_serialize_all(ic->ic_ifp); ath_rate_node_cleanup(sc, ATH_NODE(ni)); + ifnet_deserialize_all(ic->ic_ifp); sc->sc_node_free(ni); } @@ -3539,11 +3556,13 @@ ath_node_getsignal(const struct ieee80211_node *ni, int8_t *rssi, int8_t *noise) struct ath_softc *sc = ic->ic_ifp->if_softc; struct ath_hal *ah = sc->sc_ah; + ifnet_serialize_all(ic->ic_ifp); *rssi = ic->ic_node_getrssi(ni); if (ni->ni_chan != IEEE80211_CHAN_ANYC) *noise = ath_hal_getchannoise(ah, ni->ni_chan); else *noise = -95; /* nominally correct */ + ifnet_deserialize_all(ic->ic_ifp); } static int @@ -4063,6 +4082,7 @@ rx_next: if (ngood) sc->sc_lastrx = tsf; + ifnet_serialize_tx(ifp); if ((ifp->if_flags & IFF_OACTIVE) == 0) { #ifdef IEEE80211_SUPPORT_SUPERG ieee80211_ff_age_all(ic, 100); @@ -4070,6 +4090,7 @@ rx_next: if (!ifq_is_empty(&ifp->if_snd)) ath_start(ifp); } + ifnet_deserialize_tx(ifp); #undef PA2DESC } @@ -4246,11 +4267,15 @@ static int ath_wme_update(struct ieee80211com *ic) { struct ath_softc *sc = ic->ic_ifp->if_softc; + int error; - return !ath_txq_update(sc, WME_AC_BE) || - !ath_txq_update(sc, WME_AC_BK) || - !ath_txq_update(sc, WME_AC_VI) || - !ath_txq_update(sc, WME_AC_VO) ? EIO : 0; + ifnet_serialize_all(ic->ic_ifp); + error = !ath_txq_update(sc, WME_AC_BE) || + !ath_txq_update(sc, WME_AC_BK) || + !ath_txq_update(sc, WME_AC_VI) || + !ath_txq_update(sc, WME_AC_VO) ? EIO : 0; + ifnet_deserialize_all(ic->ic_ifp); + return (error); } /* @@ -5048,6 +5073,8 @@ ath_tx_proc_q0(void *arg, int npending) sc->sc_lastrx = ath_hal_gettsf64(sc->sc_ah); if (txqactive(sc->sc_ah, sc->sc_cabq->axq_qnum)) ath_tx_processq(sc, sc->sc_cabq); + + ifnet_serialize_tx(ifp); ifp->if_flags &= ~IFF_OACTIVE; sc->sc_wd_timer = 0; @@ -5055,6 +5082,7 @@ ath_tx_proc_q0(void *arg, int npending) ath_led_event(sc, sc->sc_txrix); ath_start(ifp); + ifnet_deserialize_tx(ifp); } /* @@ -5085,6 +5113,7 @@ ath_tx_proc_q0123(void *arg, int npending) if (nacked) sc->sc_lastrx = ath_hal_gettsf64(sc->sc_ah); + ifnet_serialize_tx(ifp); ifp->if_flags &= ~IFF_OACTIVE; sc->sc_wd_timer = 0; @@ -5092,6 +5121,7 @@ ath_tx_proc_q0123(void *arg, int npending) ath_led_event(sc, sc->sc_txrix); ath_start(ifp); + ifnet_deserialize_tx(ifp); } /* @@ -5114,6 +5144,7 @@ ath_tx_proc(void *arg, int npending) if (nacked) sc->sc_lastrx = ath_hal_gettsf64(sc->sc_ah); + ifnet_serialize_tx(ifp); ifp->if_flags &= ~IFF_OACTIVE; sc->sc_wd_timer = 0; @@ -5121,6 +5152,7 @@ ath_tx_proc(void *arg, int npending) ath_led_event(sc, sc->sc_txrix); ath_start(ifp); + ifnet_deserialize_tx(ifp); } static void @@ -5400,6 +5432,7 @@ ath_calibrate(void *arg) HAL_BOOL longCal, isCalDone; int nextcal; + ifnet_serialize_all(ifp); if (ic->ic_flags & IEEE80211_F_SCAN) /* defer, off channel */ goto restart; longCal = (ticks - sc->sc_lastlongcal >= ath_longcalinterval*hz); @@ -5469,6 +5502,7 @@ restart: __func__); /* NB: don't rearm timer */ } + ifnet_deserialize_all(ifp); } static void @@ -5481,11 +5515,13 @@ ath_scan_start(struct ieee80211com *ic) /* XXX calibration timer? */ + ifnet_serialize_all(ifp); sc->sc_scanning = 1; sc->sc_syncbeacon = 0; rfilt = ath_calcrxfilter(sc); ath_hal_setrxfilter(ah, rfilt); ath_hal_setassocid(ah, ifp->if_broadcastaddr, 0); + ifnet_deserialize_all(ifp); DPRINTF(sc, ATH_DEBUG_STATE, "%s: RX filter 0x%x bssid %s aid 0\n", __func__, rfilt, ether_sprintf(ifp->if_broadcastaddr)); @@ -5499,12 +5535,14 @@ ath_scan_end(struct ieee80211com *ic) struct ath_hal *ah = sc->sc_ah; u_int32_t rfilt; + ifnet_serialize_all(ifp); sc->sc_scanning = 0; rfilt = ath_calcrxfilter(sc); ath_hal_setrxfilter(ah, rfilt); ath_hal_setassocid(ah, sc->sc_curbssid, sc->sc_curaid); ath_hal_process_noisefloor(ah); + ifnet_deserialize_all(ifp); DPRINTF(sc, ATH_DEBUG_STATE, "%s: RX filter 0x%x bssid %s aid 0x%x\n", __func__, rfilt, ether_sprintf(sc->sc_curbssid), @@ -5517,7 +5555,8 @@ ath_set_channel(struct ieee80211com *ic) struct ifnet *ifp = ic->ic_ifp; struct ath_softc *sc = ifp->if_softc; - (void) ath_chan_set(sc, ic->ic_curchan); + ifnet_serialize_all(ifp); + ath_chan_set(sc, ic->ic_curchan); /* * If we are returning to our bss channel then mark state * so the next recv'd beacon's tsf will be used to sync the @@ -5526,6 +5565,7 @@ ath_set_channel(struct ieee80211com *ic) */ if (!sc->sc_scanning && ic->ic_curchan == ic->ic_bsschan) sc->sc_syncbeacon = 1; + ifnet_deserialize_all(ifp); } /* @@ -5789,11 +5829,13 @@ ath_newassoc(struct ieee80211_node *ni, int isnew) an->an_mcastrix = ath_tx_findrix(sc, tp->mcastrate); an->an_mgmtrix = ath_tx_findrix(sc, tp->mgmtrate); + ifnet_serialize_all(vap->iv_ic->ic_ifp); ath_rate_newassoc(sc, an, isnew); if (isnew && (vap->iv_flags & IEEE80211_F_PRIVACY) == 0 && sc->sc_hasclrkey && ni->ni_ucastkey.wk_keyix == IEEE80211_KEYIX_NONE) ath_setup_stationkey(ni); + ifnet_deserialize_all(vap->iv_ic->ic_ifp); } static int @@ -5809,8 +5851,10 @@ ath_setregdomain(struct ieee80211com *ic, struct ieee80211_regdomain *reg, __func__, reg->regdomain, reg->country, reg->location, reg->ecm ? " ecm" : ""); + ifnet_serialize_all(ic->ic_ifp); status = ath_hal_set_channels(ah, chans, nchans, - reg->country, reg->regdomain); + reg->country, reg->regdomain); + ifnet_deserialize_all(ic->ic_ifp); if (status != HAL_OK) { DPRINTF(sc, ATH_DEBUG_REGDOMAIN, "%s: failed, status %u\n", __func__, status); @@ -5830,8 +5874,11 @@ ath_getradiocaps(struct ieee80211com *ic, __func__, SKU_DEBUG, CTRY_DEFAULT); /* XXX check return */ + ifnet_serialize_all(ic->ic_ifp); (void) ath_hal_getchannels(ah, chans, maxchans, nchans, - HAL_MODE_ALL, CTRY_DEFAULT, SKU_DEBUG, AH_TRUE); + HAL_MODE_ALL, CTRY_DEFAULT, + SKU_DEBUG, AH_TRUE); + ifnet_deserialize_all(ic->ic_ifp); } @@ -6102,9 +6149,10 @@ static void ath_watchdog(void *arg) { struct ath_softc *sc = arg; + struct ifnet *ifp = sc->sc_ifp; + ifnet_serialize_all(ifp); if (sc->sc_wd_timer != 0 && --sc->sc_wd_timer == 0) { - struct ifnet *ifp = sc->sc_ifp; uint32_t hangs; if (ath_hal_gethangstate(sc->sc_ah, 0xffff, &hangs) && @@ -6117,6 +6165,7 @@ ath_watchdog(void *arg) ifp->if_oerrors++; sc->sc_stats.ast_watchdog++; } + ifnet_deserialize_all(ifp); callout_reset(&sc->sc_wd_ch, hz, ath_watchdog, sc); } @@ -6194,9 +6243,10 @@ ath_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data, struct ucred *ucred) const HAL_RATE_TABLE *rt; int error = 0; + ASSERT_SERIALIZED(ifp->if_serializer); + switch (cmd) { case SIOCSIFFLAGS: - ATH_LOCK(sc); if (IS_RUNNING(ifp)) { /* * To avoid rescanning another access point, @@ -6224,7 +6274,6 @@ ath_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data, struct ucred *ucred) ath_hal_setpower(sc->sc_ah, HAL_PM_FULL_SLEEP); #endif } - ATH_UNLOCK(sc); break; case SIOCGIFMEDIA: case SIOCSIFMEDIA: @@ -6431,8 +6480,11 @@ ath_sysctl_tpscale(SYSCTL_HANDLER_ARGS) error = sysctl_handle_int(oidp, &scale, 0, req); if (error || !req->newptr) return error; - return !ath_hal_settpscale(sc->sc_ah, scale) ? EINVAL : + ifnet_serialize_all(ifp); + error = !ath_hal_settpscale(sc->sc_ah, scale) ? EINVAL : (ifp->if_flags & IFF_RUNNING) ? ath_reset(ifp) : 0; + ifnet_deserialize_all(ifp); + return (error); } static int @@ -6464,7 +6516,10 @@ ath_sysctl_rfkill(SYSCTL_HANDLER_ARGS) return 0; if (!ath_hal_setrfkill(ah, rfkill)) return EINVAL; - return (ifp->if_flags & IFF_RUNNING) ? ath_reset(ifp) : 0; + ifnet_serialize_all(ifp); + error = (ifp->if_flags & IFF_RUNNING) ? ath_reset(ifp) : 0; + ifnet_deserialize_all(ifp); + return (error); } static int @@ -6879,6 +6934,7 @@ ath_raw_xmit(struct ieee80211_node *ni, struct mbuf *m, struct ath_buf *bf; int error; + ifnet_serialize_all(ifp); if ((ifp->if_flags & IFF_RUNNING) == 0 || sc->sc_invalid) { DPRINTF(sc, ATH_DEBUG_XMIT, "%s: discard frame, %s", __func__, (ifp->if_flags & IFF_RUNNING) == 0 ? @@ -6920,6 +6976,7 @@ ath_raw_xmit(struct ieee80211_node *ni, struct mbuf *m, sc->sc_wd_timer = 5; ifp->if_opackets++; sc->sc_stats.ast_tx_raw++; + ifnet_deserialize_all(ifp); return 0; bad2: @@ -6929,6 +6986,7 @@ bad2: bad: ifp->if_oerrors++; sc->sc_stats.ast_tx_raw_fail++; + ifnet_deserialize_all(ifp); ieee80211_free_node(ni); return error; } @@ -7143,12 +7201,16 @@ ath_tdma_update(struct ieee80211_node *ni, /* * Check for and adopt configuration changes. */ + ifnet_serialize_all(ic->ic_ifp); if (changed != 0) { const struct ieee80211_tdma_state *ts = vap->iv_tdma; ath_tdma_bintvalsetup(sc, ts); - if (changed & TDMA_UPDATE_SLOTLEN) + if (changed & TDMA_UPDATE_SLOTLEN) { + ifnet_deserialize_all(ic->ic_ifp); ath_wme_update(ic); + ifnet_serialize_all(ic->ic_ifp); + } DPRINTF(sc, ATH_DEBUG_TDMA, "%s: adopt slot %u slotcnt %u slotlen %u us " @@ -7248,6 +7310,7 @@ ath_tdma_update(struct ieee80211_node *ni, sc->sc_stats.ast_tdma_tsf++; } ath_tdma_beacon_send(sc, vap); /* prepare response */ + ifnet_deserialize_all(ic->ic_ifp); #undef TU_TO_TSF #undef TSF_TO_TU } diff --git a/sys/dev/netif/ath/ath/if_ath_pci.c b/sys/dev/netif/ath/ath/if_ath_pci.c index 4ec1440..7ef55ff 100644 --- a/sys/dev/netif/ath/ath/if_ath_pci.c +++ b/sys/dev/netif/ath/ath/if_ath_pci.c @@ -162,13 +162,10 @@ ath_pci_attach(device_t dev) goto bad3; } - ATH_LOCK_INIT(sc); - error = ath_attach(pci_get_device(dev), sc); if (error == 0) /* success */ return 0; - ATH_LOCK_DESTROY(sc); bus_dma_tag_destroy(sc->sc_dmat); bad3: bus_teardown_intr(dev, psc->sc_irq, psc->sc_ih); @@ -198,8 +195,6 @@ ath_pci_detach(device_t dev) bus_dma_tag_destroy(sc->sc_dmat); bus_release_resource(dev, SYS_RES_MEMORY, BS_BAR, psc->sc_sr); - ATH_LOCK_DESTROY(sc); - return (0); } diff --git a/sys/dev/netif/ath/ath/if_athvar.h b/sys/dev/netif/ath/ath/if_athvar.h index 815dd36..7beea42 100644 --- a/sys/dev/netif/ath/ath/if_athvar.h +++ b/sys/dev/netif/ath/ath/if_athvar.h @@ -347,16 +347,6 @@ struct ath_softc { struct sysctl_ctx_list sc_sysctl_ctx; }; -#define ATH_LOCK_INIT(_sc) \ - lockinit(&(_sc)->sc_lock, \ - __DECONST(char *, device_get_nameunit((_sc)->sc_dev)), \ - 0, LK_CANRECURSE) -#define ATH_LOCK_DESTROY(_sc) lockuninit(&(_sc)->sc_lock) -#define ATH_LOCK(_sc) lockmgr(&(_sc)->sc_lock, LK_EXCLUSIVE) -#define ATH_UNLOCK(_sc) lockmgr(&(_sc)->sc_lock, LK_RELEASE) -#define ATH_LOCK_ASSERT(_sc) \ - KKASSERT(lockstatus(&(_sc)->sc_lock, curthread) == LK_EXCLUSIVE) - #define ATH_TXQ_SETUP(sc, i) ((sc)->sc_txqsetup & (1< diff --git a/sys/netproto/802_11/wlan/ieee80211_hostap.c b/sys/netproto/802_11/wlan/ieee80211_hostap.c index 7754262..e19daaf 100644 --- a/sys/netproto/802_11/wlan/ieee80211_hostap.c +++ b/sys/netproto/802_11/wlan/ieee80211_hostap.c @@ -48,6 +48,7 @@ #include #include #include +#include #include #include @@ -2291,6 +2292,9 @@ hostap_recv_pspoll(struct ieee80211_node *ni, struct mbuf *m0) ifp = vap->iv_ic->ic_ifp; else ifp = vap->iv_ifp; + /* XXX deadlock against wlan serializer lock? */ + ifnet_serialize_all(ifp); IF_ENQUEUE(&ifp->if_snd, m); ifp->if_start(ifp); + ifnet_deserialize_all(ifp); } diff --git a/sys/netproto/802_11/wlan/ieee80211_ioctl.c b/sys/netproto/802_11/wlan/ieee80211_ioctl.c index bdd6b09..4c3c17f 100644 --- a/sys/netproto/802_11/wlan/ieee80211_ioctl.c +++ b/sys/netproto/802_11/wlan/ieee80211_ioctl.c @@ -3230,6 +3230,8 @@ ieee80211_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data, struct ucred *ucred struct ifreq *ifr; struct ifaddr *ifa; /* XXX */ + ASSERT_SERIALIZED(ifp->if_serializer); + switch (cmd) { case SIOCSIFFLAGS: IEEE80211_LOCK(ic); @@ -3336,7 +3338,11 @@ ieee80211_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data, struct ucred *ucred case SIOCSDRVSPEC: case SIOCGPRIVATE_0: { struct ifnet *parent = vap->iv_ic->ic_ifp; + ifnet_deserialize_all(ifp); + ifnet_serialize_all(parent); error = parent->if_ioctl(parent, cmd, data, ucred); + ifnet_deserialize_all(parent); + ifnet_serialize_all(ifp); break; } default: diff --git a/sys/netproto/802_11/wlan/ieee80211_power.c b/sys/netproto/802_11/wlan/ieee80211_power.c index a3d4541..3df4feb 100644 --- a/sys/netproto/802_11/wlan/ieee80211_power.c +++ b/sys/netproto/802_11/wlan/ieee80211_power.c @@ -449,8 +449,12 @@ pwrsave_flushq(struct ieee80211_node *ni) /* NB: do this outside the psq lock */ /* XXX packets might get reordered if parent is OACTIVE */ - if (parent != NULL) + if (parent != NULL) { + /* XXX deadlock against wlan serializer lock? */ + ifnet_serialize_all(parent); parent->if_start(parent); + ifnet_deserialize_all(parent); + } if (ifp != NULL) ifp->if_start(ifp); } diff --git a/sys/netproto/802_11/wlan/ieee80211_proto.c b/sys/netproto/802_11/wlan/ieee80211_proto.c index 7c38085..ede1f91 100644 --- a/sys/netproto/802_11/wlan/ieee80211_proto.c +++ b/sys/netproto/802_11/wlan/ieee80211_proto.c @@ -1090,7 +1090,9 @@ parent_updown(void *arg, int npending) { struct ifnet *parent = arg; + ifnet_serialize_all(parent); parent->if_ioctl(parent, SIOCSIFFLAGS, NULL, curthread->td_ucred); + ifnet_deserialize_all(parent); } static void @@ -1677,8 +1679,11 @@ ieee80211_newstate_cb(void *xvap, int npending) * Note this can also happen as a result of SLEEP->RUN * (i.e. coming out of power save mode). */ + /* XXX deadlock against wlan serializer lock? */ + ifnet_serialize_all(vap->iv_ifp); vap->iv_ifp->if_flags &= ~IFF_OACTIVE; vap->iv_ifp->if_start(vap->iv_ifp); + ifnet_deserialize_all(vap->iv_ifp); /* bring up any vaps waiting on us */ wakeupwaiting(vap);