Date: Sat, 20 Jan 2007 22:02:39 GMT From: Kip Macy <kmacy@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 113226 for review Message-ID: <200701202202.l0KM2d75028002@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=113226 Change 113226 by kmacy@kmacy_serendipity:sam_wifi on 2007/01/20 22:02:25 fix panic in rt2661 caused by fallthrough from INIT to run in newstate add sc_invalid flag for better handling of card removal - add checks for it in rt2661 Affected files ... .. //depot/projects/wifi/sys/dev/ral/if_ral_pci.c#5 edit .. //depot/projects/wifi/sys/dev/ral/rt2560var.h#6 edit .. //depot/projects/wifi/sys/dev/ral/rt2661.c#5 edit .. //depot/projects/wifi/sys/dev/ral/rt2661var.h#5 edit Differences ... ==== //depot/projects/wifi/sys/dev/ral/if_ral_pci.c#5 (text+ko) ==== @@ -192,7 +192,8 @@ sc->sc_st = rman_get_bustag(psc->mem); sc->sc_sh = rman_get_bushandle(psc->mem); - + sc->sc_invalid = 1; + psc->irq_rid = 0; psc->irq = bus_alloc_resource_any(dev, SYS_RES_IRQ, &psc->irq_rid, RF_ACTIVE | RF_SHAREABLE); @@ -214,7 +215,8 @@ device_printf(dev, "could not set up interrupt\n"); return error; } - + sc->sc_invalid = 0; + return 0; } @@ -222,7 +224,11 @@ ral_pci_detach(device_t dev) { struct ral_pci_softc *psc = device_get_softc(dev); - + struct rt2560_softc *sc = &psc->u.sc_rt2560; + + /* check if device was removed */ + sc->sc_invalid = !bus_child_present(dev); + (*psc->sc_opns->detach)(psc); bus_generic_detach(dev); ==== //depot/projects/wifi/sys/dev/ral/rt2560var.h#6 (text) ==== @@ -112,7 +112,11 @@ struct callout rssadapt_ch; int sc_tx_timer; - + int sc_invalid; +/* + * The same in both up to here + * ------------------------------------------------ + */ uint32_t asic_rev; uint32_t eeprom_rev; uint8_t rf_rev; ==== //depot/projects/wifi/sys/dev/ral/rt2661.c#5 (text) ==== @@ -353,6 +353,7 @@ sc->sc_txtap.wt_ihdr.it_len = htole16(sc->sc_txtap_len); sc->sc_txtap.wt_ihdr.it_present = htole32(RT2661_TX_RADIOTAP_PRESENT); + /* * Add a few sysctl knobs. */ @@ -373,7 +374,6 @@ fail2: while (--ac >= 0) rt2661_free_tx_ring(sc, &sc->txq[ac]); fail1: mtx_destroy(&sc->sc_mtx); - return error; } @@ -383,7 +383,7 @@ struct rt2661_softc *sc = xsc; struct ieee80211com *ic = &sc->sc_ic; struct ifnet *ifp = ic->ic_ifp; - + rt2661_stop(sc); callout_stop(&sc->watchdog_ch); callout_stop(&sc->rssadapt_ch); @@ -803,6 +803,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; @@ -1726,7 +1727,7 @@ RAL_LOCK(sc); /* prevent management frames from being sent if we're not ready */ - if (!(ifp->if_drv_flags & IFF_DRV_RUNNING)) { + if (!(ifp->if_drv_flags & IFF_DRV_RUNNING) || sc->sc_invalid) { RAL_UNLOCK(sc); return; } @@ -1819,7 +1820,7 @@ { struct rt2661_softc *sc = (struct rt2661_softc *)arg; - if (sc->sc_tx_timer > 0) { + if (sc->sc_tx_timer > 0 && !sc->sc_invalid) { if (--sc->sc_tx_timer == 0) { device_printf(sc->sc_dev, "device timeout\n"); rt2661_init(sc); ==== //depot/projects/wifi/sys/dev/ral/rt2661var.h#5 (text) ==== @@ -105,7 +105,12 @@ struct callout rssadapt_ch; int sc_tx_timer; - + int sc_invalid; +/* + * The same in both up to here + * ------------------------------------------------ + */ + struct ieee80211_channel *sc_curchan; uint8_t rf_rev;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200701202202.l0KM2d75028002>