On 2020-01-14 18:01, Sergey Matyukevich wrote:
This patch adds support to configure per TID txrate configuration
configuration through the NL80211_TID_CONFIG_ATTR_TX_RATE_TYPE
and NL80211_TID_CONFIG_ATTR_TX_RATE
attribute. TX bitrate mask values passed
in NL80211_ATTR_TX_RATES attribute and
NL80211_TID_CONFIG_ATTR_TX_RATES
attribute will have types of the TX rate should be applied. This uses
nl80211_parse_tx_bitrate_mask to validate and calculate the bitrate
mask.
Signed-off-by: Tamizh chelvam <tamizhr@xxxxxxxxxxxxxx>
---
include/net/cfg80211.h | 5 +++
include/uapi/linux/nl80211.h | 24 +++++++++++++
net/wireless/nl80211.c | 76
++++++++++++++++++++++++++++++++----------
3 files changed, 88 insertions(+), 17 deletions(-)
...
@@ -13936,6 +13947,37 @@ static int parse_tid_conf(struct
cfg80211_registered_device *rdev,
nla_get_u8(attrs[NL80211_TID_CONFIG_ATTR_RTSCTS_CTRL]);
}
+ if (attrs[NL80211_TID_CONFIG_ATTR_TX_RATE_TYPE]) {
+ int idx;
+ enum nl80211_attrs attr;
+
+ err = nl80211_check_tid_config_support(rdev, extack, peer,
+ attrs, tid_conf,
+ TX_RATE);
+ if (err)
+ return err;
+ idx = NL80211_TID_CONFIG_ATTR_TX_RATE_TYPE;
+ tid_conf->txrate_type = nla_get_u8(attrs[idx]);
+ if (tid_conf->txrate_type != NL80211_TX_RATE_AUTOMATIC) {
+ tid_conf->mask =
+ kzalloc(sizeof(struct cfg80211_bitrate_mask),
+ GFP_KERNEL);
+ if (!tid_conf->mask)
+ return -ENOMEM;
+
+ attr =
+ (enum nl80211_attrs)NL80211_TID_CONFIG_ATTR_TX_RATE;
+ err = nl80211_parse_tx_bitrate_mask(info, attrs, attr,
+ tid_conf->mask);
+ if (err) {
+ kfree(tid_conf->mask);
+ return err;
+ }
IIUC we have to free all the allocated tid_conf->mask entries in the
end of
nl80211_set_tid_config, right before tid_config is freed.
Yeah, this needs to be take care by the driver, since it will be sent
with multiple
configuration. I have added that in the comment in next patchset.
Alternatively,struct ieee80211_tid_cfg can be modified to keep
cfg80211_bitrate_mask
value rather than pointer.
I have just reused the nl80211_parse_tx_bitrate_mask, so I feel using
the similar approach
should be good.
+ } else {
+ tid_conf->mask = NULL;
+ }
+ }
+
return 0;
}
Thanks,
Tamizh.