From patchwork Fri May 22 07:24:23 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Pradeep Kumar Chitrapu X-Patchwork-Id: 11564871 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 4E92A90 for ; Fri, 22 May 2020 07:25:15 +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 134DB20679 for ; Fri, 22 May 2020 07:25:15 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="ZsSvYc0k"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=mg.codeaurora.org header.i=@mg.codeaurora.org header.b="GvKSFs6r" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 134DB20679 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:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version: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=yhfH2ZUcLHp0ioougwI961SP18vfePe22b5pf8whVRE=; b=ZsSvYc0kQO3hnS i1M1i2jS82Fiwnb9uVjGbgGYcGOeOUs4jr75qLZjUYroLHMOXVsbxMBWcTJTj0mtfZ3g63eASiZxk PHMtJhtBorh/y+KDelMdBnm/2ct8/DfhwTWVwcdlmmEVc/BlbUGxIP4GVZ/3n+kz+CBcMV0dQMXDW t+Cq5F3wfoCf7JZNx1eEVO9lG0eYbqmDt8zXrV53OIYAnZvTGWdR/yCqizsdUCEOX2xurW31HLQVs lu533Lw6TmkaPmWiTjY+TxYRY9fvrY+swfn30uCllrbfwMT0NcSKi9sfdFbcxf+8j6R563Wl0XVD3 v24XBUsZkQecPwyjd2sw==; 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 1jc23L-00052d-1x; Fri, 22 May 2020 07:25:11 +0000 Received: from mail27.static.mailgun.info ([104.130.122.27]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jc23A-0003JS-T6 for ath11k@lists.infradead.org; Fri, 22 May 2020 07:25:06 +0000 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1590132303; h=Content-Transfer-Encoding: Content-Type: MIME-Version: References: In-Reply-To: Message-Id: Date: Subject: Cc: To: From: Sender; bh=GkPPDowv8fF+eoncLt6ZIE6pGVBOH059qNd10rnxrkQ=; b=GvKSFs6rM/6GoHPvvLO5J7ezqMqiBHZQ8rHSFE2tlbQgHVAJUlf64CDZUrCNCV5VWw9EB5zV 4NP/MT4SbHwKUaVt8LTlEg6TDhu+mGrzars6OlBFkBPA4lpayRfA7FKzvtOHpnF4mOLGK2c3 PbXEdu5hDznrXphkcVtv34VVfVg= X-Mailgun-Sending-Ip: 104.130.122.27 X-Mailgun-Sid: WyJmOGQ2ZiIsICJhdGgxMWtAbGlzdHMuaW5mcmFkZWFkLm9yZyIsICJiZTllNGEiXQ== Received: from smtp.codeaurora.org (ec2-35-166-182-171.us-west-2.compute.amazonaws.com [35.166.182.171]) by mxa.mailgun.org with ESMTP id 5ec77e3c.7f9993a5bc38-smtp-out-n01; Fri, 22 May 2020 07:24:44 -0000 (UTC) Received: by smtp.codeaurora.org (Postfix, from userid 1001) id 98E6EC433C9; Fri, 22 May 2020 07:24:44 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-caf-mail-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=2.0 tests=ALL_TRUSTED,SPF_NONE, URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from pradeepc2-linux.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: pradeepc) by smtp.codeaurora.org (Postfix) with ESMTPSA id B06B9C433C8; Fri, 22 May 2020 07:24:42 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org B06B9C433C8 Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; spf=none smtp.mailfrom=pradeepc@codeaurora.org From: Pradeep Kumar Chitrapu To: Johannes Berg , ath11k@lists.infradead.org Subject: [PATCH v2 1/9] cfg80211: Add new channel flag to identify 6GHz PSC channel Date: Fri, 22 May 2020 00:24:23 -0700 Message-Id: <20200522072431.27601-2-pradeepc@codeaurora.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200522072431.27601-1-pradeepc@codeaurora.org> References: <20200522072431.27601-1-pradeepc@codeaurora.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200522_002504_076351_FB1CE809 X-CRM114-Status: GOOD ( 13.94 ) X-Spam-Score: 0.0 (/) X-Spam-Report: SpamAssassin version 3.4.4 on bombadil.infradead.org summary: Content analysis details: (0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [104.130.122.27 listed in list.dnswl.org] 0.0 RCVD_IN_MSPIKE_H4 RBL: Very Good reputation (+4) [104.130.122.27 listed in wl.mailspike.net] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid 0.0 RCVD_IN_MSPIKE_WL Mailspike good senders 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: Pradeep Kumar Chitrapu , linux-wireless@vger.kernel.org Sender: "ath11k" Errors-To: ath11k-bounces+patchwork-ath11k=patchwork.kernel.org@lists.infradead.org 6GHz channels are divided into preferred scanning channels(PSC) and non-PSC channels. One in every four 20MHz channels is a PSC. Spec mandates to use only PSC channels as primary channels for setting up BSS on 6GHz only AP. The set of 20 MHz channels in the 6 GHz band, with channel center frequency, ch_a = Channel starting frequency – 55 + 80 × n (MHz) are referred to as preferred scanning channels (PSCs) where, n = 1, …, 15 as per IEEE P802.11ax/D6.0. This flag also will be used when making scanning decision on 6GHz channels. Signed-off-by: Pradeep Kumar Chitrapu --- include/net/cfg80211.h | 2 ++ net/wireless/reg.c | 19 +++++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h index fd6a973b1249..ca3e9df7adfe 100644 --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h @@ -96,6 +96,7 @@ struct wiphy; * @IEEE80211_CHAN_NO_10MHZ: 10 MHz bandwidth is not permitted * on this channel. * @IEEE80211_CHAN_NO_HE: HE operation is not permitted on this channel. + * @IEEE80211_CHAN_PSC: 6GHz Channel is Preferred Scanning Channel(PSC) * */ enum ieee80211_channel_flags { @@ -113,6 +114,7 @@ enum ieee80211_channel_flags { IEEE80211_CHAN_NO_20MHZ = 1<<11, IEEE80211_CHAN_NO_10MHZ = 1<<12, IEEE80211_CHAN_NO_HE = 1<<13, + IEEE80211_CHAN_PSC = 1<<14, }; #define IEEE80211_CHAN_NO_HT40 \ diff --git a/net/wireless/reg.c b/net/wireless/reg.c index 0d74a31ef0ab..4ebaa57e60e4 100644 --- a/net/wireless/reg.c +++ b/net/wireless/reg.c @@ -2023,6 +2023,21 @@ static bool is_ht40_allowed(struct ieee80211_channel *chan) return true; } +static bool reg_is_6ghz_channel_psc(struct ieee80211_channel *chan) +{ + /* + * From IEEE P802.11ax/D6.0: The set of 20 MHz channels in the 6 GHz + * band, with channel center frequency, ch_a = Channel starting + * frequency – 55 + 80 × n (MHz) are referred to as preferred scanning + * channels (PSCs). Channel starting frequency is defined in 27.3.23.2 + * (Channel allocation in the 6 GHz band), and n = 1, …, 15. + */ + if (!(((chan->center_freq - 5940 + 55) >> 4) % 5)) + return true; + + return false; +} + static void reg_process_ht_flags_channel(struct wiphy *wiphy, struct ieee80211_channel *channel) { @@ -2305,6 +2320,10 @@ static void handle_channel_custom(struct wiphy *wiphy, else chan->flags |= map_regdom_flags(reg_rule->flags) | bw_flags; + if (chan->band == NL80211_BAND_6GHZ && + reg_is_6ghz_channel_psc(chan)) + chan->flags |= IEEE80211_CHAN_PSC; + chan->max_antenna_gain = (int) MBI_TO_DBI(power_rule->max_antenna_gain); chan->max_reg_power = chan->max_power = (int) MBM_TO_DBM(power_rule->max_eirp);