PERFORCE change 112489 for review

Kip Macy kmacy at FreeBSD.org
Thu Jan 4 12:06:21 PST 2007


http://perforce.freebsd.org/chv.cgi?CH=112489

Change 112489 by kmacy at kmacy_serendipity:sam_wifi on 2007/01/04 20:06:08

	fix LOR by dropping softc lock before callling ieee80211_input
	avoid race with unload by making stop sleep if RAL_INPUT_RUNNING 
	is set

Affected files ...

.. //depot/projects/wifi/sys/dev/ral/rt2560.c#8 edit
.. //depot/projects/wifi/sys/dev/ral/rt2560var.h#5 edit

Differences ...

==== //depot/projects/wifi/sys/dev/ral/rt2560.c#8 (text) ====

@@ -1170,6 +1170,8 @@
 			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);
@@ -1184,6 +1186,8 @@
 		/* node is no longer needed */
 		ieee80211_free_node(ni);
 
+		RAL_LOCK(sc);
+		sc->sc_flags &= ~RAL_INPUT_RUNNING;
 skip:		desc->flags = htole32(RT2560_RX_BUSY);
 
 		DPRINTFN(15, ("decryption done idx=%u\n", sc->rxq.cur_decrypt));
@@ -2736,7 +2740,12 @@
 	struct rt2560_softc *sc = priv;
 	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);
+	}
+	
 	sc->sc_tx_timer = 0;
 	ifp->if_drv_flags &= ~(IFF_DRV_RUNNING | IFF_DRV_OACTIVE);
 

==== //depot/projects/wifi/sys/dev/ral/rt2560var.h#5 (text) ====

@@ -156,6 +156,8 @@
 	}			sc_txtapu;
 #define sc_txtap	sc_txtapu.th
 	int			sc_txtap_len;
+#define                 RAL_INPUT_RUNNING       1
+	int                     sc_flags;
 };
 
 int	rt2560_attach(device_t, int);


More information about the p4-projects mailing list