hostapd: bump to 2024-03-09
[openwrt/staging/xback.git] / package / network / services / hostapd / patches / 170-hostapd-update-cfs0-and-cfs1-for-160MHz.patch
1 From d4c4ef302f98fd6bce173b8636e7e350d8b44981 Mon Sep 17 00:00:00 2001
2 From: P Praneesh <ppranees@codeaurora.org>
3 Date: Fri, 19 Mar 2021 12:17:27 +0530
4 Subject: [PATCH] hostapd: update cfs0 and cfs1 for 160MHz
5
6 As per standard Draft P802.11ax_D8.0,( Table 26-9—Setting
7 of the VHT Channel Width and VHT NSS at an HE STA
8 transmitting the OM Control subfield ), center frequency of
9 160MHz should be published in HT information subset 2 of
10 HT information when EXT NSS BW field is enabled.
11
12 If the supported number of NSS in 160MHz is at least max NSS
13 support, then center_freq_seg0 indicates the center frequency of 80MHz and
14 center_freq_seg1 indicates the center frequency of 160MHz.
15
16 If the supported number of NSS in 160MHz is less than max NSS
17 support, then center_freq_seg0 indicates the center frequency of 80MHz and
18 center_freq_seg1 is 0. The center frequency of 160MHz is published in HT
19 operation information element instead.
20
21 Signed-off-by: P Praneesh <ppranees@codeaurora.org>
22 ---
23 hostapd/config_file.c | 2 ++
24 src/ap/ieee802_11_ht.c | 9 +++++++++
25 src/ap/ieee802_11_vht.c | 17 +++++++++++++++++
26 src/common/hw_features_common.c | 1 +
27 src/common/ieee802_11_defs.h | 2 ++
28 5 files changed, 31 insertions(+)
29
30 --- a/hostapd/config_file.c
31 +++ b/hostapd/config_file.c
32 @@ -1229,6 +1229,8 @@ static int hostapd_config_vht_capab(stru
33 conf->vht_capab |= VHT_CAP_RX_ANTENNA_PATTERN;
34 if (os_strstr(capab, "[TX-ANTENNA-PATTERN]"))
35 conf->vht_capab |= VHT_CAP_TX_ANTENNA_PATTERN;
36 + if (os_strstr(capab, "[EXT-NSS-BW-SUPP]"))
37 + conf->vht_capab |= VHT_CAP_EXTENDED_NSS_BW_SUPPORT;
38 return 0;
39 }
40 #endif /* CONFIG_IEEE80211AC */
41 --- a/src/ap/ieee802_11_ht.c
42 +++ b/src/ap/ieee802_11_ht.c
43 @@ -82,7 +82,9 @@ u8 * hostapd_eid_ht_capabilities(struct
44 u8 * hostapd_eid_ht_operation(struct hostapd_data *hapd, u8 *eid)
45 {
46 struct ieee80211_ht_operation *oper;
47 + le32 vht_capabilities_info;
48 u8 *pos = eid;
49 + u8 chwidth;
50
51 if (!hapd->iconf->ieee80211n || hapd->conf->disable_11n ||
52 is_6ghz_op_class(hapd->iconf->op_class))
53 @@ -103,6 +105,13 @@ u8 * hostapd_eid_ht_operation(struct hos
54 oper->ht_param |= HT_INFO_HT_PARAM_SECONDARY_CHNL_BELOW |
55 HT_INFO_HT_PARAM_STA_CHNL_WIDTH;
56
57 + vht_capabilities_info = host_to_le32(hapd->iface->current_mode->vht_capab);
58 + chwidth = hostapd_get_oper_chwidth(hapd->iconf);
59 + if (vht_capabilities_info & VHT_CAP_EXTENDED_NSS_BW_SUPPORT
60 + && ((chwidth == CHANWIDTH_160MHZ) || (chwidth == CHANWIDTH_80P80MHZ))) {
61 + oper->operation_mode = host_to_le16(hapd->iconf->vht_oper_centr_freq_seg0_idx << 5);
62 + }
63 +
64 pos += sizeof(*oper);
65
66 return pos;
67 --- a/src/ap/ieee802_11_vht.c
68 +++ b/src/ap/ieee802_11_vht.c
69 @@ -26,6 +26,7 @@ u8 * hostapd_eid_vht_capabilities(struct
70 struct ieee80211_vht_capabilities *cap;
71 struct hostapd_hw_modes *mode = hapd->iface->current_mode;
72 u8 *pos = eid;
73 + u8 chwidth;
74
75 if (!mode || is_6ghz_op_class(hapd->iconf->op_class))
76 return eid;
77 @@ -63,6 +64,17 @@ u8 * hostapd_eid_vht_capabilities(struct
78 host_to_le32(nsts << VHT_CAP_BEAMFORMEE_STS_OFFSET);
79 }
80
81 + chwidth = hostapd_get_oper_chwidth(hapd->iconf);
82 + if (((host_to_le32(mode->vht_capab)) & VHT_CAP_EXTENDED_NSS_BW_SUPPORT)
83 + && ((chwidth == CHANWIDTH_160MHZ) || (chwidth == CHANWIDTH_80P80MHZ))) {
84 + cap->vht_capabilities_info |= VHT_CAP_EXTENDED_NSS_BW_SUPPORT;
85 + cap->vht_capabilities_info &= ~(host_to_le32(VHT_CAP_SUPP_CHAN_WIDTH_160_80PLUS80MHZ));
86 + cap->vht_capabilities_info &= ~(host_to_le32(VHT_CAP_SUPP_CHAN_WIDTH_160MHZ));
87 + cap->vht_capabilities_info &= ~(host_to_le32(VHT_CAP_SUPP_CHAN_WIDTH_MASK));
88 + } else {
89 + cap->vht_capabilities_info &= ~VHT_CAP_EXTENDED_NSS_BW_SUPPORT_MASK;
90 + }
91 +
92 /* Supported MCS set comes from hw */
93 os_memcpy(&cap->vht_supported_mcs_set, mode->vht_mcs_set, 8);
94
95 @@ -75,6 +87,7 @@ u8 * hostapd_eid_vht_capabilities(struct
96 u8 * hostapd_eid_vht_operation(struct hostapd_data *hapd, u8 *eid)
97 {
98 struct ieee80211_vht_operation *oper;
99 + le32 vht_capabilities_info;
100 u8 *pos = eid;
101 enum oper_chan_width oper_chwidth =
102 hostapd_get_oper_chwidth(hapd->iconf);
103 @@ -110,6 +123,7 @@ u8 * hostapd_eid_vht_operation(struct ho
104 oper->vht_op_info_chan_center_freq_seg1_idx = seg1;
105
106 oper->vht_op_info_chwidth = oper_chwidth;
107 + vht_capabilities_info = host_to_le32(hapd->iface->current_mode->vht_capab);
108 if (oper_chwidth == CONF_OPER_CHWIDTH_160MHZ) {
109 /*
110 * Convert 160 MHz channel width to new style as interop
111 @@ -123,6 +137,9 @@ u8 * hostapd_eid_vht_operation(struct ho
112 oper->vht_op_info_chan_center_freq_seg0_idx -= 8;
113 else
114 oper->vht_op_info_chan_center_freq_seg0_idx += 8;
115 +
116 + if (vht_capabilities_info & VHT_CAP_EXTENDED_NSS_BW_SUPPORT)
117 + oper->vht_op_info_chan_center_freq_seg1_idx = 0;
118 } else if (oper_chwidth == CONF_OPER_CHWIDTH_80P80MHZ) {
119 /*
120 * Convert 80+80 MHz channel width to new style as interop
121 --- a/src/common/hw_features_common.c
122 +++ b/src/common/hw_features_common.c
123 @@ -898,6 +898,7 @@ int ieee80211ac_cap_check(u32 hw, u32 co
124 VHT_CAP_CHECK(VHT_CAP_VHT_LINK_ADAPTATION_VHT_MRQ_MFB);
125 VHT_CAP_CHECK(VHT_CAP_RX_ANTENNA_PATTERN);
126 VHT_CAP_CHECK(VHT_CAP_TX_ANTENNA_PATTERN);
127 + VHT_CAP_CHECK(VHT_CAP_EXTENDED_NSS_BW_SUPPORT);
128
129 #undef VHT_CAP_CHECK
130 #undef VHT_CAP_CHECK_MAX
131 --- a/src/common/ieee802_11_defs.h
132 +++ b/src/common/ieee802_11_defs.h
133 @@ -1397,6 +1397,8 @@ struct ieee80211_ampe_ie {
134 #define VHT_CAP_VHT_LINK_ADAPTATION_VHT_MRQ_MFB ((u32) BIT(26) | BIT(27))
135 #define VHT_CAP_RX_ANTENNA_PATTERN ((u32) BIT(28))
136 #define VHT_CAP_TX_ANTENNA_PATTERN ((u32) BIT(29))
137 +#define VHT_CAP_EXTENDED_NSS_BW_SUPPORT ((u32) BIT(30))
138 +#define VHT_CAP_EXTENDED_NSS_BW_SUPPORT_MASK ((u32) BIT(30) | BIT(31))
139
140 #define VHT_OPMODE_CHANNEL_WIDTH_MASK ((u8) BIT(0) | BIT(1))
141 #define VHT_OPMODE_CHANNEL_RxNSS_MASK ((u8) BIT(4) | BIT(5) | \