All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH V2] cfg80211: adapt to new channelization of the 6GHz band
       [not found] <1590744414-55473-1-git-send-email-arend.vanspriel@broadcom.com>
@ 2020-05-29  9:41 ` Arend Van Spriel
  2020-05-29  9:53   ` Johannes Berg
  0 siblings, 1 reply; 3+ messages in thread
From: Arend Van Spriel @ 2020-05-29  9:41 UTC (permalink / raw)
  To: Johannes Berg; +Cc: linux-wireless, Pradeep Kumar Chitrapu, Jouni Malinen

The 6GHz band does not have regulatory approval yet, but things are
moving forward. However, that has led to a change in the channelization
of the 6GHz band which has been accepted in the 11ax specification. It
also fixes a missing MHZ_TO_KHZ() macro for 6GHz channels while at it.

This change is primarily thrown in to discuss how to deal with it.
I noticed ath11k adding 6G support with old channelization and ditto
for iw. It probably involves changes in hostapd as well.

Cc: Pradeep Kumar Chitrapu <pradeepc@codeaurora.org>
Cc: Jouni Malinen <jouni@w1.fi>
Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
---
V2:
  - deal with channel 2 in ieee80211_chandef_to_operating_class()
---
  net/wireless/util.c | 49 ++++++++++++++++++++++++++++++++++++++++-----
  1 file changed, 44 insertions(+), 5 deletions(-)

diff --git a/net/wireless/util.c b/net/wireless/util.c
index df75e58eca5d..220f44ae3a70 100644
--- a/net/wireless/util.c
+++ b/net/wireless/util.c
@@ -92,9 +92,11 @@ u32 ieee80211_channel_to_freq_khz(int chan, enum 
nl80211_band band)
  			return MHZ_TO_KHZ(5000 + chan * 5);
  		break;
  	case NL80211_BAND_6GHZ:
-		/* see 802.11ax D4.1 27.3.22.2 */
+		/* see 802.11ax D6.1 27.3.23.2 */
+		if (chan == 2)
+			return MHZ_TO_KHZ(5935);
  		if (chan <= 253)
-			return 5940 + chan * 5;
+			return MHZ_TO_KHZ(5950 + chan * 5);
  		break;
  	case NL80211_BAND_60GHZ:
  		if (chan < 7)
@@ -119,11 +121,14 @@ int ieee80211_freq_khz_to_channel(u32 freq)
  		return (freq - 2407) / 5;
  	else if (freq >= 4910 && freq <= 4980)
  		return (freq - 4000) / 5;
-	else if (freq < 5945)
+	else if (freq < 5935)
  		return (freq - 5000) / 5;
+	else if (freq == 5935)
+		/* see 802.11ax D6.1 27.3.23.2 */
+		return 2;
  	else if (freq <= 45000) /* DMG band lower limit */
-		/* see 802.11ax D4.1 27.3.22.2 */
-		return (freq - 5940) / 5;
+		/* see 802.11ax D6.1 27.3.23.2 */
+		return (freq - 5950) / 5;
  	else if (freq >= 58320 && freq <= 70200)
  		return (freq - 56160) / 2160;
  	else
@@ -1662,6 +1667,40 @@ bool ieee80211_chandef_to_operating_class(struct 
cfg80211_chan_def *chandef,
  		return true;
  	}
+	/* 6GHz, channels 1..233 */
+	if (freq == 5935) {
+		if (chandef->width != NL80211_CHAN_WIDTH_20)
+			return false;
+
+		*op_class = 136;
+		return true;
+	} else if (freq > 5935 && freq <= 7115) {
+		switch (chandef->width) {
+		case NL80211_CHAN_WIDTH_20:
+			*op_class = 131;
+			break;
+		case NL80211_CHAN_WIDTH_40:
+			*op_class = 132;
+			break;
+		case NL80211_CHAN_WIDTH_80:
+			*op_class = 133;
+			break;
+		case NL80211_CHAN_WIDTH_160:
+			*op_class = 134;
+			break;
+		case NL80211_CHAN_WIDTH_80P80:
+			*op_class = 135;
+			break;
+		case NL80211_CHAN_WIDTH_5:
+		case NL80211_CHAN_WIDTH_10:
+		case NL80211_CHAN_WIDTH_20_NOHT:
+		default:
+			return false;
+		}
+
+		return true;
+	}
+
  	/* 56.16 GHz, channel 1..4 */
  	if (freq >= 56160 + 2160 * 1 && freq <= 56160 + 2160 * 6) {
  		if (chandef->width >= NL80211_CHAN_WIDTH_40)
-- 
2.18.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH V2] cfg80211: adapt to new channelization of the 6GHz band
  2020-05-29  9:41 ` [PATCH V2] cfg80211: adapt to new channelization of the 6GHz band Arend Van Spriel
@ 2020-05-29  9:53   ` Johannes Berg
  2020-05-29 11:46     ` Arend Van Spriel
  0 siblings, 1 reply; 3+ messages in thread
From: Johannes Berg @ 2020-05-29  9:53 UTC (permalink / raw)
  To: Arend Van Spriel; +Cc: linux-wireless, Pradeep Kumar Chitrapu, Jouni Malinen

On Fri, 2020-05-29 at 11:41 +0200, Arend Van Spriel wrote:
> It also fixes a missing MHZ_TO_KHZ() macro for 6GHz channels while at it.

Yeah, I actually saw and fixed that earlier, but whatever. I can fix up
any issues.

>   	case NL80211_BAND_6GHZ:
> -		/* see 802.11ax D4.1 27.3.22.2 */
> +		/* see 802.11ax D6.1 27.3.23.2 */
> +		if (chan == 2)
> +			return MHZ_TO_KHZ(5935);
>   		if (chan <= 253)
> -			return 5940 + chan * 5;
> +			return MHZ_TO_KHZ(5950 + chan * 5);

So this can return 5950+5*253 == 7215

> @@ -119,11 +121,14 @@ int ieee80211_freq_khz_to_channel(u32 freq)

>   	else if (freq <= 45000) /* DMG band lower limit */
> -		/* see 802.11ax D4.1 27.3.22.2 */
> -		return (freq - 5940) / 5;
> +		/* see 802.11ax D6.1 27.3.23.2 */
> +		return (freq - 5950) / 5;

and here you have no real upper bound, which is fine

> @@ -1662,6 +1667,40 @@ bool ieee80211_chandef_to_operating_class(struct 

> +	/* 6GHz, channels 1..233 */
> +	if (freq == 5935) {
> +		if (chandef->width != NL80211_CHAN_WIDTH_20)
> +			return false;
> +
> +		*op_class = 136;
> +		return true;
> +	} else if (freq > 5935 && freq <= 7115) {

but here both the comment and the code say 7115? Should that be 1..253
and 7215, respectively?

I can fix, no need to resend.

johannes


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH V2] cfg80211: adapt to new channelization of the 6GHz band
  2020-05-29  9:53   ` Johannes Berg
@ 2020-05-29 11:46     ` Arend Van Spriel
  0 siblings, 0 replies; 3+ messages in thread
From: Arend Van Spriel @ 2020-05-29 11:46 UTC (permalink / raw)
  To: Johannes Berg; +Cc: linux-wireless, Pradeep Kumar Chitrapu, Jouni Malinen

On May 29, 2020 11:53:30 AM Johannes Berg <johannes@sipsolutions.net> wrote:

> On Fri, 2020-05-29 at 11:41 +0200, Arend Van Spriel wrote:
>> It also fixes a missing MHZ_TO_KHZ() macro for 6GHz channels while at it.
>
> Yeah, I actually saw and fixed that earlier, but whatever. I can fix up
> any issues.
>
>> case NL80211_BAND_6GHZ:
>> - /* see 802.11ax D4.1 27.3.22.2 */
>> + /* see 802.11ax D6.1 27.3.23.2 */
>> + if (chan == 2)
>> + return MHZ_TO_KHZ(5935);
>> if (chan <= 253)
>> - return 5940 + chan * 5;
>> + return MHZ_TO_KHZ(5950 + chan * 5);
>
> So this can return 5950+5*253 == 7215
>
>> @@ -119,11 +121,14 @@ int ieee80211_freq_khz_to_channel(u32 freq)
>
>> else if (freq <= 45000) /* DMG band lower limit */
>> - /* see 802.11ax D4.1 27.3.22.2 */
>> - return (freq - 5940) / 5;
>> + /* see 802.11ax D6.1 27.3.23.2 */
>> + return (freq - 5950) / 5;
>
> and here you have no real upper bound, which is fine
>
>> @@ -1662,6 +1667,40 @@ bool ieee80211_chandef_to_operating_class(struct
>
>> + /* 6GHz, channels 1..233 */
>> + if (freq == 5935) {
>> + if (chandef->width != NL80211_CHAN_WIDTH_20)
>> + return false;
>> +
>> + *op_class = 136;
>> + return true;
>> + } else if (freq > 5935 && freq <= 7115) {
>
> but here both the comment and the code say 7115? Should that be 1..253
> and 7215, respectively?
>
> I can fix, no need to resend.

The 802.11 spec specifies the 1..253 range. The FCC has proposed the U-NII 
bands 5 to 8 for the 6G band. U-NII-8 ends at 7125 so the highest 20MHz 
center freq is 7115, ie. channel 233. Have to admit that mixing the two in 
this patch can be confusing. I leave it at your discretion how to fix it. I 
can also resend if necessary.

Regards,
Arend




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-05-29 11:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <1590744414-55473-1-git-send-email-arend.vanspriel@broadcom.com>
2020-05-29  9:41 ` [PATCH V2] cfg80211: adapt to new channelization of the 6GHz band Arend Van Spriel
2020-05-29  9:53   ` Johannes Berg
2020-05-29 11:46     ` Arend Van Spriel

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.