Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 18 Apr 2008 18:44:03 GMT
From:      Sam Leffler <sam@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 140220 for review
Message-ID:  <200804181844.m3IIi3XV061961@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=140220

Change 140220 by sam@sam_ebb on 2008/04/18 18:43:38

	Cleanup stop handling the same way as init: defer the parent
	ioctl op to the taskq so we can avoid dropping the com lock.
	This also eliminates the bogus futzing of the parent's running
	flag to avoid problems.
	
	Also move taskq ops to run in a thread instead of a swi so
	the driver has a blocking context.  We're likely to add our
	own thread to help with other issues at which point we can
	do these operations there.

Affected files ...

.. //depot/projects/vap/sys/net80211/ieee80211_proto.c#29 edit

Differences ...

==== //depot/projects/vap/sys/net80211/ieee80211_proto.c#29 (text+ko) ====

@@ -96,7 +96,7 @@
 	"WME_UPSD",
 };
 
-static void parent_up(void *, int);
+static void parent_updown(void *, int);
 static int ieee80211_new_state_locked(struct ieee80211vap *,
 	enum ieee80211_state, int);
 
@@ -130,7 +130,7 @@
 	}
 	ic->ic_protmode = IEEE80211_PROT_CTSONLY;
 
-	TASK_INIT(&ic->ic_parent_task, 0, parent_up, ifp);
+	TASK_INIT(&ic->ic_parent_task, 0, parent_updown, ifp);
 
 	ic->ic_wme.wme_hipri_switch_hysteresis =
 		AGGRESSIVE_MODE_SWITCH_HYSTERESIS;
@@ -1064,7 +1064,7 @@
 }
 
 static void
-parent_up(void *arg, int npending)
+parent_updown(void *arg, int npending)
 {
 	struct ifnet *parent = arg;
 
@@ -1109,7 +1109,7 @@
 			    IEEE80211_MSG_STATE | IEEE80211_MSG_DEBUG,
 			    "%s: up parent %s\n", __func__, parent->if_xname);
 			parent->if_flags |= IFF_UP;
-			taskqueue_enqueue(taskqueue_swi, &ic->ic_parent_task);
+			taskqueue_enqueue(taskqueue_thread, &ic->ic_parent_task);
 			return;
 		}
 	}
@@ -1228,10 +1228,7 @@
 			    IEEE80211_MSG_STATE | IEEE80211_MSG_DEBUG,
 			    "down parent %s\n", parent->if_xname);
 			parent->if_flags &= ~IFF_UP;
-			/* XXX must drop lock */
-			IEEE80211_UNLOCK(ic);
-			parent->if_ioctl(parent, SIOCSIFFLAGS, NULL);
-			IEEE80211_LOCK(ic);
+			taskqueue_enqueue(taskqueue_thread, &ic->ic_parent_task);
 		}
 	}
 }
@@ -1252,22 +1249,13 @@
 void
 ieee80211_stop_all(struct ieee80211com *ic)
 {
-	struct ifnet *parent = ic->ic_ifp;
 	struct ieee80211vap *vap;
 
 	IEEE80211_LOCK(ic);
-	/* XXX why do we do this? */
-	/* XXX shouldn't touch driver state */
-	parent->if_drv_flags &= ~IFF_DRV_RUNNING;
 	TAILQ_FOREACH(vap, &ic->ic_vaps, iv_next) {
 		struct ifnet *ifp = vap->iv_ifp;
-		if (IFNET_IS_UP_RUNNING(ifp)) {	/* NB: avoid recursion */
-			/*
-			 * NB: since parent is marked !RUNNING
-			 * this won't drop com lock
-			 */
+		if (IFNET_IS_UP_RUNNING(ifp))	/* NB: avoid recursion */
 			ieee80211_stop_locked(vap);
-		}
 	}
 	IEEE80211_UNLOCK(ic);
 }



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200804181844.m3IIi3XV061961>