nl80211: Add flag attribute for RRM connections
authorAssaf Krauss <assaf.krauss@intel.com>
Wed, 3 Sep 2014 12:25:01 +0000 (15:25 +0300)
committerJohannes Berg <johannes.berg@intel.com>
Fri, 5 Sep 2014 11:52:08 +0000 (13:52 +0200)
Add a flag attribute to use in associations, for tagging the target
connection as supporting RRM. It is the responsibility of upper
layers to set this flag only if both the underlying device, and the
target network indeed support RRM.
To be used in ASSOCIATE and CONNECT commands.

Signed-off-by: Assaf Krauss <assaf.krauss@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
include/net/cfg80211.h
include/uapi/linux/nl80211.h
net/wireless/nl80211.c

index 6be68bb3191802b2425b2de99c6940e3379c9cc1..a887eeb5b31e4d9c117d728204ba83a98abd2281 100644 (file)
@@ -1608,10 +1608,12 @@ struct cfg80211_auth_request {
  *
  * @ASSOC_REQ_DISABLE_HT:  Disable HT (802.11n)
  * @ASSOC_REQ_DISABLE_VHT:  Disable VHT
+ * @ASSOC_REQ_USE_RRM: Declare RRM capability in this association
  */
 enum cfg80211_assoc_req_flags {
        ASSOC_REQ_DISABLE_HT            = BIT(0),
        ASSOC_REQ_DISABLE_VHT           = BIT(1),
+       ASSOC_REQ_USE_RRM               = BIT(2),
 };
 
 /**
index c166d3d23e5587bc32b5aa0c3a610239104be18b..de69d3df5e5509a1ac2ad7541bbeaf1ba5857002 100644 (file)
@@ -1594,6 +1594,17 @@ enum nl80211_commands {
  * @NL80211_ATTR_TDLS_INITIATOR: flag attribute indicating the current end is
  *     the TDLS link initiator.
  *
+ * @NL80211_ATTR_USE_RRM: flag for indicating whether the current connection
+ *     shall support Radio Resource Measurements (11k). This attribute can be
+ *     used with %NL80211_CMD_ASSOCIATE and %NL80211_CMD_CONNECT requests.
+ *     User space applications are expected to use this flag only if the
+ *     underlying device supports these minimal RRM features:
+ *             %NL80211_FEATURE_DS_PARAM_SET_IE_IN_PROBES,
+ *             %NL80211_FEATURE_QUIET,
+ *     If this flag is used, driver must add the Power Capabilities IE to the
+ *     association request. In addition, it must also set the RRM capability
+ *     flag in the association request's Capability Info field.
+ *
  * @NL80211_ATTR_MAX: highest attribute number currently defined
  * @__NL80211_ATTR_AFTER_LAST: internal use
  */
@@ -1936,6 +1947,8 @@ enum nl80211_attrs {
 
        NL80211_ATTR_TDLS_INITIATOR,
 
+       NL80211_ATTR_USE_RRM,
+
        /* add attributes here, update the policy in nl80211.c */
 
        __NL80211_ATTR_AFTER_LAST,
index d876146498ddb009487756e312614bf76caee8c9..459dc2769d0ead4a5cdb836fc19a128b376e8ea6 100644 (file)
@@ -389,6 +389,7 @@ static const struct nla_policy nl80211_policy[NL80211_ATTR_MAX+1] = {
        [NL80211_ATTR_TDLS_PEER_CAPABILITY] = { .type = NLA_U32 },
        [NL80211_ATTR_IFACE_SOCKET_OWNER] = { .type = NLA_FLAG },
        [NL80211_ATTR_CSA_C_OFFSETS_TX] = { .type = NLA_BINARY },
+       [NL80211_ATTR_USE_RRM] = { .type = NLA_FLAG },
 };
 
 /* policy for the key attributes */
@@ -6584,6 +6585,14 @@ static int nl80211_associate(struct sk_buff *skb, struct genl_info *info)
                       sizeof(req.vht_capa));
        }
 
+       if (nla_get_flag(info->attrs[NL80211_ATTR_USE_RRM])) {
+               if (!(rdev->wiphy.features &
+                     NL80211_FEATURE_DS_PARAM_SET_IE_IN_PROBES) ||
+                   !(rdev->wiphy.features & NL80211_FEATURE_QUIET))
+                       return -EINVAL;
+               req.flags |= ASSOC_REQ_USE_RRM;
+       }
+
        err = nl80211_crypto_settings(rdev, info, &req.crypto, 1);
        if (!err) {
                wdev_lock(dev->ieee80211_ptr);
@@ -7241,6 +7250,14 @@ static int nl80211_connect(struct sk_buff *skb, struct genl_info *info)
                       sizeof(connect.vht_capa));
        }
 
+       if (nla_get_flag(info->attrs[NL80211_ATTR_USE_RRM])) {
+               if (!(rdev->wiphy.features &
+                     NL80211_FEATURE_DS_PARAM_SET_IE_IN_PROBES) ||
+                   !(rdev->wiphy.features & NL80211_FEATURE_QUIET))
+                       return -EINVAL;
+               connect.flags |= ASSOC_REQ_USE_RRM;
+       }
+
        wdev_lock(dev->ieee80211_ptr);
        err = cfg80211_connect(rdev, dev, &connect, connkeys, NULL);
        wdev_unlock(dev->ieee80211_ptr);