Search Linux Wireless

[PATCH 2/2] mac80211: Don't go off-channel in work_work unless needed.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Ben Greear <greearb@xxxxxxxxxxxxxxx>

If the work to be done is on the current active channel, then
do not call the offchannel and return-to-channel logic.

Signed-off-by: Ben Greear <greearb@xxxxxxxxxxxxxxx>
---
:100644 100644 ae344d1... 1f2673d... M	net/mac80211/work.c
 net/mac80211/work.c |   28 ++++++++++++++++++++--------
 1 files changed, 20 insertions(+), 8 deletions(-)

diff --git a/net/mac80211/work.c b/net/mac80211/work.c
index ae344d1..1f2673d 100644
--- a/net/mac80211/work.c
+++ b/net/mac80211/work.c
@@ -873,6 +873,7 @@ static void ieee80211_work_work(struct work_struct *work)
 	LIST_HEAD(free_work);
 	enum work_action rma;
 	bool remain_off_channel = false;
+	bool went_off_channel = false;
 
 	if (local->scanning)
 		return;
@@ -910,12 +911,21 @@ static void ieee80211_work_work(struct work_struct *work)
 			 *	 happen to be on the same channel as
 			 *	 the requested channel
 			 */
-			ieee80211_offchannel_stop_beaconing(local);
-			ieee80211_offchannel_stop_station(local);
-
-			local->tmp_channel = wk->chan;
-			local->tmp_channel_type = wk->chan_type;
-			ieee80211_hw_config(local, 0);
+			WARN_ON(local->scan_channel != NULL);
+			if (wk->chan != local->oper_channel ||
+			    wk->chan_type != local->_oper_channel_type) {
+				/* Only change channels if we need to */
+				ieee80211_offchannel_stop_beaconing(local);
+				ieee80211_offchannel_stop_station(local);
+
+				local->tmp_channel = wk->chan;
+				local->tmp_channel_type = wk->chan_type;
+				ieee80211_hw_config(local, 0);
+				went_off_channel = true;
+			} else {
+				local->tmp_channel = wk->chan;
+				local->tmp_channel_type = wk->chan_type;
+			}
 			started = true;
 			wk->timeout = jiffies;
 		}
@@ -989,8 +999,10 @@ static void ieee80211_work_work(struct work_struct *work)
 
 	if (!remain_off_channel && local->tmp_channel) {
 		local->tmp_channel = NULL;
-		ieee80211_hw_config(local, 0);
-		ieee80211_offchannel_return(local, true);
+		if (went_off_channel) {
+			ieee80211_hw_config(local, 0);
+			ieee80211_offchannel_return(local, true);
+		}
 		/* give connection some time to breathe */
 		run_again(local, jiffies + HZ/2);
 	}
-- 
1.7.2.2

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]
  Powered by Linux