| From b08463cf3f68a3a5ba7fef6dacb77dff239ffd48 Mon Sep 17 00:00:00 2001 |
| From: Yuvarani V <quic_yuvarani@quicinc.com> |
| Date: Wed, 27 Sep 2023 12:52:03 +0530 |
| Subject: hostapd: mtk: Update Wide Bandwidth Channel Switch element |
| |
| This patch is from hostapd upstream |
| (https://w1.fi/cgit/hostap/commit/src/ap/ieee802_11.c?id=ef8d48c4cfe673420dcec2879cbc8c84b16e041d) |
| |
| Original commit message: |
| 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 <quic_yuvarani@quicinc.com> |
| --- |
| 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 dd477fd..8a5fd20 100644 |
| --- a/src/ap/ieee802_11.c |
| +++ b/src/ap/ieee802_11.c |
| @@ -7176,7 +7176,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 || |
| @@ -7185,20 +7185,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 */ |
| + /* 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; |
| default: |
| /* not valid VHT bandwidth or not in CSA */ |
| @@ -7222,6 +7219,21 @@ u8 * hostapd_eid_wb_chsw_wrapper(struct hostapd_data *hapd, u8 *eid) |
| *eid++ = WLAN_EID_VHT_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.25.1 |
| |