uboot-envtools: ramips: add support for ALFA Network AX1800RM
[openwrt/openwrt.git] / package / kernel / mac80211 / patches / ath11k / 0072-wifi-ath11k-MBSSID-configuration-during-vdev-create-.patch
1 From 5a81610acf66c4ad6e1a1fbd09f3f555fca863b1 Mon Sep 17 00:00:00 2001
2 From: Aloka Dixit <quic_alokad@quicinc.com>
3 Date: Fri, 5 May 2023 16:11:27 +0300
4 Subject: [PATCH 72/77] wifi: ath11k: MBSSID configuration during vdev
5 create/start
6
7 Configure multiple BSSID flags and index of the transmitting interface
8 in vdev create/start commands depending on the service bit
9 WMI_TLV_SERVICE_MBSS_PARAM_IN_VDEV_START_SUPPORT.
10
11 Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1
12
13 Signed-off-by: Aloka Dixit <quic_alokad@quicinc.com>
14 Co-developed-by: John Crispin <john@phrozen.org>
15 Signed-off-by: John Crispin <john@phrozen.org>
16 Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
17 Link: https://lore.kernel.org/r/20230405221648.17950-3-quic_alokad@quicinc.com
18 ---
19 drivers/net/wireless/ath/ath11k/mac.c | 70 +++++++++++++++++++++++++--
20 drivers/net/wireless/ath/ath11k/wmi.c | 5 ++
21 drivers/net/wireless/ath/ath11k/wmi.h | 19 ++++++++
22 3 files changed, 90 insertions(+), 4 deletions(-)
23
24 --- a/drivers/net/wireless/ath/ath11k/mac.c
25 +++ b/drivers/net/wireless/ath/ath11k/mac.c
26 @@ -6181,17 +6181,62 @@ static void ath11k_mac_op_stop(struct ie
27 atomic_set(&ar->num_pending_mgmt_tx, 0);
28 }
29
30 -static void
31 -ath11k_mac_setup_vdev_create_params(struct ath11k_vif *arvif,
32 - struct vdev_create_params *params)
33 +static int ath11k_mac_setup_vdev_params_mbssid(struct ath11k_vif *arvif,
34 + u32 *flags, u32 *tx_vdev_id)
35 +{
36 + struct ath11k *ar = arvif->ar;
37 + struct ath11k_vif *tx_arvif;
38 + struct ieee80211_vif *tx_vif;
39 +
40 + *tx_vdev_id = 0;
41 + tx_vif = arvif->vif->mbssid_tx_vif;
42 + if (!tx_vif) {
43 + *flags = WMI_HOST_VDEV_FLAGS_NON_MBSSID_AP;
44 + return 0;
45 + }
46 +
47 + tx_arvif = (void *)tx_vif->drv_priv;
48 +
49 + if (arvif->vif->bss_conf.nontransmitted) {
50 + if (ar->hw->wiphy != ieee80211_vif_to_wdev(tx_vif)->wiphy)
51 + return -EINVAL;
52 +
53 + *flags = WMI_HOST_VDEV_FLAGS_NON_TRANSMIT_AP;
54 + *tx_vdev_id = ath11k_vif_to_arvif(tx_vif)->vdev_id;
55 + } else if (tx_arvif == arvif) {
56 + *flags = WMI_HOST_VDEV_FLAGS_TRANSMIT_AP;
57 + } else {
58 + return -EINVAL;
59 + }
60 +
61 + if (arvif->vif->bss_conf.ema_ap)
62 + *flags |= WMI_HOST_VDEV_FLAGS_EMA_MODE;
63 +
64 + return 0;
65 +}
66 +
67 +static int ath11k_mac_setup_vdev_create_params(struct ath11k_vif *arvif,
68 + struct vdev_create_params *params)
69 {
70 struct ath11k *ar = arvif->ar;
71 struct ath11k_pdev *pdev = ar->pdev;
72 + int ret;
73
74 params->if_id = arvif->vdev_id;
75 params->type = arvif->vdev_type;
76 params->subtype = arvif->vdev_subtype;
77 params->pdev_id = pdev->pdev_id;
78 + params->mbssid_flags = 0;
79 + params->mbssid_tx_vdev_id = 0;
80 +
81 + if (!test_bit(WMI_TLV_SERVICE_MBSS_PARAM_IN_VDEV_START_SUPPORT,
82 + ar->ab->wmi_ab.svc_map)) {
83 + ret = ath11k_mac_setup_vdev_params_mbssid(arvif,
84 + &params->mbssid_flags,
85 + &params->mbssid_tx_vdev_id);
86 + if (ret)
87 + return ret;
88 + }
89
90 if (pdev->cap.supported_bands & WMI_HOST_WLAN_2G_CAP) {
91 params->chains[NL80211_BAND_2GHZ].tx = ar->num_tx_chains;
92 @@ -6206,6 +6251,7 @@ ath11k_mac_setup_vdev_create_params(stru
93 params->chains[NL80211_BAND_6GHZ].tx = ar->num_tx_chains;
94 params->chains[NL80211_BAND_6GHZ].rx = ar->num_rx_chains;
95 }
96 + return 0;
97 }
98
99 static void ath11k_mac_op_update_vif_offload(struct ieee80211_hw *hw,
100 @@ -6500,7 +6546,12 @@ static int ath11k_mac_op_add_interface(s
101 for (i = 0; i < ARRAY_SIZE(vif->hw_queue); i++)
102 vif->hw_queue[i] = i % (ATH11K_HW_MAX_QUEUES - 1);
103
104 - ath11k_mac_setup_vdev_create_params(arvif, &vdev_param);
105 + ret = ath11k_mac_setup_vdev_create_params(arvif, &vdev_param);
106 + if (ret) {
107 + ath11k_warn(ab, "failed to create vdev parameters %d: %d\n",
108 + arvif->vdev_id, ret);
109 + goto err;
110 + }
111
112 ret = ath11k_wmi_vdev_create(ar, vif->addr, &vdev_param);
113 if (ret) {
114 @@ -6905,6 +6956,17 @@ ath11k_mac_vdev_start_restart(struct ath
115 arg.pref_tx_streams = ar->num_tx_chains;
116 arg.pref_rx_streams = ar->num_rx_chains;
117
118 + arg.mbssid_flags = 0;
119 + arg.mbssid_tx_vdev_id = 0;
120 + if (test_bit(WMI_TLV_SERVICE_MBSS_PARAM_IN_VDEV_START_SUPPORT,
121 + ar->ab->wmi_ab.svc_map)) {
122 + ret = ath11k_mac_setup_vdev_params_mbssid(arvif,
123 + &arg.mbssid_flags,
124 + &arg.mbssid_tx_vdev_id);
125 + if (ret)
126 + return ret;
127 + }
128 +
129 if (arvif->vdev_type == WMI_VDEV_TYPE_AP) {
130 arg.ssid = arvif->u.ap.ssid;
131 arg.ssid_len = arvif->u.ap.ssid_len;
132 --- a/drivers/net/wireless/ath/ath11k/wmi.c
133 +++ b/drivers/net/wireless/ath/ath11k/wmi.c
134 @@ -724,6 +724,9 @@ int ath11k_wmi_vdev_create(struct ath11k
135 cmd->vdev_subtype = param->subtype;
136 cmd->num_cfg_txrx_streams = WMI_NUM_SUPPORTED_BAND_MAX;
137 cmd->pdev_id = param->pdev_id;
138 + cmd->mbssid_flags = param->mbssid_flags;
139 + cmd->mbssid_tx_vdev_id = param->mbssid_tx_vdev_id;
140 +
141 ether_addr_copy(cmd->vdev_macaddr.addr, macaddr);
142
143 ptr = skb->data + sizeof(*cmd);
144 @@ -941,6 +944,8 @@ int ath11k_wmi_vdev_start(struct ath11k
145 cmd->cac_duration_ms = arg->cac_duration_ms;
146 cmd->regdomain = arg->regdomain;
147 cmd->he_ops = arg->he_ops;
148 + cmd->mbssid_flags = arg->mbssid_flags;
149 + cmd->mbssid_tx_vdev_id = arg->mbssid_tx_vdev_id;
150
151 if (!restart) {
152 if (arg->ssid) {
153 --- a/drivers/net/wireless/ath/ath11k/wmi.h
154 +++ b/drivers/net/wireless/ath/ath11k/wmi.h
155 @@ -137,6 +137,14 @@ enum {
156 WMI_AUTORATE_3200NS_GI = BIT(11),
157 };
158
159 +enum {
160 + WMI_HOST_VDEV_FLAGS_NON_MBSSID_AP = 0x00000001,
161 + WMI_HOST_VDEV_FLAGS_TRANSMIT_AP = 0x00000002,
162 + WMI_HOST_VDEV_FLAGS_NON_TRANSMIT_AP = 0x00000004,
163 + WMI_HOST_VDEV_FLAGS_EMA_MODE = 0x00000008,
164 + WMI_HOST_VDEV_FLAGS_SCAN_MODE_VAP = 0x00000010,
165 +};
166 +
167 /*
168 * wmi command groups.
169 */
170 @@ -2096,6 +2104,7 @@ enum wmi_tlv_service {
171 WMI_TLV_SERVICE_EXT2_MSG = 220,
172 WMI_TLV_SERVICE_PEER_POWER_SAVE_DURATION_SUPPORT = 246,
173 WMI_TLV_SERVICE_SRG_SRP_SPATIAL_REUSE_SUPPORT = 249,
174 + WMI_TLV_SERVICE_MBSS_PARAM_IN_VDEV_START_SUPPORT = 253,
175 WMI_TLV_SERVICE_PASSIVE_SCAN_START_TIME_ENHANCE = 263,
176
177 /* The second 128 bits */
178 @@ -2583,6 +2592,8 @@ struct vdev_create_params {
179 u8 rx;
180 } chains[NUM_NL80211_BANDS];
181 u32 pdev_id;
182 + u32 mbssid_flags;
183 + u32 mbssid_tx_vdev_id;
184 };
185
186 struct wmi_vdev_create_cmd {
187 @@ -2593,6 +2604,8 @@ struct wmi_vdev_create_cmd {
188 struct wmi_mac_addr vdev_macaddr;
189 u32 num_cfg_txrx_streams;
190 u32 pdev_id;
191 + u32 mbssid_flags;
192 + u32 mbssid_tx_vdev_id;
193 } __packed;
194
195 struct wmi_vdev_txrx_streams {
196 @@ -2656,6 +2669,9 @@ struct wmi_vdev_start_request_cmd {
197 u32 he_ops;
198 u32 cac_duration_ms;
199 u32 regdomain;
200 + u32 min_data_rate;
201 + u32 mbssid_flags;
202 + u32 mbssid_tx_vdev_id;
203 } __packed;
204
205 #define MGMT_TX_DL_FRM_LEN 64
206 @@ -2825,6 +2841,9 @@ struct wmi_vdev_start_req_arg {
207 u32 pref_rx_streams;
208 u32 pref_tx_streams;
209 u32 num_noa_descriptors;
210 + u32 min_data_rate;
211 + u32 mbssid_flags;
212 + u32 mbssid_tx_vdev_id;
213 };
214
215 struct peer_create_params {