From patchwork Wed Aug 15 00:30:16 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pradeep Kumar Chitrapu X-Patchwork-Id: 10566191 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 27D3D157B for ; Wed, 15 Aug 2018 00:30:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 17B7929E1E for ; Wed, 15 Aug 2018 00:30:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0BF2D29E54; Wed, 15 Aug 2018 00:30:46 +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=ham 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 97D9129E1E for ; Wed, 15 Aug 2018 00:30:45 +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=b1X2cbkLIRvc7z1+Vwj8PKuI13QyWshfOKoF76Vbo28=; b=GxpbQwGrisJ1iThLS9Oe/003oy rfWiug8rl8sv+OTYWAU5HKJG0GV7bVg/epD9LnFhtEYGQYWB0Bi4STIicz/q325bAhK51FvXBEiqL HR7ebpbFpC5rOWMPUPRKKSaSc+NSEuRQBqO+/97ZiLdTgR5ikUMavjsL6zPoBAMWfJioXcFsW928Q Q8dv4c+1YnpvDInUv9206s3Fviwl66foMbpzms+UBgO6tB25+m6xuQNS+vUKy5pR/K9/xJ9Sqi6jc JOa2Q+RzqXIxNF/mE3L1MTFPxb+h9yD0VzBd95eYNQE4mD93WMtdKA+v38XMi0T+ArDRW08S/bu4d n+o2W7zA==; 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 1fpjhz-0008V1-P7; Wed, 15 Aug 2018 00:30:43 +0000 Received: from alexa-out-sd-01.qualcomm.com ([199.106.114.38]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fpjht-0008PS-Rn for ath10k@lists.infradead.org; Wed, 15 Aug 2018 00:30:39 +0000 X-IronPort-AV: E=Sophos;i="5.53,240,1531810800"; d="scan'208";a="6148726" Received: from unknown (HELO ironmsg01-sd.qualcomm.com) ([10.53.140.141]) by alexa-out-sd-01.qualcomm.com with ESMTP; 14 Aug 2018 17:30:21 -0700 Received: from pradeepc-linux.qualcomm.com (HELO pradeepc-linux.localdomain) ([10.234.220.147]) by ironmsg01-sd.qualcomm.com with ESMTP; 14 Aug 2018 17:30:21 -0700 Received: by pradeepc-linux.localdomain (Postfix, from userid 204078) id E218A1BA8; Tue, 14 Aug 2018 17:30:20 -0700 (PDT) From: Pradeep Kumar Chitrapu To: johannes@sipsolutions.net, ath10k@lists.infradead.org Subject: [PATCH 1/3] nl80211: add support to configure FTM responder functionality Date: Tue, 14 Aug 2018 17:30:16 -0700 Message-Id: <1534293018-4930-2-git-send-email-pradeepc@codeaurora.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1534293018-4930-1-git-send-email-pradeepc@codeaurora.org> References: <1534293018-4930-1-git-send-email-pradeepc@codeaurora.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180814_173037_923047_6D5B8AD1 X-CRM114-Status: GOOD ( 12.58 ) 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: Pradeep Kumar Chitrapu , linux-wireless@vger.kernel.org MIME-Version: 1.0 Sender: "ath10k" Errors-To: ath10k-bounces+patchwork-ath10k=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Allow userspace to enable or disable fine timing measurement responder functionality in AP mode. This can be done at AP start. A new EXT_FEATURE flag is introduced for drivers to advertise the capability. Signed-off-by: Pradeep Kumar Chitrapu --- include/net/cfg80211.h | 2 ++ include/uapi/linux/nl80211.h | 20 ++++++++++++++++++++ net/wireless/nl80211.c | 19 +++++++++++++++++++ 3 files changed, 41 insertions(+) diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h index 9a850973e09a..beb383a41657 100644 --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h @@ -851,6 +851,7 @@ struct cfg80211_bitrate_mask { * @vht_cap: VHT capabilities (or %NULL if VHT isn't enabled) * @ht_required: stations must support HT * @vht_required: stations must support VHT + * @ftm_responder: enable or disable FTM responder functionality */ struct cfg80211_ap_settings { struct cfg80211_chan_def chandef; @@ -875,6 +876,7 @@ struct cfg80211_ap_settings { const struct ieee80211_ht_cap *ht_cap; const struct ieee80211_vht_cap *vht_cap; bool ht_required, vht_required; + int ftm_responder; }; /** diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h index 7acc16f34942..0a64034343c7 100644 --- a/include/uapi/linux/nl80211.h +++ b/include/uapi/linux/nl80211.h @@ -2241,6 +2241,11 @@ enum nl80211_commands { * association request when used with NL80211_CMD_NEW_STATION). Can be set * only if %NL80211_STA_FLAG_WME is set. * + * @NL80211_ATTR_FTM_RESPONDER: attribute which user-space can include in + * %NL80211_CMD_START_AP to enable(1) or disable(0) fine timing measurement + * (FTM) responder functionality. If not set, it means don't care and + * the device will decide what to use. + * * @NUM_NL80211_ATTR: total number of nl80211_attrs available * @NL80211_ATTR_MAX: highest attribute number currently defined * @__NL80211_ATTR_AFTER_LAST: internal use @@ -2682,6 +2687,8 @@ enum nl80211_attrs { NL80211_ATTR_HE_CAPABILITY, + NL80211_ATTR_FTM_RESPONDER, + /* add attributes here, update the policy in nl80211.c */ __NL80211_ATTR_AFTER_LAST, @@ -5223,6 +5230,8 @@ enum nl80211_feature_flags { * @NL80211_EXT_FEATURE_SCAN_MIN_PREQ_CONTENT: Driver/device can omit all data * except for supported rates from the probe request content if requested * by the %NL80211_SCAN_FLAG_MIN_PREQ_CONTENT flag. + * @NL80211_EXT_FEATURE_SET_FTM_RESPONDER: Driver supports enabling and + * disabling fine timing measurement responder role. * * @NUM_NL80211_EXT_FEATURES: number of extended features. * @MAX_NL80211_EXT_FEATURES: highest extended feature index. @@ -5259,6 +5268,7 @@ enum nl80211_ext_feature_index { NL80211_EXT_FEATURE_TXQS, NL80211_EXT_FEATURE_SCAN_RANDOM_SN, NL80211_EXT_FEATURE_SCAN_MIN_PREQ_CONTENT, + NL80211_EXT_FEATURE_SET_FTM_RESPONDER, /* add new features before the definition below */ NUM_NL80211_EXT_FEATURES, @@ -5798,4 +5808,14 @@ enum nl80211_external_auth_action { NL80211_EXTERNAL_AUTH_ABORT, }; +/** + * enum nl80211_ftm_responder_state - fine timing measurement responder state + * @NL80211_FTM_RESP_DISABLED: FTM responder is disabled + * @NL80211_FTM_RESP_ENABLED: FTM responder is enabled + */ +enum nl80211_ftm_responder_state { + NL80211_FTM_RESP_DISABLED, + NL80211_FTM_RESP_ENABLED, +}; + #endif /* __LINUX_NL80211_H */ diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index 5fb9b7dd9831..dfdc1cb07add 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c @@ -430,6 +430,7 @@ enum nl80211_multicast_groups { [NL80211_ATTR_TXQ_QUANTUM] = { .type = NLA_U32 }, [NL80211_ATTR_HE_CAPABILITY] = { .type = NLA_BINARY, .len = NL80211_HE_MAX_CAPABILITY_LEN }, + [NL80211_ATTR_FTM_RESPONDER] = { .type = NLA_U32}, }; /* policy for the key attributes */ @@ -4339,6 +4340,24 @@ static int nl80211_start_ap(struct sk_buff *skb, struct genl_info *info) return PTR_ERR(params.acl); } + params.ftm_responder = -1; + if (info->attrs[NL80211_ATTR_FTM_RESPONDER]) { + if (!wiphy_ext_feature_isset( + &rdev->wiphy, + NL80211_EXT_FEATURE_SET_FTM_RESPONDER)) { + GENL_SET_ERR_MSG(info, + "FTM Responder config not supported\n"); + return -EOPNOTSUPP; + } + + params.ftm_responder = + nla_get_u32(info->attrs[NL80211_ATTR_FTM_RESPONDER]); + + if (params.ftm_responder != NL80211_FTM_RESP_DISABLED && + params.ftm_responder != NL80211_FTM_RESP_ENABLED) + return -EINVAL; + } + nl80211_calculate_ap_params(¶ms); wdev_lock(wdev); From patchwork Wed Aug 15 00:30:17 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pradeep Kumar Chitrapu X-Patchwork-Id: 10566195 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 A72B71515 for ; Wed, 15 Aug 2018 00:30:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9820029E1E for ; Wed, 15 Aug 2018 00:30:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8C65629E54; Wed, 15 Aug 2018 00:30:53 +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=ham 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 3765F29E1E for ; Wed, 15 Aug 2018 00:30:53 +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=M502l46/QY73x8pD99/P1LHZzh8gYvqHF9dTnN+kPTU=; b=s46zQ0xql4rv6S7c1dNrqN880t hSIf5lhTY/XawleTNaAU8e0AqadZ8ah+otVYwCC7cv7CeT1g8300DlS6hANWl11nUtTV9gqYHMr+q 878pDdDimEjlAa1kI0YN4YVJKW1Sf8NkyRiTbX0FU4o3yuycjW2BByxsnTzh6PxgKRF0DhA6ABN+s egvDZpLoBfIFX5v1lnSRRuuBHNRfKv6Cc11SFw6ORRyFpbDMLes2/YXWIcj+fp5lEttehFvrBbr1I jk9Oym169YoU0K6CrkwhxNfuiK2S9UXGYOl6lzIOgvirm8qgrP7pmtKydu+7NZbUKnAYWC6T0fD+E CpKT8rBQ==; 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 1fpji7-0000BU-M6; Wed, 15 Aug 2018 00:30:51 +0000 Received: from alexa-out-sd-01.qualcomm.com ([199.106.114.38]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fpji4-0008Qd-0I for ath10k@lists.infradead.org; Wed, 15 Aug 2018 00:30:49 +0000 X-IronPort-AV: E=Sophos;i="5.53,240,1531810800"; d="scan'208";a="6148728" Received: from unknown (HELO ironmsg01-sd.qualcomm.com) ([10.53.140.141]) by alexa-out-sd-01.qualcomm.com with ESMTP; 14 Aug 2018 17:30:21 -0700 Received: from pradeepc-linux.qualcomm.com (HELO pradeepc-linux.localdomain) ([10.234.220.147]) by ironmsg01-sd.qualcomm.com with ESMTP; 14 Aug 2018 17:30:21 -0700 Received: by pradeepc-linux.localdomain (Postfix, from userid 204078) id EEE872D64; Tue, 14 Aug 2018 17:30:20 -0700 (PDT) From: Pradeep Kumar Chitrapu To: johannes@sipsolutions.net, ath10k@lists.infradead.org Subject: [PATCH 2/3] mac80211: Add support to notify ftm responder configuration to the driver Date: Tue, 14 Aug 2018 17:30:17 -0700 Message-Id: <1534293018-4930-3-git-send-email-pradeepc@codeaurora.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1534293018-4930-1-git-send-email-pradeepc@codeaurora.org> References: <1534293018-4930-1-git-send-email-pradeepc@codeaurora.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180814_173048_136383_60822FA1 X-CRM114-Status: UNSURE ( 9.76 ) X-CRM114-Notice: Please train this message. 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: Pradeep Kumar Chitrapu , linux-wireless@vger.kernel.org MIME-Version: 1.0 Sender: "ath10k" Errors-To: ath10k-bounces+patchwork-ath10k=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP New bss param ftm_responder is used to notify the driver to enable or disable fine timing request (FTM) responder role in AP mode. Signed-off-by: Pradeep Kumar Chitrapu --- include/net/mac80211.h | 4 ++++ net/mac80211/cfg.c | 4 ++++ net/mac80211/util.c | 3 +++ 3 files changed, 11 insertions(+) diff --git a/include/net/mac80211.h b/include/net/mac80211.h index 5790f55c241d..6593c611655b 100644 --- a/include/net/mac80211.h +++ b/include/net/mac80211.h @@ -308,6 +308,8 @@ struct ieee80211_vif_chanctx_switch { * @BSS_CHANGED_KEEP_ALIVE: keep alive options (idle period or protected * keep alive) changed. * @BSS_CHANGED_MCAST_RATE: Multicast Rate setting changed for this interface + * @BSS_CHANGED_FTM_RESPONDER: fime timing reasurement request responder + * functionality changed for this BSS (AP mode). * */ enum ieee80211_bss_change { @@ -337,6 +339,7 @@ enum ieee80211_bss_change { BSS_CHANGED_MU_GROUPS = 1<<23, BSS_CHANGED_KEEP_ALIVE = 1<<24, BSS_CHANGED_MCAST_RATE = 1<<25, + BSS_CHANGED_FTM_RESPONDER = 1<<26, /* when adding here, make sure to change ieee80211_reconfig */ }; @@ -611,6 +614,7 @@ struct ieee80211_bss_conf { bool allow_p2p_go_ps; u16 max_idle_period; bool protected_keep_alive; + int ftm_responder; }; /** diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c index d25da0e66da1..75e314b826fb 100644 --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c @@ -964,6 +964,10 @@ static int ieee80211_start_ap(struct wiphy *wiphy, struct net_device *dev, sdata->vif.bss_conf.p2p_noa_attr.oppps_ctwindow |= IEEE80211_P2P_OPPPS_ENABLE_BIT; + sdata->vif.bss_conf.ftm_responder = params->ftm_responder; + if (params->ftm_responder >= 0) + changed |= BSS_CHANGED_FTM_RESPONDER; + err = ieee80211_assign_beacon(sdata, ¶ms->beacon, NULL); if (err < 0) { ieee80211_vif_release_channel(sdata); diff --git a/net/mac80211/util.c b/net/mac80211/util.c index 88efda7c9f8a..835fcf01fabc 100644 --- a/net/mac80211/util.c +++ b/net/mac80211/util.c @@ -2076,6 +2076,9 @@ int ieee80211_reconfig(struct ieee80211_local *local) case NL80211_IFTYPE_AP: changed |= BSS_CHANGED_SSID | BSS_CHANGED_P2P_PS; + if (sdata->vif.bss_conf.ftm_responder >= 0) + changed |= BSS_CHANGED_FTM_RESPONDER; + if (sdata->vif.type == NL80211_IFTYPE_AP) { changed |= BSS_CHANGED_AP_PROBE_RESP; From patchwork Wed Aug 15 00:30:18 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pradeep Kumar Chitrapu X-Patchwork-Id: 10566193 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 3A561157B for ; Wed, 15 Aug 2018 00:30:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2ABBD29E1E for ; Wed, 15 Aug 2018 00:30:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1F22C29E54; Wed, 15 Aug 2018 00:30:49 +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=ham 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 A312C29E1E for ; Wed, 15 Aug 2018 00:30:48 +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=XMDwJvL892gjuReIx/ftUW7Tzb51ZYTIIIlz9XgFC0U=; b=bK/5TzhEAcWT4Uvu+CQEjF2rNf Y+p/np7ugzCuzdkUJfNVer6vnh6B0oPakO5ucTsvQJytGFr5u5XTD1Ey0fAqgDa8CPx86Z1ryfVA/ O+zG/lpZ4/uqg147TqqMpvjh8iYUU7CUFZyvB330AOHqv+a2UUGNzdOjaMxpwOQavW41Ncc29dkSe fUadEGwT+id+Yyb2nAF0H4U64FyRKpm9zneC7d+QxRi4BqVFyV5N53iouGUtGTO9rqJ2ieBXiFbx3 /kBcq35p67xxofUyi/HvbYTOXw7k2Yfp4o1ejj5Q+SBRC4BmfObDe40dTTICUUeovUM9Bly9EOhME Lb4r8oqA==; 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 1fpjhx-0008SJ-BD; Wed, 15 Aug 2018 00:30:41 +0000 Received: from alexa-out-sd-02.qualcomm.com ([199.106.114.39]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fpjhs-0008PT-Gm for ath10k@lists.infradead.org; Wed, 15 Aug 2018 00:30:38 +0000 X-IronPort-AV: E=Sophos;i="5.53,240,1531810800"; d="scan'208";a="8939523" Received: from unknown (HELO ironmsg05-sd.qualcomm.com) ([10.53.140.145]) by alexa-out-sd-02.qualcomm.com with ESMTP; 14 Aug 2018 17:30:21 -0700 X-IronPort-AV: E=McAfee;i="5900,7806,8985"; a="132043228" Received: from pradeepc-linux.qualcomm.com (HELO pradeepc-linux.localdomain) ([10.234.220.147]) by ironmsg05-sd.qualcomm.com with ESMTP; 14 Aug 2018 17:30:21 -0700 Received: by pradeepc-linux.localdomain (Postfix, from userid 204078) id 093592D65; Tue, 14 Aug 2018 17:30:20 -0700 (PDT) From: Pradeep Kumar Chitrapu To: johannes@sipsolutions.net, ath10k@lists.infradead.org Subject: [PATCH 3/3] ath10k: Add support to configure ftm responder role Date: Tue, 14 Aug 2018 17:30:18 -0700 Message-Id: <1534293018-4930-4-git-send-email-pradeepc@codeaurora.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1534293018-4930-1-git-send-email-pradeepc@codeaurora.org> References: <1534293018-4930-1-git-send-email-pradeepc@codeaurora.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180814_173036_590681_D29D236F X-CRM114-Status: GOOD ( 11.98 ) 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: Pradeep Kumar Chitrapu , linux-wireless@vger.kernel.org MIME-Version: 1.0 Sender: "ath10k" Errors-To: ath10k-bounces+patchwork-ath10k=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Configure fine timing measurement (FTM) responder role from the ftm_responder bss param sent by mac80211. With FTM functionality offloaded to firmware, adding the interface allows userspace to enable or disable FTM responder functionality. ath10k disables it at the time of interface creation. Supported FW: 10.4 Tested on QCA9984 with debug firmware: 10.4-3.2.1-00121 Signed-off-by: Pradeep Kumar Chitrapu --- drivers/net/wireless/ath/ath10k/core.h | 1 + drivers/net/wireless/ath/ath10k/mac.c | 29 +++++++++++++++++++++++++++++ drivers/net/wireless/ath/ath10k/wmi.c | 4 ++++ drivers/net/wireless/ath/ath10k/wmi.h | 10 ++++++++++ 4 files changed, 44 insertions(+) diff --git a/drivers/net/wireless/ath/ath10k/core.h b/drivers/net/wireless/ath/ath10k/core.h index 9feea02e7d37..db190230b292 100644 --- a/drivers/net/wireless/ath/ath10k/core.h +++ b/drivers/net/wireless/ath/ath10k/core.h @@ -544,6 +544,7 @@ struct ath10k_vif { bool nohwcrypt; int num_legacy_stations; int txpower; + bool ftm_responder; struct wmi_wmm_params_all_arg wmm_params; struct work_struct ap_csa_work; struct delayed_work connection_loss_work; diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c index 90f9372dec25..cdb73b8cc253 100644 --- a/drivers/net/wireless/ath/ath10k/mac.c +++ b/drivers/net/wireless/ath/ath10k/mac.c @@ -5259,6 +5259,17 @@ static int ath10k_add_interface(struct ieee80211_hw *hw, goto err_peer_delete; } + if (test_bit(WMI_SERVICE_RTT, ar->wmi.svc_map)) { + vdev_param = ar->wmi.vdev_param->rtt_responder_role; + ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, vdev_param, + arvif->ftm_responder); + + /* It is harmless to not set FTM role. Do not warn */ + if (ret && ret != -EOPNOTSUPP) + ath10k_warn(ar, "failed to set vdev %i FTM Responder: %d\n", + arvif->vdev_id, ret); + } + if (vif->type == NL80211_IFTYPE_MONITOR) { ar->monitor_arvif = arvif; ret = ath10k_monitor_recalc(ar); @@ -5532,6 +5543,20 @@ static void ath10k_bss_info_changed(struct ieee80211_hw *hw, if (changed & BSS_CHANGED_BSSID && !is_zero_ether_addr(info->bssid)) ether_addr_copy(arvif->bssid, info->bssid); + if (changed & BSS_CHANGED_FTM_RESPONDER && + arvif->ftm_responder != info->ftm_responder && + test_bit(WMI_SERVICE_RTT, ar->wmi.svc_map)) { + arvif->ftm_responder = info->ftm_responder; + + vdev_param = ar->wmi.vdev_param->rtt_responder_role; + ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, vdev_param, + arvif->ftm_responder); + + ath10k_dbg(ar, ATH10K_DBG_MAC, + "mac vdev %d ftm_responder %d:ret %d\n", + arvif->vdev_id, arvif->ftm_responder, ret); + } + if (changed & BSS_CHANGED_BEACON_ENABLED) ath10k_control_beaconing(arvif, info); @@ -8463,6 +8488,10 @@ int ath10k_mac_register(struct ath10k *ar) wiphy_ext_feature_set(ar->hw->wiphy, NL80211_EXT_FEATURE_SET_SCAN_DWELL); + if (test_bit(WMI_SERVICE_RTT, ar->wmi.svc_map)) + wiphy_ext_feature_set(ar->hw->wiphy, + NL80211_EXT_FEATURE_SET_FTM_RESPONDER); + /* * on LL hardware queues are managed entirely by the FW * so we only advertise to mac we can do the queues thing diff --git a/drivers/net/wireless/ath/ath10k/wmi.c b/drivers/net/wireless/ath/ath10k/wmi.c index fd612d2905b0..00c67d53eab8 100644 --- a/drivers/net/wireless/ath/ath10k/wmi.c +++ b/drivers/net/wireless/ath/ath10k/wmi.c @@ -825,6 +825,7 @@ .meru_vc = WMI_VDEV_PARAM_UNSUPPORTED, .rx_decap_type = WMI_VDEV_PARAM_UNSUPPORTED, .bw_nss_ratemask = WMI_VDEV_PARAM_UNSUPPORTED, + .rtt_responder_role = WMI_VDEV_PARAM_UNSUPPORTED, }; /* 10.X WMI VDEV param map */ @@ -900,6 +901,7 @@ .meru_vc = WMI_VDEV_PARAM_UNSUPPORTED, .rx_decap_type = WMI_VDEV_PARAM_UNSUPPORTED, .bw_nss_ratemask = WMI_VDEV_PARAM_UNSUPPORTED, + .rtt_responder_role = WMI_VDEV_PARAM_UNSUPPORTED, }; static struct wmi_vdev_param_map wmi_10_2_4_vdev_param_map = { @@ -974,6 +976,7 @@ .meru_vc = WMI_VDEV_PARAM_UNSUPPORTED, .rx_decap_type = WMI_VDEV_PARAM_UNSUPPORTED, .bw_nss_ratemask = WMI_VDEV_PARAM_UNSUPPORTED, + .rtt_responder_role = WMI_VDEV_PARAM_UNSUPPORTED, }; static struct wmi_vdev_param_map wmi_10_4_vdev_param_map = { @@ -1051,6 +1054,7 @@ .bw_nss_ratemask = WMI_10_4_VDEV_PARAM_BW_NSS_RATEMASK, .inc_tsf = WMI_10_4_VDEV_PARAM_TSF_INCREMENT, .dec_tsf = WMI_10_4_VDEV_PARAM_TSF_DECREMENT, + .rtt_responder_role = WMI_10_4_VDEV_PARAM_ENABLE_DISABLE_RTT_RESPONDER_ROLE, }; static struct wmi_pdev_param_map wmi_pdev_param_map = { diff --git a/drivers/net/wireless/ath/ath10k/wmi.h b/drivers/net/wireless/ath/ath10k/wmi.h index 36220258e3c7..fa94873fe46f 100644 --- a/drivers/net/wireless/ath/ath10k/wmi.h +++ b/drivers/net/wireless/ath/ath10k/wmi.h @@ -5035,6 +5035,7 @@ struct wmi_vdev_param_map { u32 bw_nss_ratemask; u32 inc_tsf; u32 dec_tsf; + u32 rtt_responder_role; }; #define WMI_VDEV_PARAM_UNSUPPORTED 0 @@ -5374,6 +5375,15 @@ enum wmi_10_4_vdev_param { WMI_10_4_VDEV_PARAM_ATF_SSID_SCHED_POLICY, WMI_10_4_VDEV_PARAM_DISABLE_DYN_BW_RTS, WMI_10_4_VDEV_PARAM_TSF_DECREMENT, + WMI_10_4_VDEV_PARAM_SELFGEN_FIXED_RATE, + WMI_10_4_VDEV_PARAM_AMPDU_SUBFRAME_SIZE_PER_AC, + WMI_10_4_VDEV_PARAM_NSS_VHT160, + WMI_10_4_VDEV_PARAM_NSS_VHT80_80, + WMI_10_4_VDEV_PARAM_AMSDU_SUBFRAME_SIZE_PER_AC, + WMI_10_4_VDEV_PARAM_DISABLE_CABQ, + WMI_10_4_VDEV_PARAM_SIFS_TRIGGER_RATE, + WMI_10_4_VDEV_PARAM_TX_POWER, + WMI_10_4_VDEV_PARAM_ENABLE_DISABLE_RTT_RESPONDER_ROLE, }; #define WMI_VDEV_PARAM_TXBF_SU_TX_BFEE BIT(0)