From patchwork Tue Oct 16 18:41:07 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tamizh chelvam X-Patchwork-Id: 10644143 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B1D67157A for ; Tue, 16 Oct 2018 18:43:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9F2BF287A2 for ; Tue, 16 Oct 2018 18:43:44 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 932E328911; Tue, 16 Oct 2018 18:43:44 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id D9E83287A2 for ; Tue, 16 Oct 2018 18:43:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=BFWvv0edVulM4hEFhQhq0+vvOTfv4ThosbryfOH3iLc=; b=UY2z6A4lLO5YRzPmiIgmMVtT2b eX2AsRngJxS2mTeaVaK6ltOzsi8VFur9Nnf+Qj8p/kWxEcGna9C5cGs+9TYNI7krG3lTtaKgg2pMN +JtqA1g8hD0EwvXcQYNJoP7C5sqUeOk4dVLqcV+ES04jO0TCARC4hwHqJFH1sdB3Ip9a7ae/5YjTl KhriTM+u050qkNcNdfOVGZfNq9ZOkcTO745mRV9iF4kJlObNS1ojLL7i36oEbnEXO7KKTaM2foLsz AqVHYL9Ss0JA8ywCuhz6y3cM5EFWLHkFX4+OZRLdTfpGIoxtHqpwTi09Hm0HrDN8zrQDreAPx6iBM 5mT3gXkw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gCUJf-00018K-Cy; Tue, 16 Oct 2018 18:43:39 +0000 Received: from smtp.codeaurora.org ([198.145.29.96]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gCUJ5-0000rd-A0 for ath10k@lists.infradead.org; Tue, 16 Oct 2018 18:43:08 +0000 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id E217A61321; Tue, 16 Oct 2018 18:42:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1539715376; bh=IYIxR43lgo32Eyjowx4Rhy5kMjIpwdhWFkC2btawqMs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=d+yKbZ0jc3lM6qGJEXPZzePJNkIc5RF+ywSUNlJTFw0sZlfcTouFHU7pRWr2oTlcM NLN5rXEQZ5YTiFXdxvEq2wKXFNvjeNzP7xvQNIpuwTjbmfWXoLTgmiIlSnhqiWF4wv X0Li+O+Rzq29JFYDwP24ASxneLbUEa6eR4/64j38= Received: from cheath10p342229-lin.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 0DBA960BFA; Tue, 16 Oct 2018 18:42:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1539715375; bh=IYIxR43lgo32Eyjowx4Rhy5kMjIpwdhWFkC2btawqMs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Cih1fN2RJ+EV4SMsIkPGVjitVlmVhMbWDkxz1psH6H51KF2iAo2JhBtLyBvrc2TYr 5FYIorELnWFhoPI72VLxiYiAq+/ITjlCPon5p10TKyh7+8rnelhByErV3YQuO3hZdL VHui7lFGaUqEohmsnvIfEmvz85ACrRBgshuhALos= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 0DBA960BFA 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: ath10k@lists.infradead.org, johannes@sipsolutions.net Subject: [PATCH 2/6] nl80211/mac80211: Extend NoAck policy command with peer MAC address Date: Wed, 17 Oct 2018 00:11:07 +0530 Message-Id: <1539715271-14325-3-git-send-email-tamizhr@codeaurora.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1539715271-14325-1-git-send-email-tamizhr@codeaurora.org> References: <1539715271-14325-1-git-send-email-tamizhr@codeaurora.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181016_114303_457098_8AD0165D X-CRM114-Status: GOOD ( 20.94 ) X-BeenThere: ath10k@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Vasanthakumar Thiagarajan , linux-wireless@vger.kernel.org, Tamizh chelvam MIME-Version: 1.0 Sender: "ath10k" Errors-To: ath10k-bounces+patchwork-ath10k=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Vasanthakumar Thiagarajan Provides peer level NoAck policy configuration by extending NL80211_CMD_SET_NOACK_MAP command with peer MAC address. If user space does not give any peer mac address, the driver should retain the existing functionality of applying the NoAck policy for all the staions connected to the netdev. For a connected peer, the peer specific configuration takes precedence over netdev level configuration when both are set by the user. When the command is given without attribute NL80211_ATTR_NOACK_MAP for a peer, the NoAck policy for the peer will be reset to default which is peer's netdev NoAck policy. Newly connected stations will have default NoAck policy. Drivers supporting per-sta NoAck policy must advertise the support through the extended flag index NL80211_EXT_FEATURE_PER_STA_NOACK_MAP. Since a value of -1 NoAck map is used for default configuration, redefine noack_map as int from u16. Signed-off-by: Vasanthakumar Thiagarajan Signed-off-by: Tamizh chelvam --- include/net/cfg80211.h | 12 ++++++++++-- include/net/mac80211.h | 2 +- include/uapi/linux/nl80211.h | 16 +++++++++++++++- net/mac80211/cfg.c | 3 ++- net/mac80211/driver-ops.h | 2 +- net/mac80211/ieee80211_i.h | 2 +- net/mac80211/trace.h | 6 +++--- net/wireless/nl80211.c | 22 +++++++++++++++++----- net/wireless/rdev-ops.h | 7 ++++--- net/wireless/trace.h | 15 +++++++++------ 10 files changed, 63 insertions(+), 24 deletions(-) diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h index 1fa41b7..5801d76 100644 --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h @@ -3086,7 +3086,15 @@ struct cfg80211_ftm_responder_stats { * @probe_client: probe an associated client, must return a cookie that it * later passes to cfg80211_probe_status(). * - * @set_noack_map: Set the NoAck Map for the TIDs. + * @set_noack_map: Set the NoAck Map for the TIDs. When peer is not %NULL NoAck + * map will be applied for that particular peer. A NoAck map value of -1 + * for non-%NULL peer would indicate that the peer's current NoAck + * configuration should be reset to the default one. The default NoAck + * configuration for a peer uses the currently configured NoAck setting of + * netdev. When peer is %NULL NoAck map will be applied for all the + * connected stations on the netdev which have default NoAck policy + * configuration. Default NoAck configuration should be used for newly + * connected stations. * * @get_channel: Get the current operating channel for the virtual interface. * For monitor interfaces, it should return %NULL unless there's a single @@ -3403,7 +3411,7 @@ struct cfg80211_ops { int (*set_noack_map)(struct wiphy *wiphy, struct net_device *dev, - u16 noack_map); + const u8 *peer, int noack_map); int (*get_channel)(struct wiphy *wiphy, struct wireless_dev *wdev, diff --git a/include/net/mac80211.h b/include/net/mac80211.h index 7da9d30..5ce7ce7 100644 --- a/include/net/mac80211.h +++ b/include/net/mac80211.h @@ -3917,7 +3917,7 @@ struct ieee80211_ops { struct cfg80211_ftm_responder_stats *ftm_stats); int (*set_noack_tid_bitmap)(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, u16 noack_map); + struct ieee80211_vif *vif, int noack_map); }; /** diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h index 6d610ba..31b7a4b 100644 --- a/include/uapi/linux/nl80211.h +++ b/include/uapi/linux/nl80211.h @@ -788,7 +788,18 @@ * messages. Note that per PHY only one application may register. * * @NL80211_CMD_SET_NOACK_MAP: sets a bitmap for the individual TIDs whether - * No Acknowledgement Policy should be applied. + * No Acknowledgement Policy should be applied. %NL80211_ATTR_MAC is used + * to apply No Acknowledgement policy for a particular connected station. + * When the command is received without %NL80211_ATTR_NOACK_MAP for a + * connected station (%NL80211_ATTR_MAC), the station's current NoAck + * policy configuration should be reset to default. The default + * configuration for a peer should use the current ndev level NoAck + * policy configuration. Station specific NoAck policy 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, the No + * Acknowledgement Policy setting should be treated as per-netdev + * configuration. * * @NL80211_CMD_CH_SWITCH_NOTIFY: An AP or GO may decide to switch channels * independently of the userspace SME, send this event indicating @@ -5257,6 +5268,8 @@ enum nl80211_feature_flags { * able to rekey an in-use key correctly. Userspace must not rekey PTK keys * if this flag is not set. Ignoring this can leak clear text packets and/or * freeze the connection. + * @NL80211_EXT_FEATURE_PER_STA_NOACK_MAP: Driver supports STA specific NoAck + * policy functionality. * * @NUM_NL80211_EXT_FEATURES: number of extended features. * @MAX_NL80211_EXT_FEATURES: highest extended feature index. @@ -5297,6 +5310,7 @@ enum nl80211_ext_feature_index { NL80211_EXT_FEATURE_SCAN_MIN_PREQ_CONTENT, NL80211_EXT_FEATURE_CAN_REPLACE_PTK0, NL80211_EXT_FEATURE_ENABLE_FTM_RESPONDER, + NL80211_EXT_FEATURE_PER_STA_NOACK_MAP, /* add new features before the definition below */ NUM_NL80211_EXT_FEATURES, diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c index 4d8cc8d..7a7e423 100644 --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c @@ -340,7 +340,8 @@ static void ieee80211_del_nan_func(struct wiphy *wiphy, static int ieee80211_set_noack_map(struct wiphy *wiphy, struct net_device *dev, - u16 noack_map) + const u8 *peer, + int noack_map) { struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); diff --git a/net/mac80211/driver-ops.h b/net/mac80211/driver-ops.h index a6dcef5..d705938 100644 --- a/net/mac80211/driver-ops.h +++ b/net/mac80211/driver-ops.h @@ -1280,7 +1280,7 @@ static inline void drv_del_nan_func(struct ieee80211_local *local, static inline int drv_set_noack_tid_bitmap(struct ieee80211_local *local, struct ieee80211_sub_if_data *sdata, - u16 noack_map) + int noack_map) { int ret; diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h index 10a0506..257dec5 100644 --- a/net/mac80211/ieee80211_i.h +++ b/net/mac80211/ieee80211_i.h @@ -891,7 +891,7 @@ struct ieee80211_sub_if_data { unsigned int fragment_next; /* TID bitmap for NoAck policy */ - u16 noack_map; + int noack_map; /* bit field of ACM bits (BIT(802.1D tag)) */ u8 wmm_acm; diff --git a/net/mac80211/trace.h b/net/mac80211/trace.h index a563904..e0e6c9a 100644 --- a/net/mac80211/trace.h +++ b/net/mac80211/trace.h @@ -1885,13 +1885,13 @@ struct trace_switch_entry { TRACE_EVENT(drv_set_noack_tid_bitmap, TP_PROTO(struct ieee80211_local *local, struct ieee80211_sub_if_data *sdata, - u16 noack_map), + int noack_map), TP_ARGS(local, sdata, noack_map), TP_STRUCT__entry( LOCAL_ENTRY VIF_ENTRY - __field(u16, noack_map) + __field(int, noack_map) ), TP_fast_assign( @@ -1902,7 +1902,7 @@ struct trace_switch_entry { TP_printk( LOCAL_PR_FMT VIF_PR_FMT - ", noack_map: %u", + ", noack_map: %d", LOCAL_PR_ARG, VIF_PR_ARG, __entry->noack_map ) ); diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index 744b585..d744388 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c @@ -3331,17 +3331,29 @@ static int nl80211_set_noack_map(struct sk_buff *skb, struct genl_info *info) { struct cfg80211_registered_device *rdev = info->user_ptr[0]; struct net_device *dev = info->user_ptr[1]; - u16 noack_map; + int noack_map = -1; + const u8 *peer = NULL; - if (!info->attrs[NL80211_ATTR_NOACK_MAP]) + if (!(info->attrs[NL80211_ATTR_NOACK_MAP] || + info->attrs[NL80211_ATTR_MAC])) return -EINVAL; + if (info->attrs[NL80211_ATTR_NOACK_MAP]) + noack_map = nla_get_u16(info->attrs[NL80211_ATTR_NOACK_MAP]); + + if (info->attrs[NL80211_ATTR_MAC]) { + if (!wiphy_ext_feature_isset( + &rdev->wiphy, + NL80211_EXT_FEATURE_PER_STA_NOACK_MAP)) + return -EOPNOTSUPP; + + peer = nla_data(info->attrs[NL80211_ATTR_MAC]); + } + if (!rdev->ops->set_noack_map) return -EOPNOTSUPP; - noack_map = nla_get_u16(info->attrs[NL80211_ATTR_NOACK_MAP]); - - return rdev_set_noack_map(rdev, dev, noack_map); + return rdev_set_noack_map(rdev, dev, peer, noack_map); } struct get_key_cookie { diff --git a/net/wireless/rdev-ops.h b/net/wireless/rdev-ops.h index 51380b5..8426eb1 100644 --- a/net/wireless/rdev-ops.h +++ b/net/wireless/rdev-ops.h @@ -908,11 +908,12 @@ static inline int rdev_probe_client(struct cfg80211_registered_device *rdev, } static inline int rdev_set_noack_map(struct cfg80211_registered_device *rdev, - struct net_device *dev, u16 noack_map) + struct net_device *dev, const u8 *peer, + int noack_map) { int ret; - trace_rdev_set_noack_map(&rdev->wiphy, dev, noack_map); - ret = rdev->ops->set_noack_map(&rdev->wiphy, dev, noack_map); + trace_rdev_set_noack_map(&rdev->wiphy, dev, peer, noack_map); + ret = rdev->ops->set_noack_map(&rdev->wiphy, dev, peer, noack_map); trace_rdev_return_int(&rdev->wiphy, ret); return ret; } diff --git a/net/wireless/trace.h b/net/wireless/trace.h index c6a9446..2ff78dd 100644 --- a/net/wireless/trace.h +++ b/net/wireless/trace.h @@ -1909,21 +1909,24 @@ ); TRACE_EVENT(rdev_set_noack_map, - TP_PROTO(struct wiphy *wiphy, struct net_device *netdev, - u16 noack_map), - TP_ARGS(wiphy, netdev, noack_map), + TP_PROTO(struct wiphy *wiphy, struct net_device *netdev, const u8 *peer, + int noack_map), + TP_ARGS(wiphy, netdev, peer, noack_map), TP_STRUCT__entry( WIPHY_ENTRY NETDEV_ENTRY - __field(u16, noack_map) + MAC_ENTRY(peer) + __field(int, noack_map) ), TP_fast_assign( WIPHY_ASSIGN; NETDEV_ASSIGN; + MAC_ASSIGN(peer, peer); __entry->noack_map = noack_map; ), - TP_printk(WIPHY_PR_FMT ", " NETDEV_PR_FMT ", noack_map: %u", - WIPHY_PR_ARG, NETDEV_PR_ARG, __entry->noack_map) + TP_printk(WIPHY_PR_FMT ", " NETDEV_PR_FMT ", " MAC_PR_FMT + ", noack_map: %d", WIPHY_PR_ARG, NETDEV_PR_ARG, + MAC_PR_ARG(peer), __entry->noack_map) ); DEFINE_EVENT(wiphy_wdev_evt, rdev_get_channel,