nl80211: Add support to configure TID specific retry configuration
authorTamizh chelvam <tamizhr@codeaurora.org>
Mon, 20 Jan 2020 07:51:23 +0000 (13:21 +0530)
committerJohannes Berg <johannes.berg@intel.com>
Mon, 24 Feb 2020 12:48:54 +0000 (13:48 +0100)
This patch adds support to configure per TID retry configuration
through the NL80211_TID_CONFIG_ATTR_RETRY_SHORT and
NL80211_TID_CONFIG_ATTR_RETRY_LONG attributes. This TID specific
retry configuration will have more precedence than phy level
configuration.

Signed-off-by: Tamizh chelvam <tamizhr@codeaurora.org>
Link: https://lore.kernel.org/r/1579506687-18296-3-git-send-email-tamizhr@codeaurora.org
[rebase completely on top of my previous API changes]
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
include/net/cfg80211.h
include/uapi/linux/nl80211.h
net/wireless/nl80211.c

index bbe4acef729d2152acf0d4b5ebca16095c31339b..98981d1a026b68a84e8c5af2f644dea437a4417e 100644 (file)
@@ -634,12 +634,15 @@ struct cfg80211_chan_def {
  * @mask: bitmap of attributes indicating which parameter changed,
  *     similar to &nl80211_tid_config_supp.
  * @noack: noack configuration value for the TID
+ * @retry_long: retry count value
+ * @retry_short: retry count value
  */
 struct cfg80211_tid_cfg {
        bool config_override;
        u8 tids;
        u32 mask;
        enum nl80211_tid_config noack;
+       u8 retry_long, retry_short;
 };
 
 /**
@@ -4644,6 +4647,8 @@ struct wiphy_iftype_akm_suites {
  *     supported by the driver for each vif
  * @tid_config_support.peer: bitmap of attributes (configurations)
  *     supported by the driver for each peer
+ * @tid_config_support.max_retry: maximum supported retry count for
+ *     long/short retry configuration
  */
 struct wiphy {
        /* assign these fields before you register the wiphy */
@@ -4777,8 +4782,11 @@ struct wiphy {
 
        struct {
                u64 peer, vif;
+               u8 max_retry;
        } tid_config_support;
 
+       u8 max_data_retry_count;
+
        char priv[0] __aligned(NETDEV_ALIGN);
 };
 
index 591d843eda722d5d4a92ca01898f17f73806e6e5..c3481e1feebeefe63b634fa1ed7f484c4b1b782e 100644 (file)
@@ -4785,6 +4785,16 @@ enum nl80211_tid_config {
  * @NL80211_TID_CONFIG_ATTR_NOACK: Configure ack policy for the TID.
  *     specified in %NL80211_TID_CONFIG_ATTR_TID. see %enum nl80211_tid_config.
  *     Its type is u8.
+ * @NL80211_TID_CONFIG_ATTR_RETRY_SHORT: Number of retries used with data frame
+ *     transmission, user-space sets this configuration in
+ *     &NL80211_CMD_SET_TID_CONFIG. It is u8 type, min value is 1 and
+ *     the max value is advertised by the driver in this attribute on
+ *     output in wiphy capabilities.
+ * @NL80211_TID_CONFIG_ATTR_RETRY_LONG: Number of retries used with data frame
+ *     transmission, user-space sets this configuration in
+ *     &NL80211_CMD_SET_TID_CONFIG. Its type is u8, min value is 1 and
+ *     the max value is advertised by the driver in this attribute on
+ *     output in wiphy capabilities.
  */
 enum nl80211_tid_config_attr {
        __NL80211_TID_CONFIG_ATTR_INVALID,
@@ -4794,6 +4804,8 @@ enum nl80211_tid_config_attr {
        NL80211_TID_CONFIG_ATTR_OVERRIDE,
        NL80211_TID_CONFIG_ATTR_TIDS,
        NL80211_TID_CONFIG_ATTR_NOACK,
+       NL80211_TID_CONFIG_ATTR_RETRY_SHORT,
+       NL80211_TID_CONFIG_ATTR_RETRY_LONG,
 
        /* keep last */
        __NL80211_TID_CONFIG_ATTR_AFTER_LAST,
index 56ac851ccee16b047293b062e8eb2e1613d58c2a..4c79ba685992ecec7c19a737c20ff22cd04bd45a 100644 (file)
@@ -336,6 +336,8 @@ nl80211_tid_config_attr_policy[NL80211_TID_CONFIG_ATTR_MAX + 1] = {
        [NL80211_TID_CONFIG_ATTR_TIDS] = NLA_POLICY_RANGE(NLA_U16, 1, 0xff),
        [NL80211_TID_CONFIG_ATTR_NOACK] =
                        NLA_POLICY_MAX(NLA_U8, NL80211_TID_CONFIG_DISABLE),
+       [NL80211_TID_CONFIG_ATTR_RETRY_SHORT] = NLA_POLICY_MIN(NLA_U8, 1),
+       [NL80211_TID_CONFIG_ATTR_RETRY_LONG] = NLA_POLICY_MIN(NLA_U8, 1),
 };
 
 const struct nla_policy nl80211_policy[NUM_NL80211_ATTR] = {
@@ -1985,6 +1987,14 @@ nl80211_put_tid_config_support(struct cfg80211_registered_device *rdev,
                              NL80211_TID_CONFIG_ATTR_PAD))
                goto fail;
 
+       /* for now we just use the same value ... makes more sense */
+       if (nla_put_u8(msg, NL80211_TID_CONFIG_ATTR_RETRY_SHORT,
+                      rdev->wiphy.tid_config_support.max_retry))
+               goto fail;
+       if (nla_put_u8(msg, NL80211_TID_CONFIG_ATTR_RETRY_LONG,
+                      rdev->wiphy.tid_config_support.max_retry))
+               goto fail;
+
        nla_nest_end(msg, supp);
 
        return 0;
@@ -14019,6 +14029,24 @@ static int parse_tid_conf(struct cfg80211_registered_device *rdev,
                        nla_get_u8(attrs[NL80211_TID_CONFIG_ATTR_NOACK]);
        }
 
+       if (attrs[NL80211_TID_CONFIG_ATTR_RETRY_SHORT]) {
+               tid_conf->mask |= BIT(NL80211_TID_CONFIG_ATTR_RETRY_SHORT);
+               tid_conf->retry_short =
+                       nla_get_u8(attrs[NL80211_TID_CONFIG_ATTR_RETRY_SHORT]);
+
+               if (tid_conf->retry_short > rdev->wiphy.max_data_retry_count)
+                       return -EINVAL;
+       }
+
+       if (attrs[NL80211_TID_CONFIG_ATTR_RETRY_LONG]) {
+               tid_conf->mask |= BIT(NL80211_TID_CONFIG_ATTR_RETRY_LONG);
+               tid_conf->retry_long =
+                       nla_get_u8(attrs[NL80211_TID_CONFIG_ATTR_RETRY_LONG]);
+
+               if (tid_conf->retry_long > rdev->wiphy.max_data_retry_count)
+                       return -EINVAL;
+       }
+
        if (peer)
                mask = rdev->wiphy.tid_config_support.peer;
        else