Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 1 May 2009 19:05:07 +0000 (UTC)
From:      Andrew Thompson <thompsa@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-user@freebsd.org
Subject:   svn commit: r191728 - user/thompsa/vaptq/sys/net80211
Message-ID:  <200905011905.n41J57DZ050903@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: thompsa
Date: Fri May  1 19:05:07 2009
New Revision: 191728
URL: http://svn.freebsd.org/changeset/base/191728

Log:
  Add a comment to note that the vap list traversal is safe from the taskqeueue.
  
  Suggested by:	sam

Modified:
  user/thompsa/vaptq/sys/net80211/ieee80211_proto.c

Modified: user/thompsa/vaptq/sys/net80211/ieee80211_proto.c
==============================================================================
--- user/thompsa/vaptq/sys/net80211/ieee80211_proto.c	Fri May  1 17:50:40 2009	(r191727)
+++ user/thompsa/vaptq/sys/net80211/ieee80211_proto.c	Fri May  1 19:05:07 2009	(r191728)
@@ -1527,17 +1527,21 @@ ieee80211_cac_completeswitch(struct ieee
  * and mark them as waiting for a scan to complete.  These vaps
  * will be brought up when the scan completes and the scanning vap
  * reaches RUN state by wakeupwaiting.
- * This is called from the state taskqueue.
  */
 static void
 markwaiting(struct ieee80211vap *vap0)
 {
 	struct ieee80211com *ic = vap0->iv_ic;
-	struct ieee80211vap *vap, *next;
+	struct ieee80211vap *vap;
 
 	IEEE80211_LOCK_ASSERT(ic);
 
-	TAILQ_FOREACH_SAFE(vap, &ic->ic_vaps, iv_next, next) {
+	/*
+	 * A vap list entry can not disappear since we are running on the
+	 * taskqueue and a vap destroy will queue and drain another state
+	 * change task.
+	 */
+	TAILQ_FOREACH(vap, &ic->ic_vaps, iv_next) {
 		if (vap == vap0)
 			continue;
 		if (vap->iv_state != IEEE80211_S_INIT) {
@@ -1552,17 +1556,21 @@ markwaiting(struct ieee80211vap *vap0)
  * Wakeup all vap's waiting for a scan to complete.  This is the
  * companion to markwaiting (above) and is used to coordinate
  * multiple vaps scanning.
- * This is called from the state taskqueue.
  */
 static void
 wakeupwaiting(struct ieee80211vap *vap0)
 {
 	struct ieee80211com *ic = vap0->iv_ic;
-	struct ieee80211vap *vap, *next;
+	struct ieee80211vap *vap;
 
 	IEEE80211_LOCK_ASSERT(ic);
 
-	TAILQ_FOREACH_SAFE(vap, &ic->ic_vaps, iv_next, next) {
+	/*
+	 * A vap list entry can not disappear since we are running on the
+	 * taskqueue and a vap destroy will queue and drain another state
+	 * change task.
+	 */
+	TAILQ_FOREACH(vap, &ic->ic_vaps, iv_next) {
 		if (vap == vap0)
 			continue;
 		if (vap->iv_flags_ext & IEEE80211_FEXT_SCANWAIT) {



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