]> git.openfabrics.org - ~emulex/infiniband.git/commitdiff
cfg80211: Advertise maximum associated STAs in AP mode
authorJouni Malinen <j@w1.fi>
Tue, 14 Jan 2014 22:01:08 +0000 (00:01 +0200)
committerJohannes Berg <johannes.berg@intel.com>
Tue, 4 Feb 2014 20:48:08 +0000 (21:48 +0100)
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>
include/net/cfg80211.h
include/uapi/linux/nl80211.h
net/wireless/nl80211.c

index 572005981366eeaf2d5e7a6b09eff7f242726b32..117bea0210be3a8b5b5e29395bad3565003446c8 100644 (file)
@@ -2883,6 +2883,11 @@ struct wiphy_vendor_command {
  * @n_vendor_commands: number of vendor commands
  * @vendor_events: array of vendor events supported by the hardware
  * @n_vendor_events: number of vendor events
+ *
+ * @max_ap_assoc_sta: maximum number of associated stations supported in AP mode
+ *     (including P2P GO) or 0 to indicate no such limit is advertised. The
+ *     driver is allowed to advertise a theoretical limit that it can reach in
+ *     some cases, but may not always reach.
  */
 struct wiphy {
        /* assign these fields before you register the wiphy */
@@ -2998,6 +3003,8 @@ struct wiphy {
        const struct nl80211_vendor_cmd_info *vendor_events;
        int n_vendor_commands, n_vendor_events;
 
+       u16 max_ap_assoc_sta;
+
        char priv[0] __aligned(NETDEV_ALIGN);
 };
 
index e57de33180681be5c24ad5c4ec157a2214e7c4bc..9a86c8bf6da6845b83070f1069c80795d2f5b23b 100644 (file)
@@ -1568,6 +1568,13 @@ enum nl80211_commands {
  * @NL80211_ATTR_MAC_HINT: MAC address recommendation as initial BSS
  * @NL80211_ATTR_WIPHY_FREQ_HINT: frequency of the recommended initial BSS
  *
+ * @NL80211_ATTR_MAX_AP_ASSOC_STA: Device attribute that indicates how many
+ *     associated stations are supported in AP mode (including P2P GO); u32.
+ *     Since drivers may not have a fixed limit on the maximum number (e.g.,
+ *     other concurrent operations may affect this), drivers are allowed to
+ *     advertise values that cannot always be met. In such cases, an attempt
+ *     to add a new station entry with @NL80211_CMD_NEW_STATION may fail.
+ *
  * @NL80211_ATTR_MAX: highest attribute number currently defined
  * @__NL80211_ATTR_AFTER_LAST: internal use
  */
@@ -1899,6 +1906,8 @@ enum nl80211_attrs {
        NL80211_ATTR_MAC_HINT,
        NL80211_ATTR_WIPHY_FREQ_HINT,
 
+       NL80211_ATTR_MAX_AP_ASSOC_STA,
+
        /* add attributes here, update the policy in nl80211.c */
 
        __NL80211_ATTR_AFTER_LAST,
index 6e7d580ec645b22099ece3f83b0d30e1c2e6ffcb..b2ac1410b1132bf7548178703a4bb93a42011ec7 100644 (file)
@@ -1588,6 +1588,12 @@ static int nl80211_send_wiphy(struct cfg80211_registered_device *dev,
                    (nla_put_flag(msg, NL80211_ATTR_SUPPORT_5_MHZ) ||
                     nla_put_flag(msg, NL80211_ATTR_SUPPORT_10_MHZ)))
                        goto nla_put_failure;
+
+               if (dev->wiphy.max_ap_assoc_sta &&
+                   nla_put_u32(msg, NL80211_ATTR_MAX_AP_ASSOC_STA,
+                               dev->wiphy.max_ap_assoc_sta))
+                       goto nla_put_failure;
+
                state->split_start++;
                break;
        case 11: