6 GHz: Fix opclasses mapping in ieee80211_freq_to_channel_ext()

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>
This commit is contained in:
Veerendranath Jakkam 2020-09-16 13:58:22 +05:30 committed by Jouni Malinen
parent 5e779873ed
commit 66bed14b22

View file

@ -1030,15 +1030,28 @@ enum hostapd_hw_mode ieee80211_freq_to_channel_ext(unsigned int freq,
} }
if (freq > 5950 && freq <= 7115) { if (freq > 5950 && freq <= 7115) {
int bw; if ((freq - 5950) % 5)
u8 idx = (freq - 5950) / 5;
bw = center_idx_to_bw_6ghz(idx);
if (bw < 0)
return NUM_HOSTAPD_MODES; return NUM_HOSTAPD_MODES;
*channel = idx; switch (chanwidth) {
*op_class = 131 + bw; 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; return HOSTAPD_MODE_IEEE80211A;
} }