xref: /wlan-driver/qcacld-3.0/core/wma/inc/wma_he.h (revision 5113495b16420b49004c444715d2daae2066e7dc)
1 /*
2  * Copyright (c) 2017-2020 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
6  * any purpose with or without fee is hereby granted, provided that the
7  * above copyright notice and this permission notice appear in all
8  * copies.
9  *
10  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
11  * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
12  * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
13  * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
14  * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
15  * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
16  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
17  * PERFORMANCE OF THIS SOFTWARE.
18  */
19 
20 #ifndef __WMA_HE_H
21 #define __WMA_HE_H
22 
23 #include "wma.h"
24 #include "sir_api.h"
25 #include "target_if.h"
26 
27 /* Number of bits to shift on HE MCS 12 13 MAP to get the desired map */
28 #define WMA_MCS_12_13_MAP_L80 16
29 #define WMA_MCS_12_13_MAP_G80 8
30 
31 /* Mask to fill tx and rx mcs rate maps to be sent to the FW */
32 #define WMA_MCS_12_13_PEER_RATE_MAP 0x00ff0000
33 
34 #ifdef WLAN_FEATURE_11AX
35 /**
36  * wma_print_he_cap() - Print HE capabilities
37  * @he_cap: pointer to HE Capability
38  *
39  * Received HE capabilities are converted into dot11f structure.
40  * This function will print all the HE capabilities as stored
41  * in the dot11f structure.
42  *
43  * Return: None
44  */
45 void wma_print_he_cap(tDot11fIEhe_cap *he_cap);
46 
47 /**
48  * wma_print_he_ppet() - Prints HE PPE Threshold
49  * @he_ppet: PPE Threshold
50  *
51  * This function prints HE PPE Threshold as received from FW.
52  * Refer to the definition of wmi_ppe_threshold to understand
53  * how PPE thresholds are packed by FW for a given NSS and RU.
54  *
55  * Return: none
56  */
57 void wma_print_he_ppet(void *ppet);
58 
59 /**
60  * wma_print_he_phy_cap() - Print HE PHY Capability
61  * @phy_cap: pointer to PHY Capability
62  *
63  * This function prints HE PHY Capability received from FW.
64  *
65  * Return: none
66  */
67 void wma_print_he_phy_cap(uint32_t *phy_cap);
68 
69 /**
70  * wma_print_he_mac_cap_w1() - Print HE MAC Capability
71  * @mac_cap: MAC Capability
72  *
73  * This function prints HE MAC Capability received from FW.
74  *
75  * Return: none
76  */
77 void wma_print_he_mac_cap_w1(uint32_t mac_cap);
78 
79 /**
80  * wma_print_he_mac_cap_w2() - Print HE MAC Capability
81  * @mac_cap: MAC Capability
82  *
83  * This function prints HE MAC Capability received from FW.
84  *
85  * Return: none
86  */
87 void wma_print_he_mac_cap_w2(uint32_t mac_cap);
88 
89 /**
90  * wma_print_he_op() - Print HE Operation
91  * @he_cap: pointer to HE Operation
92  *
93  * Print HE operation stored as dot11f structure
94  *
95  * Return: None
96  */
97 void wma_print_he_op(tDot11fIEhe_op *he_ops);
98 
99 /**
100  * wma_update_target_ext_he_cap() - Update HE caps with given extended cap
101  * @tgt_hdl: target psoc information
102  * @tgt_cfg: Target config
103  *
104  * This function loop through each hardware mode and for each hardware mode
105  * again it loop through each MAC/PHY and pull the caps 2G and 5G specific
106  * HE caps and derives the final cap.
107  *
108  * Return: None
109  */
110 void wma_update_target_ext_he_cap(struct target_psoc_info *tgt_hdl,
111 				  struct wma_tgt_cfg *tgt_cfg);
112 
113 /*
114  * wma_he_update_tgt_services() - update tgt cfg to indicate 11ax support
115  * @wmi_handle: pointer to WMI handle
116  * @cfg: pointer to WMA target services
117  *
118  * Based on WMI SERVICES information, enable 11ax support and set DOT11AX bit
119  * in feature caps bitmap.
120  *
121  * Return: None
122  */
123 void wma_he_update_tgt_services(struct wmi_unified *wmi_handle,
124 				struct wma_tgt_services *cfg);
125 
126 /**
127  * wma_populate_peer_he_cap() - populate peer HE capabilities in peer assoc cmd
128  * @peer: pointer to peer assoc params
129  * @params: pointer to ADD STA params
130  *
131  * Return: None
132  */
133 void wma_populate_peer_he_cap(struct peer_assoc_params *peer,
134 			      tpAddStaParams params);
135 
136 /**
137  * wma_update_vdev_he_ops() - update he ops in vdev start request
138  * @he_ops: target he ops
139  * @he_op: source he ops
140  *
141  * Return: None
142  */
143 void wma_update_vdev_he_ops(uint32_t *he_ops, tDot11fIEhe_op *he_op);
144 
145 #define DOT11AX_HEMU_MODE 0x30
146 #define HE_SUBFEE 0
147 #define HE_SUBFER 1
148 #define HE_MUBFEE 2
149 #define HE_MUBFER 3
150 
151 /**
152  * wma_get_hemu_mode() - get hemu mode
153  * @hemumode: pointer to have hemumode
154  * @mac: pointer to mac context
155  *
156  * Return: Success on proper hemumode else failure
157  */
158 QDF_STATUS wma_get_hemu_mode(uint32_t *hemumode, struct mac_context *mac);
159 
160 /**
161  * wma_set_he_txbf_params() - set HE Tx beamforming params to FW
162  * @vdev_id: VDEV id
163  * @su bfer: SU beamformer capability
164  * @su bfee: SU beamformee capability
165  * @mu bfer: MU beamformer capability
166  *
167  * Return: None
168  */
169 void wma_set_he_txbf_params(uint8_t vdev_id, bool su_bfer,
170 			    bool su_bfee, bool mu_bfer);
171 
172 
173 /**
174  * wma_set_he_txbf_cfg() - set HE Tx beamforming mlme cfg to FW
175  * @mac: Global MAC context
176  * @vdev_id: VDEV id
177  *
178  * Return: None
179  */
180 void wma_set_he_txbf_cfg(struct mac_context *mac, uint8_t vdev_id);
181 /**
182  * wma_vdev_set_he_bss_params() - set HE OPs in vdev start
183  * @wma: pointer to wma handle
184  * @vdev_id: VDEV id
185  * @he_info: pointer to he info
186  *
187  * Return: None
188  */
189 void wma_vdev_set_he_bss_params(tp_wma_handle wma, uint8_t vdev_id,
190 				struct vdev_mlme_he_ops_info *he_info);
191 
192 /**
193  * wma_vdev_set_he_config() - set HE Config in vdev start
194  * @wma: pointer to wma handle
195  * @vdev_id: VDEV id
196  * @add_bss: BSS params
197  *
198  * Return: None
199  */
200 void wma_vdev_set_he_config(tp_wma_handle wma, uint8_t vdev_id,
201 				struct bss_params *add_bss);
202 
wma_is_peer_he_capable(tpAddStaParams params)203 static inline bool wma_is_peer_he_capable(tpAddStaParams params)
204 {
205 	return params->he_capable;
206 }
207 
208 /**
209  * wma_update_he_ops_ie() - update the HE OPS IE to firmware
210  * @wma: pointer to wma context
211  * @vdev_id: vdev id
212  * @he_ops: 32bit value of HE ops
213  *
214  * This API is used to send updated HE operational IE to firmware, so that
215  * firmware can be in sync with host
216  *
217  * Return: QDF_STATUS
218  */
219 QDF_STATUS wma_update_he_ops_ie(tp_wma_handle wma, uint8_t vdev_id,
220 				tDot11fIEhe_op *he_ops);
221 
222 /**
223  * wma_get_he_capabilities() - Get HE capabilities from WMA
224  * @he_cap: Pointer to HE capabilities
225  *
226  * Currently HE capabilities are not updated in wma_handle. This
227  * is an interface for upper layer to query capabilities from WMA.
228  * When the real use case arise, update wma_handle with HE capabilities
229  * as required.
230  *
231  * Return: QDF_STATUS
232  */
233 QDF_STATUS wma_get_he_capabilities(struct he_capability *he_cap);
234 
235 /**
236  * wma_set_he_vdev_param() - update he vdev param in wma
237  * @intr: pointer to wma_txrx_node
238  * @param_id: vdev param id
239  * @value: value of vdev param
240  *
241  * Result: None
242  */
243 void wma_set_he_vdev_param(struct wma_txrx_node *intr,
244 			   wmi_conv_vdev_param_id param_id,
245 			   uint32_t value);
246 
247 /**
248  * wma_get_he_vdev_param() - retrieve he vdev param from wma
249  * @intr: pointer to wma_txrx_node
250  * @param_id: vdev param id
251  *
252  * Result: param value
253  */
254 uint32_t wma_get_he_vdev_param(struct wma_txrx_node *intr,
255 			       wmi_conv_vdev_param_id param_id);
256 
257 /**
258  * wma_prevent_suspend_on_obss_color_collision() - prevent suspend on obss color
259  *						collision
260  * @vdev: pointer to vdev object
261  *
262  * Return: none
263  */
264 void wma_prevent_suspend_on_obss_color_collision(struct wlan_objmgr_vdev *vdev);
265 
266 /**
267  * wma_allow_suspend_after_obss_color_change() - allow suspend on obss color
268  *						change
269  * @vdev: pointer to vdev object
270  *
271  * Return: none
272  */
273 void wma_allow_suspend_after_obss_color_change(struct wlan_objmgr_vdev *vdev);
274 #else
wma_print_he_cap(tDot11fIEhe_cap * he_cap)275 static inline void wma_print_he_cap(tDot11fIEhe_cap *he_cap)
276 {
277 }
278 
wma_print_he_ppet(void * ppet)279 static inline void wma_print_he_ppet(void *ppet)
280 {
281 }
282 
wma_print_he_phy_cap(uint32_t * phy_cap)283 static inline void wma_print_he_phy_cap(uint32_t *phy_cap)
284 {
285 }
286 
wma_print_he_mac_cap_w1(uint32_t mac_cap)287 static inline void wma_print_he_mac_cap_w1(uint32_t mac_cap)
288 {
289 }
290 
wma_print_he_mac_cap_w2(uint32_t mac_cap)291 static inline void wma_print_he_mac_cap_w2(uint32_t mac_cap)
292 {
293 }
294 
wma_print_he_op(tDot11fIEhe_op * he_ops)295 static inline void wma_print_he_op(tDot11fIEhe_op *he_ops)
296 {
297 }
298 
wma_update_target_ext_he_cap(struct target_psoc_info * tgt_hdl,struct wma_tgt_cfg * tgt_cfg)299 static inline void wma_update_target_ext_he_cap(struct
300 						target_psoc_info *tgt_hdl,
301 						struct wma_tgt_cfg *tgt_cfg)
302 {
303 }
304 
wma_he_update_tgt_services(struct wmi_unified * wmi_handle,struct wma_tgt_services * cfg)305 static inline void wma_he_update_tgt_services(struct wmi_unified *wmi_handle,
306 					      struct wma_tgt_services *cfg)
307 {
308 	cfg->en_11ax = false;
309 	return;
310 }
311 
wma_populate_peer_he_cap(struct peer_assoc_params * peer,tpAddStaParams params)312 static inline void wma_populate_peer_he_cap(struct peer_assoc_params *peer,
313 					    tpAddStaParams params)
314 {
315 }
316 
317 static inline
wma_update_vdev_he_ops(uint32_t * he_ops,tDot11fIEhe_op * he_op)318 void wma_update_vdev_he_ops(uint32_t *he_ops, tDot11fIEhe_op *he_op)
319 {
320 }
321 
wma_get_hemu_mode(uint32_t * hemumode,struct mac_context * mac)322 static inline QDF_STATUS wma_get_hemu_mode(uint32_t *hemumode,
323 					   struct mac_context *mac)
324 {
325 	return QDF_STATUS_E_FAILURE;
326 }
327 
wma_set_he_txbf_params(uint8_t vdev_id,bool su_bfer,bool su_bfee,bool mu_bfer)328 static inline void wma_set_he_txbf_params(uint8_t vdev_id, bool su_bfer,
329 					  bool su_bfee, bool mu_bfer)
330 {
331 }
332 
wma_set_he_txbf_cfg(struct mac_context * mac,uint8_t vdev_id)333 static inline void wma_set_he_txbf_cfg(struct mac_context *mac, uint8_t vdev_id)
334 {
335 }
336 
wma_update_he_ops_ie(tp_wma_handle wma,uint8_t vdev_id,tDot11fIEhe_op * he_ops)337 static inline  QDF_STATUS wma_update_he_ops_ie(tp_wma_handle wma,
338 			uint8_t vdev_id, tDot11fIEhe_op *he_ops)
339 {
340 	return QDF_STATUS_SUCCESS;
341 }
342 
343 static inline
wma_vdev_set_he_bss_params(tp_wma_handle wma,uint8_t vdev_id,struct vdev_mlme_he_ops_info * he_info)344 void wma_vdev_set_he_bss_params(tp_wma_handle wma, uint8_t vdev_id,
345 				struct vdev_mlme_he_ops_info *he_info)
346 {
347 }
348 
wma_vdev_set_he_config(tp_wma_handle wma,uint8_t vdev_id,struct bss_params * add_bss)349 static inline void wma_vdev_set_he_config(tp_wma_handle wma, uint8_t vdev_id,
350 					struct bss_params *add_bss)
351 {
352 }
353 
wma_is_peer_he_capable(tpAddStaParams params)354 static inline bool wma_is_peer_he_capable(tpAddStaParams params)
355 {
356 	return false;
357 }
358 
wma_set_he_vdev_param(struct wma_txrx_node * intr,wmi_conv_vdev_param_id param_id,uint32_t value)359 static inline void wma_set_he_vdev_param(struct wma_txrx_node *intr,
360 			wmi_conv_vdev_param_id param_id, uint32_t value)
361 {
362 }
363 
wma_get_he_vdev_param(struct wma_txrx_node * intr,wmi_conv_vdev_param_id param_id)364 static inline uint32_t wma_get_he_vdev_param(struct wma_txrx_node *intr,
365 					     wmi_conv_vdev_param_id param_id)
366 {
367 	return 0;
368 }
369 
wma_prevent_suspend_on_obss_color_collision(struct wlan_objmgr_vdev * vdev)370 static inline void wma_prevent_suspend_on_obss_color_collision(
371 						struct wlan_objmgr_vdev *vdev)
372 {
373 }
374 
wma_allow_suspend_after_obss_color_change(struct wlan_objmgr_vdev * vdev)375 static inline void wma_allow_suspend_after_obss_color_change(
376 						struct wlan_objmgr_vdev *vdev)
377 {
378 }
379 #endif
380 
381 #endif /* __WMA_HE_H */
382