Date: Fri, 5 Jan 2007 04:49:07 GMT From: Kip Macy <kmacy@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 112526 for review Message-ID: <200701050449.l054n760032320@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=112526 Change 112526 by kmacy@kmacy_serendipity:sam_wifi on 2007/01/05 04:48:57 - move locking soft lock acquisition into rt2560_stop - fixing hangs when the card was removed - only call newstate to transition to INIT if the driver is currently running - fixing a panic in ieee80211_cancel_scan with mtx_lock of destroyed mutex Affected files ... .. //depot/projects/wifi/sys/dev/ral/rt2560.c#10 edit Differences ... ==== //depot/projects/wifi/sys/dev/ral/rt2560.c#10 (text) ==== @@ -350,9 +350,7 @@ struct ieee80211com *ic = &sc->sc_ic; struct ifnet *ifp = ic->ic_ifp; - RAL_LOCK(sc); rt2560_stop(sc); - RAL_UNLOCK(sc); callout_stop(&sc->watchdog_ch); callout_stop(&sc->rssadapt_ch); @@ -2080,17 +2078,18 @@ switch (cmd) { case SIOCSIFFLAGS: - RAL_LOCK(sc); if (ifp->if_flags & IFF_UP) { + RAL_LOCK(sc); if (ifp->if_drv_flags & IFF_DRV_RUNNING) rt2560_update_promisc(sc); else rt2560_init(sc); + RAL_UNLOCK(sc); } else { if (ifp->if_drv_flags & IFF_DRV_RUNNING) rt2560_stop(sc); } - RAL_UNLOCK(sc); + break; default: @@ -2652,10 +2651,11 @@ uint32_t tmp; int i; - RAL_LOCK(sc); + rt2560_stop(sc); + RAL_LOCK(sc); /* setup tx rings */ tmp = RT2560_PRIO_RING_COUNT << 24 | RT2560_ATIM_RING_COUNT << 16 | @@ -2738,41 +2738,44 @@ } void -rt2560_stop(void *priv) +rt2560_stop(void *arg) { - struct rt2560_softc *sc = priv; + struct rt2560_softc *sc = arg; struct ieee80211com *ic = &sc->sc_ic; struct ifnet *ifp = ic->ic_ifp; volatile int *flags = &sc->sc_flags; while (*flags & RAL_INPUT_RUNNING) { - msleep(sc, &sc->sc_mtx, 0, "ralrunning", hz/10); + tsleep(sc, 0, "ralrunning", hz/10); } - - sc->sc_tx_timer = 0; - ifp->if_drv_flags &= ~(IFF_DRV_RUNNING | IFF_DRV_OACTIVE); - ieee80211_new_state(ic, IEEE80211_S_INIT, -1); + RAL_LOCK(sc); + if (ifp->if_drv_flags & IFF_DRV_RUNNING) { + ieee80211_new_state(ic, IEEE80211_S_INIT, -1); + sc->sc_tx_timer = 0; + ifp->if_drv_flags &= ~(IFF_DRV_RUNNING | IFF_DRV_OACTIVE); - /* abort Tx */ - RAL_WRITE(sc, RT2560_TXCSR0, RT2560_ABORT_TX); + /* abort Tx */ + RAL_WRITE(sc, RT2560_TXCSR0, RT2560_ABORT_TX); + + /* disable Rx */ + RAL_WRITE(sc, RT2560_RXCSR0, RT2560_DISABLE_RX); - /* disable Rx */ - RAL_WRITE(sc, RT2560_RXCSR0, RT2560_DISABLE_RX); + /* reset ASIC (imply reset BBP) */ + RAL_WRITE(sc, RT2560_CSR1, RT2560_RESET_ASIC); + RAL_WRITE(sc, RT2560_CSR1, 0); - /* reset ASIC (imply reset BBP) */ - RAL_WRITE(sc, RT2560_CSR1, RT2560_RESET_ASIC); - RAL_WRITE(sc, RT2560_CSR1, 0); - - /* disable interrupts */ - RAL_WRITE(sc, RT2560_CSR8, 0xffffffff); - - /* reset Tx and Rx rings */ - rt2560_reset_tx_ring(sc, &sc->txq); - rt2560_reset_tx_ring(sc, &sc->atimq); - rt2560_reset_tx_ring(sc, &sc->prioq); - rt2560_reset_tx_ring(sc, &sc->bcnq); - rt2560_reset_rx_ring(sc, &sc->rxq); + /* disable interrupts */ + RAL_WRITE(sc, RT2560_CSR8, 0xffffffff); + + /* reset Tx and Rx rings */ + rt2560_reset_tx_ring(sc, &sc->txq); + rt2560_reset_tx_ring(sc, &sc->atimq); + rt2560_reset_tx_ring(sc, &sc->prioq); + rt2560_reset_tx_ring(sc, &sc->bcnq); + rt2560_reset_rx_ring(sc, &sc->rxq); + } + RAL_UNLOCK(sc); } static int @@ -2828,3 +2831,4 @@ RAL_UNLOCK(sc); return EIO; /* XXX */ } +
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200701050449.l054n760032320>