From b14445ec68225d41ee4176ec0ed9f22f9e627498 Mon Sep 17 00:00:00 2001 From: Ramya Gnanasekar Date: Tue, 22 Nov 2022 13:26:22 +0530 Subject: [PATCH] hostapd: Set duplicate beacon bit in HE oper IE When APUT operates in non-psc channels, duplicate beacons will be sent in psc channels. Hence duplicate beacon field to be updated in the same scenario. Signed-off-by: Ramya Gnanasekar Index: b/src/ap/ieee802_11_he.c =================================================================== --- a/src/ap/ieee802_11_he.c 2022-11-23 09:22:12.722659415 +0530 +++ b/src/ap/ieee802_11_he.c 2022-11-23 09:23:10.334202383 +0530 @@ -168,12 +168,26 @@ u8 * hostapd_eid_he_capab(struct hostapd return pos; } +bool is_psc_channel(int channel) +{ + int psc_chan[] = {37, 53, 69, 85, 101, 117, + 133, 149, 165, 181, 197, 213} ; + int i; + + for (i = 0; i < ARRAY_SIZE(psc_chan); i++) { + if (psc_chan[i] == channel) { + return true; + break; + } + } + return false; +} u8 * hostapd_eid_he_operation(struct hostapd_data *hapd, u8 *eid) { struct ieee80211_he_operation *oper; u8 *pos = eid; - int oper_size = 6; + int oper_size = 6, he_control; u32 params = 0; if (!hapd->iface->current_mode) @@ -261,13 +275,19 @@ u8 * hostapd_eid_he_operation(struct hos u8 ap_type = hostapd_get_he_6ghz_reg_pwr_type(hapd->iconf); if (seg1) - *pos++ = 3 | (IEEE80211_HE_6GHZ_OPER_CTRL_REG_INFO & + he_control = 3 | (IEEE80211_HE_6GHZ_OPER_CTRL_REG_INFO & (ap_type << IEEE80211_HE_6GHZ_OPER_CTRL_REG_INFO_LSB)); else - *pos++ = center_idx_to_bw_6ghz(seg0) | + he_control = center_idx_to_bw_6ghz(seg0) | (IEEE80211_HE_6GHZ_OPER_CTRL_REG_INFO & (ap_type << IEEE80211_HE_6GHZ_OPER_CTRL_REG_INFO_LSB)); + if (center_idx_to_bw_6ghz(seg0) && + !is_psc_channel(hapd->iconf->channel)) + he_control |= HE_6GHZ_OPER_INFO_CTRL_DUP_BEACON; + + *pos++ = he_control; + /* Channel Center Freq Seg0/Seg1 */ if (hapd->iconf->he_oper_chwidth == 2) { /*