From: Govindaraj Saminathan Date: Thu, 5 Dec 2024 17:16:55 +0000 (+0530) Subject: EHT: Update legacy bandwidth for 320 MHz in Wide Bandwidth subelement X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4bcf145caec505854e318984dcac0c593b23052d;p=thirdparty%2Fhostap.git EHT: Update legacy bandwidth for 320 MHz in Wide Bandwidth subelement As per IEEE P802.11be/D7.0, 35.15.3, for EHT BSS operating channel width wider than 160 MHz, the Bandwidth Indication subelement in the Channel Switch Wrapper element indicates the EHT bandwidth to EHT clients. The announced BSS bandwidth in the Wide Bandwidth Channel Switch subelement should be less than the BSS bandwidth in the Bandwidth Indication subelement. Update the Wide Bandwidth Channel Switch subelement to the lower bandwidth of 160 MHz if the new channel bandwidth is 320 MHz. Signed-off-by: Govindaraj Saminathan --- diff --git a/src/ap/ieee802_11.c b/src/ap/ieee802_11.c index c0da03f4c..00fd5e4bf 100644 --- a/src/ap/ieee802_11.c +++ b/src/ap/ieee802_11.c @@ -7365,32 +7365,29 @@ static u8 * hostapd_eid_wb_channel_switch(struct hostapd_data *hapd, u8 *eid, { u8 bw; - /* 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. */ + /* bandwidth: 0: 40, 1: 80, 160, 80+80, 4 to 255 reserved as per + * IEEE P802.11-REVme/D7.0, 9.4.2.159 and Table 9-316. + */ switch (hapd->cs_freq_params.bandwidth) { - case 40: - bw = 0; - break; - case 80: - bw = 1; - break; - case 160: - bw = 1; - break; case 320: - bw = 4; - break; - default: - /* not valid VHT bandwidth or not in CSA */ - return eid; - } + /* As per IEEE P802.11be/D7.0, 35.15.3, + * For EHT BSS operating channel width wider than 160 MHz, + * the announced BSS bandwidth in the Wide Bandwidth + * Channel Switch element is less than the BSS bandwidth + * in the Bandwidth Indication element + */ - *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) { + /* Modifying the center frequency to 160 MHz */ + if (hapd->cs_freq_params.channel < chan1) + chan1 -= 16; + else + chan1 += 16; + + /* fallthrough */ + case 160: /* Update the CCFS0 and CCFS1 values in the element based on - * IEEE P802.11-REVme/D4.0, Table 9-314 */ + * IEEE P802.11-REVme/D7.0, Table 9-316 + */ /* CCFS1 - The channel center frequency index of the 160 MHz * channel. */ @@ -7402,7 +7399,23 @@ static u8 * hostapd_eid_wb_channel_switch(struct hostapd_data *hapd, u8 *eid, chan1 -= 8; else chan1 += 8; + + bw = 1; + break; + case 80: + bw = 1; + break; + case 40: + bw = 0; + break; + default: + /* not valid VHT bandwidth or not in CSA */ + return eid; } + + *eid++ = WLAN_EID_WIDE_BW_CHSWITCH; + *eid++ = 3; /* Length of Wide Bandwidth Channel Switch element */ + *eid++ = bw; /* New Channel Width */ *eid++ = chan1; /* New Channel Center Frequency Segment 0 */ *eid++ = chan2; /* New Channel Center Frequency Segment 1 */