aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2014-01-14 17:01:08 -0500
committerJohannes Berg <johannes.berg@intel.com>2014-02-04 15:48:08 -0500
commitb43504cf75b8b8773ee70c90bcd691282e151b9a (patch)
tree20d2758a4e6602f0a2e43a80585923d70ffbd17d
parent1df4a51082df6e5b0b8eb70df81885b9b4c9e6ec (diff)
cfg80211: Advertise maximum associated STAs in AP mode
This allows drivers to advertise the maximum number of associated stations they support in AP mode (including P2P GO). User space applications can use this for cleaner way of handling the limit (e.g., hostapd rejecting IEEE 802.11 authentication without manual configuration of the limit) or to figure out what type of use cases can be executed with multiple devices before trying and failing. Signed-off-by: Jouni Malinen <j@w1.fi> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
-rw-r--r--include/net/cfg80211.h7
-rw-r--r--include/uapi/linux/nl80211.h9
-rw-r--r--net/wireless/nl80211.c6
3 files changed, 22 insertions, 0 deletions
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 572005981366..117bea0210be 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -2883,6 +2883,11 @@ struct wiphy_vendor_command {
2883 * @n_vendor_commands: number of vendor commands 2883 * @n_vendor_commands: number of vendor commands
2884 * @vendor_events: array of vendor events supported by the hardware 2884 * @vendor_events: array of vendor events supported by the hardware
2885 * @n_vendor_events: number of vendor events 2885 * @n_vendor_events: number of vendor events
2886 *
2887 * @max_ap_assoc_sta: maximum number of associated stations supported in AP mode
2888 * (including P2P GO) or 0 to indicate no such limit is advertised. The
2889 * driver is allowed to advertise a theoretical limit that it can reach in
2890 * some cases, but may not always reach.
2886 */ 2891 */
2887struct wiphy { 2892struct wiphy {
2888 /* assign these fields before you register the wiphy */ 2893 /* assign these fields before you register the wiphy */
@@ -2998,6 +3003,8 @@ struct wiphy {
2998 const struct nl80211_vendor_cmd_info *vendor_events; 3003 const struct nl80211_vendor_cmd_info *vendor_events;
2999 int n_vendor_commands, n_vendor_events; 3004 int n_vendor_commands, n_vendor_events;
3000 3005
3006 u16 max_ap_assoc_sta;
3007
3001 char priv[0] __aligned(NETDEV_ALIGN); 3008 char priv[0] __aligned(NETDEV_ALIGN);
3002}; 3009};
3003 3010
diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h
index e57de3318068..9a86c8bf6da6 100644
--- a/include/uapi/linux/nl80211.h
+++ b/include/uapi/linux/nl80211.h
@@ -1568,6 +1568,13 @@ enum nl80211_commands {
1568 * @NL80211_ATTR_MAC_HINT: MAC address recommendation as initial BSS 1568 * @NL80211_ATTR_MAC_HINT: MAC address recommendation as initial BSS
1569 * @NL80211_ATTR_WIPHY_FREQ_HINT: frequency of the recommended initial BSS 1569 * @NL80211_ATTR_WIPHY_FREQ_HINT: frequency of the recommended initial BSS
1570 * 1570 *
1571 * @NL80211_ATTR_MAX_AP_ASSOC_STA: Device attribute that indicates how many
1572 * associated stations are supported in AP mode (including P2P GO); u32.
1573 * Since drivers may not have a fixed limit on the maximum number (e.g.,
1574 * other concurrent operations may affect this), drivers are allowed to
1575 * advertise values that cannot always be met. In such cases, an attempt
1576 * to add a new station entry with @NL80211_CMD_NEW_STATION may fail.
1577 *
1571 * @NL80211_ATTR_MAX: highest attribute number currently defined 1578 * @NL80211_ATTR_MAX: highest attribute number currently defined
1572 * @__NL80211_ATTR_AFTER_LAST: internal use 1579 * @__NL80211_ATTR_AFTER_LAST: internal use
1573 */ 1580 */
@@ -1899,6 +1906,8 @@ enum nl80211_attrs {
1899 NL80211_ATTR_MAC_HINT, 1906 NL80211_ATTR_MAC_HINT,
1900 NL80211_ATTR_WIPHY_FREQ_HINT, 1907 NL80211_ATTR_WIPHY_FREQ_HINT,
1901 1908
1909 NL80211_ATTR_MAX_AP_ASSOC_STA,
1910
1902 /* add attributes here, update the policy in nl80211.c */ 1911 /* add attributes here, update the policy in nl80211.c */
1903 1912
1904 __NL80211_ATTR_AFTER_LAST, 1913 __NL80211_ATTR_AFTER_LAST,
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index 6e7d580ec645..b2ac1410b113 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -1588,6 +1588,12 @@ static int nl80211_send_wiphy(struct cfg80211_registered_device *dev,
1588 (nla_put_flag(msg, NL80211_ATTR_SUPPORT_5_MHZ) || 1588 (nla_put_flag(msg, NL80211_ATTR_SUPPORT_5_MHZ) ||
1589 nla_put_flag(msg, NL80211_ATTR_SUPPORT_10_MHZ))) 1589 nla_put_flag(msg, NL80211_ATTR_SUPPORT_10_MHZ)))
1590 goto nla_put_failure; 1590 goto nla_put_failure;
1591
1592 if (dev->wiphy.max_ap_assoc_sta &&
1593 nla_put_u32(msg, NL80211_ATTR_MAX_AP_ASSOC_STA,
1594 dev->wiphy.max_ap_assoc_sta))
1595 goto nla_put_failure;
1596
1591 state->split_start++; 1597 state->split_start++;
1592 break; 1598 break;
1593 case 11: 1599 case 11: