Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp2864915ybk; Mon, 18 May 2020 09:45:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJztXjr+nhXRFEptTuVC3VvvwfcMl7aROG3mrEXqQts0L68A7cdr6sLMKtTIvXUJns8MN4+b X-Received: by 2002:a50:9e2c:: with SMTP id z41mr13800880ede.193.1589820354799; Mon, 18 May 2020 09:45:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589820354; cv=none; d=google.com; s=arc-20160816; b=TY2GxuWvMbPvPXpF0uXKIeGwjWigta8WdU+ENn+3ciYD4W9dwWrMu+6txJDZ8P8egC IxIQ9WMgVbitRmKoUPMMffGqzUD+AuvLSK7cr1CcdY1Z1MZ8DznOs5zyMFidjtn0ST34 veDyy3muYKGnj+cN9zCQm0LKJF/ZC/BkXu/U+MhEHv+HZ9qZ/iZIINIdFnrrpvE+nUD7 0FG5lx4/b+WkpdMyNFRwNJVWdx4MduyeG/zUQR9UTEzXQ9ArzNmIhGuIcKfcA15pBFgx 17Rm9I4Z6LFNaLuXzjRlYgVASB9yx3hnTb/yirwUySnwIEsj9yJ3qnqycRl5T0SWhbkz fw9w== 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=GkPPDowv8fF+eoncLt6ZIE6pGVBOH059qNd10rnxrkQ=; b=uiKO2FPOEpoS0PTP03K1hCxkH/CITNt3CZjeNE351CA1GrjeRx+YTwujklGf5HAumD jeoqtgWByBtNoEdwD3mQZ4o8I9GNRKJ9lmFaHNiBe0i4as5TbRgEs0n+8kegMd2i1UlX y7oeQngX4yjBF3NBURPDArxGU90yvpNLzLLictW7N/4pARt3jYN+uDR7uz/m1Ziv4FOo 8lt8IHrg6ijFv1lrRGWf9BzmVflQJ8I2wdJmq1p/CKAGd8+gIWMHM5ms+fePnjOAKooj IcMtKhYhKrWSQoz4FpJ/0htiuGba8Ig0vfeNGy2JA0ZlnFw+hJpDPHwHZ21TZEITWcUi 9KdQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@mg.codeaurora.org header.s=smtp header.b=DpbFBNKx; 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 d7si2728945edt.176.2020.05.18.09.45.18; Mon, 18 May 2020 09:45:54 -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=DpbFBNKx; 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 S1728198AbgERQog (ORCPT + 99 others); Mon, 18 May 2020 12:44:36 -0400 Received: from mail26.static.mailgun.info ([104.130.122.26]:62346 "EHLO mail26.static.mailgun.info" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727035AbgERQof (ORCPT ); Mon, 18 May 2020 12:44:35 -0400 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1589820274; h=Content-Transfer-Encoding: Content-Type: MIME-Version: References: In-Reply-To: Message-Id: Date: Subject: Cc: To: From: Sender; bh=GkPPDowv8fF+eoncLt6ZIE6pGVBOH059qNd10rnxrkQ=; b=DpbFBNKxWLUS/h8WncNd9VfhyxFHqfmJ/8bjxNpAqz1qZmpfknP6CuXue2j0SSIn4VkMDRWl d2bpd5FgO0qDMjm/RHINcAR5AmItMZ6wQGUy1v4HBfeTvW80yXgRygDlW1S3wOSpEFmmhMn8 eiS5jXjKyAwz639He6tHaWxsvBM= X-Mailgun-Sending-Ip: 104.130.122.26 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 mxa.mailgun.org with ESMTP id 5ec2bb71.7fdc5a3263b0-smtp-out-n05; Mon, 18 May 2020 16:44:33 -0000 (UTC) Received: by smtp.codeaurora.org (Postfix, from userid 1001) id 6ADA8C432C2; Mon, 18 May 2020 16:44:33 +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 2D349C44793; Mon, 18 May 2020 16:44:32 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 2D349C44793 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 1/9] cfg80211: Add new channel flag to identify 6GHz PSC channel Date: Mon, 18 May 2020 09:44:16 -0700 Message-Id: <20200518164424.29497-2-pradeepc@codeaurora.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200518164424.29497-1-pradeepc@codeaurora.org> References: <20200518164424.29497-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.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); -- 2.17.1