PERFORCE change 141022 for review

Andrew Thompson thompsa at FreeBSD.org
Fri May 2 01:08:29 UTC 2008


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

Change 141022 by thompsa at thompsa_burger on 2008/05/02 01:08:28

	Move the locking into bwi_init() so we only lock once for SIOCSIFFLAGS

Affected files ...

.. //depot/projects/vap/sys/dev/bwi/if_bwi.c#15 edit

Differences ...

==== //depot/projects/vap/sys/dev/bwi/if_bwi.c#15 (text+ko) ====

@@ -1220,7 +1220,9 @@
 static void
 bwi_init(void *xsc)
 {
+	BWI_LOCK(sc);
 	bwi_init_statechg(xsc, 1);
+	BWI_UNLOCK(sc);
 }
 
 static void
@@ -1231,8 +1233,6 @@
 	struct bwi_mac *mac;
 	int error;
 
-	BWI_LOCK(sc);
-
 	bwi_stop_locked(sc, statechg);
 
 	bwi_bbp_power_on(sc, BWI_CLOCK_MODE_FAST);
@@ -1296,12 +1296,9 @@
 
 	/* Enable intrs */
 	bwi_enable_intrs(sc, BWI_INIT_INTRS);
-
-	BWI_UNLOCK(sc);
 	return;
 bad:
 	bwi_stop_locked(sc, 1);
-	BWI_UNLOCK(sc);
 }
 
 static int
@@ -1312,7 +1309,7 @@
 	struct bwi_softc *sc = ifp->if_softc;
 	struct ieee80211com *ic = ifp->if_l2com;
 	struct ifreq *ifr = (struct ifreq *) data;
-	int error = 0;
+	int error = 0, startall = 0;
 
 	switch (cmd) {
 	case SIOCSIFFLAGS:
@@ -1339,17 +1336,19 @@
 			if (promisc >= 0)
 				bwi_mac_set_promisc(mac, promisc);
 		}
-		BWI_UNLOCK(sc);
 
 		if (ifp->if_flags & IFF_UP) {
 			if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) {
-				bwi_init(sc);
-				ieee80211_start_all(ic);
+				bwi_init_statechg(xsc, 1);
+				startall = 1;
 			}
 		} else {
 			if (ifp->if_drv_flags & IFF_DRV_RUNNING)
-				bwi_stop(sc, 1);
+				bwi_stop_locked(sc, 1);
 		}
+		BWI_UNLOCK(sc);
+		if (startall)
+			ieee80211_start_all(ic);
 		break;
 	case SIOCGIFMEDIA:
 		error = ifmedia_ioctl(ifp, ifr, &ic->ic_media, cmd);
@@ -4021,7 +4020,9 @@
 	struct ifnet *ifp = sc->sc_ifp;
 
 	if_printf(ifp, "%s begin, help!\n", __func__);
+	BWI_LOCK(sc);
 	bwi_init_statechg(xsc, 0);
+	BWI_UNLOCK(sc);
 #if 0
 	bwi_start_locked(ifp);
 #endif


More information about the p4-projects mailing list