From patchwork Tue Mar 27 08:42:49 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vasanthakumar Thiagarajan X-Patchwork-Id: 10309543 X-Patchwork-Delegate: johannes@sipsolutions.net Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id C026060325 for ; Tue, 27 Mar 2018 08:44:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9E18129C14 for ; Tue, 27 Mar 2018 08:44:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 92FE829C16; Tue, 27 Mar 2018 08:44:23 +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=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EE01129C15 for ; Tue, 27 Mar 2018 08:44:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751714AbeC0IoT (ORCPT ); Tue, 27 Mar 2018 04:44:19 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:40848 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751184AbeC0IoQ (ORCPT ); Tue, 27 Mar 2018 04:44:16 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 2487C60558; Tue, 27 Mar 2018 08:44:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1522140256; bh=pb/PiKJglsmfxQbKfqwZXQfaSYeucSgimf2y0Wne7ZQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dJsf8ATf2UoNTVf6p0o2pCnlVBn3t6UGXz8fdtp082gI/iRF1hR8LZtHzeKfATu8m EF42t+Y89vAwXwmleM5S52cnXuVcEuYCGnzVQCtS+yhvHWPLYpD6uwR2Rx8X1II8uK laB+aEj4M9F8BMpRVShivSCXiMlfP56uHyAWewGM= Received: from vasanth-lnx.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: vthiagar@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id F167C60251; Tue, 27 Mar 2018 08:44:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1522140255; bh=pb/PiKJglsmfxQbKfqwZXQfaSYeucSgimf2y0Wne7ZQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Jh3ETTcabmXyUeMVHGOMUS5mzG142IUEouOkO2oKsB33QiVWtFLyzfVmPoZqxgIpR 2VK3pIg+BKlr0+hj/uH1XR9aCZ3FT5iFFshc4+ZIwnTsnKn5oNMvVWbR/lr4BkGj+1 adzDgEIQh/Y1tM9210tbOqKmtSRa6mFi04rTbRKo= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org F167C60251 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=vthiagar@codeaurora.org From: Vasanthakumar Thiagarajan To: johannes@sipsolutions.net Cc: linux-wireless@vger.kernel.org, Vasanthakumar Thiagarajan Subject: [RFC 2/4] nl80211/mac80211: Extend NoAck policy command with peer MAC address Date: Tue, 27 Mar 2018 14:12:49 +0530 Message-Id: <1522140171-10926-3-git-send-email-vthiagar@codeaurora.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1522140171-10926-1-git-send-email-vthiagar@codeaurora.org> References: <1522140171-10926-1-git-send-email-vthiagar@codeaurora.org> Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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. Peer specific configuration takes precedence over netdev level configuration when both are set by the user. Drivers supporting per-sta NoAck policy must advertise the support through the extended flag index NL80211_EXT_FEATURE_PER_STA_NOACK_MAP. Signed-off-by: Vasanthakumar Thiagarajan --- include/net/cfg80211.h | 9 +++++++-- include/uapi/linux/nl80211.h | 12 +++++++++++- net/mac80211/cfg.c | 1 + net/wireless/nl80211.c | 12 +++++++++++- net/wireless/rdev-ops.h | 7 ++++--- net/wireless/trace.h | 11 +++++++---- 6 files changed, 41 insertions(+), 11 deletions(-) diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h index fc40843..b974d32 100644 --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h @@ -2872,7 +2872,12 @@ struct cfg80211_external_auth_params { * @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. When peer is %NULL NoAck + * map will be applied for all the connected stations (except the ones + * which already have per-peer TID map configured) on the netdev. + * Driver should return -ENOSPC when the it does not have room for + * additional entries for per-peer NoAck map. * * @get_channel: Get the current operating channel for the virtual interface. * For monitor interfaces, it should return %NULL unless there's a single @@ -3180,7 +3185,7 @@ struct cfg80211_ops { int (*set_noack_map)(struct wiphy *wiphy, struct net_device *dev, - u16 noack_map); + const u8 *peer, u16 noack_map); int (*get_channel)(struct wiphy *wiphy, struct wireless_dev *wdev, diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h index 60fefc5..7425ea6 100644 --- a/include/uapi/linux/nl80211.h +++ b/include/uapi/linux/nl80211.h @@ -784,7 +784,14 @@ * 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. + * Station specific NoAck policy configuration is valid only for STA's + * current connection, i.e. the configuration will not be used 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 @@ -5005,6 +5012,8 @@ enum nl80211_feature_flags { * channel change triggered by radar detection event. * No need to start CAC from user-space, no need to react to * "radar detected" event. + * @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. @@ -5036,6 +5045,7 @@ enum nl80211_ext_feature_index { NL80211_EXT_FEATURE_LOW_POWER_SCAN, NL80211_EXT_FEATURE_HIGH_ACCURACY_SCAN, NL80211_EXT_FEATURE_DFS_OFFLOAD, + 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 a2f0eae..621ef38 100644 --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c @@ -341,6 +341,7 @@ static void ieee80211_del_nan_func(struct wiphy *wiphy, static int ieee80211_set_noack_map(struct wiphy *wiphy, struct net_device *dev, + const u8 *peer, u16 noack_map) { struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index fe27ab4..8d7f055a 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c @@ -3095,16 +3095,26 @@ 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; + const u8 *peer = NULL; if (!info->attrs[NL80211_ATTR_NOACK_MAP]) return -EINVAL; + 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 84f23ae..5c9089d 100644 --- a/net/wireless/rdev-ops.h +++ b/net/wireless/rdev-ops.h @@ -881,11 +881,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, + u16 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 5152938..caecf18 100644 --- a/net/wireless/trace.h +++ b/net/wireless/trace.h @@ -1883,21 +1883,24 @@ ); TRACE_EVENT(rdev_set_noack_map, - TP_PROTO(struct wiphy *wiphy, struct net_device *netdev, + TP_PROTO(struct wiphy *wiphy, struct net_device *netdev, const u8 *peer, u16 noack_map), - TP_ARGS(wiphy, netdev, noack_map), + TP_ARGS(wiphy, netdev, peer, noack_map), TP_STRUCT__entry( WIPHY_ENTRY NETDEV_ENTRY + MAC_ENTRY(peer) __field(u16, 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: %u", WIPHY_PR_ARG, NETDEV_PR_ARG, + MAC_PR_ARG(peer), __entry->noack_map) ); DEFINE_EVENT(wiphy_wdev_evt, rdev_get_channel,