Commit 84540869 authored by Luis R. Rodriguez's avatar Luis R. Rodriguez Committed by John W. Linville

ath9k: follow beacon hints on reg_notifier when world roaming

If we are roaming we allow to follow beacon hints.
Signed-off-by: default avatarLuis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent e38f8a7a
...@@ -160,13 +160,18 @@ static bool ath9k_is_radar_freq(u16 center_freq) ...@@ -160,13 +160,18 @@ static bool ath9k_is_radar_freq(u16 center_freq)
} }
/* /*
* Enable adhoc on 5 GHz if allowed by 11d. * N.B: These exception rules do not apply radar freqs.
* Remove passive scan if channel is allowed by 11d, *
* except when on radar frequencies. * - We enable adhoc (or beaconing) if allowed by 11d
* - We enable active scan if the channel is allowed by 11d
* - If no country IE has been processed and a we determine we have
* received a beacon on a channel we can enable active scan and
* adhoc (or beaconing).
*/ */
static void ath9k_reg_apply_5ghz_beaconing_flags(struct wiphy *wiphy, static void ath9k_reg_apply_beaconing_flags(struct wiphy *wiphy,
enum reg_set_by setby) enum reg_set_by setby)
{ {
enum ieee80211_band band;
struct ieee80211_supported_band *sband; struct ieee80211_supported_band *sband;
const struct ieee80211_reg_rule *reg_rule; const struct ieee80211_reg_rule *reg_rule;
struct ieee80211_channel *ch; struct ieee80211_channel *ch;
...@@ -174,29 +179,50 @@ static void ath9k_reg_apply_5ghz_beaconing_flags(struct wiphy *wiphy, ...@@ -174,29 +179,50 @@ static void ath9k_reg_apply_5ghz_beaconing_flags(struct wiphy *wiphy,
u32 bandwidth = 0; u32 bandwidth = 0;
int r; int r;
if (setby != REGDOM_SET_BY_COUNTRY_IE) for (band = 0; band < IEEE80211_NUM_BANDS; band++) {
return;
if (!wiphy->bands[IEEE80211_BAND_5GHZ]) if (!wiphy->bands[band])
return; continue;
sband = wiphy->bands[band];
sband = wiphy->bands[IEEE80211_BAND_5GHZ];
for (i = 0; i < sband->n_channels; i++) { for (i = 0; i < sband->n_channels; i++) {
ch = &sband->channels[i]; ch = &sband->channels[i];
if (ath9k_is_radar_freq(ch->center_freq) ||
(ch->flags & IEEE80211_CHAN_RADAR))
continue;
if (setby == REGDOM_SET_BY_COUNTRY_IE) {
r = freq_reg_info(wiphy, ch->center_freq, r = freq_reg_info(wiphy, ch->center_freq,
&bandwidth, &reg_rule); &bandwidth, &reg_rule);
if (r) if (r)
continue; continue;
/* If 11d had a rule for this channel ensure we enable adhoc /*
* if it allows us to use it. Note that we would have disabled * If 11d had a rule for this channel ensure
* it by applying our static world regdomain by default during * we enable adhoc/beaconing if it allows us to
* probe */ * use it. Note that we would have disabled it
if (!(reg_rule->flags & NL80211_RRF_NO_IBSS)) * by applying our static world regdomain by
ch->flags &= ~IEEE80211_CHAN_NO_IBSS; * default during init, prior to calling our
if (!ath9k_is_radar_freq(ch->center_freq)) * regulatory_hint().
continue; */
if (!(reg_rule->flags & NL80211_RRF_PASSIVE_SCAN)) if (!(reg_rule->flags &
ch->flags &= ~IEEE80211_CHAN_PASSIVE_SCAN; NL80211_RRF_NO_IBSS))
ch->flags &=
~IEEE80211_CHAN_NO_IBSS;
if (!(reg_rule->flags &
NL80211_RRF_PASSIVE_SCAN))
ch->flags &=
~IEEE80211_CHAN_PASSIVE_SCAN;
} else {
if (ch->beacon_found)
ch->flags &= ~(IEEE80211_CHAN_NO_IBSS |
IEEE80211_CHAN_PASSIVE_SCAN);
} }
}
}
} }
/* Allows active scan scan on Ch 12 and 13 */ /* Allows active scan scan on Ch 12 and 13 */
...@@ -209,11 +235,12 @@ static void ath9k_reg_apply_active_scan_flags(struct wiphy *wiphy, ...@@ -209,11 +235,12 @@ static void ath9k_reg_apply_active_scan_flags(struct wiphy *wiphy,
u32 bandwidth = 0; u32 bandwidth = 0;
int r; int r;
/* Force passive scan on Channels 12-13 */
sband = wiphy->bands[IEEE80211_BAND_2GHZ]; sband = wiphy->bands[IEEE80211_BAND_2GHZ];
/* If no country IE has been received always enable active scan /*
* on these channels */ * If no country IE has been received always enable active scan
* on these channels. This is only done for specific regulatory SKUs
*/
if (setby != REGDOM_SET_BY_COUNTRY_IE) { if (setby != REGDOM_SET_BY_COUNTRY_IE) {
ch = &sband->channels[11]; /* CH 12 */ ch = &sband->channels[11]; /* CH 12 */
if (ch->flags & IEEE80211_CHAN_PASSIVE_SCAN) if (ch->flags & IEEE80211_CHAN_PASSIVE_SCAN)
...@@ -224,10 +251,12 @@ static void ath9k_reg_apply_active_scan_flags(struct wiphy *wiphy, ...@@ -224,10 +251,12 @@ static void ath9k_reg_apply_active_scan_flags(struct wiphy *wiphy,
return; return;
} }
/* If a country IE has been recieved check its rule for this /*
* If a country IE has been recieved check its rule for this
* channel first before enabling active scan. The passive scan * channel first before enabling active scan. The passive scan
* would have been enforced by the initial probe processing on * would have been enforced by the initial processing of our
* our custom regulatory domain. */ * custom regulatory domain.
*/
ch = &sband->channels[11]; /* CH 12 */ ch = &sband->channels[11]; /* CH 12 */
r = freq_reg_info(wiphy, ch->center_freq, &bandwidth, &reg_rule); r = freq_reg_info(wiphy, ch->center_freq, &bandwidth, &reg_rule);
...@@ -290,10 +319,10 @@ void ath9k_reg_apply_world_flags(struct wiphy *wiphy, enum reg_set_by setby) ...@@ -290,10 +319,10 @@ void ath9k_reg_apply_world_flags(struct wiphy *wiphy, enum reg_set_by setby)
case 0x63: case 0x63:
case 0x66: case 0x66:
case 0x67: case 0x67:
ath9k_reg_apply_5ghz_beaconing_flags(wiphy, setby); ath9k_reg_apply_beaconing_flags(wiphy, setby);
break; break;
case 0x68: case 0x68:
ath9k_reg_apply_5ghz_beaconing_flags(wiphy, setby); ath9k_reg_apply_beaconing_flags(wiphy, setby);
ath9k_reg_apply_active_scan_flags(wiphy, setby); ath9k_reg_apply_active_scan_flags(wiphy, setby);
break; break;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment