aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2012-12-12 11:59:39 -0500
committerJohannes Berg <johannes.berg@intel.com>2013-02-15 03:41:38 -0500
commit50640f169372b9977487a328dedf13a8debedff7 (patch)
tree5ee6bf0cc8d936441049e94d48f7773a5fbdd420
parentc7a6ee27abd46247c1c7edfc49fb935138da7875 (diff)
nl80211: advertise HT/VHT channel limitations
When drivers or regulatory have limitations on 40, 80 or 160 MHz channels, advertise these to userspace via nl80211. Also add a new feature flag to let userspace know this is supported. Signed-off-by: Johannes Berg <johannes.berg@intel.com>
-rw-r--r--include/uapi/linux/nl80211.h17
-rw-r--r--net/wireless/core.c3
-rw-r--r--net/wireless/nl80211.c12
3 files changed, 31 insertions, 1 deletions
diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h
index 90b7af86f392..3880f6ad7ed1 100644
--- a/include/uapi/linux/nl80211.h
+++ b/include/uapi/linux/nl80211.h
@@ -2041,6 +2041,16 @@ enum nl80211_band_attr {
2041 * (enum nl80211_dfs_state) 2041 * (enum nl80211_dfs_state)
2042 * @NL80211_FREQUENCY_ATTR_DFS_TIME: time in miliseconds for how long 2042 * @NL80211_FREQUENCY_ATTR_DFS_TIME: time in miliseconds for how long
2043 * this channel is in this DFS state. 2043 * this channel is in this DFS state.
2044 * @NL80211_FREQUENCY_ATTR_NO_HT40_MINUS: HT40- isn't possible with this
2045 * channel as the control channel
2046 * @NL80211_FREQUENCY_ATTR_NO_HT40_PLUS: HT40+ isn't possible with this
2047 * channel as the control channel
2048 * @NL80211_FREQUENCY_ATTR_NO_80MHZ: any 80 MHz channel using this channel
2049 * as the primary or any of the secondary channels isn't possible,
2050 * this includes 80+80 channels
2051 * @NL80211_FREQUENCY_ATTR_NO_160MHZ: any 160 MHz (but not 80+80) channel
2052 * using this channel as the primary or any of the secondary channels
2053 * isn't possible
2044 * @NL80211_FREQUENCY_ATTR_MAX: highest frequency attribute number 2054 * @NL80211_FREQUENCY_ATTR_MAX: highest frequency attribute number
2045 * currently defined 2055 * currently defined
2046 * @__NL80211_FREQUENCY_ATTR_AFTER_LAST: internal use 2056 * @__NL80211_FREQUENCY_ATTR_AFTER_LAST: internal use
@@ -2055,6 +2065,10 @@ enum nl80211_frequency_attr {
2055 NL80211_FREQUENCY_ATTR_MAX_TX_POWER, 2065 NL80211_FREQUENCY_ATTR_MAX_TX_POWER,
2056 NL80211_FREQUENCY_ATTR_DFS_STATE, 2066 NL80211_FREQUENCY_ATTR_DFS_STATE,
2057 NL80211_FREQUENCY_ATTR_DFS_TIME, 2067 NL80211_FREQUENCY_ATTR_DFS_TIME,
2068 NL80211_FREQUENCY_ATTR_NO_HT40_MINUS,
2069 NL80211_FREQUENCY_ATTR_NO_HT40_PLUS,
2070 NL80211_FREQUENCY_ATTR_NO_80MHZ,
2071 NL80211_FREQUENCY_ATTR_NO_160MHZ,
2058 2072
2059 /* keep last */ 2073 /* keep last */
2060 __NL80211_FREQUENCY_ATTR_AFTER_LAST, 2074 __NL80211_FREQUENCY_ATTR_AFTER_LAST,
@@ -3421,6 +3435,8 @@ enum nl80211_ap_sme_features {
3421 * Note that even for drivers that support this, the default is to add 3435 * Note that even for drivers that support this, the default is to add
3422 * stations in authenticated/associated state, so to add unauthenticated 3436 * stations in authenticated/associated state, so to add unauthenticated
3423 * stations the authenticated/associated bits have to be set in the mask. 3437 * stations the authenticated/associated bits have to be set in the mask.
3438 * @NL80211_FEATURE_ADVERTISE_CHAN_LIMITS: cfg80211 advertises channel limits
3439 * (HT40, VHT 80/160 MHz) if this flag is set
3424 */ 3440 */
3425enum nl80211_feature_flags { 3441enum nl80211_feature_flags {
3426 NL80211_FEATURE_SK_TX_STATUS = 1 << 0, 3442 NL80211_FEATURE_SK_TX_STATUS = 1 << 0,
@@ -3437,6 +3453,7 @@ enum nl80211_feature_flags {
3437 NL80211_FEATURE_P2P_GO_CTWIN = 1 << 11, 3453 NL80211_FEATURE_P2P_GO_CTWIN = 1 << 11,
3438 NL80211_FEATURE_P2P_GO_OPPPS = 1 << 12, 3454 NL80211_FEATURE_P2P_GO_OPPPS = 1 << 12,
3439 NL80211_FEATURE_FULL_AP_CLIENT_STATE = 1 << 13, 3455 NL80211_FEATURE_FULL_AP_CLIENT_STATE = 1 << 13,
3456 NL80211_FEATURE_ADVERTISE_CHAN_LIMITS = 1 << 14,
3440}; 3457};
3441 3458
3442/** 3459/**
diff --git a/net/wireless/core.c b/net/wireless/core.c
index 922002105062..33b75b9b8efa 100644
--- a/net/wireless/core.c
+++ b/net/wireless/core.c
@@ -367,7 +367,8 @@ struct wiphy *wiphy_new(const struct cfg80211_ops *ops, int sizeof_priv)
367 rdev->wiphy.rts_threshold = (u32) -1; 367 rdev->wiphy.rts_threshold = (u32) -1;
368 rdev->wiphy.coverage_class = 0; 368 rdev->wiphy.coverage_class = 0;
369 369
370 rdev->wiphy.features = NL80211_FEATURE_SCAN_FLUSH; 370 rdev->wiphy.features = NL80211_FEATURE_SCAN_FLUSH |
371 NL80211_FEATURE_ADVERTISE_CHAN_LIMITS;
371 372
372 return &rdev->wiphy; 373 return &rdev->wiphy;
373} 374}
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index c1e18ccf4049..7e40b9e82b45 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -562,6 +562,18 @@ static int nl80211_msg_put_channel(struct sk_buff *msg,
562 if (nla_put_u32(msg, NL80211_FREQUENCY_ATTR_DFS_TIME, time)) 562 if (nla_put_u32(msg, NL80211_FREQUENCY_ATTR_DFS_TIME, time))
563 goto nla_put_failure; 563 goto nla_put_failure;
564 } 564 }
565 if ((chan->flags & IEEE80211_CHAN_NO_HT40MINUS) &&
566 nla_put_flag(msg, NL80211_FREQUENCY_ATTR_NO_HT40_MINUS))
567 goto nla_put_failure;
568 if ((chan->flags & IEEE80211_CHAN_NO_HT40PLUS) &&
569 nla_put_flag(msg, NL80211_FREQUENCY_ATTR_NO_HT40_PLUS))
570 goto nla_put_failure;
571 if ((chan->flags & IEEE80211_CHAN_NO_80MHZ) &&
572 nla_put_flag(msg, NL80211_FREQUENCY_ATTR_NO_80MHZ))
573 goto nla_put_failure;
574 if ((chan->flags & IEEE80211_CHAN_NO_160MHZ) &&
575 nla_put_flag(msg, NL80211_FREQUENCY_ATTR_NO_160MHZ))
576 goto nla_put_failure;
565 577
566 if (nla_put_u32(msg, NL80211_FREQUENCY_ATTR_MAX_TX_POWER, 578 if (nla_put_u32(msg, NL80211_FREQUENCY_ATTR_MAX_TX_POWER,
567 DBM_TO_MBM(chan->max_power))) 579 DBM_TO_MBM(chan->max_power)))