2020-05-22 07:25:23

by Pradeep Kumar Chitrapu

[permalink] [raw]
Subject: [PATCH v2 1/9] cfg80211: Add new channel flag to identify 6GHz PSC channel

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 <[email protected]>
---
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


2020-05-22 20:41:14

by Johannes Berg

[permalink] [raw]
Subject: Re: [PATCH v2 1/9] cfg80211: Add new channel flag to identify 6GHz PSC channel

On Fri, 2020-05-22 at 00:24 -0700, Pradeep Kumar Chitrapu wrote:
> 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.

Is there much value in exposing this as a *flag*?

We have a similar patch, but it just adds the function and everyone who
cares can call it. Do we really need to precalculate that?

johannes


2020-05-22 23:47:48

by Pradeep Kumar Chitrapu

[permalink] [raw]
Subject: Re: [PATCH v2 1/9] cfg80211: Add new channel flag to identify 6GHz PSC channel

On 2020-05-22 13:38, Johannes Berg wrote:
> On Fri, 2020-05-22 at 00:24 -0700, Pradeep Kumar Chitrapu wrote:
>> 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.
>
> Is there much value in exposing this as a *flag*?
>
> We have a similar patch, but it just adds the function and everyone who
> cares can call it. Do we really need to precalculate that?
>
> johannes
Thanks Johannes for the review..

IMO, accessing flag would be faster instead of computation, as this info
is handy (already in cache) when accessing ieee80211_channel.
However, considering general usage for this info would be only for
control
path, it should be ok to expose function instead of maintaining separate
flag.
Please let me know your suggestion..


Thanks
Pradeep

2020-05-25 08:59:21

by Johannes Berg

[permalink] [raw]
Subject: Re: [PATCH v2 1/9] cfg80211: Add new channel flag to identify 6GHz PSC channel

On Fri, 2020-05-22 at 16:46 -0700, Pradeep Kumar Chitrapu wrote:
> IMO, accessing flag would be faster instead of computation, as this info
> is handy (already in cache) when accessing ieee80211_channel.

True.

> However, considering general usage for this info would be only for
> control
> path, it should be ok to expose function instead of maintaining separate
> flag.

Yeah, I can't really see where we'd care ... this is used only when we
set up a scan, etc.

> Please let me know your suggestion..

I'll now go and try to consolidate all your changes and ours, we'll see
what falls out.

johannes