From patchwork Tue Oct 29 11:43:24 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sathishkumar Muruganandam X-Patchwork-Id: 11217775 X-Patchwork-Delegate: kvalo@adurom.com 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 93EF11390 for ; Tue, 29 Oct 2019 11:43:48 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 7018321924 for ; Tue, 29 Oct 2019 11:43:48 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="Z56AJQJp"; dkim=fail reason="key not found in DNS" (0-bit key) header.d=codeaurora.org header.i=@codeaurora.org header.b="MKGnOroA"; dkim=fail reason="key not found in DNS" (0-bit key) header.d=codeaurora.org header.i=@codeaurora.org header.b="VGrLhjoW" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7018321924 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=ath11k-bounces+patchwork-ath11k=patchwork.kernel.org@lists.infradead.org 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=6JbVEyye38DPVnrPxhnXo7yaXUamyOgv//+3uJ5y2D0=; b=Z56AJQJpGONFtBn9cMA7K9dBhZ 7YLLklpgf5HBWCF0FTbByuN/B/fRsMvQEtBE1+15Z5BcM5CbB/edxC26FWHwhOmkfom4us7F0KfxG d1U1DlCb2K2LAEWq6srkEcJOUf8V99D/DnBK0Rl6LHu8D/NwEN75AB2LkKwp41+u2oAm391fRTlCZ FW5Rhg2RIpYINS1APtCQz+PsYb67wzxKX2O7CG7IOpimz6/42BpU5LeWcOgogIWKiI04ZDgl6HU6o 3nstsVdp55v8vvw0+TLrt0U7yRLfhONa1gO4U0KpoQkcnUmRDjUIj8tGX/l+TsVDMWkAWDhotWn/6 AososBGQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1iPPuc-0000Y0-V8; Tue, 29 Oct 2019 11:43:46 +0000 Received: from smtp.codeaurora.org ([198.145.29.96]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1iPPuZ-0000Vx-Ok for ath11k@lists.infradead.org; Tue, 29 Oct 2019 11:43:45 +0000 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 7B3F560F94; Tue, 29 Oct 2019 11:43:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1572349423; bh=vYp+JoyOs7ouIAI5gIlph6mt4Kl7pyRftCyg64wiTMM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MKGnOroAxEyKVO0wd8QE0hARwGCGdhwSvkqiWjLfD3f9qsP6F19BLxktlVRxAa7L0 dWIzhfNxUeVzLBaxy0dPYIKf9GiGntRtkBaTTDlNegbCv6E47RCa+E9Y9XMI4IaLiY 1LKfjYMZRWRrhSyU+bO8WmxjVmI+z5xc8Io2r5DA= 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 murugana-linux.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: murugana@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id BF21360F7E; Tue, 29 Oct 2019 11:43:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1572349422; bh=vYp+JoyOs7ouIAI5gIlph6mt4Kl7pyRftCyg64wiTMM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VGrLhjoWhbTqRh2mdONdEOQ5XhKbMUYyqI0jljaxlE5L640H7Uh8x4M2FNgtmvmWN 6TMa7+Q7H0WfASjwVanJNL4DsdCdwFqvclcFD6vUe6JtG7dum/9SMzTy5W4BaFZTCO 9UDU22JOhyQmY8qOKGmOWbqyBtb0Rb/z5/pIbKXo= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org BF21360F7E 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=murugana@codeaurora.org From: Sathishkumar Muruganandam To: ath11k@lists.infradead.org Subject: [PATCH 1/2] nl80211: add Wide Band Scan support Date: Tue, 29 Oct 2019 17:13:24 +0530 Message-Id: <1572349405-4653-2-git-send-email-murugana@codeaurora.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1572349405-4653-1-git-send-email-murugana@codeaurora.org> References: <1572349405-4653-1-git-send-email-murugana@codeaurora.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20191029_044343_845182_D7F6BCA4 X-CRM114-Status: GOOD ( 16.21 ) X-Spam-Score: -2.5 (--) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (-2.5 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [198.145.29.96 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature X-BeenThere: ath11k@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Sathishkumar Muruganandam MIME-Version: 1.0 Sender: "ath11k" Errors-To: ath11k-bounces+patchwork-ath11k=patchwork.kernel.org@lists.infradead.org New nl80211 ext_feature and scan_flag added to support wide band scan which allows driver to scan on requested channel with corresponding phy mode/bandwidth (40Mhz, 80Mhz). To handle center frequency of 80Mhz channel, struct cfg80211_chan_def is included in cfg80211_scan_request. Signed-off-by: Sathishkumar Muruganandam --- include/net/cfg80211.h | 2 ++ include/uapi/linux/nl80211.h | 7 +++++ net/mac80211/scan.c | 2 ++ net/wireless/nl80211.c | 68 ++++++++++++++++++++++++++++---------------- 4 files changed, 55 insertions(+), 24 deletions(-) diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h index 8140c4837122..fab7186dcd87 100644 --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h @@ -1822,6 +1822,7 @@ struct cfg80211_scan_info { * @channels: channels to scan on. * @n_channels: total number of channels to scan * @scan_width: channel width for scanning + * @chandef: defines the channel to do wide band scan * @ie: optional information element(s) to add into Probe Request or %NULL * @ie_len: length of ie in octets * @duration: how long to listen on each channel, in TUs. If @@ -1848,6 +1849,7 @@ struct cfg80211_scan_request { int n_ssids; u32 n_channels; enum nl80211_bss_scan_width scan_width; + struct cfg80211_chan_def *chandef; const u8 *ie; size_t ie_len; u16 duration; diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h index 822851d369ab..26580f533138 100644 --- a/include/uapi/linux/nl80211.h +++ b/include/uapi/linux/nl80211.h @@ -5452,6 +5452,9 @@ 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_WIDE_BAND_SCAN: Driver/device supports wide band scan + * on a frequency along with its corresponding phymode (40Mhz, 80Mhz) + * * @NUM_NL80211_EXT_FEATURES: number of extended features. * @MAX_NL80211_EXT_FEATURES: highest extended feature index. */ @@ -5497,6 +5500,7 @@ 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_WIDE_BAND_SCAN, /* add new features before the definition below */ NUM_NL80211_EXT_FEATURES, @@ -5608,6 +5612,8 @@ enum nl80211_timeout_reason { * @NL80211_SCAN_FLAG_MIN_PREQ_CONTENT: minimize probe request content to * only have supported rates and no additional capabilities (unless * added by userspace explicitly.) + * @NL80211_SCAN_FLAG_WIDE_BAND_SCAN: This flag intends the driver to perform + * wide band scan only if the driver supports it. */ enum nl80211_scan_flags { NL80211_SCAN_FLAG_LOW_PRIORITY = 1<<0, @@ -5623,6 +5629,7 @@ enum nl80211_scan_flags { NL80211_SCAN_FLAG_HIGH_ACCURACY = 1<<10, NL80211_SCAN_FLAG_RANDOM_SN = 1<<11, NL80211_SCAN_FLAG_MIN_PREQ_CONTENT = 1<<12, + NL80211_SCAN_FLAG_WIDE_BAND_SCAN = 1<<13, }; /** diff --git a/net/mac80211/scan.c b/net/mac80211/scan.c index adf94ba1ed77..00ee715aa012 100644 --- a/net/mac80211/scan.c +++ b/net/mac80211/scan.c @@ -662,11 +662,13 @@ static int __ieee80211_start_scan(struct ieee80211_sub_if_data *sdata, local->hw_scan_req = kmalloc( sizeof(*local->hw_scan_req) + + sizeof(*req->chandef) + req->n_channels * sizeof(req->channels[0]) + local->hw_scan_ies_bufsize, GFP_KERNEL); if (!local->hw_scan_req) return -ENOMEM; + local->hw_scan_req->req.chandef = req->chandef; local->hw_scan_req->req.ssids = req->ssids; local->hw_scan_req->req.n_ssids = req->n_ssids; ies = (u8 *)local->hw_scan_req + diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index 92e06482563c..429505b5d627 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c @@ -7407,7 +7407,10 @@ nl80211_check_scan_flags(struct wiphy *wiphy, struct wireless_dev *wdev, NL80211_EXT_FEATURE_SCAN_RANDOM_SN) || !nl80211_check_scan_feat(wiphy, *flags, NL80211_SCAN_FLAG_MIN_PREQ_CONTENT, - NL80211_EXT_FEATURE_SCAN_MIN_PREQ_CONTENT)) + NL80211_EXT_FEATURE_SCAN_MIN_PREQ_CONTENT) || + !nl80211_check_scan_feat(wiphy, *flags, + NL80211_SCAN_FLAG_WIDE_BAND_SCAN, + NL80211_EXT_FEATURE_WIDE_BAND_SCAN)) return -EOPNOTSUPP; if (*flags & NL80211_SCAN_FLAG_RANDOM_ADDR) { @@ -7430,10 +7433,12 @@ static int nl80211_trigger_scan(struct sk_buff *skb, struct genl_info *info) struct cfg80211_registered_device *rdev = info->user_ptr[0]; struct wireless_dev *wdev = info->user_ptr[1]; struct cfg80211_scan_request *request; + struct cfg80211_chan_def chandef; struct nlattr *attr; struct wiphy *wiphy; - int err, tmp, n_ssids = 0, n_channels, i; + int err, tmp, n_ssids = 0, n_channels = 0, i; size_t ie_len; + bool chandef_found = false; wiphy = &rdev->wiphy; @@ -7448,7 +7453,14 @@ static int nl80211_trigger_scan(struct sk_buff *skb, struct genl_info *info) goto unlock; } - if (info->attrs[NL80211_ATTR_SCAN_FREQUENCIES]) { + if (info->attrs[NL80211_ATTR_WIPHY_FREQ]) { + n_channels = 1; + if (nl80211_parse_chandef(rdev, info, &chandef)) { + err = -EINVAL; + goto unlock; + } + chandef_found = true; + } else if (info->attrs[NL80211_ATTR_SCAN_FREQUENCIES]) { n_channels = validate_scan_freqs( info->attrs[NL80211_ATTR_SCAN_FREQUENCIES]); if (!n_channels) { @@ -7479,6 +7491,7 @@ static int nl80211_trigger_scan(struct sk_buff *skb, struct genl_info *info) } request = kzalloc(sizeof(*request) + + sizeof(*request->chandef) + sizeof(*request->ssids) * n_ssids + sizeof(*request->channels) * n_channels + ie_len, GFP_KERNEL); @@ -7487,6 +7500,12 @@ static int nl80211_trigger_scan(struct sk_buff *skb, struct genl_info *info) goto unlock; } + if (chandef_found) { + request->chandef = &chandef; + request->channels[0] = chandef.chan; + request->n_channels = n_channels; + } + if (n_ssids) request->ssids = (void *)&request->channels[n_channels]; request->n_ssids = n_ssids; @@ -7517,7 +7536,7 @@ static int nl80211_trigger_scan(struct sk_buff *skb, struct genl_info *info) request->channels[i] = chan; i++; } - } else { + } else if (!chandef_found) { enum nl80211_band band; /* all channels */ @@ -7540,31 +7559,32 @@ static int nl80211_trigger_scan(struct sk_buff *skb, struct genl_info *info) } } - if (!i) { - err = -EINVAL; - goto out_free; - } - - request->n_channels = i; - - wdev_lock(wdev); - if (!cfg80211_off_channel_oper_allowed(wdev)) { - struct ieee80211_channel *chan; - - if (request->n_channels != 1) { - wdev_unlock(wdev); - err = -EBUSY; + if (!chandef_found) { + if (!i) { + err = -EINVAL; goto out_free; } + request->n_channels = i; - chan = request->channels[0]; - if (chan->center_freq != wdev->chandef.chan->center_freq) { - wdev_unlock(wdev); - err = -EBUSY; - goto out_free; + wdev_lock(wdev); + if (!cfg80211_off_channel_oper_allowed(wdev)) { + struct ieee80211_channel *chan; + + if (request->n_channels != 1) { + wdev_unlock(wdev); + err = -EBUSY; + goto out_free; + } + + chan = request->channels[0]; + if (chan->center_freq != wdev->chandef.chan->center_freq) { + wdev_unlock(wdev); + err = -EBUSY; + goto out_free; + } } + wdev_unlock(wdev); } - wdev_unlock(wdev); i = 0; if (n_ssids) { From patchwork Tue Oct 29 11:43:25 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sathishkumar Muruganandam X-Patchwork-Id: 11217777 X-Patchwork-Delegate: kvalo@adurom.com 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 5CBE215AB for ; Tue, 29 Oct 2019 11:43:57 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 370CA217D9 for ; Tue, 29 Oct 2019 11:43:57 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="hOkdTr1K"; dkim=fail reason="key not found in DNS" (0-bit key) header.d=codeaurora.org header.i=@codeaurora.org header.b="bIF3Pqh1"; dkim=fail reason="key not found in DNS" (0-bit key) header.d=codeaurora.org header.i=@codeaurora.org header.b="FPa+LQB0" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 370CA217D9 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=ath11k-bounces+patchwork-ath11k=patchwork.kernel.org@lists.infradead.org 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=VGG/mWn3cNWPuhHilD4PZqrXSlFVm0jLtMg5X4VKh5g=; b=hOkdTr1KMJNDQ4Rmmwd0WTUTvA tdWQYsefoaibS4+usv8n6YFVdgmcNFX9tm1jHLhUKK17rcRDrCf5/F45ly3+MTnoQAHCn+6MxEqPx D4vllI21k2Ykjd6RhiFPx5wNhFXjyBCoFCYeGGjqwQ9MtcyQ7zPOdaV7V920HVOzIdLW0cvz0vdz1 HTveGjzVR35ID19Uzw5MlroxVE/YBm7UfiTz7iLw7xO+BS5NJ2yVHTTC9p5ygL6vWx2VTJOK+9XZP V4v6HfVlnywx/EB8mwaiegPfvSVzPWUEt6Fe8Une0Guoti5OsQpJNmcomoPwTEQhx+khC6EXlQRSk mWESIKkw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1iPPul-0000bS-A5; Tue, 29 Oct 2019 11:43:55 +0000 Received: from smtp.codeaurora.org ([198.145.29.96]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1iPPuh-0000a0-EV for ath11k@lists.infradead.org; Tue, 29 Oct 2019 11:43:53 +0000 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 1F11F61389; Tue, 29 Oct 2019 11:43:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1572349431; bh=cXuJ9e5wftAJSQP+049qKsJZUlWgpUYplzMsiva7KqA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bIF3Pqh1+/xWzUAa0s6VmXcvUmR8+Llm8ALRs6tukFosdn5kIHp33ogVQ5biO/ea4 hEyjTlspyZAWA1Y7sNaa0LpxK34GmybTfvYmqw5/+5hddlDLLqQZUHPyWxt6fmowHp eHfwpkMFzRcCbZUtZnflgj38RVLiJcPE6Z3tWWjI= 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 murugana-linux.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: murugana@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 6B33861323; Tue, 29 Oct 2019 11:43:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1572349427; bh=cXuJ9e5wftAJSQP+049qKsJZUlWgpUYplzMsiva7KqA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FPa+LQB00vR5FkJ6aCtegH2mZojUgfvRlg9DSxkQ338Zaga/WanaufBAyLboskWho bxGIS3RW/JLptp9/VMxjX9dqluWM+ibmGb4MQCFGrCW1cs0/kqW1jRoAdF1XtxNWed WHmQfsEUxXbIptN4v+yN5iH8O3XfekUwb4eKBbBE= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 6B33861323 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=murugana@codeaurora.org From: Sathishkumar Muruganandam To: ath11k@lists.infradead.org Subject: [PATCH 2/2] ath11k: add Wide Band Scan support Date: Tue, 29 Oct 2019 17:13:25 +0530 Message-Id: <1572349405-4653-3-git-send-email-murugana@codeaurora.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1572349405-4653-1-git-send-email-murugana@codeaurora.org> References: <1572349405-4653-1-git-send-email-murugana@codeaurora.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20191029_044351_531784_F9D058F1 X-CRM114-Status: GOOD ( 17.05 ) X-Spam-Score: -2.5 (--) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (-2.5 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [198.145.29.96 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature X-BeenThere: ath11k@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Sathishkumar Muruganandam MIME-Version: 1.0 Sender: "ath11k" Errors-To: ath11k-bounces+patchwork-ath11k=patchwork.kernel.org@lists.infradead.org Doing wide band scan instead of normal 20Mhz scan before spectral dump, allows to fetch FFT reports for the complete requested bandwidth (40Mhz, 80Mhz). Below are the FW expectations and configs from host to request Wide Band Scan, 1. SCAN_PHYMODE_SUPPORT WMI service bit advertised from FW. 2. SCAN_CHAN_LIST_CMD updated with the phymode and other channel params of the requested channel to do wide band scan. 3. START_SCAN_CMD updated with all the seven supported TLVs and PHYMODE TLV being the last. PHYMODE TLV holds the (wmi_phy_mode + 1) value corresponding to wide band scan channel. Scan flags scan_f_wide_band and scan_f_passive need to be set for wide band scan request from host. In case of supporting NL80211_EXT_FEATURE_WIDE_BAND_SCAN, cfg80211_scan_request holds the cfg80211_chan_def of the requested channel from which we update the center frequencies and phymode params needed for SCAN_CHAN_LIST_CMD and START_SCAN_CMD to FW. Signed-off-by: Sathishkumar Muruganandam --- drivers/net/wireless/ath/ath11k/mac.c | 41 ++++++++++-- drivers/net/wireless/ath/ath11k/wmi.c | 115 +++++++++++++++++++++++++++++++--- drivers/net/wireless/ath/ath11k/wmi.h | 34 +++++++++- 3 files changed, 175 insertions(+), 15 deletions(-) diff --git a/drivers/net/wireless/ath/ath11k/mac.c b/drivers/net/wireless/ath/ath11k/mac.c index 6f82fdbbd358..56cd6f5d8ced 100644 --- a/drivers/net/wireless/ath/ath11k/mac.c +++ b/drivers/net/wireless/ath/ath11k/mac.c @@ -2088,6 +2088,28 @@ static int ath11k_start_scan(struct ath11k *ar, return 0; } +static void ath11k_mac_update_scan_params(struct cfg80211_scan_request *req, + struct scan_req_params *arg) +{ + int i; + struct wmi_chan_info *chan = &arg->chan_list.chan[0]; + enum nl80211_band band; + enum nl80211_chan_width width; + + if (req->chandef) { + band = req->chandef->chan->band; + width = req->chandef->width; + } + + arg->chan_list.num_chan = req->n_channels; + for (i = 0; i < arg->chan_list.num_chan; i++) { + if (req->channels) + chan[i].freq = req->channels[i]->center_freq; + if (req->chandef) + chan[i].phymode = ath11k_phymodes[band][width]; + } +} + static int ath11k_mac_op_hw_scan(struct ieee80211_hw *hw, struct ieee80211_vif *vif, struct ieee80211_scan_request *hw_req) @@ -2144,10 +2166,16 @@ static int ath11k_mac_op_hw_scan(struct ieee80211_hw *hw, arg.scan_flags |= WMI_SCAN_FLAG_PASSIVE; } - if (req->n_channels) { - arg.num_chan = req->n_channels; - for (i = 0; i < arg.num_chan; i++) - arg.chan_list[i] = req->channels[i]->center_freq; + if (req->n_channels) + ath11k_mac_update_scan_params(req, &arg); + + if (req->chandef) { + arg.scan_f_wide_band = true; + arg.scan_f_passive = true; + arg.chandef = req->chandef; + ret = ath11k_wmi_append_scan_chan_list(ar, &arg); + if (ret) + goto exit; } ret = ath11k_start_scan(ar, &arg); @@ -5577,6 +5605,11 @@ static int ath11k_mac_register(struct ath11k *ar) wiphy_ext_feature_set(ar->hw->wiphy, NL80211_EXT_FEATURE_CQM_RSSI_LIST); + if (test_bit(WMI_TLV_SERVICE_SCAN_PHYMODE_SUPPORT, + ar->ab->wmi_sc.svc_map)) + wiphy_ext_feature_set(ar->hw->wiphy, + NL80211_EXT_FEATURE_WIDE_BAND_SCAN); + ar->hw->wiphy->cipher_suites = cipher_suites; ar->hw->wiphy->n_cipher_suites = ARRAY_SIZE(cipher_suites); diff --git a/drivers/net/wireless/ath/ath11k/wmi.c b/drivers/net/wireless/ath/ath11k/wmi.c index ccebf7ce420a..3950c0f94a9e 100644 --- a/drivers/net/wireless/ath/ath11k/wmi.c +++ b/drivers/net/wireless/ath/ath11k/wmi.c @@ -1810,6 +1810,57 @@ int ath11k_wmi_send_peer_assoc_cmd(struct ath11k *ar, return ret; } +int ath11k_wmi_append_scan_chan_list(struct ath11k *ar, + struct scan_req_params *arg) +{ + struct scan_chan_list_params *params; + struct channel_param *ch; + struct cfg80211_chan_def *chandef; + struct ieee80211_channel *channel; + int params_len; + int ret; + + params_len = sizeof(struct scan_chan_list_params) + + arg->chan_list.num_chan * sizeof(struct channel_param); + params = kzalloc(params_len, GFP_KERNEL); + + if (!params) + return -ENOMEM; + + params->pdev_id = ar->pdev->pdev_id; + params->nallchans = arg->chan_list.num_chan; + params->append_chan_list = true; + + ch = params->ch_param; + chandef = arg->chandef; + channel = chandef->chan; + + ch->mhz = arg->chan_list.chan[0].freq; + ch->cfreq1 = chandef->center_freq1; + ch->cfreq2 = chandef->center_freq2; + ch->phy_mode = arg->chan_list.chan[0].phymode; + + ch->dfs_set = + !!(channel->flags & IEEE80211_CHAN_RADAR); + ch->is_chan_passive = !!(channel->flags & + IEEE80211_CHAN_NO_IR); + ch->is_chan_passive |= ch->dfs_set; + ch->minpower = 0; + ch->maxpower = channel->max_power * 2; + ch->maxregpower = channel->max_reg_power * 2; + ch->antennamax = channel->max_antenna_gain * 2; + + ath11k_dbg(ar->ab, ATH11K_DBG_WMI, + "scan chan list %d freq %d cfreq1 %d phymode %d is_dfs_ch %u is_chan_passive %u\n", + params->nallchans, ch->mhz, ch->cfreq1, ch->phy_mode, + ch->dfs_set, ch->is_chan_passive); + + ret = ath11k_wmi_send_scan_chan_list_cmd(ar, params); + kfree(params); + + return ret; +} + void ath11k_wmi_start_scan_init(struct ath11k *ar, struct scan_req_params *arg) { @@ -1922,13 +1973,15 @@ int ath11k_wmi_send_scan_start_cmd(struct ath11k *ar, void *ptr; int i, ret, len; u32 *tmp_ptr; + u8 *phy_ptr; u8 extraie_len_with_pad = 0; + u8 phymode_roundup = 0; len = sizeof(*cmd); len += TLV_HDR_SIZE; - if (params->num_chan) - len += params->num_chan * sizeof(u32); + if (params->chan_list.num_chan) + len += params->chan_list.num_chan * sizeof(u32); len += TLV_HDR_SIZE; if (params->num_ssids) @@ -1944,6 +1997,19 @@ int ath11k_wmi_send_scan_start_cmd(struct ath11k *ar, roundup(params->extraie.len, sizeof(u32)); len += extraie_len_with_pad; + len += TLV_HDR_SIZE; + if (params->scan_f_en_ie_whitelist_in_probe) + len += params->ie_whitelist.num_vendor_oui * + sizeof(struct wmi_vendor_oui); + + len += TLV_HDR_SIZE; + if (params->scan_f_wide_band) + phymode_roundup = + roundup(params->chan_list.num_chan * sizeof(u8), + sizeof(u32)); + + len += phymode_roundup; + skb = ath11k_wmi_alloc_skb(wmi->wmi_sc, len); if (!skb) return -ENOMEM; @@ -1973,7 +2039,7 @@ int ath11k_wmi_send_scan_start_cmd(struct ath11k *ar, cmd->max_scan_time = params->max_scan_time; cmd->probe_delay = params->probe_delay; cmd->burst_duration = params->burst_duration; - cmd->num_chan = params->num_chan; + cmd->num_chan = params->chan_list.num_chan; cmd->num_bssid = params->num_bssid; cmd->num_ssids = params->num_ssids; cmd->ie_len = params->extraie.len; @@ -1981,7 +2047,7 @@ int ath11k_wmi_send_scan_start_cmd(struct ath11k *ar, ptr += sizeof(*cmd); - len = params->num_chan * sizeof(u32); + len = params->chan_list.num_chan * sizeof(u32); tlv = ptr; tlv->header = FIELD_PREP(WMI_TLV_TAG, WMI_TAG_ARRAY_UINT32) | @@ -1989,8 +2055,8 @@ int ath11k_wmi_send_scan_start_cmd(struct ath11k *ar, ptr += TLV_HDR_SIZE; tmp_ptr = (u32 *)ptr; - for (i = 0; i < params->num_chan; ++i) - tmp_ptr[i] = params->chan_list[i]; + for (i = 0; i < params->chan_list.num_chan; ++i) + tmp_ptr[i] = params->chan_list.chan[i].freq; ptr += len; @@ -2042,6 +2108,36 @@ int ath11k_wmi_send_scan_start_cmd(struct ath11k *ar, ptr += extraie_len_with_pad; + len = params->ie_whitelist.num_vendor_oui * sizeof(struct wmi_vendor_oui); + tlv = ptr; + tlv->header = FIELD_PREP(WMI_TLV_TAG, WMI_TAG_ARRAY_STRUCT) | + FIELD_PREP(WMI_TLV_LEN, len); + ptr += TLV_HDR_SIZE; + + if (params->scan_f_en_ie_whitelist_in_probe) { + /* TODO: fill vendor OUIs for probe req ie whitelisting */ + /* currently added for FW TLV validation */ + } + + ptr += cmd->num_vendor_oui * sizeof(struct wmi_vendor_oui); + + len = phymode_roundup; + tlv = ptr; + tlv->header = FIELD_PREP(WMI_TLV_TAG, WMI_TAG_ARRAY_BYTE) | + FIELD_PREP(WMI_TLV_LEN, len); + ptr += TLV_HDR_SIZE; + + /* Wide Band Scan */ + if (params->scan_f_wide_band) { + phy_ptr = (u8 *)ptr; + /* Add PHY mode TLV for wide band scan with phymode + 1 value + * so that phymode '0' is ignored by FW as default value. + */ + for (i = 0; i < params->chan_list.num_chan; ++i) + phy_ptr[i] = params->chan_list.chan[i].phymode + 1; + } + ptr += phymode_roundup; + ret = ath11k_wmi_cmd_send(wmi, skb, WMI_START_SCAN_CMDID); if (ret) { @@ -2129,6 +2225,9 @@ int ath11k_wmi_send_scan_chan_list_cmd(struct ath11k *ar, cmd->pdev_id = chan_list->pdev_id; cmd->num_scan_chans = chan_list->nallchans; + if (chan_list->append_chan_list) + cmd->flags |= WMI_APPEND_TO_EXISTING_CHAN_LIST_FLAG; + ptr = skb->data + sizeof(*cmd); len = sizeof(*chan_info) * chan_list->nallchans; @@ -2181,8 +2280,8 @@ int ath11k_wmi_send_scan_chan_list_cmd(struct ath11k *ar, tchan_info->antennamax); ath11k_dbg(ar->ab, ATH11K_DBG_WMI, - "WMI chan scan list chan[%d] = %u\n", - i, chan_info->mhz); + "WMI chan scan list chan[%d] = %u, chan_info->info %8x\n", + i, chan_info->mhz, chan_info->info); ptr += sizeof(*chan_info); diff --git a/drivers/net/wireless/ath/ath11k/wmi.h b/drivers/net/wireless/ath/ath11k/wmi.h index 4a518d406bc5..989b461394dc 100644 --- a/drivers/net/wireless/ath/ath11k/wmi.h +++ b/drivers/net/wireless/ath/ath11k/wmi.h @@ -2930,6 +2930,12 @@ struct wlan_ssid { }; #define WMI_IE_BITMAP_SIZE 8 +#define PROBE_REQ_MAX_OUIS 16 + +struct wmi_vendor_oui { + u32 tlv_header; + u32 oui_type_subtype; /* vendor OUI type and subtype */ +}; #define WMI_SCAN_MAX_NUM_SSID 0x0A /* prefix used by scan requestor ids on the host */ @@ -3051,6 +3057,22 @@ enum { ((flag) |= (((mode) << WMI_SCAN_DWELL_MODE_SHIFT) & \ WMI_SCAN_DWELL_MODE_MASK)) +struct wmi_chan_info { + u32 freq; + u32 phymode; +}; + +struct wmi_chan_list { + u32 num_chan; + struct wmi_chan_info chan[WLAN_SCAN_MAX_NUM_CHANNELS]; +}; + +struct wmi_probe_req_whitelist { + u32 ie_bitmap[WMI_IE_BITMAP_SIZE]; + u32 num_vendor_oui; + u32 voui[PROBE_REQ_MAX_OUIS]; +}; + struct scan_req_params { u32 scan_id; u32 scan_req_id; @@ -3111,23 +3133,24 @@ struct scan_req_params { scan_f_forced:1, scan_f_2ghz:1, scan_f_5ghz:1, - scan_f_80mhz:1; + scan_f_wide_band:1; }; u32 scan_flags; }; enum scan_dwelltime_adaptive_mode adaptive_dwell_time_mode; u32 burst_duration; - u32 num_chan; u32 num_bssid; u32 num_ssids; u32 n_probes; - u32 chan_list[WLAN_SCAN_MAX_NUM_CHANNELS]; + struct wmi_chan_list chan_list; + struct cfg80211_chan_def *chandef; u32 notify_scan_events; struct wlan_ssid ssid[WLAN_SCAN_MAX_NUM_SSID]; struct wmi_mac_addr bssid_list[WLAN_SCAN_MAX_NUM_BSSID]; struct element_info extraie; struct element_info htcap; struct element_info vhtcap; + struct wmi_probe_req_whitelist ie_whitelist; }; struct wmi_ssid_arg { @@ -3470,9 +3493,12 @@ struct wmi_stop_scan_cmd { struct scan_chan_list_params { u32 pdev_id; u16 nallchans; + bool append_chan_list; struct channel_param ch_param[1]; }; +#define WMI_APPEND_TO_EXISTING_CHAN_LIST_FLAG BIT(0) + struct wmi_scan_chan_list_cmd { u32 tlv_header; u32 num_scan_chans; @@ -4710,6 +4736,8 @@ int ath11k_wmi_vdev_delete(struct ath11k *ar, u8 vdev_id); void ath11k_wmi_start_scan_init(struct ath11k *ar, struct scan_req_params *arg); int ath11k_wmi_send_scan_start_cmd(struct ath11k *ar, struct scan_req_params *params); +int ath11k_wmi_append_scan_chan_list(struct ath11k *ar, + struct scan_req_params *params); int ath11k_wmi_send_scan_stop_cmd(struct ath11k *ar, struct scan_cancel_param *param); int ath11k_wmi_send_wmm_update_cmd_tlv(struct ath11k *ar, u32 vdev_id,