blob: b0151b071f6aab4d786ed489f15f39e8439c1b38 [file] [log] [blame]
developer8bff6472023-07-17 11:11:44 +08001From d4c4ef302f98fd6bce173b8636e7e350d8b44981 Mon Sep 17 00:00:00 2001
2From: P Praneesh <ppranees@codeaurora.org>
3Date: Fri, 19 Mar 2021 12:17:27 +0530
4Subject: [PATCH] hostapd: update cfs0 and cfs1 for 160MHz
5
6As per standard Draft P802.11ax_D8.0,( Table 26-9Setting
7of the VHT Channel Width and VHT NSS at an HE STA
8transmitting the OM Control subfield ), center frequency of
9160MHz should be published in HT information subset 2 of
10HT information when EXT NSS BW field is enabled.
11
12If the supported number of NSS in 160MHz is at least max NSS
13support, then center_freq_seg0 indicates the center frequency of 80MHz and
14center_freq_seg1 indicates the center frequency of 160MHz.
15
16If the supported number of NSS in 160MHz is less than max NSS
17support, then center_freq_seg0 indicates the center frequency of 80MHz and
18center_freq_seg1 is 0. The center frequency of 160MHz is published in HT
19operation information element instead.
20
21Signed-off-by: P Praneesh <ppranees@codeaurora.org>
22---
23 hostapd/config_file.c | 2 ++
24 src/ap/ieee802_11_ht.c | 7 +++++++
25 src/ap/ieee802_11_vht.c | 16 ++++++++++++++++
26 src/common/hw_features_common.c | 1 +
27 src/common/ieee802_11_defs.h | 1 +
28 5 files changed, 27 insertions(+)
29
30--- a/hostapd/config_file.c
31+++ b/hostapd/config_file.c
32@@ -1153,6 +1153,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@@ -25,6 +25,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@@ -62,6 +63,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@@ -74,6 +86,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@@ -106,6 +119,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@@ -119,6 +133,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
developer95671ae2023-09-25 14:16:05 +0800123@@ -811,6 +811,7 @@ int ieee80211ac_cap_check(u32 hw, u32 co
developer8bff6472023-07-17 11:11:44 +0800124 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
developer95671ae2023-09-25 14:16:05 +0800133@@ -1349,6 +1349,8 @@ struct ieee80211_ampe_ie {
developer8bff6472023-07-17 11:11:44 +0800134 #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) | \