| From 35e67264aef9b6f050e01465ff419495198ad110 Mon Sep 17 00:00:00 2001 |
| From: Michael-CY Lee <michael-cy.lee@mediatek.com> |
| Date: Wed, 14 Aug 2024 17:42:00 +0800 |
| Subject: [PATCH 125/126] mtk: hostapd: do not set secondary channel in HT |
| operation if punctured |
| |
| If the secondary channel is punctured, the HT operation in the beacon |
| should not indicate a secondary channel offset |
| (HT_INFO_HT_PARAM_SECONDARY_CHNL_ABOVE or HT_INFO_HT_PARAM_SECONDARY_CHNL_BELOW) |
| |
| Signed-off-by: Michael-CY Lee <michael-cy.lee@mediatek.com> |
| --- |
| src/ap/ieee802_11_ht.c | 53 ++++++++++++++++++++++++++++++++++++------ |
| 1 file changed, 46 insertions(+), 7 deletions(-) |
| |
| diff --git a/src/ap/ieee802_11_ht.c b/src/ap/ieee802_11_ht.c |
| index 7f0a00f95..1b323819e 100644 |
| --- a/src/ap/ieee802_11_ht.c |
| +++ b/src/ap/ieee802_11_ht.c |
| @@ -79,6 +79,49 @@ u8 * hostapd_eid_ht_capabilities(struct hostapd_data *hapd, u8 *eid) |
| } |
| |
| |
| +void set_ht_param(struct hostapd_data *hapd, struct ieee80211_ht_operation *oper, |
| + u8 chwidth) |
| +{ |
| + int secondary_channel = hapd->iconf->secondary_channel; |
| +#ifdef CONFIG_IEEE80211BE |
| + u8 offset, chan_bit_pos; |
| + u16 bw = 0, punct_bitmap = hostapd_get_punct_bitmap(hapd); |
| + |
| + switch (chwidth) { |
| + case CONF_OPER_CHWIDTH_80MHZ: |
| + bw = 80; |
| + offset = 6; |
| + break; |
| + case CONF_OPER_CHWIDTH_160MHZ: |
| + bw = 160; |
| + offset = 14; |
| + break; |
| + case CONF_OPER_CHWIDTH_320MHZ: |
| + bw = 320; |
| + offset = 30; |
| + break; |
| + default: |
| + break; |
| + } |
| + |
| + chan_bit_pos = (hapd->iconf->channel - |
| + hostapd_get_oper_centr_freq_seg0_idx(hapd->iconf) + |
| + offset) / 4; |
| + /* check if secondary channel is punctured */ |
| + if (bw >= 80 && punct_bitmap && secondary_channel && |
| + (punct_bitmap & BIT(chan_bit_pos + secondary_channel))) |
| + return; |
| +#endif /* CONFIG_IEEE80211BE */ |
| + |
| + if (secondary_channel == 1) |
| + oper->ht_param |= HT_INFO_HT_PARAM_SECONDARY_CHNL_ABOVE | |
| + HT_INFO_HT_PARAM_STA_CHNL_WIDTH; |
| + if (secondary_channel == -1) |
| + oper->ht_param |= HT_INFO_HT_PARAM_SECONDARY_CHNL_BELOW | |
| + HT_INFO_HT_PARAM_STA_CHNL_WIDTH; |
| +} |
| + |
| + |
| u8 * hostapd_eid_ht_operation(struct hostapd_data *hapd, u8 *eid) |
| { |
| struct ieee80211_ht_operation *oper; |
| @@ -98,15 +141,11 @@ u8 * hostapd_eid_ht_operation(struct hostapd_data *hapd, u8 *eid) |
| |
| oper->primary_chan = hapd->iconf->channel; |
| oper->operation_mode = host_to_le16(hapd->iface->ht_op_mode); |
| - if (hapd->iconf->secondary_channel == 1) |
| - oper->ht_param |= HT_INFO_HT_PARAM_SECONDARY_CHNL_ABOVE | |
| - HT_INFO_HT_PARAM_STA_CHNL_WIDTH; |
| - if (hapd->iconf->secondary_channel == -1) |
| - oper->ht_param |= HT_INFO_HT_PARAM_SECONDARY_CHNL_BELOW | |
| - HT_INFO_HT_PARAM_STA_CHNL_WIDTH; |
| |
| - vht_capabilities_info = host_to_le32(hapd->iface->current_mode->vht_capab); |
| chwidth = hostapd_get_oper_chwidth(hapd->iconf); |
| + set_ht_param(hapd, oper, chwidth); |
| + |
| + vht_capabilities_info = host_to_le32(hapd->iface->current_mode->vht_capab); |
| if (vht_capabilities_info & VHT_CAP_EXTENDED_NSS_BW_SUPPORT |
| && ((chwidth == CHANWIDTH_160MHZ) || (chwidth == CHANWIDTH_80P80MHZ))) { |
| oper->operation_mode = host_to_le16(hapd->iconf->vht_oper_centr_freq_seg0_idx << 5); |
| -- |
| 2.18.0 |
| |