Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 15 Apr 2009 14:51:41 +0000 (UTC)
From:      Andrew Thompson <thompsa@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-user@freebsd.org
Subject:   svn commit: r191102 - user/thompsa/vaptq/sys/net80211
Message-ID:  <200904151451.n3FEpf4G045751@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: thompsa
Date: Wed Apr 15 14:51:41 2009
New Revision: 191102
URL: http://svn.freebsd.org/changeset/base/191102

Log:
  Perform the channel change in ieee80211_setcurchan() on the taskqueue. This is
  safe as the channel is set before the new state is switched in
  ieee80211_sta_join(), the taskqueue is serialised so the channel change is
  guaranteed to have completed before the state transition happens.

Modified:
  user/thompsa/vaptq/sys/net80211/ieee80211_node.c
  user/thompsa/vaptq/sys/net80211/ieee80211_proto.c
  user/thompsa/vaptq/sys/net80211/ieee80211_var.h

Modified: user/thompsa/vaptq/sys/net80211/ieee80211_node.c
==============================================================================
--- user/thompsa/vaptq/sys/net80211/ieee80211_node.c	Wed Apr 15 05:37:17 2009	(r191101)
+++ user/thompsa/vaptq/sys/net80211/ieee80211_node.c	Wed Apr 15 14:51:41 2009	(r191102)
@@ -34,6 +34,7 @@ __FBSDID("$FreeBSD$");
 #include <sys/mbuf.h>   
 #include <sys/malloc.h>
 #include <sys/kernel.h>
+#include <sys/taskqueue.h>
 
 #include <sys/socket.h>
  
@@ -653,7 +654,11 @@ ieee80211_setcurchan(struct ieee80211com
 	ic->ic_bsschan = ic->ic_curchan = c;
 	ic->ic_curmode = ieee80211_chan2mode(ic->ic_curchan);
 	ic->ic_rt = ieee80211_get_ratetable(ic->ic_curchan);
-	ic->ic_set_channel(ic);
+	/*
+	 * The channel change is guaranteed to have happened before the next
+	 * state change
+	 */
+	taskqueue_enqueue(ic->ic_tq, &ic->ic_chan_task);
 }
 
 /*

Modified: user/thompsa/vaptq/sys/net80211/ieee80211_proto.c
==============================================================================
--- user/thompsa/vaptq/sys/net80211/ieee80211_proto.c	Wed Apr 15 05:37:17 2009	(r191101)
+++ user/thompsa/vaptq/sys/net80211/ieee80211_proto.c	Wed Apr 15 14:51:41 2009	(r191102)
@@ -99,6 +99,7 @@ const char *ieee80211_wme_acnames[] = {
 static void parent_updown(void *, int);
 static void update_mcast(void *, int);
 static void update_promisc(void *, int);
+static void update_channel(void *, int);
 static void ieee80211_newstate_cb(void *, int);
 static int ieee80211_newstate_cb_locked(struct ieee80211vap *,
 	enum ieee80211_state, int);
@@ -138,6 +139,7 @@ ieee80211_proto_attach(struct ieee80211c
 	TASK_INIT(&ic->ic_parent_task, 0, parent_updown, ifp);
 	TASK_INIT(&ic->ic_mcast_task, 0, update_mcast, ic);
 	TASK_INIT(&ic->ic_promisc_task, 0, update_promisc, ic);
+	TASK_INIT(&ic->ic_chan_task, 0, update_channel, ic);
 
 	ic->ic_wme.wme_hipri_switch_hysteresis =
 		AGGRESSIVE_MODE_SWITCH_HYSTERESIS;
@@ -1098,6 +1100,14 @@ update_promisc(void *arg, int npending)
 	ic->ic_update_promisc(parent);
 }
 
+static void
+update_channel(void *arg, int npending)
+{
+	struct ieee80211com *ic = arg;
+
+	ic->ic_set_channel(ic);
+}
+
 /*
  * Block until the parent is in a known state.  This is
  * used after any operations that dispatch a task (e.g.
@@ -1109,6 +1119,7 @@ ieee80211_waitfor_parent(struct ieee8021
 	taskqueue_drain(ic->ic_tq, &ic->ic_parent_task);
 	taskqueue_drain(ic->ic_tq, &ic->ic_mcast_task);
 	taskqueue_drain(ic->ic_tq, &ic->ic_promisc_task);
+	taskqueue_drain(ic->ic_tq, &ic->ic_chan_task);
 }
 
 /*

Modified: user/thompsa/vaptq/sys/net80211/ieee80211_var.h
==============================================================================
--- user/thompsa/vaptq/sys/net80211/ieee80211_var.h	Wed Apr 15 05:37:17 2009	(r191101)
+++ user/thompsa/vaptq/sys/net80211/ieee80211_var.h	Wed Apr 15 14:51:41 2009	(r191102)
@@ -128,6 +128,7 @@ struct ieee80211com {
 	struct task		ic_parent_task;	/* deferred parent processing */
 	struct task		ic_promisc_task;/* deferred promisc update */
 	struct task		ic_mcast_task;	/* deferred mcast update */
+	struct task		ic_chan_task;	/* deferred channel change */
 
 	uint32_t		ic_flags;	/* state flags */
 	uint32_t		ic_flags_ext;	/* extended state flags */



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