diff options
author | Rostislav Lisovy <lisovy@gmail.com> | 2014-04-15 08:37:56 -0400 |
---|---|---|
committer | Johannes Berg <johannes.berg@intel.com> | 2014-04-25 11:39:32 -0400 |
commit | 8eca1fb692cc9557f386eddce75c300a3855d11a (patch) | |
tree | 88c9b3fa62c0dc38c947cb023ca6a3eb3fe44c99 | |
parent | ea077c1cea36a6b5ded1256dcd56c72ff2a22c62 (diff) |
cfg80211: Use 5MHz bandwidth by default when checking usable channels
Current code checks if the 20MHz bandwidth is allowed for
particular channel -- if it is not, the channel is disabled.
Since we need to use 5/10 MHz channels, this code is modified in
the way that the default bandwidth to check is 5MHz. If the
maximum bandwidth allowed by the channel is smaller than 5MHz,
the channel is disabled. Otherwise the channel is used and the
flags are set according to the bandwidth allowed by the channel.
Signed-off-by: Rostislav Lisovy <rostislav.lisovy@fel.cvut.cz>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
-rw-r--r-- | net/wireless/reg.c | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/net/wireless/reg.c b/net/wireless/reg.c index 625c41ed489c..e78f532aaa5b 100644 --- a/net/wireless/reg.c +++ b/net/wireless/reg.c | |||
@@ -935,7 +935,7 @@ freq_reg_info_regd(struct wiphy *wiphy, u32 center_freq, | |||
935 | if (!band_rule_found) | 935 | if (!band_rule_found) |
936 | band_rule_found = freq_in_rule_band(fr, center_freq); | 936 | band_rule_found = freq_in_rule_band(fr, center_freq); |
937 | 937 | ||
938 | bw_fits = reg_does_bw_fit(fr, center_freq, MHZ_TO_KHZ(20)); | 938 | bw_fits = reg_does_bw_fit(fr, center_freq, MHZ_TO_KHZ(5)); |
939 | 939 | ||
940 | if (band_rule_found && bw_fits) | 940 | if (band_rule_found && bw_fits) |
941 | return rr; | 941 | return rr; |
@@ -1019,10 +1019,10 @@ static void chan_reg_rule_print_dbg(const struct ieee80211_regdomain *regd, | |||
1019 | } | 1019 | } |
1020 | #endif | 1020 | #endif |
1021 | 1021 | ||
1022 | /* | 1022 | /* Find an ieee80211_reg_rule such that a 5MHz channel with frequency |
1023 | * Note that right now we assume the desired channel bandwidth | 1023 | * chan->center_freq fits there. |
1024 | * is always 20 MHz for each individual channel (HT40 uses 20 MHz | 1024 | * If there is no such reg_rule, disable the channel, otherwise set the |
1025 | * per channel, the primary and the extension channel). | 1025 | * flags corresponding to the bandwidths allowed in the particular reg_rule |
1026 | */ | 1026 | */ |
1027 | static void handle_channel(struct wiphy *wiphy, | 1027 | static void handle_channel(struct wiphy *wiphy, |
1028 | enum nl80211_reg_initiator initiator, | 1028 | enum nl80211_reg_initiator initiator, |
@@ -1083,8 +1083,12 @@ static void handle_channel(struct wiphy *wiphy, | |||
1083 | if (reg_rule->flags & NL80211_RRF_AUTO_BW) | 1083 | if (reg_rule->flags & NL80211_RRF_AUTO_BW) |
1084 | max_bandwidth_khz = reg_get_max_bandwidth(regd, reg_rule); | 1084 | max_bandwidth_khz = reg_get_max_bandwidth(regd, reg_rule); |
1085 | 1085 | ||
1086 | if (max_bandwidth_khz < MHZ_TO_KHZ(10)) | ||
1087 | bw_flags = IEEE80211_CHAN_NO_10MHZ; | ||
1088 | if (max_bandwidth_khz < MHZ_TO_KHZ(20)) | ||
1089 | bw_flags |= IEEE80211_CHAN_NO_20MHZ; | ||
1086 | if (max_bandwidth_khz < MHZ_TO_KHZ(40)) | 1090 | if (max_bandwidth_khz < MHZ_TO_KHZ(40)) |
1087 | bw_flags = IEEE80211_CHAN_NO_HT40; | 1091 | bw_flags |= IEEE80211_CHAN_NO_HT40; |
1088 | if (max_bandwidth_khz < MHZ_TO_KHZ(80)) | 1092 | if (max_bandwidth_khz < MHZ_TO_KHZ(80)) |
1089 | bw_flags |= IEEE80211_CHAN_NO_80MHZ; | 1093 | bw_flags |= IEEE80211_CHAN_NO_80MHZ; |
1090 | if (max_bandwidth_khz < MHZ_TO_KHZ(160)) | 1094 | if (max_bandwidth_khz < MHZ_TO_KHZ(160)) |
@@ -1518,8 +1522,12 @@ static void handle_channel_custom(struct wiphy *wiphy, | |||
1518 | if (reg_rule->flags & NL80211_RRF_AUTO_BW) | 1522 | if (reg_rule->flags & NL80211_RRF_AUTO_BW) |
1519 | max_bandwidth_khz = reg_get_max_bandwidth(regd, reg_rule); | 1523 | max_bandwidth_khz = reg_get_max_bandwidth(regd, reg_rule); |
1520 | 1524 | ||
1525 | if (max_bandwidth_khz < MHZ_TO_KHZ(10)) | ||
1526 | bw_flags = IEEE80211_CHAN_NO_10MHZ; | ||
1527 | if (max_bandwidth_khz < MHZ_TO_KHZ(20)) | ||
1528 | bw_flags |= IEEE80211_CHAN_NO_20MHZ; | ||
1521 | if (max_bandwidth_khz < MHZ_TO_KHZ(40)) | 1529 | if (max_bandwidth_khz < MHZ_TO_KHZ(40)) |
1522 | bw_flags = IEEE80211_CHAN_NO_HT40; | 1530 | bw_flags |= IEEE80211_CHAN_NO_HT40; |
1523 | if (max_bandwidth_khz < MHZ_TO_KHZ(80)) | 1531 | if (max_bandwidth_khz < MHZ_TO_KHZ(80)) |
1524 | bw_flags |= IEEE80211_CHAN_NO_80MHZ; | 1532 | bw_flags |= IEEE80211_CHAN_NO_80MHZ; |
1525 | if (max_bandwidth_khz < MHZ_TO_KHZ(160)) | 1533 | if (max_bandwidth_khz < MHZ_TO_KHZ(160)) |