From ef8d48c4cfe673420dcec2879cbc8c84b16e041d Mon Sep 17 00:00:00 2001 From: Yuvarani V Date: Wed, 27 Sep 2023 12:52:03 +0530 Subject: [PATCH] Update Wide Bandwidth Channel Switch element Update Wide Bandwidth Channel Switch element as per IEEE P802.11-REVme/D4.0, 9.4.2.159 (Wide Bandwidth Channel Switch element) and Table 9-314 (VHT Operation Information subfields). Update New Channel Width, New Channel Center Frequency Segment 0, and New Channel Center Frequency Segment 1 fields as per IEEE P802.11-REVme/D4.0 for 160 MHz and 80+80 MHz bandwidth. This replaces the use of now deprecated Channel Width 2 and 3 values with a more backwards compatible design. Signed-off-by: Yuvarani V --- src/ap/ieee802_11.c | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/src/ap/ieee802_11.c b/src/ap/ieee802_11.c index 02948fd58..a9b3e8c60 100644 --- a/src/ap/ieee802_11.c +++ b/src/ap/ieee802_11.c @@ -7055,7 +7055,7 @@ u8 * hostapd_eid_txpower_envelope(struct hostapd_data *hapd, u8 *eid) u8 * hostapd_eid_wb_chsw_wrapper(struct hostapd_data *hapd, u8 *eid) { - u8 bw, chan1, chan2 = 0; + u8 bw, chan1 = 0, chan2 = 0; int freq1; if (!hapd->cs_freq_params.channel || @@ -7064,20 +7064,17 @@ u8 * hostapd_eid_wb_chsw_wrapper(struct hostapd_data *hapd, u8 *eid) !hapd->cs_freq_params.eht_enabled)) return eid; - /* bandwidth: 0: 40, 1: 80, 2: 160, 3: 80+80, 4: 320 */ + /* bandwidth: 0: 40, 1: 80, 160, 80+80, 4: 320 as per + * IEEE P802.11-REVme/D4.0, 9.4.2.159 and Table 9-314. */ switch (hapd->cs_freq_params.bandwidth) { case 40: bw = 0; break; case 80: - /* check if it's 80+80 */ - if (!hapd->cs_freq_params.center_freq2) - bw = 1; - else - bw = 3; + bw = 1; break; case 160: - bw = 2; + bw = 1; break; case 320: bw = 4; @@ -7104,6 +7101,21 @@ u8 * hostapd_eid_wb_chsw_wrapper(struct hostapd_data *hapd, u8 *eid) *eid++ = WLAN_EID_WIDE_BW_CHSWITCH; *eid++ = 3; /* Length of Wide Bandwidth Channel Switch element */ *eid++ = bw; /* New Channel Width */ + if (hapd->cs_freq_params.bandwidth == 160) { + /* Update the CCFS0 and CCFS1 values in the element based on + * IEEE P802.11-REVme/D4.0, Table 9-314 */ + + /* CCFS1 - The channel center frequency index of the 160 MHz + * channel. */ + chan2 = chan1; + + /* CCFS0 - The channel center frequency index of the 80 MHz + * channel segment that contains the primary channel. */ + if (hapd->cs_freq_params.channel < chan1) + chan1 -= 8; + else + chan1 += 8; + } *eid++ = chan1; /* New Channel Center Frequency Segment 0 */ *eid++ = chan2; /* New Channel Center Frequency Segment 1 */ -- 2.47.2