Skip to content

Commit

Permalink
nl80211: Add support to configure TID specific retry configuration
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Tamizh chelvam authored and Johannes Berg committed Feb 24, 2020
1 parent 3710a8a commit 6a21d16
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 0 deletions.
8 changes: 8 additions & 0 deletions include/net/cfg80211.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};

/**
Expand Down Expand Up @@ -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 */
Expand Down Expand Up @@ -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);
};

Expand Down
12 changes: 12 additions & 0 deletions include/uapi/linux/nl80211.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand Down
28 changes: 28 additions & 0 deletions net/wireless/nl80211.c
Original file line number Diff line number Diff line change
Expand Up @@ -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] = {
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 6a21d16

Please sign in to comment.