* [RFT 0/2] cfg80211: UNII regulatory hints
@ 2012-08-11 0:25 Luis R. Rodriguez
2012-08-11 0:25 ` [RFT 1/2] cfg80211: add a helper for processing 5 GHz beacon hints Luis R. Rodriguez
2012-08-11 0:25 ` [RFT 2/2] cfg80211: add 5 GHz UNII band regulatory hints Luis R. Rodriguez
0 siblings, 2 replies; 4+ messages in thread
From: Luis R. Rodriguez @ 2012-08-11 0:25 UTC (permalink / raw)
To: linux-wireless; +Cc: dquan, Luis R. Rodriguez
From: "Luis R. Rodriguez" <mcgrof@do-not-panic.com>
It was hinted to me a while ago that we can enhance
beacon hints a little more by taking advantage of
common regulatory assumptions globally on UNII 1
and UNII 3. This implements that idea.
What this will do is in short enable to lift passive
scan flags off of 5 GHz channels *faster* when cards
are world roaming. This means that we can also initiate
communication on channels on either UNII 1 or UNII 3
faster than before when world roaming.
Credit goes got David Quan for the idea.
Luis R. Rodriguez (2):
cfg80211: add a helper for processing 5 GHz beacon hints
cfg80211: add 5 GHz UNII band regulatory hints
net/wireless/reg.c | 167 +++++++++++++++++++++++++++++++++++++++++++++++-----
1 file changed, 151 insertions(+), 16 deletions(-)
--
1.7.10.4
^ permalink raw reply [flat|nested] 4+ messages in thread
* [RFT 1/2] cfg80211: add a helper for processing 5 GHz beacon hints
2012-08-11 0:25 [RFT 0/2] cfg80211: UNII regulatory hints Luis R. Rodriguez
@ 2012-08-11 0:25 ` Luis R. Rodriguez
2012-08-11 0:25 ` [RFT 2/2] cfg80211: add 5 GHz UNII band regulatory hints Luis R. Rodriguez
1 sibling, 0 replies; 4+ messages in thread
From: Luis R. Rodriguez @ 2012-08-11 0:25 UTC (permalink / raw)
To: linux-wireless; +Cc: dquan, Luis R. Rodriguez
From: "Luis R. Rodriguez" <mcgrof@do-not-panic.com>
Add a helper for doing the work required for processing
a beacon hint. This allows us to re-use the code if
we later want to do the same processing.
This commit has no functional change, it only introduces
a helper.
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
---
net/wireless/reg.c | 45 +++++++++++++++++++++++++++++----------------
1 file changed, 29 insertions(+), 16 deletions(-)
diff --git a/net/wireless/reg.c b/net/wireless/reg.c
index 2ded3c7..8525ece 100644
--- a/net/wireless/reg.c
+++ b/net/wireless/reg.c
@@ -1028,30 +1028,19 @@ static bool ignore_reg_update(struct wiphy *wiphy,
return false;
}
-static void handle_reg_beacon(struct wiphy *wiphy,
- unsigned int chan_idx,
- struct reg_beacon *reg_beacon)
+static bool reg_chan_process_beacon_hint(struct wiphy *wiphy,
+ struct ieee80211_channel *chan)
{
- struct ieee80211_supported_band *sband;
- struct ieee80211_channel *chan;
- bool channel_changed = false;
struct ieee80211_channel chan_before;
-
- assert_cfg80211_lock();
-
- sband = wiphy->bands[reg_beacon->chan.band];
- chan = &sband->channels[chan_idx];
-
- if (likely(chan->center_freq != reg_beacon->chan.center_freq))
- return;
+ bool channel_changed = false;
if (chan->beacon_found)
- return;
+ return false;
chan->beacon_found = true;
if (wiphy->flags & WIPHY_FLAG_DISABLE_BEACON_HINTS)
- return;
+ return false;
chan_before.center_freq = chan->center_freq;
chan_before.flags = chan->flags;
@@ -1068,6 +1057,30 @@ static void handle_reg_beacon(struct wiphy *wiphy,
if (channel_changed)
nl80211_send_beacon_hint_event(wiphy, &chan_before, chan);
+
+ return channel_changed;
+}
+
+static void handle_reg_beacon(struct wiphy *wiphy,
+ unsigned int chan_idx,
+ struct reg_beacon *reg_beacon)
+{
+ struct ieee80211_supported_band *sband;
+ struct ieee80211_channel *chan;
+ bool channel_changed = false;
+
+ assert_cfg80211_lock();
+
+ sband = wiphy->bands[reg_beacon->chan.band];
+ chan = &sband->channels[chan_idx];
+
+ if (likely(chan->center_freq != reg_beacon->chan.center_freq))
+ return;
+
+ channel_changed = reg_chan_process_beacon_hint(wiphy, chan);
+
+ if (channel_changed)
+ return; /* some band hint could potenially go here */
}
/*
--
1.7.10.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [RFT 2/2] cfg80211: add 5 GHz UNII band regulatory hints
2012-08-11 0:25 [RFT 0/2] cfg80211: UNII regulatory hints Luis R. Rodriguez
2012-08-11 0:25 ` [RFT 1/2] cfg80211: add a helper for processing 5 GHz beacon hints Luis R. Rodriguez
@ 2012-08-11 0:25 ` Luis R. Rodriguez
2012-08-13 13:58 ` Arend van Spriel
1 sibling, 1 reply; 4+ messages in thread
From: Luis R. Rodriguez @ 2012-08-11 0:25 UTC (permalink / raw)
To: linux-wireless; +Cc: dquan, Luis R. Rodriguez
From: "Luis R. Rodriguez" <mcgrof@do-not-panic.com>
It turns out that what is known as UNII 1 (5180 MHz - 5240 MHz)
and UNII 3 (5745 MHz - 5825 MHz) share the same regulatory
permissions globally. This fact can be used to enable enhancing
world roaming quite a bit by taking advantage of beacon hints [0].
If we receive a beacon hint on UNII 1 it means we can not only
take advantage of that beacon hint to lift passive scan flags
on that channel but all other UNII 1 channels. The same applies
to UNII 3.
This implements UNII 1 and UNII 3 beacon hints.
[0] http://wireless.kernel.org/en/developers/Regulatory/processing_rules#Beacon_hints
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
---
net/wireless/reg.c | 124 +++++++++++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 123 insertions(+), 1 deletion(-)
diff --git a/net/wireless/reg.c b/net/wireless/reg.c
index 8525ece..2366ea2 100644
--- a/net/wireless/reg.c
+++ b/net/wireless/reg.c
@@ -1061,6 +1061,128 @@ static bool reg_chan_process_beacon_hint(struct wiphy *wiphy,
return channel_changed;
}
+enum reg_5ghz_unii_band {
+ REG_5GHZ_UNKNOWN, /* all others */
+ REG_5GHZ_UNII_1, /* 5180 MHz - 5240 MHz */
+ REG_5GHZ_UNII_2, /* 5260 MHz - 5320 MHz */
+ REG_5GHZ_MID_BAND, /* 5500 MHz - 5700 MHz */
+ REG_5GHZ_UNII_3, /* 5745 MHz - 5825 MHz */
+};
+
+static bool reg_is_5ghz_unii_1(struct ieee80211_channel *chan)
+{
+ if (chan->center_freq >= 5180 &&
+ chan->center_freq <= 5240)
+ return true;
+ return false;
+}
+
+static bool reg_is_5ghz_unii_2(struct ieee80211_channel *chan)
+{
+ if (chan->center_freq >= 5260 &&
+ chan->center_freq <= 5320 )
+ return true;
+ return false;
+}
+
+static bool reg_is_5ghz_mid_band(struct ieee80211_channel *chan)
+{
+ if (chan->center_freq >= 5500 &&
+ chan->center_freq <= 5700)
+ return true;
+ return false;
+}
+
+static bool reg_is_5ghz_unii_3(struct ieee80211_channel *chan)
+{
+ if (chan->center_freq >= 5745 &&
+ chan->center_freq <= 5825)
+ return true;
+ return false;
+}
+
+static enum reg_5ghz_unii_band
+reg_get_5ghz_unii_band(struct ieee80211_channel *chan)
+{
+ if (reg_is_5ghz_unii_1(chan))
+ return REG_5GHZ_UNII_1;
+ if (reg_is_5ghz_unii_2(chan))
+ return REG_5GHZ_UNII_2;
+ if (reg_is_5ghz_mid_band(chan))
+ return REG_5GHZ_MID_BAND;
+ if (reg_is_5ghz_mid_band(chan))
+ return REG_5GHZ_UNII_3;
+
+ return REG_5GHZ_UNKNOWN;
+}
+
+static void reg_unii_5ghz_beacon_hint_unii(struct wiphy *wiphy,
+ struct ieee80211_channel *chan,
+ enum reg_5ghz_unii_band unii_band)
+{
+ struct ieee80211_supported_band *sband;
+ unsigned int i;
+
+ assert_cfg80211_lock();
+
+ sband = wiphy->bands[chan->band];
+
+ /*
+ * Only process UNII 1 hints for UNII 1 channels
+ * Only process UNII 3 hints for UNII 3 channels
+ */
+ for (i = 0; i < sband->n_channels; i++) {
+ struct ieee80211_channel *c = &sband->channels[i];
+
+ switch (unii_band) {
+ case REG_5GHZ_UNII_1:
+ if (!reg_is_5ghz_unii_1(c))
+ continue;
+ break;
+ case REG_5GHZ_UNII_3:
+ if (!reg_is_5ghz_unii_3(c))
+ continue;
+ break;
+ default:
+ WARN_ONCE(1, "unexpected regulatory unii hint\n");
+ continue;
+ }
+
+ reg_chan_process_beacon_hint(wiphy, chan);
+ }
+
+ REG_DBG_PRINT("Processed 5 GHz UNII %d beacon hint\n",
+ (unii_band == REG_5GHZ_UNII_1) ? 1 : 3);
+}
+
+static void reg_unii_5ghz_beacon_hint(struct wiphy *wiphy,
+ struct ieee80211_channel *chan)
+{
+ enum reg_5ghz_unii_band unii_band = reg_get_5ghz_unii_band(chan);
+
+ switch (unii_band) {
+ case REG_5GHZ_UNKNOWN:
+ return;
+ /*
+ * These should not happen given that typically DFS
+ * is always enabled on the rest of the 5 GHz frequencies.
+ * We'll just bail out.
+ */
+ case REG_5GHZ_UNII_2:
+ case REG_5GHZ_MID_BAND:
+ return;
+ /*
+ * 5 GHz UNII hints are only enabled for UNII1 and UNII3
+ */
+ case REG_5GHZ_UNII_1:
+ case REG_5GHZ_UNII_3:
+ reg_unii_5ghz_beacon_hint_unii(wiphy, chan, unii_band);
+ break;
+ default:
+ break;
+ }
+}
+
static void handle_reg_beacon(struct wiphy *wiphy,
unsigned int chan_idx,
struct reg_beacon *reg_beacon)
@@ -1080,7 +1202,7 @@ static void handle_reg_beacon(struct wiphy *wiphy,
channel_changed = reg_chan_process_beacon_hint(wiphy, chan);
if (channel_changed)
- return; /* some band hint could potenially go here */
+ reg_unii_5ghz_beacon_hint(wiphy, chan);
}
/*
--
1.7.10.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [RFT 2/2] cfg80211: add 5 GHz UNII band regulatory hints
2012-08-11 0:25 ` [RFT 2/2] cfg80211: add 5 GHz UNII band regulatory hints Luis R. Rodriguez
@ 2012-08-13 13:58 ` Arend van Spriel
0 siblings, 0 replies; 4+ messages in thread
From: Arend van Spriel @ 2012-08-13 13:58 UTC (permalink / raw)
To: Luis R. Rodriguez; +Cc: linux-wireless, dquan
On 08/11/2012 02:25 AM, Luis R. Rodriguez wrote:
> +static void reg_unii_5ghz_beacon_hint_unii(struct wiphy *wiphy,
> + struct ieee80211_channel *chan,
> + enum reg_5ghz_unii_band unii_band)
> +{
> + struct ieee80211_supported_band *sband;
> + unsigned int i;
> +
> + assert_cfg80211_lock();
> +
> + sband = wiphy->bands[chan->band];
> +
> + /*
> + * Only process UNII 1 hints for UNII 1 channels
> + * Only process UNII 3 hints for UNII 3 channels
> + */
> + for (i = 0; i < sband->n_channels; i++) {
> + struct ieee80211_channel *c = &sband->channels[i];
> +
> + switch (unii_band) {
> + case REG_5GHZ_UNII_1:
> + if (!reg_is_5ghz_unii_1(c))
> + continue;
> + break;
> + case REG_5GHZ_UNII_3:
> + if (!reg_is_5ghz_unii_3(c))
> + continue;
> + break;
> + default:
> + WARN_ONCE(1, "unexpected regulatory unii hint\n");
> + continue;
> + }
> +
> + reg_chan_process_beacon_hint(wiphy, chan);
Not sure, but reading the description I think variable 'c' should be
passed here instead of 'chan'.
> + }
Gr. AvS
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2012-08-13 13:58 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-08-11 0:25 [RFT 0/2] cfg80211: UNII regulatory hints Luis R. Rodriguez
2012-08-11 0:25 ` [RFT 1/2] cfg80211: add a helper for processing 5 GHz beacon hints Luis R. Rodriguez
2012-08-11 0:25 ` [RFT 2/2] cfg80211: add 5 GHz UNII band regulatory hints Luis R. Rodriguez
2012-08-13 13:58 ` Arend van Spriel
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).