From patchwork Fri Sep 21 00:30:11 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: 10608893 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 8D4A214BD for ; Fri, 21 Sep 2018 00:30:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 72C062E036 for ; Fri, 21 Sep 2018 00:30:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 677722E07A; Fri, 21 Sep 2018 00:30:54 +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 F24EA2E036 for ; Fri, 21 Sep 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=MPp5jnSQ4q1IO93J2/cgb0lRJru9DSPYJqKBr5OKUV4=; b=ZAT9asTNbcHpk+kSKfGsrvECNv 9JZkZ50n0/vKAhl4eDVcL2V1NfTsD48NnpudDX9MNcOxEKG6kHQygDWeBqW62529V+Rni1uOlYLIX KGz5a2mtPVjQbFm3sB7inPCz/8Be0jkf6iVuGnGvA+AwN/EoT25rMC6PtOZymrImmDnOE4uy59i10 RWdJPXye2q+F+EFH2DljcIoTEquJo6qwI1S47kRRuzG71Ao24ylTa1hpML02igkyTCt14sMCTsNTi wR8hMZSu2DUmM9VNc0tmOI6Raobaa9V6xyreZ+quJGuoP4FEIxEZDOxyjxv+h03s6xshbV0iTCUz+ hiB/0Ong==; 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 1g39LM-0005zw-Fp; Fri, 21 Sep 2018 00:30:48 +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 1g39L3-0005sW-Cc for ath10k@lists.infradead.org; Fri, 21 Sep 2018 00:30:33 +0000 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id C691F60D6F; Fri, 21 Sep 2018 00:30:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1537489820; bh=eaEzQwTlV8HCGlxTrgZJ2KfRmCpiLt47gw4zH05S450=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JkJ0TjHugqZs0Nragkp48Wx78G/VYh1GSY9MeoS0+P3+fN1z1Ry+KU04K4EY/fWJq nlGGXQodtACJH//Bof98caj3Q+GgpEiRsCZlBqdSdWx6rjlOCWoMn8zy51sDh/Y+Ts tb4V6xlGCfCApNbvdA2wvAD0tD7wre9k6l8hjhnk= Received: from pradeepc-linux.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: pradeepc@codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 2D08560D2E; Fri, 21 Sep 2018 00:30:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1537489819; bh=eaEzQwTlV8HCGlxTrgZJ2KfRmCpiLt47gw4zH05S450=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YWRaD8Q5vsqdSw5fPinoPQ011VoH+CcJRRwARcqse1BMj8PDeRZZIbqICkZwh01OV w9cQRnlFoHNtla8xgPdUCwKgcdDtun97ceipldJHhasIDwI0K9Igp5EQxzqrDuNu+x 3XYJYSnX7uBpwjpxoEciVtbHic+vkEGUfgfH2H28= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 2D08560D2E 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=pradeepc@codeaurora.org From: Pradeep Kumar Chitrapu To: Johannes Berg , ath10k@lists.infradead.org Subject: [PATCH v5 3/3] ath10k: Add support to configure ftm responder role Date: Thu, 20 Sep 2018 17:30:11 -0700 Message-Id: <1537489811-5752-4-git-send-email-pradeepc@codeaurora.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1537489811-5752-1-git-send-email-pradeepc@codeaurora.org> References: <1537489811-5752-1-git-send-email-pradeepc@codeaurora.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180920_173029_526990_15562D02 X-CRM114-Status: GOOD ( 12.75 ) 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, David Spinadel , Johannes Berg 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 FTM responder functionality. ath10k disables it at the time of interface creation. Supported FW: 10.4 Tested on QCA9984 with firmware: 10.4-3.6-00144 Signed-off-by: Pradeep Kumar Chitrapu --- v5, v4, v3, v2: - no changes drivers/net/wireless/ath/ath10k/core.h | 1 + drivers/net/wireless/ath/ath10k/mac.c | 28 ++++++++++++++++++++++++++++ drivers/net/wireless/ath/ath10k/wmi.c | 4 ++++ drivers/net/wireless/ath/ath10k/wmi.h | 10 ++++++++++ 4 files changed, 43 insertions(+) diff --git a/drivers/net/wireless/ath/ath10k/core.h b/drivers/net/wireless/ath/ath10k/core.h index f6e5c29f74e7..ba3a5a7e6309 100644 --- a/drivers/net/wireless/ath/ath10k/core.h +++ b/drivers/net/wireless/ath/ath10k/core.h @@ -567,6 +567,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 97548f96a2f7..d56a3c2dcbb1 100644 --- a/drivers/net/wireless/ath/ath10k/mac.c +++ b/drivers/net/wireless/ath/ath10k/mac.c @@ -5260,6 +5260,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); @@ -5533,6 +5544,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); @@ -8482,6 +8507,9 @@ int ath10k_mac_register(struct ath10k *ar) if (test_bit(WMI_SERVICE_TX_DATA_ACK_RSSI, ar->wmi.svc_map)) wiphy_ext_feature_set(ar->hw->wiphy, NL80211_EXT_FEATURE_DATA_ACK_SIGNAL_SUPPORT); + if (test_bit(WMI_SERVICE_RTT, ar->wmi.svc_map)) + wiphy_ext_feature_set(ar->hw->wiphy, + NL80211_EXT_FEATURE_ENABLE_FTM_RESPONDER); /* * on LL hardware queues are managed entirely by the FW diff --git a/drivers/net/wireless/ath/ath10k/wmi.c b/drivers/net/wireless/ath/ath10k/wmi.c index 0f9fccc6322b..07e5ea47866f 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 15622943a885..6007e64ee0d3 100644 --- a/drivers/net/wireless/ath/ath10k/wmi.h +++ b/drivers/net/wireless/ath/ath10k/wmi.h @@ -5048,6 +5048,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 @@ -5387,6 +5388,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)