linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Arend van Spriel <arend.vanspriel@broadcom.com>
To: Johannes Berg <johannes@sipsolutions.net>
Cc: linux-wireless@vger.kernel.org,
	Arend van Spriel <arend.vanspriel@broadcom.com>
Subject: [RFC V2 3/8] cfg80211: util: add 6GHz channel to freq conversion and vice versa
Date: Tue, 25 Jun 2019 13:10:22 +0200	[thread overview]
Message-ID: <1561461027-10793-4-git-send-email-arend.vanspriel@broadcom.com> (raw)
In-Reply-To: <1561461027-10793-1-git-send-email-arend.vanspriel@broadcom.com>

Extend the functions ieee80211_channel_to_frequency() and
ieee80211_frequency_to_channel() to support 6GHz band according
specification in 802.11ax D4.1 27.3.22.2.

Reviewed-by: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com>
Reviewed-by: Leon Zegers <leon.zegers@broadcom.com>
Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
---
 net/wireless/util.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/net/wireless/util.c b/net/wireless/util.c
index 1c39d6a..4e633d4 100644
--- a/net/wireless/util.c
+++ b/net/wireless/util.c
@@ -91,6 +91,11 @@ int ieee80211_channel_to_frequency(int chan, enum nl80211_band band)
 		else
 			return 5000 + chan * 5;
 		break;
+	case NL80211_BAND_6GHZ:
+		/* see 802.11ax D4.1 27.3.22.2 */
+		if (chan <= 253)
+			return 5940 + chan * 5;
+		break;
 	case NL80211_BAND_60GHZ:
 		if (chan < 7)
 			return 56160 + chan * 2160;
@@ -111,8 +116,11 @@ int ieee80211_frequency_to_channel(int freq)
 		return (freq - 2407) / 5;
 	else if (freq >= 4910 && freq <= 4980)
 		return (freq - 4000) / 5;
-	else if (freq <= 45000) /* DMG band lower limit */
+	else if (freq < 5940)
 		return (freq - 5000) / 5;
+	else if (freq <= 45000) /* DMG band lower limit */
+		/* see 802.11ax D4.1 27.3.22.2 */
+		return (freq - 5940) / 5;
 	else if (freq >= 58320 && freq <= 70200)
 		return (freq - 56160) / 2160;
 	else
-- 
1.9.1


  parent reply	other threads:[~2019-06-25 11:15 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-25 11:10 [RFC V2 0/8] nl80211: add 6GHz band support Arend van Spriel
2019-06-25 11:10 ` [RFC V2 1/8] nl80211: add 6GHz band definition to enum nl80211_band Arend van Spriel
2019-06-25 11:10 ` [RFC V2 2/8] cfg80211: add 6GHz UNII band definitions Arend van Spriel
2019-06-25 11:10 ` Arend van Spriel [this message]
2019-06-25 11:10 ` [RFC V2 4/8] cfg80211: extend ieee80211_operating_class_to_band() for 6GHz Arend van Spriel
2019-06-25 11:10 ` [RFC V2 5/8] cfg80211: add 6GHz in code handling array with NUM_NL80211_BANDS entries Arend van Spriel
2019-06-28 13:03   ` Johannes Berg
2019-06-25 11:10 ` [RFC V2 6/8] cfg80211: use same IR permissive rules for 6GHz band Arend van Spriel
2019-06-25 11:10 ` [RFC V2 7/8] cfg80211: ibss: use 11a mandatory rates for 6GHz band operation Arend van Spriel
2019-06-28 13:04   ` Johannes Berg
2019-06-28 21:36     ` Igor Mitsyanko
2019-06-25 11:10 ` [RFC V2 8/8] cfg80211: apply same mandatory rate flags for 5GHz and 6GHz Arend van Spriel
2019-07-24  9:35 ` [RFC V2 0/8] nl80211: add 6GHz band support Johannes Berg
2019-07-24 13:40   ` Arend Van Spriel
2019-07-24 13:46     ` Johannes Berg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1561461027-10793-4-git-send-email-arend.vanspriel@broadcom.com \
    --to=arend.vanspriel@broadcom.com \
    --cc=johannes@sipsolutions.net \
    --cc=linux-wireless@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).