From owner-p4-projects@FreeBSD.ORG Sat Jan 20 22:02:40 2007 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 5344616A407; Sat, 20 Jan 2007 22:02:40 +0000 (UTC) X-Original-To: perforce@freebsd.org Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id C9A8016A406 for ; Sat, 20 Jan 2007 22:02:39 +0000 (UTC) (envelope-from kmacy@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [69.147.83.41]) by mx1.freebsd.org (Postfix) with ESMTP id B9E5513C448 for ; Sat, 20 Jan 2007 22:02:39 +0000 (UTC) (envelope-from kmacy@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.6/8.13.6) with ESMTP id l0KM2dBL028006 for ; Sat, 20 Jan 2007 22:02:39 GMT (envelope-from kmacy@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.6/8.13.4/Submit) id l0KM2d75028002 for perforce@freebsd.org; Sat, 20 Jan 2007 22:02:39 GMT (envelope-from kmacy@freebsd.org) Date: Sat, 20 Jan 2007 22:02:39 GMT Message-Id: <200701202202.l0KM2d75028002@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to kmacy@freebsd.org using -f From: Kip Macy To: Perforce Change Reviews Cc: Subject: PERFORCE change 113226 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Jan 2007 22:02:40 -0000 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;