EHT: Add 320 channel width support

Add initial changes to support 320 MHz channel width.

Signed-off-by: Veerendranath Jakkam <quic_vjakkam@quicinc.com>
Signed-off-by: Karthikeyan Periyasamy <quic_periyasa@quicinc.com>
This commit is contained in:
Veerendranath Jakkam 2022-05-13 21:47:41 +05:30 committed by Jouni Malinen
parent bafe35df03
commit 085a3fc76e
16 changed files with 121 additions and 13 deletions

View file

@ -429,6 +429,7 @@ enum chan_width {
CHAN_WIDTH_4320,
CHAN_WIDTH_6480,
CHAN_WIDTH_8640,
CHAN_WIDTH_320,
CHAN_WIDTH_UNKNOWN
};
@ -445,6 +446,7 @@ enum oper_chan_width {
CONF_OPER_CHWIDTH_6480MHZ,
CONF_OPER_CHWIDTH_8640MHZ,
CONF_OPER_CHWIDTH_40MHZ_6GHZ,
CONF_OPER_CHWIDTH_320MHZ,
};
enum key_flag {

View file

@ -392,6 +392,8 @@ int hostapd_set_freq_params(struct hostapd_freq_params *data,
{
if (!he_cap || !he_cap->he_supported)
he_enabled = 0;
if (!eht_cap || !eht_cap->eht_supported)
eht_enabled = 0;
os_memset(data, 0, sizeof(*data));
data->mode = mode;
data->freq = freq;
@ -408,6 +410,8 @@ int hostapd_set_freq_params(struct hostapd_freq_params *data,
else if (oper_chwidth == CONF_OPER_CHWIDTH_160MHZ ||
oper_chwidth == CONF_OPER_CHWIDTH_80P80MHZ)
data->bandwidth = 160;
else if (oper_chwidth == CONF_OPER_CHWIDTH_320MHZ)
data->bandwidth = 320;
else if (sec_channel_offset)
data->bandwidth = 40;
else
@ -483,9 +487,8 @@ int hostapd_set_freq_params(struct hostapd_freq_params *data,
return 0;
}
#if 0 /* FIX: Figure out how to handle CHANWIDTH_320MHZ */
if (data->eht_enabled) switch (oper_chwidth) {
case CHANWIDTH_320MHZ:
case CONF_OPER_CHWIDTH_320MHZ:
if (!(eht_cap->phy_cap[EHT_PHYCAP_320MHZ_IN_6GHZ_SUPPORT_IDX] &
EHT_PHYCAP_320MHZ_IN_6GHZ_SUPPORT_MASK)) {
wpa_printf(MSG_ERROR,
@ -493,8 +496,9 @@ int hostapd_set_freq_params(struct hostapd_freq_params *data,
return -1;
}
break;
default:
break;
}
#endif
if (data->he_enabled || data->eht_enabled) switch (oper_chwidth) {
case CONF_OPER_CHWIDTH_USE_HT:
@ -673,6 +677,41 @@ int hostapd_set_freq_params(struct hostapd_freq_params *data,
return -1;
}
break;
case CONF_OPER_CHWIDTH_320MHZ:
data->bandwidth = 320;
if (!data->eht_enabled || !is_6ghz_freq(freq)) {
wpa_printf(MSG_ERROR,
"320 MHz: EHT not enabled or not a 6 GHz channel");
return -1;
}
if (center_segment1) {
wpa_printf(MSG_ERROR,
"320 MHz: center segment 1 should not be set");
return -1;
}
if (center_segment0 == channel + 30 ||
center_segment0 == channel + 26 ||
center_segment0 == channel + 22 ||
center_segment0 == channel + 18 ||
center_segment0 == channel + 14 ||
center_segment0 == channel + 10 ||
center_segment0 == channel + 6 ||
center_segment0 == channel + 2 ||
center_segment0 == channel - 2 ||
center_segment0 == channel - 6 ||
center_segment0 == channel - 10 ||
center_segment0 == channel - 14 ||
center_segment0 == channel - 18 ||
center_segment0 == channel - 22 ||
center_segment0 == channel - 26 ||
center_segment0 == channel - 30)
data->center_freq1 = 5000 + center_segment0 * 5;
else {
wpa_printf(MSG_ERROR,
"320 MHz: wrong center segment 0");
return -1;
}
break;
default:
break;
}
@ -785,6 +824,7 @@ u32 num_chan_to_bw(int num_chans)
case 2:
case 4:
case 8:
case 16:
return num_chans * 20;
default:
return 20;
@ -818,6 +858,9 @@ int chan_bw_allowed(const struct hostapd_channel_data *chan, u32 bw,
case 160:
bw_mask = HOSTAPD_CHAN_WIDTH_160;
break;
case 320:
bw_mask = HOSTAPD_CHAN_WIDTH_320;
break;
default:
bw_mask = 0;
break;

View file

@ -1060,6 +1060,9 @@ ieee80211_freq_to_channel_ext(unsigned int freq, int sec_channel,
case CONF_OPER_CHWIDTH_80P80MHZ:
*op_class = 135;
break;
case CONF_OPER_CHWIDTH_320MHZ:
*op_class = 137;
break;
default:
if (sec_channel)
*op_class = 132;
@ -1157,6 +1160,9 @@ int ieee80211_chaninfo_to_channel(unsigned int freq, enum chan_width chanwidth,
case CHAN_WIDTH_8640:
cw = CONF_OPER_CHWIDTH_8640MHZ;
break;
case CHAN_WIDTH_320:
cw = CONF_OPER_CHWIDTH_320MHZ;
break;
}
if (ieee80211_freq_to_channel_ext(freq, sec_channel, cw, op_class,
@ -1452,6 +1458,7 @@ static int ieee80211_chan_to_freq_global(u8 op_class, u8 chan)
case 133: /* UHB channels, 80 MHz: 7, 23, 39.. */
case 134: /* UHB channels, 160 MHz: 15, 47, 79.. */
case 135: /* UHB channels, 80+80 MHz: 7, 23, 39.. */
case 137: /* UHB channels, 320 MHz: 31, 63, 95, 127, 159, 191 */
if (chan < 1 || chan > 233)
return -1;
return 5950 + chan * 5;
@ -2265,6 +2272,9 @@ int center_idx_to_bw_6ghz(u8 idx)
/* channels 15, 47, 79...*/
if ((idx & 0x1f) == 0xf)
return 3; /* 160 MHz */
/* channels 31, 63, 95, 127, 159, 191 */
if ((idx & 0x1f) == 0x1f && idx < 192)
return 4; /* 320 MHz */
return -1;
}
@ -2287,7 +2297,7 @@ bool is_6ghz_freq(int freq)
bool is_6ghz_op_class(u8 op_class)
{
return op_class >= 131 && op_class <= 136;
return op_class >= 131 && op_class <= 137;
}
@ -2593,6 +2603,8 @@ int op_class_to_bandwidth(u8 op_class)
return 160;
case 136: /* UHB channels, 20 MHz: 2 */
return 20;
case 137: /* UHB channels, 320 MHz: 31, 63, 95, 127, 159, 191 */
return 320;
case 180: /* 60 GHz band, channels 1..8 */
return 2160;
case 181: /* 60 GHz band, EDMG CB2, channels 9..15 */
@ -2655,6 +2667,8 @@ enum oper_chan_width op_class_to_ch_width(u8 op_class)
return CONF_OPER_CHWIDTH_80P80MHZ;
case 136: /* UHB channels, 20 MHz: 2 */
return CONF_OPER_CHWIDTH_USE_HT;
case 137: /* UHB channels, 320 MHz: 31, 63, 95, 127, 159, 191 */
return CONF_OPER_CHWIDTH_320MHZ;
case 180: /* 60 GHz band, channels 1..8 */
return CONF_OPER_CHWIDTH_2160MHZ;
case 181: /* 60 GHz band, EDMG CB2, channels 9..15 */