developer | 05f3b2b | 2024-08-19 19:17:34 +0800 | [diff] [blame] | 1 | From 35e67264aef9b6f050e01465ff419495198ad110 Mon Sep 17 00:00:00 2001 |
| 2 | From: Michael-CY Lee <michael-cy.lee@mediatek.com> |
| 3 | Date: Wed, 14 Aug 2024 17:42:00 +0800 |
| 4 | Subject: [PATCH 125/126] mtk: hostapd: do not set secondary channel in HT |
| 5 | operation if punctured |
| 6 | |
| 7 | If the secondary channel is punctured, the HT operation in the beacon |
| 8 | should not indicate a secondary channel offset |
| 9 | (HT_INFO_HT_PARAM_SECONDARY_CHNL_ABOVE or HT_INFO_HT_PARAM_SECONDARY_CHNL_BELOW) |
| 10 | |
| 11 | Signed-off-by: Michael-CY Lee <michael-cy.lee@mediatek.com> |
| 12 | --- |
| 13 | src/ap/ieee802_11_ht.c | 53 ++++++++++++++++++++++++++++++++++++------ |
| 14 | 1 file changed, 46 insertions(+), 7 deletions(-) |
| 15 | |
| 16 | diff --git a/src/ap/ieee802_11_ht.c b/src/ap/ieee802_11_ht.c |
| 17 | index 7f0a00f95..1b323819e 100644 |
| 18 | --- a/src/ap/ieee802_11_ht.c |
| 19 | +++ b/src/ap/ieee802_11_ht.c |
| 20 | @@ -79,6 +79,49 @@ u8 * hostapd_eid_ht_capabilities(struct hostapd_data *hapd, u8 *eid) |
| 21 | } |
| 22 | |
| 23 | |
| 24 | +void set_ht_param(struct hostapd_data *hapd, struct ieee80211_ht_operation *oper, |
| 25 | + u8 chwidth) |
| 26 | +{ |
| 27 | + int secondary_channel = hapd->iconf->secondary_channel; |
| 28 | +#ifdef CONFIG_IEEE80211BE |
| 29 | + u8 offset, chan_bit_pos; |
| 30 | + u16 bw = 0, punct_bitmap = hostapd_get_punct_bitmap(hapd); |
| 31 | + |
| 32 | + switch (chwidth) { |
| 33 | + case CONF_OPER_CHWIDTH_80MHZ: |
| 34 | + bw = 80; |
| 35 | + offset = 6; |
| 36 | + break; |
| 37 | + case CONF_OPER_CHWIDTH_160MHZ: |
| 38 | + bw = 160; |
| 39 | + offset = 14; |
| 40 | + break; |
| 41 | + case CONF_OPER_CHWIDTH_320MHZ: |
| 42 | + bw = 320; |
| 43 | + offset = 30; |
| 44 | + break; |
| 45 | + default: |
| 46 | + break; |
| 47 | + } |
| 48 | + |
| 49 | + chan_bit_pos = (hapd->iconf->channel - |
| 50 | + hostapd_get_oper_centr_freq_seg0_idx(hapd->iconf) + |
| 51 | + offset) / 4; |
| 52 | + /* check if secondary channel is punctured */ |
| 53 | + if (bw >= 80 && punct_bitmap && secondary_channel && |
| 54 | + (punct_bitmap & BIT(chan_bit_pos + secondary_channel))) |
| 55 | + return; |
| 56 | +#endif /* CONFIG_IEEE80211BE */ |
| 57 | + |
| 58 | + if (secondary_channel == 1) |
| 59 | + oper->ht_param |= HT_INFO_HT_PARAM_SECONDARY_CHNL_ABOVE | |
| 60 | + HT_INFO_HT_PARAM_STA_CHNL_WIDTH; |
| 61 | + if (secondary_channel == -1) |
| 62 | + oper->ht_param |= HT_INFO_HT_PARAM_SECONDARY_CHNL_BELOW | |
| 63 | + HT_INFO_HT_PARAM_STA_CHNL_WIDTH; |
| 64 | +} |
| 65 | + |
| 66 | + |
| 67 | u8 * hostapd_eid_ht_operation(struct hostapd_data *hapd, u8 *eid) |
| 68 | { |
| 69 | struct ieee80211_ht_operation *oper; |
| 70 | @@ -98,15 +141,11 @@ u8 * hostapd_eid_ht_operation(struct hostapd_data *hapd, u8 *eid) |
| 71 | |
| 72 | oper->primary_chan = hapd->iconf->channel; |
| 73 | oper->operation_mode = host_to_le16(hapd->iface->ht_op_mode); |
| 74 | - if (hapd->iconf->secondary_channel == 1) |
| 75 | - oper->ht_param |= HT_INFO_HT_PARAM_SECONDARY_CHNL_ABOVE | |
| 76 | - HT_INFO_HT_PARAM_STA_CHNL_WIDTH; |
| 77 | - if (hapd->iconf->secondary_channel == -1) |
| 78 | - oper->ht_param |= HT_INFO_HT_PARAM_SECONDARY_CHNL_BELOW | |
| 79 | - HT_INFO_HT_PARAM_STA_CHNL_WIDTH; |
| 80 | |
| 81 | - vht_capabilities_info = host_to_le32(hapd->iface->current_mode->vht_capab); |
| 82 | chwidth = hostapd_get_oper_chwidth(hapd->iconf); |
| 83 | + set_ht_param(hapd, oper, chwidth); |
| 84 | + |
| 85 | + vht_capabilities_info = host_to_le32(hapd->iface->current_mode->vht_capab); |
| 86 | if (vht_capabilities_info & VHT_CAP_EXTENDED_NSS_BW_SUPPORT |
| 87 | && ((chwidth == CHANWIDTH_160MHZ) || (chwidth == CHANWIDTH_80P80MHZ))) { |
| 88 | oper->operation_mode = host_to_le16(hapd->iconf->vht_oper_centr_freq_seg0_idx << 5); |
| 89 | -- |
| 90 | 2.18.0 |
| 91 | |