linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: greearb@candelatech.com
To: linux-wireless@vger.kernel.org
Cc: Ben Greear <greearb@candelatech.com>
Subject: [PATCH 5/7] mac80211:  Allow work items to use existing channel type.
Date: Mon,  7 Feb 2011 13:44:36 -0800	[thread overview]
Message-ID: <1297115078-27773-5-git-send-email-greearb@candelatech.com> (raw)
In-Reply-To: <1297115078-27773-1-git-send-email-greearb@candelatech.com>

From: Ben Greear <greearb@candelatech.com>

Narrow channel types can function within larger channel types.
So, use existing channel type for work items when possible.
This decreases hardware channel changes significantly when
using non NO_HT channel types on the operating channel.

Signed-off-by: Ben Greear <greearb@candelatech.com>
---
:100644 100644 6bf787a... 64f2b28... M	net/mac80211/work.c
 net/mac80211/work.c |   53 ++++++++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 50 insertions(+), 3 deletions(-)

diff --git a/net/mac80211/work.c b/net/mac80211/work.c
index 6bf787a..64f2b28 100644
--- a/net/mac80211/work.c
+++ b/net/mac80211/work.c
@@ -874,6 +874,44 @@ static void ieee80211_work_rx_queued_mgmt(struct ieee80211_local *local,
 	kfree_skb(skb);
 }
 
+static bool ieee80211_work_ct_coexists(enum nl80211_channel_type wk_ct,
+				       enum nl80211_channel_type oper_ct)
+{
+	switch (wk_ct) {
+	case NL80211_CHAN_NO_HT:
+		return true;
+	case NL80211_CHAN_HT20:
+		if (oper_ct != NL80211_CHAN_NO_HT)
+			return true;
+		return false;
+	case NL80211_CHAN_HT40MINUS:
+	case NL80211_CHAN_HT40PLUS:
+		return (wk_ct == oper_ct);
+	}
+	WARN_ON(1); /* shouldn't get here */
+	return false;
+}
+
+static enum nl80211_channel_type
+ieee80211_calc_ct(enum nl80211_channel_type wk_ct,
+		  enum nl80211_channel_type oper_ct)
+{
+	switch (wk_ct) {
+	case NL80211_CHAN_NO_HT:
+		return oper_ct;
+	case NL80211_CHAN_HT20:
+		if (oper_ct != NL80211_CHAN_NO_HT)
+			return oper_ct;
+		return wk_ct;
+	case NL80211_CHAN_HT40MINUS:
+	case NL80211_CHAN_HT40PLUS:
+		return wk_ct;
+	}
+	WARN_ON(1); /* shouldn't get here */
+	return wk_ct;
+}
+
+
 static void ieee80211_work_timer(unsigned long data)
 {
 	struct ieee80211_local *local = (void *) data;
@@ -927,14 +965,22 @@ static void ieee80211_work_work(struct work_struct *work)
 			bool on_oper_chan;
 			bool tmp_chan_changed = false;
 			bool on_oper_chan2;
+			enum nl80211_channel_type wk_ct;
 			on_oper_chan = ieee80211_cfg_on_oper_channel(local);
+
+			/* Work with existing channel type if possible. */
+			wk_ct = wk->chan_type;
+			if (wk->chan == local->hw.conf.channel)
+				wk_ct = ieee80211_calc_ct(wk->chan_type,
+						local->hw.conf.channel_type);
+
 			if (local->tmp_channel)
 				if ((local->tmp_channel != wk->chan) ||
-				    (local->tmp_channel_type != wk->chan_type))
+				    (local->tmp_channel_type != wk_ct))
 					tmp_chan_changed = true;
 
 			local->tmp_channel = wk->chan;
-			local->tmp_channel_type = wk->chan_type;
+			local->tmp_channel_type = wk_ct;
 			/*
 			 * Leave the station vifs in awake mode if they
 			 * happen to be on the same channel as
@@ -1031,7 +1077,8 @@ static void ieee80211_work_work(struct work_struct *work)
 			continue;
 		if (wk->chan != local->tmp_channel)
 			continue;
-		if (wk->chan_type != local->tmp_channel_type)
+		if (ieee80211_work_ct_coexists(wk->chan_type,
+					       local->tmp_channel_type))
 			continue;
 		remain_off_channel = true;
 	}
-- 
1.7.2.3


  parent reply	other threads:[~2011-02-07 21:44 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-07 21:44 [PATCH 1/7] mac80211: Make STA disconnect messages warn instead of debug greearb
2011-02-07 21:44 ` [PATCH 2/7] ath9k: Print channel-type in chan-change dbg message greearb
2011-02-07 21:44 ` [PATCH 3/7] mac80211: Properly set work-item channel-type greearb
2011-02-14 10:21   ` Johannes Berg
2011-02-07 21:44 ` [PATCH 4/7] mac80211: Allow scanning on existing channel-type greearb
2011-02-07 21:44 ` greearb [this message]
2011-02-07 21:44 ` [PATCH 6/7] ath9k: Add debug info for configuring power level greearb
2011-02-07 21:44 ` [PATCH 7/7] mac80211: Ensure power-level set properly for scanning greearb
2011-02-08 14:04 ` [PATCH 1/7] mac80211: Make STA disconnect messages warn instead of debug Kalle Valo
2011-02-08 17:10   ` Ben Greear
2011-02-09 12:07     ` Kalle Valo
2011-02-09 14:26       ` Ben Greear
2011-02-14 10:21   ` Johannes Berg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1297115078-27773-5-git-send-email-greearb@candelatech.com \
    --to=greearb@candelatech.com \
    --cc=linux-wireless@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).