Received: by 2002:a25:ef43:0:0:0:0:0 with SMTP id w3csp245495ybm; Tue, 26 May 2020 15:49:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw9fJzruY46PVHlA0PvdWsc0pS1NcRmhTNaQxOhFYDpblQRwKsgjyxiPPtWJdFoUitUZLv8 X-Received: by 2002:a17:906:350c:: with SMTP id r12mr3008668eja.516.1590533372288; Tue, 26 May 2020 15:49:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590533372; cv=none; d=google.com; s=arc-20160816; b=XQKLoO1QDkx0a6ISUFF5frgMKC0kOnAnpo80GPJa0S0x9RVUhIH5dtAYsm+piHHrgL CxQk5vjbonhTAAFa1waLxW/cp3kGT0goBD0lH3dNCZBaxzqIfJbnZ+WU/3C+0X5ufo5/ cq1soo4xmRMLGZhFT5gH2lrXUV+6ScVGqHmDrdG97eoYp11w+ZIgWC/vp2BiXCFtcrLG zvx7yzgKjwWUAmZblp4NDiNukCBTxgVv8AENTxfTnwy+7SNSQqbAzL480rmgL6ZZeZyx 5R0ZLUOQsxxI0g9baaSF1UX4oofNG0Cun70P/R/QrYDym5qa0IIuywKXKEse229m3TDK 4vYQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dmarc-filter:dkim-signature; bh=BKTf5sbZpwUcA83Stdp1FDd4+6uYo4GAbXrDP5BPwgg=; b=YHvlPkvzXh/n6gSyZeCdebLFSEUgitc14claH/ShwtLt4+cChehz1oGr/MuiQHRAbP 2D7c62SUPOj78AYzuA9DfPTGM1RBL7XgoW3KISQYvSeVnJisEDbNfsEUpXWmqQRn+ED3 jkYBw9FHWocjBrnCTqCkr4NfkJ7Yo2kB8zc88w5/Y+MFn2GtZOYaHogNYSRF/k1wR6i1 mF59EJ/XExSwP3F3YBM0cbIgaSsInCkuUh6ueF6EtHM+GvFsom5AjVvOUBFaK/OUO8s4 S9am4YlwvJD2QD66u7NFt5E9IU+aBzQaVWUWNmqVTo5YsYt6v8oR8GUZ2J0ah7srQqXT jfiA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@mg.codeaurora.org header.s=smtp header.b=v97PhJio; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y24si382294eju.659.2020.05.26.15.49.08; Tue, 26 May 2020 15:49:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=fail header.i=@mg.codeaurora.org header.s=smtp header.b=v97PhJio; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2404428AbgEZWr6 (ORCPT + 99 others); Tue, 26 May 2020 18:47:58 -0400 Received: from m43-7.mailgun.net ([69.72.43.7]:12951 "EHLO m43-7.mailgun.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389755AbgEZWr5 (ORCPT ); Tue, 26 May 2020 18:47:57 -0400 X-Greylist: delayed 300 seconds by postgrey-1.27 at vger.kernel.org; Tue, 26 May 2020 18:47:38 EDT DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1590533276; h=Content-Transfer-Encoding: Content-Type: MIME-Version: References: In-Reply-To: Message-Id: Date: Subject: Cc: To: From: Sender; bh=BKTf5sbZpwUcA83Stdp1FDd4+6uYo4GAbXrDP5BPwgg=; b=v97PhJioI22OZtGppp0cLPBgQHWkRoi+NriMy190jCJXVjoPARyl1J8FycZhTK3m7bmo2USs erocn/NeBeEUGwqx1lgZMPkSXx7gG0VlUh/QVT4Dg+0V/fuWhYWl1cwBFuv+Q1tLBmr2x7rx ZEjxmN71w1rfrhGDjqt8V7d6rSc= X-Mailgun-Sending-Ip: 69.72.43.7 X-Mailgun-Sid: WyI3YTAwOSIsICJsaW51eC13aXJlbGVzc0B2Z2VyLmtlcm5lbC5vcmciLCAiYmU5ZTRhIl0= Received: from smtp.codeaurora.org (ec2-35-166-182-171.us-west-2.compute.amazonaws.com [35.166.182.171]) by smtp-out-n01.prod.us-west-2.postgun.com with SMTP id 5ecd9b5f5086732481801082 (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Tue, 26 May 2020 22:42:39 GMT Received: by smtp.codeaurora.org (Postfix, from userid 1001) id 2BEEFC433AF; Tue, 26 May 2020 22:42:39 +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 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 7DD74C433C9; Tue, 26 May 2020 22:42:36 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 7DD74C433C9 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 Cc: linux-wireless@vger.kernel.org, Pradeep Kumar Chitrapu Subject: [PATCH v3 1/9] cfg80211: Add helper function to identify 6GHz PSC channel Date: Tue, 26 May 2020 15:42:09 -0700 Message-Id: <20200526224217.11119-2-pradeepc@codeaurora.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200526224217.11119-1-pradeepc@codeaurora.org> References: <20200526224217.11119-1-pradeepc@codeaurora.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.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.1. This function can be used by drivers or cfg80211 when making scanning decision on 6GHz channels. Signed-off-by: Pradeep Kumar Chitrapu --- v3: - update channel starting frequency from 5945 to 5950 as per IEEE P802.11ax/D6.1 - Define helper function and remove cahnnel flag PSC include/net/cfg80211.h | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h index fd6a973b1249..bd27020ea8c9 100644 --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h @@ -5281,6 +5281,30 @@ ieee80211_get_channel(struct wiphy *wiphy, int freq) return ieee80211_get_channel_khz(wiphy, MHZ_TO_KHZ(freq)); } +/** + * ieee80211_is_channel_psc - is 6ghz channel a Preferred Scanning Channel (PSC) + * + * @chan: struct ieee80211_channel to determine + * Return: True if 6ghz channel is a PSC channel. False for the rest. + */ +static inline bool ieee80211_is_channel_psc(struct ieee80211_channel *chan) +{ + if (chan->band != NL80211_BAND_6GHZ) + return false; + + /* + * From IEEE P802.11ax/D6.1: 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 - 5950 + 55) >> 4) % 5)) + return true; + + return false; +} + /** * ieee80211_get_response_rate - get basic rate for a given rate * -- 2.17.1