]> git.ipfire.org Git - thirdparty/iw.git/commitdiff
iw: update freq to chan mappings for 6GHz band per IEEE P802.11ax/D6.1
authorPradeep Kumar Chitrapu <pradeepc@codeaurora.org>
Mon, 22 Jun 2020 06:39:06 +0000 (23:39 -0700)
committerJohannes Berg <johannes.berg@intel.com>
Thu, 27 Aug 2020 10:26:24 +0000 (12:26 +0200)
This fixes dfferences in 6GHz frequencies which were updated in
IEEE P802.11ax/D6.1.

Also sync 60GHz band channel to freq mapping with kernel.

Fixes: 43789196 ("iw: sync frequency to channel mapping with kernel for 6GHz band")
Signed-off-by: Pradeep Kumar Chitrapu <pradeepc@codeaurora.org>
Link: https://lore.kernel.org/r/20200622063906.24957-1-pradeepc@codeaurora.org
[remove MHZ_TO_KHZ conversion???]
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
util.c

diff --git a/util.c b/util.c
index 195fc0fb1c164945746ff1e8f6b5c25ae8854221..186e05b99bfebc5f35fd9b3c0923bd53bead01c7 100644 (file)
--- a/util.c
+++ b/util.c
@@ -181,12 +181,14 @@ int ieee80211_channel_to_frequency(int chan, enum nl80211_band band)
                        return 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 5935;
                if (chan <= 253)
-                       return 5940 + chan * 5;
+                       return 5950 + chan * 5;
                break;
        case NL80211_BAND_60GHZ:
-               if (chan < 5)
+               if (chan < 7)
                        return 56160 + chan * 2160;
                break;
        default:
@@ -200,15 +202,18 @@ int ieee80211_frequency_to_channel(int freq)
        /* see 802.11-2007 17.3.8.3.2 and Annex J */
        if (freq == 2484)
                return 14;
+       /* see 802.11ax D6.1 27.3.23.2 and Annex E */
+       else if (freq == 5935)
+               return 2;
        else if (freq < 2484)
                return (freq - 2407) / 5;
        else if (freq >= 4910 && freq <= 4980)
                return (freq - 4000) / 5;
-       else if (freq < 5945)
+       else if (freq < 5950)
                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;
+               /* see 802.11ax D6.1 27.3.23.2 */
+               return (freq - 5950) / 5;
        else if (freq >= 58320 && freq <= 70200)
                return (freq - 56160) / 2160;
        else