From 881177201a8c8b4d3a5a6b771b90030ee34281a8 Mon Sep 17 00:00:00 2001 From: Vamsi Krishna Date: Tue, 24 Dec 2019 17:32:29 +0530 Subject: [PATCH] 6 GHz: Fix Channel Width value for 80+80 in 6 GHZ Operation Info field The Channel Width field value is 0 for 20 MHz, 1 for 40 MHz, 2 for 80 MHz, and 3 for both 160 MHz and 80+80 MHz channels. The 80+80 MHz case was not addressed previously correctly since it cannot be derived from seg0 only. The Channel Center Frequency Segment 0 field value is the index of channel center frequency for 20 MHz, 40 MHz, and 80 MHz channels. The value is the center frequency index of the primary 80 MHz segment for 160 MHz and 80+80 MHz channels. The Channel Center Frequency Segment 1 field value is zero for 20 MHz, 40 MHz, and 80 MHz channels. The value is the index of the channel center frequency for 160 MHz channel and the center frequency index of the secondary 80 MHz segment for 80+80 MHz channels. Signed-off-by: Jouni Malinen --- src/ap/ieee802_11_he.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/ap/ieee802_11_he.c b/src/ap/ieee802_11_he.c index abd39409e..3e22ce412 100644 --- a/src/ap/ieee802_11_he.c +++ b/src/ap/ieee802_11_he.c @@ -206,17 +206,25 @@ u8 * hostapd_eid_he_operation(struct hostapd_data *hapd, u8 *eid) if (is_6ghz_op_class(hapd->iconf->op_class)) { u8 seg0 = hostapd_get_oper_centr_freq_seg0_idx(hapd->iconf); + u8 seg1 = hostapd_get_oper_centr_freq_seg1_idx(hapd->iconf); if (!seg0) seg0 = hapd->iconf->channel; params |= HE_OPERATION_6GHZ_OPER_INFO; + + /* 6 GHz Operation Information field */ *pos++ = hapd->iconf->channel; /* Primary Channel */ - *pos++ = center_idx_to_bw_6ghz(seg0); /* Control: Channel Width - */ - /* Channel Center Freq Seg0/Seg0 */ + + /* Control: Channel Width */ + if (seg1) + *pos++ = 3; + else + *pos++ = center_idx_to_bw_6ghz(seg0); + + /* Channel Center Freq Seg0/Seg1 */ *pos++ = seg0; - *pos++ = hostapd_get_oper_centr_freq_seg1_idx(hapd->iconf); + *pos++ = seg1; /* Minimum Rate */ *pos++ = 6; /* TODO: what should be set here? */ }