aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRostislav Lisovy <lisovy@gmail.com>2014-04-15 08:37:55 -0400
committerJohannes Berg <johannes.berg@intel.com>2014-04-25 11:38:23 -0400
commitea077c1cea36a6b5ded1256dcd56c72ff2a22c62 (patch)
treebf071f6c59f762aed4ebe077ab8272bfb5379b4b
parent8bd811aa6c407a8a4712d7142fb9909f1b2a5fa4 (diff)
cfg80211: Add attributes describing prohibited channel bandwidth
Since there are frequency bands (e.g. 5.9GHz) allowing channels with only 10 or 5 MHz bandwidth, this patch adds attributes that allow keeping track about this information. When channel attributes are reported to user-space, make sure to not break old tools, i.e. if the 'split wiphy dump' is enabled, report the extra attributes (if present) describing the bandwidth restrictions. If the 'split wiphy dump' is not enabled, completely omit those channels that have flags set to either IEEE80211_CHAN_NO_10MHZ or IEEE80211_CHAN_NO_20MHZ. Add the check for new bandwidth restriction flags in cfg80211_chandef_usable() to comply with the restrictions. Signed-off-by: Rostislav Lisovy <rostislav.lisovy@fel.cvut.cz> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
-rw-r--r--include/net/cfg80211.h6
-rw-r--r--include/uapi/linux/nl80211.h6
-rw-r--r--net/wireless/chan.c2
-rw-r--r--net/wireless/nl80211.c13
4 files changed, 27 insertions, 0 deletions
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 3dd2cb465540..c98cf08538b9 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -111,6 +111,10 @@ enum ieee80211_band {
111 * restrictions. 111 * restrictions.
112 * @IEEE80211_CHAN_INDOOR_ONLY: see %NL80211_FREQUENCY_ATTR_INDOOR_ONLY 112 * @IEEE80211_CHAN_INDOOR_ONLY: see %NL80211_FREQUENCY_ATTR_INDOOR_ONLY
113 * @IEEE80211_CHAN_GO_CONCURRENT: see %NL80211_FREQUENCY_ATTR_GO_CONCURRENT 113 * @IEEE80211_CHAN_GO_CONCURRENT: see %NL80211_FREQUENCY_ATTR_GO_CONCURRENT
114 * @IEEE80211_CHAN_NO_20MHZ: 20 MHz bandwidth is not permitted
115 * on this channel.
116 * @IEEE80211_CHAN_NO_10MHZ: 10 MHz bandwidth is not permitted
117 * on this channel.
114 * 118 *
115 */ 119 */
116enum ieee80211_channel_flags { 120enum ieee80211_channel_flags {
@@ -125,6 +129,8 @@ enum ieee80211_channel_flags {
125 IEEE80211_CHAN_NO_160MHZ = 1<<8, 129 IEEE80211_CHAN_NO_160MHZ = 1<<8,
126 IEEE80211_CHAN_INDOOR_ONLY = 1<<9, 130 IEEE80211_CHAN_INDOOR_ONLY = 1<<9,
127 IEEE80211_CHAN_GO_CONCURRENT = 1<<10, 131 IEEE80211_CHAN_GO_CONCURRENT = 1<<10,
132 IEEE80211_CHAN_NO_20MHZ = 1<<11,
133 IEEE80211_CHAN_NO_10MHZ = 1<<12,
128}; 134};
129 135
130#define IEEE80211_CHAN_NO_HT40 \ 136#define IEEE80211_CHAN_NO_HT40 \
diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h
index 513bfd7b2e5f..0592032ff160 100644
--- a/include/uapi/linux/nl80211.h
+++ b/include/uapi/linux/nl80211.h
@@ -2358,6 +2358,10 @@ enum nl80211_band_attr {
2358 * connected to an AP with DFS and radar detection on the UNII band (it is 2358 * connected to an AP with DFS and radar detection on the UNII band (it is
2359 * up to user-space, i.e., wpa_supplicant to perform the required 2359 * up to user-space, i.e., wpa_supplicant to perform the required
2360 * verifications) 2360 * verifications)
2361 * @NL80211_FREQUENCY_ATTR_NO_20MHZ: 20 MHz operation is not allowed
2362 * on this channel in current regulatory domain.
2363 * @NL80211_FREQUENCY_ATTR_NO_10MHZ: 10 MHz operation is not allowed
2364 * on this channel in current regulatory domain.
2361 * @NL80211_FREQUENCY_ATTR_MAX: highest frequency attribute number 2365 * @NL80211_FREQUENCY_ATTR_MAX: highest frequency attribute number
2362 * currently defined 2366 * currently defined
2363 * @__NL80211_FREQUENCY_ATTR_AFTER_LAST: internal use 2367 * @__NL80211_FREQUENCY_ATTR_AFTER_LAST: internal use
@@ -2384,6 +2388,8 @@ enum nl80211_frequency_attr {
2384 NL80211_FREQUENCY_ATTR_DFS_CAC_TIME, 2388 NL80211_FREQUENCY_ATTR_DFS_CAC_TIME,
2385 NL80211_FREQUENCY_ATTR_INDOOR_ONLY, 2389 NL80211_FREQUENCY_ATTR_INDOOR_ONLY,
2386 NL80211_FREQUENCY_ATTR_GO_CONCURRENT, 2390 NL80211_FREQUENCY_ATTR_GO_CONCURRENT,
2391 NL80211_FREQUENCY_ATTR_NO_20MHZ,
2392 NL80211_FREQUENCY_ATTR_NO_10MHZ,
2387 2393
2388 /* keep last */ 2394 /* keep last */
2389 __NL80211_FREQUENCY_ATTR_AFTER_LAST, 2395 __NL80211_FREQUENCY_ATTR_AFTER_LAST,
diff --git a/net/wireless/chan.c b/net/wireless/chan.c
index 2adf7b2eccbc..84d686e2dbd0 100644
--- a/net/wireless/chan.c
+++ b/net/wireless/chan.c
@@ -616,12 +616,14 @@ bool cfg80211_chandef_usable(struct wiphy *wiphy,
616 width = 5; 616 width = 5;
617 break; 617 break;
618 case NL80211_CHAN_WIDTH_10: 618 case NL80211_CHAN_WIDTH_10:
619 prohibited_flags |= IEEE80211_CHAN_NO_10MHZ;
619 width = 10; 620 width = 10;
620 break; 621 break;
621 case NL80211_CHAN_WIDTH_20: 622 case NL80211_CHAN_WIDTH_20:
622 if (!ht_cap->ht_supported) 623 if (!ht_cap->ht_supported)
623 return false; 624 return false;
624 case NL80211_CHAN_WIDTH_20_NOHT: 625 case NL80211_CHAN_WIDTH_20_NOHT:
626 prohibited_flags |= IEEE80211_CHAN_NO_20MHZ;
625 width = 20; 627 width = 20;
626 break; 628 break;
627 case NL80211_CHAN_WIDTH_40: 629 case NL80211_CHAN_WIDTH_40:
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index fce423a4e96a..ca75f60041d2 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -567,6 +567,13 @@ static int nl80211_msg_put_channel(struct sk_buff *msg,
567 struct ieee80211_channel *chan, 567 struct ieee80211_channel *chan,
568 bool large) 568 bool large)
569{ 569{
570 /* Some channels must be completely excluded from the
571 * list to protect old user-space tools from breaking
572 */
573 if (!large && chan->flags &
574 (IEEE80211_CHAN_NO_10MHZ | IEEE80211_CHAN_NO_20MHZ))
575 return 0;
576
570 if (nla_put_u32(msg, NL80211_FREQUENCY_ATTR_FREQ, 577 if (nla_put_u32(msg, NL80211_FREQUENCY_ATTR_FREQ,
571 chan->center_freq)) 578 chan->center_freq))
572 goto nla_put_failure; 579 goto nla_put_failure;
@@ -620,6 +627,12 @@ static int nl80211_msg_put_channel(struct sk_buff *msg,
620 if ((chan->flags & IEEE80211_CHAN_GO_CONCURRENT) && 627 if ((chan->flags & IEEE80211_CHAN_GO_CONCURRENT) &&
621 nla_put_flag(msg, NL80211_FREQUENCY_ATTR_GO_CONCURRENT)) 628 nla_put_flag(msg, NL80211_FREQUENCY_ATTR_GO_CONCURRENT))
622 goto nla_put_failure; 629 goto nla_put_failure;
630 if ((chan->flags & IEEE80211_CHAN_NO_20MHZ) &&
631 nla_put_flag(msg, NL80211_FREQUENCY_ATTR_NO_20MHZ))
632 goto nla_put_failure;
633 if ((chan->flags & IEEE80211_CHAN_NO_10MHZ) &&
634 nla_put_flag(msg, NL80211_FREQUENCY_ATTR_NO_10MHZ))
635 goto nla_put_failure;
623 } 636 }
624 637
625 if (nla_put_u32(msg, NL80211_FREQUENCY_ATTR_MAX_TX_POWER, 638 if (nla_put_u32(msg, NL80211_FREQUENCY_ATTR_MAX_TX_POWER,