]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
6 GHz: Fix opclasses mapping in ieee80211_freq_to_channel_ext()
authorVeerendranath Jakkam <vjakkam@codeaurora.org>
Wed, 16 Sep 2020 08:28:22 +0000 (13:58 +0530)
committerJouni Malinen <j@w1.fi>
Fri, 30 Oct 2020 12:20:50 +0000 (14:20 +0200)
Previously only primary channel number used to calculate 6GHz operating
class in ieee80211_freq_to_channel_ext() and it is always giving 131
operating class. Fix this by mapping operating class using chanwidth and
sec_channel also.

This is needed to avoid OCV failures on the 6 GHz band when the channel
width is larger than 20 MHz.

Signed-off-by: Veerendranath Jakkam <vjakkam@codeaurora.org>
src/common/ieee802_11_common.c

index 9c536cc5f34f0425d2d5881839ce763814218e62..471db43c7b96f1a4e2912e78294e35709dd70265 100644 (file)
@@ -1030,15 +1030,28 @@ enum hostapd_hw_mode ieee80211_freq_to_channel_ext(unsigned int freq,
        }
 
        if (freq > 5950 && freq <= 7115) {
-               int bw;
-               u8 idx = (freq - 5950) / 5;
-
-               bw = center_idx_to_bw_6ghz(idx);
-               if (bw < 0)
+               if ((freq - 5950) % 5)
                        return NUM_HOSTAPD_MODES;
 
-               *channel = idx;
-               *op_class = 131 + bw;
+               switch (chanwidth) {
+               case CHANWIDTH_80MHZ:
+                       *op_class = 133;
+                       break;
+               case CHANWIDTH_160MHZ:
+                       *op_class = 134;
+                       break;
+               case CHANWIDTH_80P80MHZ:
+                       *op_class = 135;
+                       break;
+               default:
+                       if (sec_channel)
+                               *op_class = 132;
+                       else
+                               *op_class = 131;
+                       break;
+               }
+
+               *channel = (freq - 5950) / 5;
                return HOSTAPD_MODE_IEEE80211A;
        }