From patchwork Sat Nov 2 06:07:45 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tamizh chelvam X-Patchwork-Id: 11224035 X-Patchwork-Delegate: johannes@sipsolutions.net Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8CC0F15AB for ; Sat, 2 Nov 2019 06:08:04 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 583D320862 for ; Sat, 2 Nov 2019 06:08:04 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="key not found in DNS" (0-bit key) header.d=codeaurora.org header.i=@codeaurora.org header.b="CIOb17mc"; dkim=fail reason="key not found in DNS" (0-bit key) header.d=codeaurora.org header.i=@codeaurora.org header.b="WBxpKiX9" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726771AbfKBGIB (ORCPT ); Sat, 2 Nov 2019 02:08:01 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:37318 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725820AbfKBGIA (ORCPT ); Sat, 2 Nov 2019 02:08:00 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 58A456147C; Sat, 2 Nov 2019 06:07:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1572674879; bh=elL78LjMUAPsxSHRIcUyiBCA0Qvz+QupAdqQ6/MWQ5c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CIOb17mc8xgLKHViNOSMtEdKueFmW7OAONTxzZIxTNTYa+ZEDcvxemmOHLLmwSTFb RFD3vAekmt3HNdzlfjkZRKlSKHvJq+5uDX6OBh8Klxhg8UU1jENLTSdGm5IcLarPMX Q9NPpPYiC0Jtq7M2e4ZbjSwyxoNEiVt7ZiGZDHu0= X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on pdx-caf-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=ALL_TRUSTED,BAYES_00, DKIM_INVALID,DKIM_SIGNED,SPF_NONE autolearn=no autolearn_force=no version=3.4.0 Received: from akolli-ThinkPad-L560.qca.qualcomm.com (blr-c-bdr-fw-01_globalnat_allzones-outside.qualcomm.com [103.229.19.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: tamizhr@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 064CD61459; Sat, 2 Nov 2019 06:07:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1572674878; bh=elL78LjMUAPsxSHRIcUyiBCA0Qvz+QupAdqQ6/MWQ5c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WBxpKiX9Bs3uRlJ+WjXQCCOAOOPW9wavGVaudnQ/ZNlHqTza1ozACHlpgxgh6HF8a qiE3sOd9neC7RJX7Q0KMxSduJfhHsr8/gGbVX6RquS/La0vVZLf1/SvJ6U9Ta9AzHQ cq9C9yTuPGh14AQJKPLOKQwefUUGzfnklKpxt+h4= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 064CD61459 Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=tamizhr@codeaurora.org From: Tamizh chelvam To: johannes@sipsolutions.net Cc: linux-wireless@vger.kernel.org, Tamizh chelvam Subject: [PATCHv7 1/6] nl80211: New netlink command for TID specific configuration Date: Sat, 2 Nov 2019 11:37:45 +0530 Message-Id: <1572674870-23517-2-git-send-email-tamizhr@codeaurora.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1572674870-23517-1-git-send-email-tamizhr@codeaurora.org> References: <1572674870-23517-1-git-send-email-tamizhr@codeaurora.org> Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Add a new NL command, NL80211_CMD_SET_TID_CONFIG to support data TID specific configuration. This per TID configurations are passed in NL80211_TID_CONFIG_ATTR_TID which is a nested attribute. This patch adds support to configure per TID noack policy through NL80211_TID_CONFIG_ATTR_NOACK attribute. Data TID value for this configuration will be passed through NL80211_TID_CONFIG_ATTR_TID attribute. When the user-space wants this configuration peer specific rather than being applied for all the connected stations, MAC address of the peer can be passed in NL80211_ATTR_MAC attribute. This patch introduced enum ieee80211_tid_conf_mask to notify the driver that which configuration modified. Driver supporting data TID specific noack policy configuration should be advertise through NL80211_EXT_FEATURE_PER_TID_NOACK_CONFIG and supporting per STA data TID noack policy configuration should be advertise through NL80211_EXT_FEATURE_PER_STA_NOACK_CONFIG Signed-off-by: Tamizh chelvam --- include/net/cfg80211.h | 35 ++++++++++++ include/uapi/linux/nl80211.h | 59 ++++++++++++++++++++ net/wireless/nl80211.c | 122 ++++++++++++++++++++++++++++++++++++++++++ net/wireless/rdev-ops.h | 12 +++++ net/wireless/trace.h | 17 ++++++ 5 files changed, 245 insertions(+) diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h index 4ab2c49..58e956d 100644 --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h @@ -596,6 +596,35 @@ struct cfg80211_chan_def { struct ieee80211_edmg edmg; }; +enum ieee80211_tid_conf_mask { + IEEE80211_TID_CONF_NOACK = BIT(0), +}; + +/** + * struct ieee80211_tid_cfg - TID specific configuration + * @tid: TID number + * @tid_conf_mask: bitmap indicating which parameter changed + * see %enum ieee80211_tid_conf_mask + * @noack: noack configuration value for the TID + */ +struct ieee80211_tid_cfg { + u8 tid; + u32 tid_conf_mask; + u8 noack; +}; + +/** + * struct ieee80211_tid_config - TID configuration + * @peer: Station's MAC address + * @n_tid_conf: Number of TID specific configurations to be applied + * @tid_conf: Configuration change info + */ +struct ieee80211_tid_config { + const u8 *peer; + u32 n_tid_conf; + struct ieee80211_tid_cfg tid_conf[]; +}; + /** * cfg80211_get_chandef_type - return old channel type from chandef * @chandef: the channel definition @@ -3625,6 +3654,10 @@ struct cfg80211_update_owe_info { * * @probe_mesh_link: Probe direct Mesh peer's link quality by sending data frame * and overrule HWMP path selection algorithm. + * @set_tid_config: TID specific configuration. Apply this configuration for + * all the connected stations in the BSS if peer is %NULL. Otherwise + * apply this configuration to the specific station. + * This callback may sleep. */ struct cfg80211_ops { int (*suspend)(struct wiphy *wiphy, struct cfg80211_wowlan *wow); @@ -3943,6 +3976,8 @@ struct cfg80211_ops { struct cfg80211_update_owe_info *owe_info); int (*probe_mesh_link)(struct wiphy *wiphy, struct net_device *dev, const u8 *buf, size_t len); + int (*set_tid_config)(struct wiphy *wiphy, struct net_device *dev, + struct ieee80211_tid_config *tid_conf); }; /* diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h index 64135ab..c0b43da 100644 --- a/include/uapi/linux/nl80211.h +++ b/include/uapi/linux/nl80211.h @@ -1109,6 +1109,10 @@ * peer MAC address and %NL80211_ATTR_FRAME is used to specify the frame * content. The frame is ethernet data. * + * @NL80211_CMD_SET_TID_CONFIG: Data frame TID specific configuration + * is passed through this command using %NL80211_ATTR_TID_CONFIG + * nested attributes. + * * @NL80211_CMD_MAX: highest used command number * @__NL80211_CMD_AFTER_LAST: internal use */ @@ -1333,6 +1337,8 @@ enum nl80211_commands { NL80211_CMD_PROBE_MESH_LINK, + NL80211_CMD_SET_TID_CONFIG, + /* add new commands above here */ /* used to define NL80211_CMD_MAX below */ @@ -2381,6 +2387,9 @@ enum nl80211_commands { * the allowed channel bandwidth configurations. (u8 attribute) * Defined by IEEE P802.11ay/D4.0 section 9.4.2.251, Table 13. * + * @NL80211_ATTR_TID_CONFIG: TID specific configuration in a + * nested attribute with %NL80211_TID_CONFIG_ATTR_* sub-attributes. + * * @NUM_NL80211_ATTR: total number of nl80211_attrs available * @NL80211_ATTR_MAX: highest attribute number currently defined * @__NL80211_ATTR_AFTER_LAST: internal use @@ -2843,6 +2852,8 @@ enum nl80211_attrs { NL80211_ATTR_WIPHY_EDMG_CHANNELS, NL80211_ATTR_WIPHY_EDMG_BW_CONFIG, + NL80211_ATTR_TID_CONFIG, + /* add attributes here, update the policy in nl80211.c */ __NL80211_ATTR_AFTER_LAST, @@ -4682,6 +4693,47 @@ enum nl80211_tx_power_setting { }; /** + * enum nl80211_tid_config - TID config state + * @NL80211_TID_CONFIG_DEFAULT: Default config for the TID. This is to + * notify driver to reset the previous config and use vif specific + * default config + * @NL80211_TID_CONFIG_ENABLE: Enable config for the TID + * NL80211_TID_CONFIG_DISABLE: Disable config for the TID + */ +enum nl80211_tid_config { + NL80211_TID_CONFIG_DEFAULT, + NL80211_TID_CONFIG_ENABLE, + NL80211_TID_CONFIG_DISABLE, +}; + +/* enum nl80211_tid_config_attr - TID specific configuration. + * @NL80211_TID_CONFIG_ATTR_TID: a TID value (u8 attribute). + * @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, if the peer MAC address is passed in %NL80211_ATTR_MAC, + * then the noack configuration is applied to the data frame for the tid + * to that connected station. This configuration is valid only for STA's + * current connection. i.e. the configuration will be reset to default when + * the station connects back after disconnection/roaming. + * when user-space does not include %NL80211_ATTR_MAC, then this + * configuration should be treated as per-netdev configuration. + * This configuration will be cleared when the interface goes down and on + * the disconnection from a BSS. Driver supporting this feature should + * advertise NL80211_EXT_FEATURE_PER_TID_NOACK_CONFIG and + * NL80211_EXT_FEATURE_PER_STA_NOACK_CONFIG for supporting per sta + * configuration. + */ +enum nl80211_tid_config_attr { + __NL80211_TID_CONFIG_ATTR_INVALID, + NL80211_TID_CONFIG_ATTR_TID, + NL80211_TID_CONFIG_ATTR_NOACK, + + /* keep last */ + __NL80211_TID_CONFIG_ATTR_AFTER_LAST, + NL80211_TID_CONFIG_ATTR_MAX = __NL80211_TID_CONFIG_ATTR_AFTER_LAST - 1 +}; + +/** * enum nl80211_packet_pattern_attr - packet pattern attribute * @__NL80211_PKTPAT_INVALID: invalid number for nested attribute * @NL80211_PKTPAT_PATTERN: the pattern, values where the mask has @@ -5492,6 +5544,11 @@ enum nl80211_feature_flags { * @NL80211_EXT_FEATURE_SAE_OFFLOAD: Device wants to do SAE authentication in * station mode (SAE password is passed as part of the connect command). * + * @NL80211_EXT_FEATURE_PER_TID_NOACK_CONFIG: Driver supports per TID NoAck + * policy functionality. + * @NL80211_EXT_FEATURE_PER_STA_NOACK_CONFIG: Driver supports STA specific NoAck + * policy functionality. + * * @NUM_NL80211_EXT_FEATURES: number of extended features. * @MAX_NL80211_EXT_FEATURES: highest extended feature index. */ @@ -5537,6 +5594,8 @@ enum nl80211_ext_feature_index { NL80211_EXT_FEATURE_EXT_KEY_ID, NL80211_EXT_FEATURE_STA_TX_PWR, NL80211_EXT_FEATURE_SAE_OFFLOAD, + NL80211_EXT_FEATURE_PER_TID_NOACK_CONFIG, + NL80211_EXT_FEATURE_PER_STA_NOACK_CONFIG, /* add new features before the definition below */ NUM_NL80211_EXT_FEATURES, diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index d1451e7..c5c3af5 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c @@ -321,6 +321,13 @@ static int validate_ie_attr(const struct nlattr *attr, NLA_POLICY_RANGE(NLA_U8, 1, 20), }; +static const struct nla_policy +nl80211_tid_config_attr_policy[NL80211_TID_CONFIG_ATTR_MAX + 1] = { + [NL80211_TID_CONFIG_ATTR_TID] = { .type = NLA_U8 }, + [NL80211_TID_CONFIG_ATTR_NOACK] = + NLA_POLICY_MAX(NLA_U8, NL80211_TID_CONFIG_DISABLE), +}; + const struct nla_policy nl80211_policy[NUM_NL80211_ATTR] = { [0] = { .strict_start_type = NL80211_ATTR_HE_OBSS_PD }, [NL80211_ATTR_WIPHY] = { .type = NLA_U32 }, @@ -624,6 +631,8 @@ static int validate_ie_attr(const struct nlattr *attr, .len = SAE_PASSWORD_MAX_LEN }, [NL80211_ATTR_TWT_RESPONDER] = { .type = NLA_FLAG }, [NL80211_ATTR_HE_OBSS_PD] = NLA_POLICY_NESTED(he_obss_pd_policy), + [NL80211_ATTR_TID_CONFIG] = + NLA_POLICY_NESTED_ARRAY(nl80211_tid_config_attr_policy), }; /* policy for the key attributes */ @@ -13788,6 +13797,112 @@ static int nl80211_probe_mesh_link(struct sk_buff *skb, struct genl_info *info) return rdev_probe_mesh_link(rdev, dev, dest, buf, len); } +static int +nl80211_check_tid_config_support(struct cfg80211_registered_device *rdev, + struct netlink_ext_ack *extack, + const u8 *peer, struct nlattr *attr, + enum nl80211_ext_feature_index per_tid_config, + enum nl80211_ext_feature_index per_sta_config) +{ + if (!wiphy_ext_feature_isset(&rdev->wiphy, per_tid_config)) { + NL_SET_ERR_MSG_ATTR(extack, attr, "TID specific configuration not supported"); + return -ENOTSUPP; + } + + if (peer && !wiphy_ext_feature_isset(&rdev->wiphy, per_sta_config)) { + NL_SET_ERR_MSG_ATTR(extack, attr, "peer specific TID configuration not supported"); + return -ENOTSUPP; + } + + return 0; +} + +static int parse_tid_conf(struct cfg80211_registered_device *rdev, + struct nlattr *attrs[], + struct ieee80211_tid_cfg *tid_conf, + struct genl_info *info, const u8 *peer) +{ + struct netlink_ext_ack *extack = info->extack; + int err; + + tid_conf->tid = nla_get_u8(attrs[NL80211_TID_CONFIG_ATTR_TID]); + if (attrs[NL80211_TID_CONFIG_ATTR_NOACK]) { + err = nl80211_check_tid_config_support(rdev, extack, peer, + attrs[NL80211_TID_CONFIG_ATTR_NOACK], + NL80211_EXT_FEATURE_PER_TID_NOACK_CONFIG, + NL80211_EXT_FEATURE_PER_STA_NOACK_CONFIG); + if (err) + return err; + + tid_conf->tid_conf_mask |= IEEE80211_TID_CONF_NOACK; + tid_conf->noack = + nla_get_u8(attrs[NL80211_TID_CONFIG_ATTR_NOACK]); + } + + return 0; +} + +static int nl80211_set_tid_config(struct sk_buff *skb, + struct genl_info *info) +{ + struct cfg80211_registered_device *rdev = info->user_ptr[0]; + struct nlattr *attrs[NL80211_TID_CONFIG_ATTR_MAX + 1]; + struct net_device *dev = info->user_ptr[1]; + struct ieee80211_tid_config *tid_config; + struct nlattr *tid; + int conf_idx = 0, rem_conf; + int ret = -EINVAL; + u32 num_conf = 0; + + if (!info->attrs[NL80211_ATTR_TID_CONFIG]) + return -EINVAL; + + if (!rdev->ops->set_tid_config) + return -EOPNOTSUPP; + + nla_for_each_nested(tid, info->attrs[NL80211_ATTR_TID_CONFIG], + rem_conf) + num_conf++; + + tid_config = kzalloc(struct_size(tid_config, tid_conf, num_conf), + GFP_KERNEL); + if (!tid_config) + return -ENOMEM; + + tid_config->n_tid_conf = num_conf; + + if (info->attrs[NL80211_ATTR_MAC]) + tid_config->peer = nla_data(info->attrs[NL80211_ATTR_MAC]); + + nla_for_each_nested(tid, info->attrs[NL80211_ATTR_TID_CONFIG], + rem_conf) { + ret = nla_parse_nested(attrs, NL80211_TID_CONFIG_ATTR_MAX, + tid, NULL, NULL); + + if (ret) + goto bad_tid_conf; + + if (!attrs[NL80211_TID_CONFIG_ATTR_TID]) { + ret = -EINVAL; + goto bad_tid_conf; + } + + ret = parse_tid_conf(rdev, attrs, + &tid_config->tid_conf[conf_idx], + info, tid_config->peer); + if (ret) + goto bad_tid_conf; + + conf_idx++; + } + + ret = rdev_set_tid_config(rdev, dev, tid_config); + +bad_tid_conf: + kfree(tid_config); + return ret; +} + #define NL80211_FLAG_NEED_WIPHY 0x01 #define NL80211_FLAG_NEED_NETDEV 0x02 #define NL80211_FLAG_NEED_RTNL 0x04 @@ -14742,6 +14857,13 @@ static void nl80211_post_doit(const struct genl_ops *ops, struct sk_buff *skb, .internal_flags = NL80211_FLAG_NEED_NETDEV_UP | NL80211_FLAG_NEED_RTNL, }, + { + .cmd = NL80211_CMD_SET_TID_CONFIG, + .doit = nl80211_set_tid_config, + .flags = GENL_UNS_ADMIN_PERM, + .internal_flags = NL80211_FLAG_NEED_NETDEV | + NL80211_FLAG_NEED_RTNL, + }, }; static struct genl_family nl80211_fam __ro_after_init = { diff --git a/net/wireless/rdev-ops.h b/net/wireless/rdev-ops.h index e853a4f..887cda2 100644 --- a/net/wireless/rdev-ops.h +++ b/net/wireless/rdev-ops.h @@ -1299,4 +1299,16 @@ static inline int rdev_update_owe_info(struct cfg80211_registered_device *rdev, return ret; } +static inline int rdev_set_tid_config(struct cfg80211_registered_device *rdev, + struct net_device *dev, + struct ieee80211_tid_config *tid_conf) +{ + int ret; + + trace_rdev_set_tid_config(&rdev->wiphy, dev, tid_conf); + ret = rdev->ops->set_tid_config(&rdev->wiphy, dev, tid_conf); + trace_rdev_return_int(&rdev->wiphy, ret); + return ret; +} + #endif /* __CFG80211_RDEV_OPS */ diff --git a/net/wireless/trace.h b/net/wireless/trace.h index d98ad2b..522da8d 100644 --- a/net/wireless/trace.h +++ b/net/wireless/trace.h @@ -3458,6 +3458,23 @@ WIPHY_PR_ARG, NETDEV_PR_ARG, MAC_PR_ARG(dest)) ); +TRACE_EVENT(rdev_set_tid_config, + TP_PROTO(struct wiphy *wiphy, struct net_device *netdev, + struct ieee80211_tid_config *tid_conf), + TP_ARGS(wiphy, netdev, tid_conf), + TP_STRUCT__entry( + WIPHY_ENTRY + NETDEV_ENTRY + MAC_ENTRY(peer) + ), + TP_fast_assign( + WIPHY_ASSIGN; + NETDEV_ASSIGN; + MAC_ASSIGN(peer, tid_conf->peer); + ), + TP_printk(WIPHY_PR_FMT ", " NETDEV_PR_FMT ", peer: " MAC_PR_FMT, + WIPHY_PR_ARG, NETDEV_PR_ARG, MAC_PR_ARG(peer)) +); #endif /* !__RDEV_OPS_TRACE || TRACE_HEADER_MULTI_READ */ #undef TRACE_INCLUDE_PATH From patchwork Sat Nov 2 06:07:46 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tamizh chelvam X-Patchwork-Id: 11224037 X-Patchwork-Delegate: johannes@sipsolutions.net Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B6FC4913 for ; Sat, 2 Nov 2019 06:08:04 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9606A20862 for ; Sat, 2 Nov 2019 06:08:04 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="key not found in DNS" (0-bit key) header.d=codeaurora.org header.i=@codeaurora.org header.b="ZYPLK3Z3"; dkim=fail reason="key not found in DNS" (0-bit key) header.d=codeaurora.org header.i=@codeaurora.org header.b="LUvPJ8Iv" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726989AbfKBGIC (ORCPT ); Sat, 2 Nov 2019 02:08:02 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:37372 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725820AbfKBGIC (ORCPT ); Sat, 2 Nov 2019 02:08:02 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 3386B6126D; Sat, 2 Nov 2019 06:08:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1572674881; bh=OzDWEz0D3IWHlcA4gpZX3A3ihcCV+CLpFFPHBlkZ6BQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZYPLK3Z3ECVSWK607tQ+t1UKpqD3NvIqHP5xD8lIGxwL3/2+lujqLxcNbvrPV7GN/ ySQYK04DadCv4LNr6GeWyLGVBLXv96Spya1BLee9pZ8H6ANqkmIv1JIkz4AfBBd/qv F6Kg0/1BZzYGTOAgjTbVj3r581XBa9kfv56Dk2wE= X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on pdx-caf-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=ALL_TRUSTED,BAYES_00, DKIM_INVALID,DKIM_SIGNED,SPF_NONE autolearn=no autolearn_force=no version=3.4.0 Received: from akolli-ThinkPad-L560.qca.qualcomm.com (blr-c-bdr-fw-01_globalnat_allzones-outside.qualcomm.com [103.229.19.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: tamizhr@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 0C91261466; Sat, 2 Nov 2019 06:07:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1572674880; bh=OzDWEz0D3IWHlcA4gpZX3A3ihcCV+CLpFFPHBlkZ6BQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LUvPJ8IvL0YSKBNZqEYzwuHaJsMUJB6EVUMb8kW20hRAVsJHPE2S20CMTowjzeefB muQkeA3itGhsrJF7Jo4lja6U4A2O97qjo1UjsPouVKCdDrauc5GCy8NPf5fL5xHeeG o1969YiaXeSPtsZDShjrtxgZ4aEoWdYfrj23L7zs= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 0C91261466 Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=tamizhr@codeaurora.org From: Tamizh chelvam To: johannes@sipsolutions.net Cc: linux-wireless@vger.kernel.org, Tamizh chelvam Subject: [PATCHv7 2/6] nl80211: Add new netlink attribute for TID speicific retry count Date: Sat, 2 Nov 2019 11:37:46 +0530 Message-Id: <1572674870-23517-3-git-send-email-tamizhr@codeaurora.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1572674870-23517-1-git-send-email-tamizhr@codeaurora.org> References: <1572674870-23517-1-git-send-email-tamizhr@codeaurora.org> Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org This patch introduced below NL attributes to add support for configuring data TID specific retry count NL80211_TID_CONFIG_ATTR_RETRY NL80211_TID_CONFIG_ATTR_RETRY_SHORT NL80211_TID_CONFIG_ATTR_RETRY_LONG These attributes are added in NL80211_ATTR_TID_CONFIG nested attribute. This will be useful for the driver which supports data TID specific retry count configuration rather using phy level retry configuration. This TID specific retry configuration will have more precedence than phy level configuration. This configuration can be applied for a specific peer. To apply this configuration specific to a peer rather than being applied for all the connected stations, MAC address of the peer can be passed in NL80211_ATTR_MAC attribute. Driver should advertise WIPHY_FLAG_HAS_MAX_DATA_RETRY_COUNT and max_data_retry_count value to notify user space to avoid of passing greater than the allowed limit. Driver supporting TID specific retry configuration should advertise NL80211_EXT_FEATURE_PER_TID_RETRY_CONFIG and per STA specific data TID retry configuration should advertise NL80211_EXT_FEATURE_PER_STA_RETRY_CONFIG. Signed-off-by: Tamizh chelvam --- include/net/cfg80211.h | 9 ++++++++ include/uapi/linux/nl80211.h | 48 ++++++++++++++++++++++++++++++++++++++++++ net/wireless/nl80211.c | 45 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 102 insertions(+) diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h index 58e956d..dd40774 100644 --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h @@ -598,6 +598,7 @@ struct cfg80211_chan_def { enum ieee80211_tid_conf_mask { IEEE80211_TID_CONF_NOACK = BIT(0), + IEEE80211_TID_CONF_RETRY = BIT(1), }; /** @@ -606,11 +607,15 @@ enum ieee80211_tid_conf_mask { * @tid_conf_mask: bitmap indicating which parameter changed * see %enum ieee80211_tid_conf_mask * @noack: noack configuration value for the TID + * @retry_long: retry count value + * @retry_short: retry count value */ struct ieee80211_tid_cfg { u8 tid; u32 tid_conf_mask; u8 noack; + int retry_long; + int retry_short; }; /** @@ -4567,6 +4572,8 @@ struct cfg80211_pmsr_capabilities { * @support_mbssid must be set for this to have any effect. * * @pmsr_capa: peer measurement capabilities + * @max_data_retry_count: Maximum limit can be configured as retry count + * for a TID. */ struct wiphy { /* assign these fields before you register the wiphy */ @@ -4711,6 +4718,8 @@ struct wiphy { const struct cfg80211_pmsr_capabilities *pmsr_capa; + u8 max_data_retry_count; + char priv[0] __aligned(NETDEV_ALIGN); }; diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h index c0b43da..69b3229 100644 --- a/include/uapi/linux/nl80211.h +++ b/include/uapi/linux/nl80211.h @@ -2389,6 +2389,8 @@ enum nl80211_commands { * * @NL80211_ATTR_TID_CONFIG: TID specific configuration in a * nested attribute with %NL80211_TID_CONFIG_ATTR_* sub-attributes. + * @NL80211_ATTR_MAX_RETRY_COUNT: The upper limit for the retry count + * configuration that the driver can accept. * * @NUM_NL80211_ATTR: total number of nl80211_attrs available * @NL80211_ATTR_MAX: highest attribute number currently defined @@ -2853,6 +2855,7 @@ enum nl80211_attrs { NL80211_ATTR_WIPHY_EDMG_BW_CONFIG, NL80211_ATTR_TID_CONFIG, + NL80211_ATTR_MAX_RETRY_COUNT, /* add attributes here, update the policy in nl80211.c */ @@ -4722,11 +4725,50 @@ enum nl80211_tid_config { * advertise NL80211_EXT_FEATURE_PER_TID_NOACK_CONFIG and * NL80211_EXT_FEATURE_PER_STA_NOACK_CONFIG for supporting per sta * configuration. + * @NL80211_TID_CONFIG_ATTR_RETRY: Data TID retry count should be applied + * with the value passed through %NL80211_TID_CONFIG_ATTR_RETRY_LONG + * and/or %NL80211_TID_CONFIG_ATTR_RETRY_SHORT. This configuration + * is per-TID, and the TID is specified with %NL80211_TID_CONFIG_ATTR_TID. + * If the peer MAC address is passed in %NL80211_ATTR_MAC, the retry + * configuration is applied to the data frame for the tid to that + * connected station. + * This attribute will be useful to notfiy the driver to apply default + * retry values for the connected station (%NL80211_ATTR_MAC), when the + * command received without %NL80211_ATTR_RETRY_LONG and/or + * %NL80211_ATTR_RETRY_SHORT. + * Station specific retry configuration is valid only for STA's + * current connection. i.e. the configuration will be reset to default when + * the station connects back after disconnection/roaming. + * when user-space does not include %NL80211_ATTR_MAC, this configuration + * should be treated as per-netdev configuration. This configuration will + * be cleared when the interface goes down and on the disconnection from a + * BSS. When retry count has never been configured using this command, the + * other available radio level retry configuration + * (%NL80211_ATTR_WIPHY_RETRY_SHORT and %NL80211_ATTR_WIPHY_RETRY_LONG) + * should be used. Driver supporting this feature should advertise + * NL80211_EXT_FEATURE_PER_TID_RETRY_CONFIG and supporting per station + * retry count configuration should advertise + * NL80211_EXT_FEATURE_PER_STA_RETRY_CONFIG. + * @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 should be advertised by the driver through + * max_data_retry_count. when this attribute is not present, the driver + * would use the default configuration. + * @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 should be advertised by the driver through + * max_data_retry_count. when this attribute is not present, the driver + * would use the default configuration. */ enum nl80211_tid_config_attr { __NL80211_TID_CONFIG_ATTR_INVALID, NL80211_TID_CONFIG_ATTR_TID, NL80211_TID_CONFIG_ATTR_NOACK, + NL80211_TID_CONFIG_ATTR_RETRY, + NL80211_TID_CONFIG_ATTR_RETRY_SHORT, + NL80211_TID_CONFIG_ATTR_RETRY_LONG, /* keep last */ __NL80211_TID_CONFIG_ATTR_AFTER_LAST, @@ -5548,6 +5590,10 @@ enum nl80211_feature_flags { * policy functionality. * @NL80211_EXT_FEATURE_PER_STA_NOACK_CONFIG: Driver supports STA specific NoAck * policy functionality. + * @NL80211_EXT_FEATURE_PER_TID_RETRY_CONFIG: Driver supports per TID data retry + * count functionality. + * @NL80211_EXT_FEATURE_PER_STA_RETRY_CONFIG: Driver supports STA specific + * data retry count functionality. * * @NUM_NL80211_EXT_FEATURES: number of extended features. * @MAX_NL80211_EXT_FEATURES: highest extended feature index. @@ -5596,6 +5642,8 @@ enum nl80211_ext_feature_index { NL80211_EXT_FEATURE_SAE_OFFLOAD, NL80211_EXT_FEATURE_PER_TID_NOACK_CONFIG, NL80211_EXT_FEATURE_PER_STA_NOACK_CONFIG, + NL80211_EXT_FEATURE_PER_TID_RETRY_CONFIG, + NL80211_EXT_FEATURE_PER_STA_RETRY_CONFIG, /* add new features before the definition below */ NUM_NL80211_EXT_FEATURES, diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index c5c3af5..7facc93 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c @@ -326,6 +326,9 @@ static int validate_ie_attr(const struct nlattr *attr, [NL80211_TID_CONFIG_ATTR_TID] = { .type = NLA_U8 }, [NL80211_TID_CONFIG_ATTR_NOACK] = NLA_POLICY_MAX(NLA_U8, NL80211_TID_CONFIG_DISABLE), + [NL80211_TID_CONFIG_ATTR_RETRY] = { .type = NLA_FLAG }, + [NL80211_TID_CONFIG_ATTR_RETRY_SHORT] = { .type = NLA_U8}, + [NL80211_TID_CONFIG_ATTR_RETRY_LONG] = { .type = NLA_U8}, }; const struct nla_policy nl80211_policy[NUM_NL80211_ATTR] = { @@ -2028,6 +2031,12 @@ static int nl80211_send_wiphy(struct cfg80211_registered_device *rdev, } } + if (rdev->wiphy.max_data_retry_count) { + if (nla_put_u8(msg, NL80211_ATTR_MAX_RETRY_COUNT, + rdev->wiphy.max_data_retry_count)) + goto nla_put_failure; + } + state->split_start++; if (state->split) break; @@ -13839,6 +13848,42 @@ static int parse_tid_conf(struct cfg80211_registered_device *rdev, nla_get_u8(attrs[NL80211_TID_CONFIG_ATTR_NOACK]); } + if (nla_get_flag(attrs[NL80211_TID_CONFIG_ATTR_RETRY])) { + err = nl80211_check_tid_config_support(rdev, extack, peer, + attrs[NL80211_TID_CONFIG_ATTR_RETRY], + NL80211_EXT_FEATURE_PER_TID_RETRY_CONFIG, + NL80211_EXT_FEATURE_PER_STA_RETRY_CONFIG); + if (err) + return err; + + tid_conf->tid_conf_mask |= IEEE80211_TID_CONF_RETRY; + if (attrs[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; + } else { + /* Use driver default retry count or VIF specific + * retry count + */ + tid_conf->retry_short = -1; + } + + if (attrs[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; + } else { + /* Use driver default retry count or VIF specific + * retry count + */ + tid_conf->retry_long = -1; + } + } + return 0; } From patchwork Sat Nov 2 06:07:47 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tamizh chelvam X-Patchwork-Id: 11224039 X-Patchwork-Delegate: johannes@sipsolutions.net Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id CB4F9913 for ; Sat, 2 Nov 2019 06:08:05 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9E942218AC for ; Sat, 2 Nov 2019 06:08:05 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="key not found in DNS" (0-bit key) header.d=codeaurora.org header.i=@codeaurora.org header.b="EQaZfs4b"; dkim=fail reason="key not found in DNS" (0-bit key) header.d=codeaurora.org header.i=@codeaurora.org header.b="f/2xHUW+" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727052AbfKBGIE (ORCPT ); Sat, 2 Nov 2019 02:08:04 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:37422 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725820AbfKBGIE (ORCPT ); Sat, 2 Nov 2019 02:08:04 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 4C95861466; Sat, 2 Nov 2019 06:08:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1572674883; bh=jlIRQ9hir4B18PN3RBDhSnqAzxvoeZdOPhx7RmYjjMI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EQaZfs4bnz5Kf9DUuScWhvYNoHwcRiZv7bHSdRD2PbsxeDxnjJlvHXzhkLNh7vrEE TV0/YEzgLZu9ac+03xUI1RCSWmtKDvmJEwy+FQoUh9j5WB0gzMMQkwCAgxvYgA3qys ZojRZwgctDGbO96WxznUKAFHG/DEPSnRp8+vyNRM= X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on pdx-caf-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=ALL_TRUSTED,BAYES_00, DKIM_INVALID,DKIM_SIGNED,SPF_NONE autolearn=no autolearn_force=no version=3.4.0 Received: from akolli-ThinkPad-L560.qca.qualcomm.com (blr-c-bdr-fw-01_globalnat_allzones-outside.qualcomm.com [103.229.19.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: tamizhr@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 13B2161459; Sat, 2 Nov 2019 06:08:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1572674882; bh=jlIRQ9hir4B18PN3RBDhSnqAzxvoeZdOPhx7RmYjjMI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=f/2xHUW+NIDekfcu8T1h3t32Nu4k5CEeyno9o5jWDpioCkOS8EHHXn7gy3VjK0QcP 2thGuquZko+5NrXzlO6TNO858CflMX/xYKM8LLHTL5oeMljBx8XfvtjhLSwez9dA6Z 6/Ik9GEFRBvO1OmvOs33q6hEbe6V+/8rJvWI4wik= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 13B2161459 Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=tamizhr@codeaurora.org From: Tamizh chelvam To: johannes@sipsolutions.net Cc: linux-wireless@vger.kernel.org, Tamizh chelvam Subject: [PATCHv7 3/6] nl80211: Add netlink attribute for AMPDU aggregation enable/disable Date: Sat, 2 Nov 2019 11:37:47 +0530 Message-Id: <1572674870-23517-4-git-send-email-tamizhr@codeaurora.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1572674870-23517-1-git-send-email-tamizhr@codeaurora.org> References: <1572674870-23517-1-git-send-email-tamizhr@codeaurora.org> Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Introduce NL80211_TID_CONFIG_ATTR_AMPDU_CTRL in nl80211_attr_tid_config to accept TID specific AMPDU aggregation enable/disable configuration through NL80211_CMD_SET_TID_CONFIG command. TID for which the aggregation control configuration is to be applied is passed in NL80211_TID_CONFIG_ATTR_TID attribute. When the user-space wants this configuration peer specific rather than being applied for all the connected stations, MAC address of the peer can be passed in NL80211_ATTR_MAC attribute. Driver supporting this feature should advertise NL80211_EXT_FEATURE_PER_TID_AMPDU_CTRL and supporting per-STA data TID ampdu configuration should advertise NL80211_EXT_FEATURE_PER_STA_AMPDU_CTRL. Signed-off-by: Tamizh chelvam --- include/net/cfg80211.h | 3 +++ include/uapi/linux/nl80211.h | 22 ++++++++++++++++++++++ net/wireless/nl80211.c | 14 ++++++++++++++ 3 files changed, 39 insertions(+) diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h index dd40774..baed260 100644 --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h @@ -599,6 +599,7 @@ struct cfg80211_chan_def { enum ieee80211_tid_conf_mask { IEEE80211_TID_CONF_NOACK = BIT(0), IEEE80211_TID_CONF_RETRY = BIT(1), + IEEE80211_TID_CONF_AMPDU = BIT(2), }; /** @@ -609,6 +610,7 @@ enum ieee80211_tid_conf_mask { * @noack: noack configuration value for the TID * @retry_long: retry count value * @retry_short: retry count value + * @ampdu: Enable/Disable aggregation */ struct ieee80211_tid_cfg { u8 tid; @@ -616,6 +618,7 @@ struct ieee80211_tid_cfg { u8 noack; int retry_long; int retry_short; + u8 ampdu; }; /** diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h index 69b3229..32ca476 100644 --- a/include/uapi/linux/nl80211.h +++ b/include/uapi/linux/nl80211.h @@ -4761,6 +4761,21 @@ enum nl80211_tid_config { * the max value should be advertised by the driver through * max_data_retry_count. when this attribute is not present, the driver * would use the default configuration. + * @NL80211_TID_CONFIG_ATTR_AMPDU_CTRL: Enable/Disable aggregation for the TID + * specified in %%NL80211_TID_CONFIG_ATTR_TID. Its type is u8, + * if the peer MAC address is passed in %NL80211_ATTR_MAC, the aggregation + * configuration is applied + * to the data frame for the tid to that connected station. + * Station specific aggregation configuration is valid only for STA's + * current connection. i.e. the configuration will be reset to default when + * the station connects back after disconnection/roaming. + * when user-space does not include %NL80211_ATTR_MAC, this configuration + * should be treated as per-netdev configuration. This configuration will + * be cleared when the interface goes down and on the disconnection from a + * BSS. Driver supporting this feature should advertise + * NL80211_EXT_FEATURE_PER_TID_AMPDU_CTRL and supporting per station + * aggregation configuration should advertise + * NL80211_EXT_FEATURE_PER_STA_AMPDU_CTRL. */ enum nl80211_tid_config_attr { __NL80211_TID_CONFIG_ATTR_INVALID, @@ -4769,6 +4784,7 @@ enum nl80211_tid_config_attr { NL80211_TID_CONFIG_ATTR_RETRY, NL80211_TID_CONFIG_ATTR_RETRY_SHORT, NL80211_TID_CONFIG_ATTR_RETRY_LONG, + NL80211_TID_CONFIG_ATTR_AMPDU_CTRL, /* keep last */ __NL80211_TID_CONFIG_ATTR_AFTER_LAST, @@ -5594,6 +5610,10 @@ enum nl80211_feature_flags { * count functionality. * @NL80211_EXT_FEATURE_PER_STA_RETRY_CONFIG: Driver supports STA specific * data retry count functionality. + * @NL80211_EXT_FEATURE_PER_TID_AMPDU_CTRL: Driver supports TID specific + * aggregation control(enable/disable). + * @NL80211_EXT_FEATURE_PER_STA_AMPDU_CTRL: Driver supports per STA + * specific TID aggregation control(enable/disable). * * @NUM_NL80211_EXT_FEATURES: number of extended features. * @MAX_NL80211_EXT_FEATURES: highest extended feature index. @@ -5644,6 +5664,8 @@ enum nl80211_ext_feature_index { NL80211_EXT_FEATURE_PER_STA_NOACK_CONFIG, NL80211_EXT_FEATURE_PER_TID_RETRY_CONFIG, NL80211_EXT_FEATURE_PER_STA_RETRY_CONFIG, + NL80211_EXT_FEATURE_PER_TID_AMPDU_CTRL, + NL80211_EXT_FEATURE_PER_STA_AMPDU_CTRL, /* add new features before the definition below */ NUM_NL80211_EXT_FEATURES, diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index 7facc93..5ac8862 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c @@ -329,6 +329,8 @@ static int validate_ie_attr(const struct nlattr *attr, [NL80211_TID_CONFIG_ATTR_RETRY] = { .type = NLA_FLAG }, [NL80211_TID_CONFIG_ATTR_RETRY_SHORT] = { .type = NLA_U8}, [NL80211_TID_CONFIG_ATTR_RETRY_LONG] = { .type = NLA_U8}, + [NL80211_TID_CONFIG_ATTR_AMPDU_CTRL] = + NLA_POLICY_MAX(NLA_U8, NL80211_TID_CONFIG_DISABLE), }; const struct nla_policy nl80211_policy[NUM_NL80211_ATTR] = { @@ -13884,6 +13886,18 @@ static int parse_tid_conf(struct cfg80211_registered_device *rdev, } } + if (attrs[NL80211_TID_CONFIG_ATTR_AMPDU_CTRL]) { + err = nl80211_check_tid_config_support(rdev, extack, peer, + attrs[NL80211_TID_CONFIG_ATTR_AMPDU_CTRL], + NL80211_EXT_FEATURE_PER_TID_AMPDU_CTRL, + NL80211_EXT_FEATURE_PER_STA_AMPDU_CTRL); + if (err) + return err; + + tid_conf->tid_conf_mask |= IEEE80211_TID_CONF_AMPDU; + tid_conf->ampdu = + nla_get_u8(attrs[NL80211_TID_CONFIG_ATTR_AMPDU_CTRL]); + } return 0; } From patchwork Sat Nov 2 06:07:48 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tamizh chelvam X-Patchwork-Id: 11224041 X-Patchwork-Delegate: johannes@sipsolutions.net Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id DC3AB15AB for ; Sat, 2 Nov 2019 06:08:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B11F020862 for ; Sat, 2 Nov 2019 06:08:07 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="key not found in DNS" (0-bit key) header.d=codeaurora.org header.i=@codeaurora.org header.b="WOUa5ls2"; dkim=fail reason="key not found in DNS" (0-bit key) header.d=codeaurora.org header.i=@codeaurora.org header.b="YJcxc1Xg" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727121AbfKBGIH (ORCPT ); Sat, 2 Nov 2019 02:08:07 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:37490 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725820AbfKBGIG (ORCPT ); Sat, 2 Nov 2019 02:08:06 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 7A41161549; Sat, 2 Nov 2019 06:08:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1572674885; bh=K89Xyn91bB7ybsklN+PqW4i7qZ8u2rcPRiQCw1m3hsk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WOUa5ls2quLylGGD4fo5v0fbnHVmf4rTM6+ISL9gTz8Jrw/DBRuGExZtw97d1TzOQ FsW8ZJrmPAhun3qdFqTOLs2tR8A0Q/7LKYFW4eTWLuxpunOJlXKSuh8JZxMU/6ZiXT d+Ty7Vcqxo721hayU7pUBmzjE4hI5/ly4ShWlqjo= X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on pdx-caf-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=ALL_TRUSTED,BAYES_00, DKIM_INVALID,DKIM_SIGNED,SPF_NONE autolearn=no autolearn_force=no version=3.4.0 Received: from akolli-ThinkPad-L560.qca.qualcomm.com (blr-c-bdr-fw-01_globalnat_allzones-outside.qualcomm.com [103.229.19.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: tamizhr@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 20274614E7; Sat, 2 Nov 2019 06:08:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1572674884; bh=K89Xyn91bB7ybsklN+PqW4i7qZ8u2rcPRiQCw1m3hsk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YJcxc1Xg+mCsFJ2u6E5tuTkxsp1fzafiozzs29UlWAZBzTV35CRn1KgTLd6zpv1iu VC8z6h9JFncTNAnurrLDDUmKRDrSuMzEEBoGZGcp45NCFustIxCHKBg9TzWQoqvOO3 fJyRTJ+osUOpAt2/1KH6yxQkoQPzkKzJ31fOVsFA= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 20274614E7 Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=tamizhr@codeaurora.org From: Tamizh chelvam To: johannes@sipsolutions.net Cc: linux-wireless@vger.kernel.org, Tamizh chelvam Subject: [PATCHv7 4/6] nl80211: Add netlink attribute to enable/disable RTS_CTS Date: Sat, 2 Nov 2019 11:37:48 +0530 Message-Id: <1572674870-23517-5-git-send-email-tamizhr@codeaurora.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1572674870-23517-1-git-send-email-tamizhr@codeaurora.org> References: <1572674870-23517-1-git-send-email-tamizhr@codeaurora.org> Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Introduce NL80211_TID_CONFIG_ATTR_RTSCTS_CTRL in nl80211_attr_tid_config to accept TID specific RTS_CTS enable/disable configuration through NL80211_CMD_SET_TID_CONFIG command. TID for which the RTS_CTS control configuration is to be applied is passed in NL80211_TID_CONFIG_ATTR_TID attribute. When the user-space wants this configuration peer specific rather than being applied for all the connected stations, MAC address of the peer can be passed in NL80211_ATTR_MAC attribute. Driver supporting this feature should advertise NL80211_EXT_FEATURE_PER_TID_RTSCTS_CTRL and supporting per-STA data TID RTS_CTS configuration should advertise NL80211_EXT_FEATURE_PER_STA_RTSCTS_CTRL. Signed-off-by: Tamizh chelvam --- include/net/cfg80211.h | 3 +++ include/uapi/linux/nl80211.h | 22 ++++++++++++++++++++++ net/wireless/nl80211.c | 16 ++++++++++++++++ 3 files changed, 41 insertions(+) diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h index baed260..deeb1c1 100644 --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h @@ -600,6 +600,7 @@ enum ieee80211_tid_conf_mask { IEEE80211_TID_CONF_NOACK = BIT(0), IEEE80211_TID_CONF_RETRY = BIT(1), IEEE80211_TID_CONF_AMPDU = BIT(2), + IEEE80211_TID_CONF_RTSCTS = BIT(3), }; /** @@ -611,6 +612,7 @@ enum ieee80211_tid_conf_mask { * @retry_long: retry count value * @retry_short: retry count value * @ampdu: Enable/Disable aggregation + * @rtscts: Enable/Disable RTS/CTS */ struct ieee80211_tid_cfg { u8 tid; @@ -619,6 +621,7 @@ struct ieee80211_tid_cfg { int retry_long; int retry_short; u8 ampdu; + u8 rtscts; }; /** diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h index 32ca476..f75f243 100644 --- a/include/uapi/linux/nl80211.h +++ b/include/uapi/linux/nl80211.h @@ -4776,6 +4776,21 @@ enum nl80211_tid_config { * NL80211_EXT_FEATURE_PER_TID_AMPDU_CTRL and supporting per station * aggregation configuration should advertise * NL80211_EXT_FEATURE_PER_STA_AMPDU_CTRL. + * @NL80211_TID_CONFIG_ATTR_RTSCTS_CTRL: Enable/Disable RTS_CTS for the TID + * specified in %%NL80211_TID_CONFIG_ATTR_TID. It is u8 type, if the + * peer MAC address is passed in %NL80211_ATTR_MAC, then this + * configuration is applied to the data frame for the tid to that + * connected station. + * Station specific RTS_CTS configuration is valid only for STA's + * current connection. i.e. the configuration will be reset to default when + * the station connects back after disconnection/roaming. + * when user-space does not include %NL80211_ATTR_MAC, this configuration + * should be treated as per-netdev configuration. This configuration will + * be cleared when the interface goes down and on the disconnection from a + * BSS. Driver supporting this feature should advertise + * NL80211_EXT_FEATURE_PER_TID_RTSCTS_CTRL and supporting per station + * RTS_CTS configuration should advertise + * NL80211_EXT_FEATURE_PER_STA_RTSCTS_CTRL. */ enum nl80211_tid_config_attr { __NL80211_TID_CONFIG_ATTR_INVALID, @@ -4785,6 +4800,7 @@ enum nl80211_tid_config_attr { NL80211_TID_CONFIG_ATTR_RETRY_SHORT, NL80211_TID_CONFIG_ATTR_RETRY_LONG, NL80211_TID_CONFIG_ATTR_AMPDU_CTRL, + NL80211_TID_CONFIG_ATTR_RTSCTS_CTRL, /* keep last */ __NL80211_TID_CONFIG_ATTR_AFTER_LAST, @@ -5614,6 +5630,10 @@ enum nl80211_feature_flags { * aggregation control(enable/disable). * @NL80211_EXT_FEATURE_PER_STA_AMPDU_CTRL: Driver supports per STA * specific TID aggregation control(enable/disable). + * @NL80211_EXT_FEATURE_PER_TID_RTSCTS_CTRL: Driver supports TID specific + * RTS_CTS control(enable/disable). + * @NL80211_EXT_FEATURE_PER_STA_RTSCTS_CTRL: Driver supports STA specific + * RTS_CTS control(enable/disable). * * @NUM_NL80211_EXT_FEATURES: number of extended features. * @MAX_NL80211_EXT_FEATURES: highest extended feature index. @@ -5666,6 +5686,8 @@ enum nl80211_ext_feature_index { NL80211_EXT_FEATURE_PER_STA_RETRY_CONFIG, NL80211_EXT_FEATURE_PER_TID_AMPDU_CTRL, NL80211_EXT_FEATURE_PER_STA_AMPDU_CTRL, + NL80211_EXT_FEATURE_PER_TID_RTSCTS_CTRL, + NL80211_EXT_FEATURE_PER_STA_RTSCTS_CTRL, /* add new features before the definition below */ NUM_NL80211_EXT_FEATURES, diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index 5ac8862..abce915 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c @@ -331,6 +331,8 @@ static int validate_ie_attr(const struct nlattr *attr, [NL80211_TID_CONFIG_ATTR_RETRY_LONG] = { .type = NLA_U8}, [NL80211_TID_CONFIG_ATTR_AMPDU_CTRL] = NLA_POLICY_MAX(NLA_U8, NL80211_TID_CONFIG_DISABLE), + [NL80211_TID_CONFIG_ATTR_RTSCTS_CTRL] = + NLA_POLICY_MAX(NLA_U8, NL80211_TID_CONFIG_DISABLE), }; const struct nla_policy nl80211_policy[NUM_NL80211_ATTR] = { @@ -13898,6 +13900,20 @@ static int parse_tid_conf(struct cfg80211_registered_device *rdev, tid_conf->ampdu = nla_get_u8(attrs[NL80211_TID_CONFIG_ATTR_AMPDU_CTRL]); } + + if (attrs[NL80211_TID_CONFIG_ATTR_RTSCTS_CTRL]) { + err = nl80211_check_tid_config_support(rdev, extack, peer, + attrs[NL80211_TID_CONFIG_ATTR_RTSCTS_CTRL], + NL80211_EXT_FEATURE_PER_TID_RTSCTS_CTRL, + NL80211_EXT_FEATURE_PER_STA_RTSCTS_CTRL); + if (err) + return err; + + tid_conf->tid_conf_mask |= IEEE80211_TID_CONF_RTSCTS; + tid_conf->rtscts = + nla_get_u8(attrs[NL80211_TID_CONFIG_ATTR_RTSCTS_CTRL]); + } + return 0; } From patchwork Sat Nov 2 06:07:49 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tamizh chelvam X-Patchwork-Id: 11224043 X-Patchwork-Delegate: johannes@sipsolutions.net Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0760B15AB for ; Sat, 2 Nov 2019 06:08:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id BD38620862 for ; Sat, 2 Nov 2019 06:08:09 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="key not found in DNS" (0-bit key) header.d=codeaurora.org header.i=@codeaurora.org header.b="VX/ddcGR"; dkim=fail reason="key not found in DNS" (0-bit key) header.d=codeaurora.org header.i=@codeaurora.org header.b="XoWp/KXi" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727269AbfKBGIJ (ORCPT ); Sat, 2 Nov 2019 02:08:09 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:37548 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725820AbfKBGII (ORCPT ); Sat, 2 Nov 2019 02:08:08 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 47802615B5; Sat, 2 Nov 2019 06:08:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1572674887; bh=HyE66F+gwzce2D7r7TYBgc/MJ62ZBGuIU/fpUWrg3qU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VX/ddcGRQyUmKhRFMrDArQXgat1dkwk+9QEdZ2shWJ9EXB5tes7YBQ89nKkMn7yCQ esuRCcR3XZZbYFhOrQvP6y3fZ7iCrnBpH1+rblyjyGyyZ+87GgLMghrB0x+FOVTBc3 83S4UzbuHGITjBgpoXaln4rSa1Fg24Rs5vE90Fnw= X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on pdx-caf-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=ALL_TRUSTED,BAYES_00, DKIM_INVALID,DKIM_SIGNED,SPF_NONE autolearn=no autolearn_force=no version=3.4.0 Received: from akolli-ThinkPad-L560.qca.qualcomm.com (blr-c-bdr-fw-01_globalnat_allzones-outside.qualcomm.com [103.229.19.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: tamizhr@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 2CAB861475; Sat, 2 Nov 2019 06:08:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1572674886; bh=HyE66F+gwzce2D7r7TYBgc/MJ62ZBGuIU/fpUWrg3qU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XoWp/KXiL6GFNeeZozh2J1dWY2QSI+sp3XoAhsUICw8LKAoZBkCEO1+LYsInhQiL7 mP7PSAKfWMq8/xugUYGK3/yj4h/pNR9nequyElFU7aWQ+WMNQoU7B8T2PeqJq4Q1pP RPnZCbvgRLt/j41NWFjvb6JzmPw/avUfITihSN+8= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 2CAB861475 Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=tamizhr@codeaurora.org From: Tamizh chelvam To: johannes@sipsolutions.net Cc: linux-wireless@vger.kernel.org, Tamizh chelvam Subject: [PATCHv7 5/6] nl80211: Add netlink attribute to configure TID specific tx rate Date: Sat, 2 Nov 2019 11:37:49 +0530 Message-Id: <1572674870-23517-6-git-send-email-tamizhr@codeaurora.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1572674870-23517-1-git-send-email-tamizhr@codeaurora.org> References: <1572674870-23517-1-git-send-email-tamizhr@codeaurora.org> Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Introduce NL80211_TID_CONFIG_ATTR_TX_RATES in nl80211_tid_attr_config to accept data TID specific TX bitrate configuration through NL80211_CMD_SET_TID_CONFIG command. TID for which the this configuration is to be applied is passed in NL80211_TID_CONFIG_ATTR_TID 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. When the user-space wants this configuration peer specific rather than being applied for all the connected stations, MAC address of the peer can be passed in NL80211_ATTR_MAC attribute. Driver supporting this feature should advertise NL80211_EXT_FEATURE_PER_TID_TX_BITRATE_MASK and supporting per-STA data TID TX bitrate configuration should advertise NL80211_EXT_FEATURE_PER_STA_TX_BITRATE_MASK. Signed-off-by: Tamizh chelvam --- include/net/cfg80211.h | 5 +++ include/uapi/linux/nl80211.h | 39 +++++++++++++++++++++ net/wireless/nl80211.c | 79 +++++++++++++++++++++++++++++++++--------- 3 files changed, 106 insertions(+), 17 deletions(-) diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h index deeb1c1..69f4769 100644 --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h @@ -601,6 +601,7 @@ enum ieee80211_tid_conf_mask { IEEE80211_TID_CONF_RETRY = BIT(1), IEEE80211_TID_CONF_AMPDU = BIT(2), IEEE80211_TID_CONF_RTSCTS = BIT(3), + IEEE80211_TID_CONF_TX_BITRATE = BIT(4), }; /** @@ -613,6 +614,8 @@ enum ieee80211_tid_conf_mask { * @retry_short: retry count value * @ampdu: Enable/Disable aggregation * @rtscts: Enable/Disable RTS/CTS + * @txrate_type: TX bitrate mask type + * @mask: bitrate to be applied for the TID */ struct ieee80211_tid_cfg { u8 tid; @@ -622,6 +625,8 @@ struct ieee80211_tid_cfg { int retry_short; u8 ampdu; u8 rtscts; + enum nl80211_tx_rate_setting txrate_type; + struct cfg80211_bitrate_mask *mask; }; /** diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h index f75f243..034d8ff 100644 --- a/include/uapi/linux/nl80211.h +++ b/include/uapi/linux/nl80211.h @@ -4696,6 +4696,18 @@ enum nl80211_tx_power_setting { }; /** + * enum nl80211_tx_rate_setting - TX rate configuration type + * @NL80211_TX_RATE_AUTOMATIC: automatically determine TX rate + * @NL80211_TX_RATE_LIMITED: limit the TX rate by the TX rate parameter + * @NL80211_TX_RATE_FIXED: fix TX rate to the TX rate parameter + */ +enum nl80211_tx_rate_setting { + NL80211_TX_RATE_AUTOMATIC, + NL80211_TX_RATE_LIMITED, + NL80211_TX_RATE_FIXED, +}; + +/** * enum nl80211_tid_config - TID config state * @NL80211_TID_CONFIG_DEFAULT: Default config for the TID. This is to * notify driver to reset the previous config and use vif specific @@ -4791,6 +4803,25 @@ enum nl80211_tid_config { * NL80211_EXT_FEATURE_PER_TID_RTSCTS_CTRL and supporting per station * RTS_CTS configuration should advertise * NL80211_EXT_FEATURE_PER_STA_RTSCTS_CTRL. + * @NL80211_TID_CONFIG_ATTR_TX_RATES: Data frame TX rate mask should be applied + * with the parameters passed through %NL80211_ATTR_TX_RATES. This + * configuration is per TID, TID is specified with + * %NL80211_TID_CONFIG_ATTR_TID. + * If the peer MAC address is passed in %NL80211_ATTR_MAC, then this + * configuration is applied to the data frame for the tid to that connected + * station. This attribute will be useful to notfiy the driver that what + * type of txrate should be applied(%enum enum nl80211_tx_rate_setting) + * for the connected station (%NL80211_ATTR_MAC), + * Station specific retry configuration is valid only for STA's + * current connection. i.e. the configuration will be reset to default when + * the station connects back after disconnection/roaming. + * when user-space does not include %NL80211_ATTR_MAC, this configuration + * should be treated as per-netdev configuration. This configuration will + * be cleared when the interface goes down and on the disconnection from a + * BSS. Driver supporting this feature should advertise + * NL80211_EXT_FEATURE_PER_TID_TX_BITRATE_MASK and supporting per station + * TX bitrate configuration should advertise + * NL80211_EXT_FEATURE_PER_STA_TX_BITRATE_MASK. */ enum nl80211_tid_config_attr { __NL80211_TID_CONFIG_ATTR_INVALID, @@ -4801,6 +4832,8 @@ enum nl80211_tid_config_attr { NL80211_TID_CONFIG_ATTR_RETRY_LONG, NL80211_TID_CONFIG_ATTR_AMPDU_CTRL, NL80211_TID_CONFIG_ATTR_RTSCTS_CTRL, + NL80211_TID_CONFIG_ATTR_TX_RATES_TYPE, + NL80211_TID_CONFIG_ATTR_TX_RATES, /* keep last */ __NL80211_TID_CONFIG_ATTR_AFTER_LAST, @@ -5634,6 +5667,10 @@ enum nl80211_feature_flags { * RTS_CTS control(enable/disable). * @NL80211_EXT_FEATURE_PER_STA_RTSCTS_CTRL: Driver supports STA specific * RTS_CTS control(enable/disable). + * @NL80211_EXT_FEATURE_PER_TID_TX_BITRATE_MASK: Driver supports TID specific + * TX bitrate configuration. + * @NL80211_EXT_FEATURE_PER_STA_TX_BITRATE_MASK: Driver supports STA specific + * TX bitrate configuration. * * @NUM_NL80211_EXT_FEATURES: number of extended features. * @MAX_NL80211_EXT_FEATURES: highest extended feature index. @@ -5688,6 +5725,8 @@ enum nl80211_ext_feature_index { NL80211_EXT_FEATURE_PER_STA_AMPDU_CTRL, NL80211_EXT_FEATURE_PER_TID_RTSCTS_CTRL, NL80211_EXT_FEATURE_PER_STA_RTSCTS_CTRL, + NL80211_EXT_FEATURE_PER_TID_TX_BITRATE_MASK, + NL80211_EXT_FEATURE_PER_STA_TX_BITRATE_MASK, /* add new features before the definition below */ NUM_NL80211_EXT_FEATURES, diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index abce915..cb1f231 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c @@ -321,6 +321,18 @@ static int validate_ie_attr(const struct nlattr *attr, NLA_POLICY_RANGE(NLA_U8, 1, 20), }; +static const struct nla_policy nl80211_txattr_policy[NL80211_TXRATE_MAX + 1] = { + [NL80211_TXRATE_LEGACY] = { .type = NLA_BINARY, + .len = NL80211_MAX_SUPP_RATES }, + [NL80211_TXRATE_HT] = { .type = NLA_BINARY, + .len = NL80211_MAX_SUPP_HT_RATES }, + [NL80211_TXRATE_VHT] = { + .type = NLA_EXACT_LEN_WARN, + .len = sizeof(struct nl80211_txrate_vht), + }, + [NL80211_TXRATE_GI] = { .type = NLA_U8 }, +}; + static const struct nla_policy nl80211_tid_config_attr_policy[NL80211_TID_CONFIG_ATTR_MAX + 1] = { [NL80211_TID_CONFIG_ATTR_TID] = { .type = NLA_U8 }, @@ -333,6 +345,10 @@ static int validate_ie_attr(const struct nlattr *attr, NLA_POLICY_MAX(NLA_U8, NL80211_TID_CONFIG_DISABLE), [NL80211_TID_CONFIG_ATTR_RTSCTS_CTRL] = NLA_POLICY_MAX(NLA_U8, NL80211_TID_CONFIG_DISABLE), + [NL80211_TID_CONFIG_ATTR_TX_RATES_TYPE] = + NLA_POLICY_MAX(NLA_U8, NL80211_TX_RATE_FIXED), + [NL80211_TID_CONFIG_ATTR_TX_RATES] = + NLA_POLICY_NESTED(nl80211_txattr_policy), }; const struct nla_policy nl80211_policy[NUM_NL80211_ATTR] = { @@ -4240,19 +4256,9 @@ static bool vht_set_mcs_mask(struct ieee80211_supported_band *sband, return true; } -static const struct nla_policy nl80211_txattr_policy[NL80211_TXRATE_MAX + 1] = { - [NL80211_TXRATE_LEGACY] = { .type = NLA_BINARY, - .len = NL80211_MAX_SUPP_RATES }, - [NL80211_TXRATE_HT] = { .type = NLA_BINARY, - .len = NL80211_MAX_SUPP_HT_RATES }, - [NL80211_TXRATE_VHT] = { - .type = NLA_EXACT_LEN_WARN, - .len = sizeof(struct nl80211_txrate_vht), - }, - [NL80211_TXRATE_GI] = { .type = NLA_U8 }, -}; - static int nl80211_parse_tx_bitrate_mask(struct genl_info *info, + struct nlattr *attrs[], + enum nl80211_attrs attr, struct cfg80211_bitrate_mask *mask) { struct nlattr *tb[NL80211_TXRATE_MAX + 1]; @@ -4283,14 +4289,14 @@ static int nl80211_parse_tx_bitrate_mask(struct genl_info *info, } /* if no rates are given set it back to the defaults */ - if (!info->attrs[NL80211_ATTR_TX_RATES]) + if (!attrs[attr]) goto out; /* The nested attribute uses enum nl80211_band as the index. This maps * directly to the enum nl80211_band values used in cfg80211. */ BUILD_BUG_ON(NL80211_MAX_SUPP_HT_RATES > IEEE80211_HT_MCS_MASK_LEN * 8); - nla_for_each_nested(tx_rates, info->attrs[NL80211_ATTR_TX_RATES], rem) { + nla_for_each_nested(tx_rates, attrs[attr], rem) { enum nl80211_band band = nla_type(tx_rates); int err; @@ -4766,7 +4772,9 @@ static int nl80211_start_ap(struct sk_buff *skb, struct genl_info *info) return -EINVAL; if (info->attrs[NL80211_ATTR_TX_RATES]) { - err = nl80211_parse_tx_bitrate_mask(info, ¶ms.beacon_rate); + err = nl80211_parse_tx_bitrate_mask(info, info->attrs, + NL80211_ATTR_TX_RATES, + ¶ms.beacon_rate); if (err) return err; @@ -10510,7 +10518,8 @@ static int nl80211_set_tx_bitrate_mask(struct sk_buff *skb, if (!rdev->ops->set_bitrate_mask) return -EOPNOTSUPP; - err = nl80211_parse_tx_bitrate_mask(info, &mask); + err = nl80211_parse_tx_bitrate_mask(info, info->attrs, + NL80211_ATTR_TX_RATES, &mask); if (err) return err; @@ -11105,7 +11114,9 @@ static int nl80211_join_mesh(struct sk_buff *skb, struct genl_info *info) } if (info->attrs[NL80211_ATTR_TX_RATES]) { - err = nl80211_parse_tx_bitrate_mask(info, &setup.beacon_rate); + err = nl80211_parse_tx_bitrate_mask(info, info->attrs, + NL80211_ATTR_TX_RATES, + &setup.beacon_rate); if (err) return err; @@ -13914,6 +13925,40 @@ 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_RATES_TYPE]) { + int idx; + enum nl80211_attrs attr; + + err = nl80211_check_tid_config_support(rdev, extack, peer, + attrs[NL80211_TID_CONFIG_ATTR_TX_RATES_TYPE], + NL80211_EXT_FEATURE_PER_TID_TX_BITRATE_MASK, + NL80211_EXT_FEATURE_PER_STA_TX_BITRATE_MASK); + if (err) + return err; + + idx = NL80211_TID_CONFIG_ATTR_TX_RATES_TYPE; + tid_conf->txrate_type = nla_get_u8(attrs[idx]); + + tid_conf->tid_conf_mask |= IEEE80211_TID_CONF_TX_BITRATE; + 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 = NL80211_TID_CONFIG_ATTR_TX_RATES; + err = nl80211_parse_tx_bitrate_mask(info, attrs, attr, + tid_conf->mask); + if (err) { + kfree(tid_conf->mask); + return err; + } + } else { + tid_conf->mask = NULL; + } + } + return 0; } From patchwork Sat Nov 2 06:07:50 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tamizh chelvam X-Patchwork-Id: 11224045 X-Patchwork-Delegate: johannes@sipsolutions.net Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B5825913 for ; Sat, 2 Nov 2019 06:08:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 930D320862 for ; Sat, 2 Nov 2019 06:08:11 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="key not found in DNS" (0-bit key) header.d=codeaurora.org header.i=@codeaurora.org header.b="HxhQgAFr"; dkim=fail reason="key not found in DNS" (0-bit key) header.d=codeaurora.org header.i=@codeaurora.org header.b="Qi0nclIl" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727272AbfKBGIL (ORCPT ); Sat, 2 Nov 2019 02:08:11 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:37618 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725820AbfKBGIK (ORCPT ); Sat, 2 Nov 2019 02:08:10 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 73672615CB; Sat, 2 Nov 2019 06:08:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1572674889; bh=htR+KJ6Zg79a6Ej6jVaiaPN3PLb10i3E86p881GBMAY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HxhQgAFrQaBnP/KGqhpx7mQpTM/Nq2er09J6eSjGkEudUsETUtRFP0E6rf8YAG6sS i6mqHMgw6AnbQ1udDqqTzDgcDNKctEyNM+T3tMY+70JS/zq4etUJsWpazcYm2J9ySw CXeQenfLQudfJDtauvxgGus/XYRuugaTZXktZY8U= X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on pdx-caf-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=ALL_TRUSTED,BAYES_00, DKIM_INVALID,DKIM_SIGNED,SPF_NONE autolearn=no autolearn_force=no version=3.4.0 Received: from akolli-ThinkPad-L560.qca.qualcomm.com (blr-c-bdr-fw-01_globalnat_allzones-outside.qualcomm.com [103.229.19.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: tamizhr@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 30B7F614E7; Sat, 2 Nov 2019 06:08:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1572674888; bh=htR+KJ6Zg79a6Ej6jVaiaPN3PLb10i3E86p881GBMAY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Qi0nclIltYIgN935BytkEGPnEmLulHvKZ0Kdlgy3zOW510oCPYOby2c0xqf2poSWN WKB6c6b5q+DZfbCayOXuyTltCnVYAk3dcSJm/cO11E8IDwYSuBqHbcdn5b7nwhCyTh dtyh3TjUfd8zrtkY2E0VEE/n92sR4lwdUpEnn8io= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 30B7F614E7 Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=tamizhr@codeaurora.org From: Tamizh chelvam To: johannes@sipsolutions.net Cc: linux-wireless@vger.kernel.org, Tamizh chelvam Subject: [PATCHv7 6/6] mac80211: Add api to support configuring TID specific configuration Date: Sat, 2 Nov 2019 11:37:50 +0530 Message-Id: <1572674870-23517-7-git-send-email-tamizhr@codeaurora.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1572674870-23517-1-git-send-email-tamizhr@codeaurora.org> References: <1572674870-23517-1-git-send-email-tamizhr@codeaurora.org> Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Implement drv_set_tid_config api to allow TID specific configuration. This per-TID configuration will be applied for all the connected stations when MAC is NULL. Signed-off-by: Tamizh chelvam --- include/net/mac80211.h | 8 ++++++++ net/mac80211/cfg.c | 28 ++++++++++++++++++++++++++++ net/mac80211/driver-ops.h | 15 +++++++++++++++ 3 files changed, 51 insertions(+) diff --git a/include/net/mac80211.h b/include/net/mac80211.h index f599696..017bd44 100644 --- a/include/net/mac80211.h +++ b/include/net/mac80211.h @@ -3756,6 +3756,10 @@ enum ieee80211_reconfig_type { * * @start_pmsr: start peer measurement (e.g. FTM) (this call can sleep) * @abort_pmsr: abort peer measurement (this call can sleep) + * @set_tid_config: TID specific configurations will be applied for a particular + * station when @sta is non-NULL. When @sta is %NULL, then the + * configuration will be for all the connected clients in the vif. + * This callback may sleep. */ struct ieee80211_ops { void (*tx)(struct ieee80211_hw *hw, @@ -4060,6 +4064,10 @@ struct ieee80211_ops { struct cfg80211_pmsr_request *request); void (*abort_pmsr)(struct ieee80211_hw *hw, struct ieee80211_vif *vif, struct cfg80211_pmsr_request *request); + int (*set_tid_config)(struct ieee80211_hw *hw, + struct ieee80211_vif *vif, + struct ieee80211_sta *sta, + struct ieee80211_tid_config *tid_conf); }; /** diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c index 70739e7..22aa640 100644 --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c @@ -3942,6 +3942,33 @@ static int ieee80211_get_txq_stats(struct wiphy *wiphy, return drv_abort_pmsr(local, sdata, request); } +static int ieee80211_set_tid_config(struct wiphy *wiphy, + struct net_device *dev, + struct ieee80211_tid_config *tid_conf) +{ + struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); + struct sta_info *sta; + int ret; + + if (!sdata->local->ops->set_tid_config) + return -EOPNOTSUPP; + + if (!tid_conf->peer) + return drv_set_tid_config(sdata->local, sdata, NULL, tid_conf); + + mutex_lock(&sdata->local->sta_mtx); + + sta = sta_info_get_bss(sdata, tid_conf->peer); + if (!sta) { + mutex_unlock(&sdata->local->sta_mtx); + return -ENOENT; + } + + ret = drv_set_tid_config(sdata->local, sdata, &sta->sta, tid_conf); + mutex_unlock(&sdata->local->sta_mtx); + return ret; +} + const struct cfg80211_ops mac80211_config_ops = { .add_virtual_intf = ieee80211_add_iface, .del_virtual_intf = ieee80211_del_iface, @@ -4040,4 +4067,5 @@ static int ieee80211_get_txq_stats(struct wiphy *wiphy, .start_pmsr = ieee80211_start_pmsr, .abort_pmsr = ieee80211_abort_pmsr, .probe_mesh_link = ieee80211_probe_mesh_link, + .set_tid_config = ieee80211_set_tid_config, }; diff --git a/net/mac80211/driver-ops.h b/net/mac80211/driver-ops.h index 2c9b3eb8..c4954c7 100644 --- a/net/mac80211/driver-ops.h +++ b/net/mac80211/driver-ops.h @@ -1358,4 +1358,19 @@ static inline void drv_del_nan_func(struct ieee80211_local *local, trace_drv_return_void(local); } +static inline int drv_set_tid_config(struct ieee80211_local *local, + struct ieee80211_sub_if_data *sdata, + struct ieee80211_sta *sta, + struct ieee80211_tid_config *tid_conf) +{ + int ret; + + might_sleep(); + ret = local->ops->set_tid_config(&local->hw, &sdata->vif, sta, + tid_conf); + trace_drv_return_int(local, ret); + + return ret; +} + #endif /* __MAC80211_DRIVER_OPS */