xref: /wlan-driver/qcacld-3.0/core/wma/src/wma_eht.h (revision 5113495b16420b49004c444715d2daae2066e7dc)
1 /*
2  * Copyright (c) 2021, The Linux Foundation. All rights reserved.
3  * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved.
4  *
5  * Permission to use, copy, modify, and/or distribute this software for any
6  * purpose with or without fee is hereby granted, provided that the above
7  * copyright notice and this permission notice appear in all copies.
8  *
9  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16  */
17 
18 #ifndef __WMA_EHT_H
19 #define __WMA_EHT_H
20 
21 #include "wma.h"
22 
23 enum EHT_TXRX_MCS_NSS_IDX {
24 	EHTCAP_TXRX_MCS_NSS_IDX0,
25 	EHTCAP_TXRX_MCS_NSS_IDX1,
26 	EHTCAP_TXRX_MCS_NSS_IDX2,
27 	EHTCAP_TXRX_MCS_NSS_IDXMAX,
28 };
29 
30 #if defined(WLAN_FEATURE_11BE)
31 #define MAX_EHT_DCM_INDEX 2
32 /* valid only for mcs-15 */
33 #define IS_EHT_ MCS_HAS_DCM_RATE(val)  ((val) == 15)
34 /**
35  * struct index_eht_data_rate_type - eht data rate type
36  * @beacon_rate_index: Beacon rate index
37  * @supported_eht20_rate: eht20 rate
38  * @supported_eht40_rate: eht40 rate
39  * @supported_eht80_rate: eht80 rate
40  * @supported_eht160_rate: eht160 rate
41  */
42 struct index_eht_data_rate_type {
43 	uint8_t beacon_rate_index;
44 	uint16_t supported_eht20_rate[MAX_EHT_DCM_INDEX][3];
45 	uint16_t supported_eht40_rate[MAX_EHT_DCM_INDEX][3];
46 	uint16_t supported_eht80_rate[MAX_EHT_DCM_INDEX][3];
47 	uint16_t supported_eht160_rate[MAX_EHT_DCM_INDEX][3];
48 	uint16_t supported_eht320_rate[MAX_EHT_DCM_INDEX][3];
49 };
50 
51 /*
52  * wma_eht_update_tgt_services() - update tgt cfg to indicate 11be support
53  * @wmi_handle: pointer to WMI handle
54  * @cfg: pointer to WMA target services
55  *
56  * Based on WMI SERVICES information, enable 11be support and set DOT11BE
57  * bit in feature caps bitmap.
58  *
59  * Return: None
60  */
61 void wma_eht_update_tgt_services(struct wmi_unified *wmi_handle,
62 				 struct wma_tgt_services *cfg);
63 /**
64  * wma_update_target_ext_eht_cap() - Update EHT caps with given extended cap
65  * @tgt_hdl: target psoc information
66  * @tgt_cfg: Target config
67  *
68  * This function loop through each hardware mode and for each hardware mode
69  * again it loop through each MAC/PHY and pull the caps 2G and 5G specific
70  * EHT caps and derives the final cap.
71  *
72  * Return: None
73  */
74 void wma_update_target_ext_eht_cap(struct target_psoc_info *tgt_hdl,
75 				   struct wma_tgt_cfg *tgt_cfg);
76 
77 void wma_update_vdev_eht_ops(uint32_t *eht_ops, tDot11fIEeht_op *eht_op);
78 
79 /**
80  * wma_print_eht_cap() - Print EHT capabilities
81  * @eht_cap: pointer to EHT Capability
82  *
83  * Received EHT capabilities are converted into dot11f structure.
84  * This function will print all the EHT capabilities as stored
85  * in the dot11f structure.
86  *
87  * Return: None
88  */
89 void wma_print_eht_cap(tDot11fIEeht_cap *eht_cap);
90 
91 /**
92  * wma_print_eht_phy_cap() - Print EHT PHY Capability
93  * @phy_cap: pointer to PHY Capability
94  *
95  * This function prints EHT PHY Capability received from FW.
96  *
97  * Return: none
98  */
99 void wma_print_eht_phy_cap(uint32_t *phy_cap);
100 
101 /**
102  * wma_print_eht_mac_cap() - Print EHT MAC Capability
103  * @mac_cap: pointer to MAC Capability
104  *
105  * This function prints EHT MAC Capability received from FW.
106  *
107  * Return: none
108  */
109 void wma_print_eht_mac_cap(uint32_t *mac_cap);
110 
111 /**
112  * wma_print_eht_op() - Print EHT Operation
113  * @eht_cap: pointer to EHT Operation
114  *
115  * Print EHT operation stored as dot11f structure
116  *
117  * Return: None
118  */
119 void wma_print_eht_op(tDot11fIEeht_op *eht_ops);
120 
121 /**
122  * wma_populate_peer_eht_cap() - populate peer EHT capabilities in
123  *                               peer assoc cmd
124  * @peer: pointer to peer assoc params
125  * @params: pointer to ADD STA params
126  *
127  * Return: None
128  */
129 void wma_populate_peer_eht_cap(struct peer_assoc_params *peer,
130 			       tpAddStaParams params);
131 
132 /**
133  * wma_vdev_set_eht_bss_params() - set EHT OPs in vdev start
134  * @wma: pointer to wma handle
135  * @vdev_id: VDEV id
136  * @eht_info: pointer to eht info
137  *
138  * Return: None
139  */
140 void wma_vdev_set_eht_bss_params(tp_wma_handle wma, uint8_t vdev_id,
141 				 struct vdev_mlme_eht_ops_info *eht_info);
142 
143 /**
144  * wma_is_peer_eht_capable() - whether peer is eht capable or not
145  * @params: add sta params
146  *
147  * Return: true if eht capable is present
148  */
wma_is_peer_eht_capable(tpAddStaParams params)149 static inline bool wma_is_peer_eht_capable(tpAddStaParams params)
150 {
151 	return params->eht_capable;
152 }
153 
154 /**
155  * wma_get_eht_capabilities() - Get EHT capabilities from WMA
156  * @eht_cap: Pointer to EHT capabilities
157  *
158  * Currently EHT capabilities are not updated in wma_handle. This
159  * is an interface for upper layer to query capabilities from WMA.
160  * When the real use case arise, update wma_handle with EHT capabilities
161  * as required.
162  *
163  * Return: QDF_STATUS
164  */
165 QDF_STATUS wma_get_eht_capabilities(struct eht_capability *eht_cap);
166 
167 /**
168  * wma_set_peer_assoc_params_bw_320() - Set bw_320 based on ch_width
169  * @params: pointer to peer assoc params
170  * @ch_width: enum phy_ch_width
171  *
172  * If ch_width is CH_WIDTH_320MHZ, set params->bw_320 to 1
173  *
174  * Return: None
175  */
176 void wma_set_peer_assoc_params_bw_320(struct peer_assoc_params *params,
177 				      enum phy_ch_width ch_width);
178 
179 /**
180  * wma_set_eht_txbf_cfg() - set EHT Tx beamforming mlme cfg to FW
181  * @mac: Global MAC context
182  * @vdev_id: VDEV id
183  *
184  * Return: None
185  */
186 void wma_set_eht_txbf_cfg(struct mac_context *mac, uint8_t vdev_id);
187 
188 /**
189  * wma_set_eht_txbf_params() - set EHT Tx beamforming params to FW
190  * @vdev_id: VDEV id
191  * @su bfer: SU beamformer capability
192  * @su bfee: SU beamformee capability
193  * @mu bfer: MU beamformer capability
194  *
195  * Return: None
196  */
197 void wma_set_eht_txbf_params(uint8_t vdev_id, bool su_bfer,
198 			     bool su_bfee, bool mu_bfer);
199 
200 /**
201  * wma_get_eht_rate_flags() - Return the EHT rate flags corresponding to the BW
202  * @ch_width: BW for which rate flags is required
203  *
204  * Return: Rate flags corresponding to ch_width
205  */
206 enum tx_rate_info wma_get_eht_rate_flags(enum phy_ch_width ch_width);
207 
208 /**
209  * wma_match_eht_rate() - get eht rate matching with nss
210  * @raw_rate: raw rate from fw
211  * @rate_flags: rate flags
212  * @nss: nss
213  * @dcm: dcm
214  * @guard_interval: guard interval
215  * @mcs_rate_flag: mcs rate flags
216  * @p_index: index for matched rate
217  *
218  *  Return: return match rate if found, else 0
219  */
220 uint16_t wma_match_eht_rate(uint16_t raw_rate,
221 			    enum tx_rate_info rate_flags,
222 			    uint8_t *nss, uint8_t *dcm,
223 			    enum txrate_gi *guard_interval,
224 			    enum tx_rate_info *mcs_rate_flag,
225 			    uint8_t *p_index);
226 
227 /**
228  * wma_set_bss_rate_flags_eht() - set rate flags based on BSS capability
229  * @rate_flags: rate_flags pointer
230  * @add_bss: add_bss params
231  *
232  * Return: QDF_STATUS
233  */
234 QDF_STATUS wma_set_bss_rate_flags_eht(enum tx_rate_info *rate_flags,
235 				      struct bss_params *add_bss);
236 
237 /**
238  * wma_get_bss_eht_capable() - whether bss is eht capable or not
239  * @add_bss: add_bss params
240  *
241  * Return: true if eht capable is present
242  */
243 bool wma_get_bss_eht_capable(struct bss_params *add_bss);
244 
245 static
wma_is_eht_phymode_supported(enum wlan_phymode bss_phymode)246 inline bool wma_is_eht_phymode_supported(enum wlan_phymode bss_phymode)
247 {
248 	return IS_WLAN_PHYMODE_EHT(bss_phymode);
249 }
250 
251 /**
252  * wma_set_eht_txbf_vdev_params() - set EHT Tx beamforming params to FW
253  * @mac: mac context
254  * @mode: mode address to access mode value
255  *
256  * Return: success
257  */
258 QDF_STATUS
259 wma_set_eht_txbf_vdev_params(struct mac_context *mac, uint32_t *mode);
260 
261 #else
wma_eht_update_tgt_services(struct wmi_unified * wmi_handle,struct wma_tgt_services * cfg)262 static inline void wma_eht_update_tgt_services(struct wmi_unified *wmi_handle,
263 					       struct wma_tgt_services *cfg)
264 {
265 		cfg->en_11be = false;
266 		return;
267 }
268 
269 static inline
wma_update_target_ext_eht_cap(struct target_psoc_info * tgt_hdl,struct wma_tgt_cfg * tgt_cfg)270 void wma_update_target_ext_eht_cap(struct target_psoc_info *tgt_hdl,
271 				   struct wma_tgt_cfg *tgt_cfg)
272 {
273 }
274 
275 static inline
wma_update_vdev_eht_ops(uint32_t * eht_ops,tDot11fIEeht_op * eht_op)276 void wma_update_vdev_eht_ops(uint32_t *eht_ops, tDot11fIEeht_op *eht_op)
277 {
278 }
279 
280 static inline
wma_print_eht_cap(tDot11fIEeht_cap * eht_cap)281 void wma_print_eht_cap(tDot11fIEeht_cap *eht_cap)
282 {
283 }
284 
285 static inline
wma_print_eht_phy_cap(uint32_t * phy_cap)286 void wma_print_eht_phy_cap(uint32_t *phy_cap)
287 {
288 }
289 
290 static inline
wma_print_eht_mac_cap(uint32_t * mac_cap)291 void wma_print_eht_mac_cap(uint32_t *mac_cap)
292 {
293 }
294 
295 static inline
wma_print_eht_op(tDot11fIEeht_op * eht_ops)296 void wma_print_eht_op(tDot11fIEeht_op *eht_ops)
297 {
298 }
299 
300 static inline
wma_populate_peer_eht_cap(struct peer_assoc_params * peer,tpAddStaParams params)301 void wma_populate_peer_eht_cap(struct peer_assoc_params *peer,
302 			       tpAddStaParams params)
303 {
304 }
305 
wma_is_peer_eht_capable(tpAddStaParams params)306 static inline bool wma_is_peer_eht_capable(tpAddStaParams params)
307 {
308 	return false;
309 }
310 
311 static inline
wma_set_peer_assoc_params_bw_320(struct peer_assoc_params * params,enum phy_ch_width ch_width)312 void wma_set_peer_assoc_params_bw_320(struct peer_assoc_params *params,
313 				      enum phy_ch_width ch_width)
314 {
315 }
316 
317 static inline
wma_set_eht_txbf_cfg(struct mac_context * mac,uint8_t vdev_id)318 void wma_set_eht_txbf_cfg(struct mac_context *mac, uint8_t vdev_id)
319 {
320 }
321 
322 static inline
wma_set_eht_txbf_params(uint8_t vdev_id,bool su_bfer,bool su_bfee,bool mu_bfer)323 void wma_set_eht_txbf_params(uint8_t vdev_id, bool su_bfer,
324 			     bool su_bfee, bool mu_bfer)
325 {
326 }
327 
328 static inline
wma_set_bss_rate_flags_eht(enum tx_rate_info * rate_flags,struct bss_params * add_bss)329 QDF_STATUS wma_set_bss_rate_flags_eht(enum tx_rate_info *rate_flags,
330 				      struct bss_params *add_bss)
331 {
332 	return QDF_STATUS_E_INVAL;
333 }
334 
335 static inline
wma_get_eht_rate_flags(enum phy_ch_width ch_width)336 enum tx_rate_info wma_get_eht_rate_flags(enum phy_ch_width ch_width)
337 {
338 	return TX_RATE_EHT20;
339 }
340 
341 static inline
wma_match_eht_rate(uint16_t raw_rate,enum tx_rate_info rate_flags,uint8_t * nss,uint8_t * dcm,enum txrate_gi * guard_interval,enum tx_rate_info * mcs_rate_flag,uint8_t * p_index)342 uint16_t wma_match_eht_rate(uint16_t raw_rate,
343 			    enum tx_rate_info rate_flags,
344 			    uint8_t *nss, uint8_t *dcm,
345 			    enum txrate_gi *guard_interval,
346 			    enum tx_rate_info *mcs_rate_flag,
347 			    uint8_t *p_index)
348 {
349 		return 0;
350 }
351 
352 static inline
wma_get_bss_eht_capable(struct bss_params * add_bss)353 bool wma_get_bss_eht_capable(struct bss_params *add_bss)
354 {
355 	return false;
356 }
357 
wma_is_eht_phymode_supported(enum wlan_phymode bss_phymode)358 static inline bool wma_is_eht_phymode_supported(enum wlan_phymode bss_phymode)
359 {
360 	return false;
361 }
362 
363 static inline
wma_set_eht_txbf_vdev_params(struct mac_context * mac,uint32_t * mode)364 QDF_STATUS wma_set_eht_txbf_vdev_params(struct mac_context *mac, uint32_t *mode)
365 {
366 	return QDF_STATUS_E_NOSUPPORT;
367 }
368 #endif
369 
370 #ifdef WLAN_FEATURE_11BE_MLO
371 void wma_vdev_set_listen_interval(uint8_t vdev_id, uint8_t val);
372 #else
373 static inline
wma_vdev_set_listen_interval(uint8_t vdev_id,uint8_t val)374 void wma_vdev_set_listen_interval(uint8_t vdev_id, uint8_t val)
375 {}
376 #endif
377 #endif
378