1 /*
2 * Copyright (c) 2013-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
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_INTERNAL_H
21 #define WMA_INTERNAL_H
22 #include <cdp_txrx_handle.h>
23 #if !defined(REMOVE_PKT_LOG)
24 #include "pktlog_ac.h"
25 #endif
26
27 /* ################### defines ################### */
28 /*
29 * TODO: Following constant should be shared by firmware in
30 * wmi_unified.h. This will be done once wmi_unified.h is updated.
31 */
32 #define WMI_PEER_STATE_AUTHORIZED 0x2
33
34 #define WMA_2_4_GHZ_MAX_FREQ 3000
35
36 /*AR9888/AR6320 noise floor approx value
37 * similar to the mentioned the WMA
38 */
39 #define WMA_TGT_NOISE_FLOOR_DBM (-96)
40 #define WMA_INVALID_PER_CHAIN_SNR (0x80)
41 #define WMA_INVALID_PER_CHAIN_RSSI (0xFF)
42
43 /*
44 * Make sure that link monitor and keep alive
45 * default values should be in sync with CFG.
46 */
47 #define WMA_LINK_MONITOR_DEFAULT_TIME_SECS 10
48 #define WMA_KEEP_ALIVE_DEFAULT_TIME_SECS 5
49
50 #define WMA_WMM_EXPO_TO_VAL(val) ((1 << (val)) - 1)
51
52 #define INVALID_MCS_IDX 255
53
54 #define IS_MCS_HAS_DCM_RATE(val) \
55 ((val) == 0 || (val) == 1 || \
56 (val) == 3 || (val) == 4)
57
58 #define LINK_STATUS_LEGACY 0
59 #define LINK_STATUS_VHT 0x1
60 #define LINK_STATUS_MIMO 0x2
61 #define LINK_SUPPORT_VHT 0x4
62 #define LINK_SUPPORT_MIMO 0x8
63
64 #define LINK_RATE_VHT 0x3
65
66 #define MAX_ENTRY_HOLD_REQ_QUEUE 2
67 #define MAX_ENTRY_VDEV_RESP_QUEUE 10
68
69 /**
70 * struct index_data_rate_type - non vht data rate type
71 * @mcs_index: mcs rate index
72 * @ht20_rate: HT20 supported rate table
73 * @ht40_rate: HT40 supported rate table
74 */
75 struct index_data_rate_type {
76 uint8_t mcs_index;
77 uint16_t ht20_rate[2];
78 uint16_t ht40_rate[2];
79 };
80
81 /**
82 * struct index_vht_data_rate_type - vht data rate type
83 * @mcs_index: mcs rate index
84 * @ht20_rate: VHT20 supported rate table
85 * @ht40_rate: VHT40 supported rate table
86 * @ht80_rate: VHT80 supported rate table
87 * @ht160_rate: VHT160 supported rate table
88 */
89 struct index_vht_data_rate_type {
90 uint8_t mcs_index;
91 uint16_t ht20_rate[2];
92 uint16_t ht40_rate[2];
93 uint16_t ht80_rate[2];
94 uint16_t ht160_rate[2];
95 };
96
97 #ifdef WLAN_FEATURE_11AX
98 #define MAX_HE_DCM_INDEX 2
99 /**
100 * struct index_he_data_rate_type - he data rate type
101 * @beacon_rate_index: Beacon rate index
102 * @supported_he80_rate: he80 rate
103 * @supported_he40_rate: he40 rate
104 * @supported_he20_rate: he20 rate
105 * @supported_he160_rate: he160 rate
106 */
107 struct index_he_data_rate_type {
108 uint8_t beacon_rate_index;
109 uint16_t supported_he20_rate[MAX_HE_DCM_INDEX][3];
110 uint16_t supported_he40_rate[MAX_HE_DCM_INDEX][3];
111 uint16_t supported_he80_rate[MAX_HE_DCM_INDEX][3];
112 uint16_t supported_he160_rate[MAX_HE_DCM_INDEX][3];
113 };
114 #endif
115
116 struct wifi_scan_cmd_req_params;
117 /*
118 * wma_main.c functions declarations
119 */
120
121 /**
122 * wma_send_msg_by_priority() - Send wma message to PE with priority.
123 * @wma_handle: wma handle
124 * @msg_type: message type
125 * @body_ptr: message body ptr
126 * @body_val: message body value
127 * @is_high_priority: if msg is high priority
128 *
129 * Return: none
130 */
131 void wma_send_msg_by_priority(tp_wma_handle wma_handle, uint16_t msg_type,
132 void *body_ptr, uint32_t body_val, bool is_high_priority);
133
134 /**
135 * wma_send_msg() - Send wma message to PE.
136 * @wma_handle: wma handle
137 * @msg_type: message type
138 * @body_ptr: message body ptr
139 * @body_val: message body value
140 *
141 * Return: none
142 */
143 void wma_send_msg(tp_wma_handle wma_handle, uint16_t msg_type,
144 void *body_ptr, uint32_t body_val);
145
146 /**
147 * wma_send_msg_high_priority() - Send wma message to PE with high priority.
148 * @wma_handle: wma handle
149 * @msg_type: message type
150 * @body_ptr: message body ptr
151 * @body_val: message body value
152 *
153 * Return: none
154 */
155 void wma_send_msg_high_priority(tp_wma_handle wma_handle, uint16_t msg_type,
156 void *body_ptr, uint32_t body_val);
157
158 void wma_data_tx_ack_comp_hdlr(void *wma_context,
159 qdf_nbuf_t netbuf, int32_t status);
160
161 QDF_STATUS wma_set_ppsconfig(uint8_t vdev_id, uint16_t pps_param,
162 int value);
163
164 /*
165 * wma_scan_roam.c functions declarations
166 */
167
168 #ifdef WLAN_FEATURE_ROAM_OFFLOAD
169
170 #ifdef WLAN_FEATURE_FIPS
171 /**
172 * wma_register_pmkid_req_event_handler() - Register pmkid request event handler
173 * @wma_handle: wma_handle
174 *
175 * This function register pmkid request event handler.
176 */
177 void wma_register_pmkid_req_event_handler(tp_wma_handle wma_handle);
178
179 /**
180 * wma_roam_pmkid_request_event_handler() - Handles roam pmkid request event
181 * @handle: wma_handle
182 * @event: pmkid request event data pointer
183 * @len: length of the data
184 *
185 * Handles pmkid request event from firmware which is triggered after roam
186 * candidate selection.
187 */
188 int wma_roam_pmkid_request_event_handler(void *handle,
189 uint8_t *event,
190 uint32_t len);
191 #else
192 static inline void
wma_register_pmkid_req_event_handler(tp_wma_handle wma_handle)193 wma_register_pmkid_req_event_handler(tp_wma_handle wma_handle)
194 {
195 }
196
197 static inline int
wma_roam_pmkid_request_event_handler(void * handle,uint8_t * event,uint32_t len)198 wma_roam_pmkid_request_event_handler(void *handle,
199 uint8_t *event,
200 uint32_t len)
201 {
202 return 0;
203 }
204 #endif /* WLAN_FEATURE_FIPS */
205
206 /**
207 * wma_roam_stats_event_handler() - Handle the WMI_ROAM_STATS_EVENTID
208 * from target
209 * @handle: wma_handle
210 * @event: roam debug stats event data pointer
211 * @len: length of the data
212 *
213 * This function handles the roam debug stats from the target and logs it
214 * to kmsg. This WMI_ROAM_STATS_EVENTID event is received whenever roam
215 * scan trigger happens or when neighbor report is sent by the firmware.
216 *
217 * Return: Success or Failure status
218 */
219 int wma_roam_stats_event_handler(WMA_HANDLE handle, uint8_t *event,
220 uint32_t len);
221
222 /**
223 * wma_roam_vdev_disconnect_event_handler() - Handles roam vdev disconnect event
224 * @handle: wma_handle
225 * @event: pmkid request event data pointer
226 * @len: length of the data
227 *
228 * @Return: 0 on sucees else error code
229 */
230 int wma_roam_vdev_disconnect_event_handler(void *handle, uint8_t *event,
231 uint32_t len);
232
233 #else
wma_mlme_roam_synch_event_handler_cb(void * handle,uint8_t * event,uint32_t len)234 static inline int wma_mlme_roam_synch_event_handler_cb(void *handle,
235 uint8_t *event,
236 uint32_t len)
237 {
238 return 0;
239 }
240
241 static inline int
wma_roam_vdev_disconnect_event_handler(void * handle,uint8_t * event,uint32_t len)242 wma_roam_vdev_disconnect_event_handler(void *handle, uint8_t *event,
243 uint32_t len)
244 {
245 return 0;
246 }
247
248 static inline int
wma_roam_stats_event_handler(WMA_HANDLE handle,uint8_t * event,uint32_t len)249 wma_roam_stats_event_handler(WMA_HANDLE handle, uint8_t *event,
250 uint32_t len)
251 {
252 return 0;
253 }
254
255 static inline int
wma_roam_pmkid_request_event_handler(void * handle,uint8_t * event,uint32_t len)256 wma_roam_pmkid_request_event_handler(void *handle,
257 uint8_t *event,
258 uint32_t len)
259 {
260 return 0;
261 }
262 #endif
263
264 #ifdef WLAN_FEATURE_ROAM_OFFLOAD
265 /**
266 * wma_roam_scan_chan_list_event_handler() - roam scan chan list event handler
267 * @handle: wma handle
268 * @event: pointer to fw event
269 * @len: length of event
270 *
271 * Return: Success or Failure status
272 */
273 int wma_roam_scan_chan_list_event_handler(WMA_HANDLE handle,
274 uint8_t *event,
275 uint32_t len);
276 #else
277 static inline int
wma_roam_scan_chan_list_event_handler(WMA_HANDLE handle,uint8_t * event,uint32_t len)278 wma_roam_scan_chan_list_event_handler(WMA_HANDLE handle, uint8_t *event,
279 uint32_t len)
280 {
281 return 0;
282 }
283 #endif
284
285 QDF_STATUS wma_update_channel_list(WMA_HANDLE handle,
286 tSirUpdateChanList *chan_list);
287
288 QDF_STATUS wma_roam_scan_bmiss_cnt(tp_wma_handle wma_handle,
289 A_INT32 first_bcnt,
290 A_UINT32 final_bcnt, uint32_t vdev_id);
291
292 #ifdef WLAN_FEATURE_ROAM_OFFLOAD
293 void wma_set_ric_req(tp_wma_handle wma, void *msg, uint8_t is_add_ts);
294 #endif
295
296 #ifdef FEATURE_WLAN_EXTSCAN
297
298 int wma_extscan_start_stop_event_handler(void *handle,
299 uint8_t *cmd_param_info,
300 uint32_t len);
301
302 int wma_extscan_operations_event_handler(void *handle,
303 uint8_t *cmd_param_info,
304 uint32_t len);
305
306 int wma_extscan_table_usage_event_handler(void *handle,
307 uint8_t *cmd_param_info,
308 uint32_t len);
309
310 int wma_extscan_capabilities_event_handler(void *handle,
311 uint8_t *cmd_param_info,
312 uint32_t len);
313
314 int wma_extscan_hotlist_match_event_handler(void *handle,
315 uint8_t *cmd_param_info,
316 uint32_t len);
317
318 int wma_extscan_cached_results_event_handler(void *handle,
319 uint8_t *cmd_param_info,
320 uint32_t len);
321
322 int wma_extscan_change_results_event_handler(void *handle,
323 uint8_t *cmd_param_info,
324 uint32_t len);
325
326 int wma_passpoint_match_event_handler(void *handle,
327 uint8_t *cmd_param_info,
328 uint32_t len);
329
330 #endif
331
332 #ifdef FEATURE_WLAN_EXTSCAN
333 int wma_extscan_wow_event_callback(void *handle, void *event, uint32_t len);
334
335 void wma_register_extscan_event_handler(tp_wma_handle wma_handle);
336
337 /**
338 * wma_start_extscan() - start extscan command to fw.
339 * @wma: wma handle
340 * @params: extscan command request params
341 *
342 * This function sends start extscan request to fw.
343 *
344 * Return: QDF Status.
345 */
346 QDF_STATUS wma_start_extscan(tp_wma_handle wma,
347 struct wifi_scan_cmd_req_params *pstart);
348
349 /**
350 * wma_stop_extscan() - stop extscan command to fw.
351 * @wma: wma handle
352 * @params: stop scan command request params
353 *
354 * This function sends stop extscan request to fw.
355 *
356 * Return: QDF Status.
357 */
358 QDF_STATUS wma_stop_extscan(tp_wma_handle wma,
359 struct extscan_stop_req_params *params);
360
361 /**
362 * wma_extscan_start_hotlist_monitor() - start hotlist monitor
363 * @wma: wma handle
364 * @params: hotlist request params
365 *
366 * This function configures hotlist monitor in fw.
367 *
368 * Return: QDF status
369 */
370 QDF_STATUS wma_extscan_start_hotlist_monitor(tp_wma_handle wma,
371 struct extscan_bssid_hotlist_set_params *params);
372
373 /**
374 * wma_extscan_stop_hotlist_monitor() - stop hotlist monitor
375 * @wma: wma handle
376 * @params: hotlist request params
377 *
378 * This function configures hotlist monitor to stop in fw.
379 *
380 * Return: QDF status
381 */
382 QDF_STATUS wma_extscan_stop_hotlist_monitor(tp_wma_handle wma,
383 struct extscan_bssid_hotlist_reset_params *params);
384
385 /**
386 * wma_extscan_start_change_monitor() - send start change monitor cmd
387 * @wma: wma handle
388 * @params: change monitor request params
389 *
390 * This function sends start change monitor request to fw.
391 *
392 * Return: QDF status
393 */
394 QDF_STATUS
395 wma_extscan_start_change_monitor(tp_wma_handle wma,
396 struct extscan_set_sig_changereq_params *params);
397
398 /**
399 * wma_extscan_stop_change_monitor() - send stop change monitor cmd
400 * @wma: wma handle
401 * @params: change monitor request params
402 *
403 * This function sends stop change monitor request to fw.
404 *
405 * Return: QDF status
406 */
407 QDF_STATUS
408 wma_extscan_stop_change_monitor(tp_wma_handle wma,
409 struct extscan_capabilities_reset_params *params);
410
411 /**
412 * wma_extscan_get_cached_results() - extscan get cached results
413 * @wma: wma handle
414 * @params: cached results parameters
415 *
416 * This function send request to fw to get cached results.
417 *
418 * Return: QDF status
419 */
420 QDF_STATUS
421 wma_extscan_get_cached_results(tp_wma_handle wma,
422 struct extscan_cached_result_params *params);
423
424 /**
425 * wma_extscan_get_capabilities() - extscan get capabilities
426 * @wma: wma handle
427 * @params: get capabilities params
428 *
429 * This function sends request to fw to get extscan capabilities.
430 *
431 * Return: QDF status
432 */
433 QDF_STATUS
434 wma_extscan_get_capabilities(tp_wma_handle wma,
435 struct extscan_capabilities_params *params);
436
437 /**
438 * wma_set_epno_network_list() - set epno network list
439 * @wma: WMA handle
440 * @req: epno config params request structure
441 *
442 * This function reads the incoming epno config request structure
443 * and constructs the WMI message to the firmware.
444 *
445 * Return: 0 on success, error number otherwise
446 */
447 QDF_STATUS wma_set_epno_network_list(tp_wma_handle wma,
448 struct wifi_enhanced_pno_params *req);
449
450 /**
451 * wma_set_passpoint_network_list() - set passpoint network list
452 * @wma: WMA handle
453 * @params: passpoint network request structure
454 *
455 * This function sends the passpoint configs down to the firmware
456 *
457 * Return: QDF_STATUS enumeration
458 */
459 QDF_STATUS
460 wma_set_passpoint_network_list(tp_wma_handle wma,
461 struct wifi_passpoint_req_param *params);
462
463 /**
464 * wma_reset_passpoint_network_list() - reset passpoint network list
465 * @wma: WMA handle
466 * @params: passpoint network request structure
467 *
468 * This function sends down WMI command with network id set to wildcard id.
469 * firmware shall clear all the config entries
470 *
471 * Return: QDF_STATUS enumeration
472 */
473 QDF_STATUS
474 wma_reset_passpoint_network_list(tp_wma_handle wma,
475 struct wifi_passpoint_req_param *params);
476 #endif
477
478 /**
479 * wma_scan_probe_setoui() - set scan probe OUI
480 * @wma: wma handle
481 * @set_oui: OUI parameters
482 *
483 * set scan probe OUI parameters in firmware
484 *
485 * Return: QDF status
486 */
487 QDF_STATUS wma_scan_probe_setoui(tp_wma_handle wma,
488 struct scan_mac_oui *set_oui);
489
490 void wma_roam_better_ap_handler(tp_wma_handle wma, uint32_t vdev_id);
491
492 /*
493 * wma_dev_if.c functions declarations
494 */
495
496 /**
497 * wma_find_vdev_id_by_addr() - find vdev_id from mac address
498 * @wma: wma handle
499 * @addr: mac address
500 * @vdev_id: return vdev_id
501 *
502 * Return: SUCCESS or FAILURE
503 */
504 QDF_STATUS wma_find_vdev_id_by_addr(tp_wma_handle wma, uint8_t *addr,
505 uint8_t *vdev_id);
506
507 bool wma_is_vdev_in_ap_mode(tp_wma_handle wma, uint8_t vdev_id);
508
509 /**
510 * wma_get_vdev_bssid() - Get BSSID from mlme_obj
511 * @vdev - pointer to vdev
512 *
513 * This API is used to get BSSID stored in vdev mlme object.
514 *
515 * Return: pointer to bssid on success else NULL.
516 */
517 uint8_t *wma_get_vdev_bssid(struct wlan_objmgr_vdev *vdev);
518
519 /**
520 * wma_find_bssid_by_vdev_id() - Get the BSS ID corresponding to the vdev ID
521 * @wma - wma handle
522 * @vdev_id - vdev ID
523 *
524 * Return: Returns pointer to bssid on success,
525 * otherwise returns NULL.
526 */
wma_find_bssid_by_vdev_id(tp_wma_handle wma,uint8_t vdev_id)527 static inline uint8_t *wma_find_bssid_by_vdev_id(tp_wma_handle wma,
528 uint8_t vdev_id)
529 {
530 if (vdev_id >= wma->max_bssid)
531 return NULL;
532
533 return wma_get_vdev_bssid(wma->interfaces[vdev_id].vdev);
534 }
535
536 /**
537 * wma_find_vdev_id_by_bssid() - Get the corresponding vdev_id from BSSID
538 * @wma - wma handle
539 * @bssid - bssid address
540 * @vdev_id - vdev ID
541 *
542 * Return: SUCCESS or FAILURE.
543 */
544 QDF_STATUS wma_find_vdev_id_by_bssid(tp_wma_handle wma, uint8_t *bssid,
545 uint8_t *vdev_id);
546
547 QDF_STATUS wma_vdev_set_param(wmi_unified_t wmi_handle, uint32_t if_id,
548 uint32_t param_id, uint32_t param_value);
549
550 QDF_STATUS wma_remove_peer(tp_wma_handle wma, uint8_t *mac_addr,
551 uint8_t vdev_id, bool no_fw_peer_delete);
552
553 QDF_STATUS wma_peer_unmap_conf_send(tp_wma_handle wma,
554 struct send_peer_unmap_conf_params *msg);
555
556 /**
557 * wma_send_del_bss_response() - send delete bss resp
558 * @wma: wma handle
559 * @resp: pointer to del bss response
560 *
561 * Return: none
562 */
563 void wma_send_del_bss_response(tp_wma_handle wma, struct del_bss_resp *resp);
564
565 /**
566 * __wma_handle_vdev_stop_rsp() - vdev stop response handler
567 * @resp_event: pointer to response received
568 *
569 * Return: QDF_STATUS_SUCCESS for success or QDF_ERROR code
570 */
571 QDF_STATUS
572 __wma_handle_vdev_stop_rsp(struct vdev_stop_response *resp_event);
573
574 void wma_hold_req_timer(void *data);
575 struct wma_target_req *wma_fill_hold_req(tp_wma_handle wma,
576 uint8_t vdev_id, uint32_t msg_type,
577 uint8_t type, void *params,
578 uint32_t timeout);
579
580 /**
581 * wma_add_bss() - Add BSS request to fw as per opmode
582 * @wma: wma handle
583 * @params: add bss params
584 *
585 * Return: none
586 */
587 void wma_add_bss(tp_wma_handle wma, struct bss_params *params);
588
589 /**
590 * wma_add_sta() - process add sta request as per opmode
591 * @wma: wma handle
592 * @add_Sta: add sta params
593 *
594 * Return: none
595 */
596 void wma_add_sta(tp_wma_handle wma, tpAddStaParams add_sta);
597
598 /**
599 * wma_delete_sta() - process del sta request as per opmode
600 * @wma: wma handle
601 * @del_sta: delete sta params
602 *
603 * Return: none
604 */
605 void wma_delete_sta(tp_wma_handle wma, tpDeleteStaParams del_sta);
606
607 /**
608 * wma_delete_bss() - process delete bss request from upper layer
609 * @wma: wma handle
610 * @vdev_id: vdev id
611 *
612 * Return: none
613 */
614 void wma_delete_bss(tp_wma_handle wma, uint8_t vdev_id);
615
616 int32_t wma_find_vdev_by_type(tp_wma_handle wma, int32_t type);
617
618 /**
619 * wma_set_vdev_intrabss_fwd() - set intra_fwd value to wni_in.
620 * @wma_handle: wma handle
621 * @pdis_intra_fwd: Pointer to DisableIntraBssFwd struct
622 *
623 * Return: none
624 */
625 void wma_set_vdev_intrabss_fwd(tp_wma_handle wma_handle,
626 tpDisableIntraBssFwd pdis_intra_fwd);
627
628 /**
629 * wma_delete_bss_ho_fail() - process delete bss request for handoff failure
630 * @wma: wma handle
631 * @vdev_id: vdev id
632 *
633 * Delete BSS in case of ROAM_HO_FAIL processing is handled separately in
634 * this routine. It needs to be done without sending any commands to firmware
635 * because firmware has already stopped and deleted peer and vdev is down.
636 * Relevant logic is aggregated from other routines. It changes the host
637 * data structures without sending VDEV_STOP, PEER_FLUSH_TIDS, PEER_DELETE
638 * and VDEV_DOWN commands to firmware.
639 *
640 * Return: none
641 */
642 void wma_delete_bss_ho_fail(tp_wma_handle wma, uint8_t vdev_id);
643
644 uint32_t wma_get_bcn_rate_code(uint16_t rate);
645
646 /*
647 * wma_mgmt.c functions declarations
648 */
649 #ifdef WLAN_WMI_BCN
650 int wma_beacon_swba_handler(void *handle, uint8_t *event, uint32_t len);
651 #endif
652
653 /**
654 * wma_peer_sta_kickout_event_handler() - kickout event handler
655 * @handle: wma handle
656 * @event: event data
657 * @len: data length
658 *
659 * Kickout event is received from firmware on observing beacon miss
660 * It handles kickout event for different modes and indicate to
661 * upper layers.
662 *
663 * Return: 0 for success or error code
664 */
665 int wma_peer_sta_kickout_event_handler(void *handle, uint8_t *event,
666 uint32_t len);
667
668 /**
669 * wma_unified_bcntx_status_event_handler() - beacon tx status event handler
670 * @handle: wma handle
671 * @cmd_param_info: event data
672 * @len: data length
673 *
674 * WMI Handler for WMI_OFFLOAD_BCN_TX_STATUS_EVENTID event from firmware.
675 * This event is generated by FW when the beacon transmission is offloaded
676 * and the host performs beacon template modification using WMI_BCN_TMPL_CMDID
677 * The FW generates this event when the first successful beacon transmission
678 * after template update
679 *
680 * Return: 0 for success or error code
681 */
682 int wma_unified_bcntx_status_event_handler(void *handle,
683 uint8_t *cmd_param_info,
684 uint32_t len);
685
686 void wma_set_sta_sa_query_param(tp_wma_handle wma,
687 uint8_t vdev_id);
688
689 void wma_set_sta_keep_alive(tp_wma_handle wma, uint8_t vdev_id,
690 uint32_t method, uint32_t timeperiod,
691 uint8_t *hostv4addr, uint8_t *destv4addr,
692 uint8_t *destmac);
693
694 /**
695 * wma_objmgr_set_peer_mlme_phymode() - set phymode to peer object
696 * @wma: wma handle
697 * @mac_addr: mac addr of peer
698 * @phymode: phymode value to set
699 *
700 * Return: None
701 */
702 void wma_objmgr_set_peer_mlme_phymode(tp_wma_handle wma, uint8_t *mac_addr,
703 enum wlan_phymode phymode);
704
705 /**
706 * wma_objmgr_set_peer_mlme_nss() - set nss to peer object
707 * @wma: wma handle
708 * @mac_addr: mac addr of peer
709 * @nss: nss value to set
710 *
711 * Return: None
712 */
713 void wma_objmgr_set_peer_mlme_nss(tp_wma_handle wma, uint8_t *mac_addr,
714 uint8_t nss);
715
716 /**
717 * wma_objmgr_get_peer_mlme_nss() - set nss to peer object
718 * @wma: wma handle
719 * @mac_addr: mac addr of peer
720 *
721 * Return: Peer NSS
722 */
723 uint8_t wma_objmgr_get_peer_mlme_nss(tp_wma_handle wma, uint8_t *mac_addr);
724
725 QDF_STATUS wma_send_peer_assoc(tp_wma_handle wma,
726 tSirNwType nw_type,
727 tpAddStaParams params);
728
729 QDF_STATUS wmi_unified_vdev_set_gtx_cfg_send(wmi_unified_t wmi_handle,
730 uint32_t if_id,
731 gtx_config_t *gtx_info);
732
733 void wma_update_protection_mode(tp_wma_handle wma, uint8_t vdev_id,
734 uint8_t llbcoexist);
735
736 void wma_process_update_beacon_params(tp_wma_handle wma,
737 tUpdateBeaconParams *bcn_params);
738
739 /**
740 * wma_update_rts_params() - update cfg parameters to target
741 * @wma: wma handle
742 * @value: rts_threshold
743 *
744 * Return: none
745 */
746 void wma_update_rts_params(tp_wma_handle wma, uint32_t value);
747
748 /**
749 * wma_update_frag_params() - update cfg parameters to target
750 * @wma: wma handle
751 * @value: frag_threshold
752 *
753 * Return: none
754 */
755 void wma_update_frag_params(tp_wma_handle wma, uint32_t value);
756
757 QDF_STATUS wma_process_update_edca_param_req(WMA_HANDLE handle,
758 tEdcaParams *edca_params);
759
760 /**
761 * wma_tbttoffset_update_event_handler() - tbtt offset update handler
762 * @handle: wma handle
763 * @event: event buffer
764 * @len: data length
765 *
766 * Return: 0 for success or error code
767 */
768 int wma_tbttoffset_update_event_handler(void *handle, uint8_t *event,
769 uint32_t len);
770
771 void wma_send_probe_rsp_tmpl(tp_wma_handle wma,
772 tpSendProbeRespParams probe_rsp_info);
773
774 /**
775 * wma_set_ap_vdev_up() - send vdev up req
776 * @wma: wma handle
777 * @vdev_id: vdev id
778 *
779 * Return: QDF_STATUS
780 */
781 QDF_STATUS wma_set_ap_vdev_up(tp_wma_handle wma, uint8_t vdev_id);
782
783 void wma_send_beacon(tp_wma_handle wma, tpSendbeaconParams bcn_info);
784
785 void wma_set_keepalive_req(tp_wma_handle wma,
786 struct keep_alive_req *keepalive);
787
788 void wma_beacon_miss_handler(tp_wma_handle wma, uint32_t vdev_id,
789 int32_t rssi);
790
791 void wma_process_update_opmode(tp_wma_handle wma_handle,
792 tUpdateVHTOpMode *update_vht_opmode);
793
794 void wma_process_update_rx_nss(tp_wma_handle wma_handle,
795 tUpdateRxNss *update_rx_nss);
796
797 void wma_process_update_membership(tp_wma_handle wma_handle,
798 tUpdateMembership *membership);
799
800 void wma_process_update_userpos(tp_wma_handle wma_handle,
801 tUpdateUserPos *userpos);
802
803 /*
804 * wma_power.c functions declarations
805 */
806
807 /**
808 * wma_enable_sta_ps_mode() - enable sta powersave params in fw
809 * @ps_req: power save request
810 *
811 * Return: none
812 */
813 void wma_enable_sta_ps_mode(tpEnablePsParams ps_req);
814
815 QDF_STATUS wma_unified_set_sta_ps_param(wmi_unified_t wmi_handle,
816 uint32_t vdev_id, uint32_t param,
817 uint32_t value);
818
819 QDF_STATUS wma_set_ap_peer_uapsd(tp_wma_handle wma, uint32_t vdev_id,
820 uint8_t *peer_addr, uint8_t uapsd_value,
821 uint8_t max_sp);
822
823 void wma_update_edca_params_for_ac(tSirMacEdcaParamRecord *edca_param,
824 struct wmi_host_wme_vparams *wmm_param,
825 int ac, bool mu_edca_param,
826 uint8_t *debug_str,
827 uint32_t debug_str_size, uint32_t *len);
828
829 void wma_set_tx_power(WMA_HANDLE handle,
830 tMaxTxPowerParams *tx_pwr_params);
831
832 void wma_set_max_tx_power(WMA_HANDLE handle,
833 tMaxTxPowerParams *tx_pwr_params);
834
835 void wma_disable_sta_ps_mode(tpDisablePsParams ps_req);
836
837 /**
838 * wma_enable_uapsd_mode() - enable uapsd mode in fw
839 * @wma: wma handle
840 * @ps_req: power save request
841 *
842 * Return: none
843 */
844 void wma_enable_uapsd_mode(tp_wma_handle wma, tpEnableUapsdParams ps_req);
845
846 void wma_disable_uapsd_mode(tp_wma_handle wma, tpDisableUapsdParams ps_req);
847
848 QDF_STATUS wma_get_temperature(tp_wma_handle wma_handle);
849
850 int wma_pdev_temperature_evt_handler(void *handle, uint8_t *event,
851 uint32_t len);
852
853 QDF_STATUS wma_process_tx_power_limits(WMA_HANDLE handle,
854 struct tx_power_limit *ptxlim);
855
856 void wma_update_noa(struct beacon_info *beacon,
857 struct p2p_sub_element_noa *noa_ie);
858
859 void wma_update_probe_resp_noa(tp_wma_handle wma_handle,
860 struct p2p_sub_element_noa *noa_ie);
861
862 void wma_process_set_mimops_req(tp_wma_handle wma_handle,
863 tSetMIMOPS *mimops);
864
865 QDF_STATUS wma_set_mimops(tp_wma_handle wma, uint8_t vdev_id, int value);
866
867 QDF_STATUS wma_notify_modem_power_state(void *wma_ptr,
868 tSirModemPowerStateInd *pReq);
869
870 QDF_STATUS wma_set_smps_params(tp_wma_handle wma, uint8_t vdev_id,
871 int value);
872
873 /*
874 * wma_data.c functions declarations
875 */
876 /**
877 * wma_set_bss_rate_flags() - set rate flags based on BSS capability
878 * @wma: pointer to wma handle
879 * @vdev_id: vdev id
880 * @add_bss: pointer to bss params
881 *
882 * Return: none
883 */
884 void wma_set_bss_rate_flags(tp_wma_handle wma, uint8_t vdev_id,
885 struct bss_params *add_bss);
886
887 /**
888 * wma_get_vht_rate_flags() - Return the VHT rate flags corresponding to the BW
889 * @ch_width: BW for which rate flags is required
890 *
891 * Return: Rate flags corresponding to ch_width
892 */
893 enum tx_rate_info wma_get_vht_rate_flags(enum phy_ch_width ch_width);
894
895 /**
896 * wma_get_ht_rate_flags() - Return the HT rate flags corresponding to the BW
897 * @ch_width: BW for which rate flags is required
898 *
899 * Return: Rate flags corresponding to ch_width
900 */
901 enum tx_rate_info wma_get_ht_rate_flags(enum phy_ch_width ch_width);
902
903 /**
904 * wma_get_he_rate_flags() - Return the HE rate flags corresponding to the BW
905 * @ch_width: BW for which rate flags is required
906 *
907 * Return: Rate flags corresponding to ch_width
908 */
909 enum tx_rate_info wma_get_he_rate_flags(enum phy_ch_width ch_width);
910
911 /**
912 * wma_set_vht_txbf_cfg() - set VHT Tx beamforming capability to FW
913 * @mac: Global MAC context
914 * @vdev_id: VDEV id
915 *
916 * Return: None
917 */
918 void wma_set_vht_txbf_cfg(struct mac_context *mac, uint8_t vdev_id);
919
920 int32_t wmi_unified_send_txbf(tp_wma_handle wma, tpAddStaParams params);
921
922 /**
923 * wma_check_txrx_chainmask() - check txrx chainmask
924 * @num_rf_chains: number of rf chains
925 * @cmd_value: command value
926 *
927 * Return: QDF_STATUS_SUCCESS for success or error code
928 */
929 QDF_STATUS wma_check_txrx_chainmask(int num_rf_chains, int cmd_value);
930
931 QDF_STATUS wma_set_enable_disable_mcc_adaptive_scheduler(uint32_t
932 mcc_adaptive_scheduler);
933
934 QDF_STATUS wma_set_mcc_channel_time_latency
935 (tp_wma_handle wma,
936 uint32_t mcc_channel, uint32_t mcc_channel_time_latency);
937
938 QDF_STATUS wma_set_mcc_channel_time_quota
939 (tp_wma_handle wma,
940 uint32_t adapter_1_chan_number,
941 uint32_t adapter_1_quota, uint32_t adapter_2_chan_number);
942
943 /**
944 * wma_process_rate_update_indate() - rate update indication
945 * @wma: wma handle
946 * @pRateUpdateParams: Rate update params
947 *
948 * This function update rate & short GI interval to fw based on params
949 * send by SME.
950 *
951 * Return: QDF status
952 */
953 QDF_STATUS wma_process_rate_update_indicate(tp_wma_handle wma,
954 tSirRateUpdateInd *
955 pRateUpdateParams);
956
957 QDF_STATUS wma_tx_attach(tp_wma_handle wma_handle);
958
959 QDF_STATUS wma_tx_detach(tp_wma_handle wma_handle);
960
961 #if defined(QCA_LL_LEGACY_TX_FLOW_CONTROL) || \
962 defined(QCA_LL_TX_FLOW_CONTROL_V2) || defined(CONFIG_HL_SUPPORT)
963
964 /**
965 * wma_mcc_vdev_tx_pause_evt_handler() - pause event handler
966 * @handle: wma handle
967 * @event: event buffer
968 * @len: data length
969 *
970 * This function handle pause event from fw and pause/unpause
971 * vdev.
972 *
973 * Return: 0 for success or error code.
974 */
975 int wma_mcc_vdev_tx_pause_evt_handler(void *handle, uint8_t *event,
976 uint32_t len);
977 #endif
978
979 #if defined(CONFIG_HL_SUPPORT) && defined(QCA_BAD_PEER_TX_FLOW_CL)
980 QDF_STATUS wma_process_init_bad_peer_tx_ctl_info(tp_wma_handle wma,
981 struct t_bad_peer_txtcl_config *config);
982 #else
983 static inline QDF_STATUS
wma_process_init_bad_peer_tx_ctl_info(tp_wma_handle wma,struct t_bad_peer_txtcl_config * config)984 wma_process_init_bad_peer_tx_ctl_info(tp_wma_handle wma,
985 struct t_bad_peer_txtcl_config *config)
986 {
987 return QDF_STATUS_E_FAILURE;
988 }
989 #endif
990
991 QDF_STATUS wma_process_init_thermal_info(tp_wma_handle wma,
992 t_thermal_mgmt *pThermalParams);
993
994 QDF_STATUS wma_process_set_thermal_level(tp_wma_handle wma,
995 uint8_t thermal_level);
996
997 QDF_STATUS wma_set_thermal_mgmt(tp_wma_handle wma_handle,
998 t_thermal_cmd_params thermal_info);
999
1000 int wma_thermal_mgmt_evt_handler(void *handle, uint8_t *event,
1001 uint32_t len);
1002 /*
1003 * wma_utils.c functions declarations
1004 */
1005
1006 #ifdef WLAN_FEATURE_STATS_EXT
1007 /**
1008 * wma_stats_ext_event_handler() - extended stats event handler
1009 * @handle: wma handle
1010 * @event_buf: event buffer received from fw
1011 * @len: length of data
1012 *
1013 * Return: 0 for success or error code
1014 */
1015 int wma_stats_ext_event_handler(void *handle, uint8_t *event_buf,
1016 uint32_t len);
1017 #endif
1018
1019 enum eSmpsModeValue host_map_smps_mode(A_UINT32 fw_smps_mode);
1020 int wma_smps_mode_to_force_mode_param(uint8_t smps_mode);
1021
1022 #ifdef WLAN_FEATURE_LINK_LAYER_STATS
1023 void wma_register_ll_stats_event_handler(tp_wma_handle wma_handle);
1024
1025 /**
1026 * wma_process_ll_stats_clear_req() - clear link layer stats
1027 * @wma: wma handle
1028 * @clearReq: ll stats clear request command params
1029 *
1030 * Return: QDF_STATUS_SUCCESS for success or error code
1031 */
1032 QDF_STATUS wma_process_ll_stats_clear_req
1033 (tp_wma_handle wma, const tpSirLLStatsClearReq clearReq);
1034
1035 QDF_STATUS wma_process_ll_stats_set_req
1036 (tp_wma_handle wma, const tpSirLLStatsSetReq setReq);
1037
1038 /**
1039 * wma_process_ll_stats_get_req() - link layer stats get request
1040 * @wma:wma handle
1041 * @getReq:ll stats get request command params
1042 *
1043 * Return: QDF_STATUS_SUCCESS for success or error code
1044 */
1045 QDF_STATUS wma_process_ll_stats_get_req
1046 (tp_wma_handle wma, const tpSirLLStatsGetReq getReq);
1047
1048 int wma_unified_link_iface_stats_event_handler(void *handle,
1049 uint8_t *cmd_param_info,
1050 uint32_t len);
1051 void wma_config_stats_ext_threshold(tp_wma_handle wma,
1052 struct sir_ll_ext_stats_threshold *thresh);
1053 #endif
1054
1055 void wma_post_link_status(tAniGetLinkStatus *pGetLinkStatus,
1056 uint8_t link_status);
1057
1058 /**
1059 * wma_link_status_event_handler() - link status event handler
1060 * @handle: wma handle
1061 * @cmd_param_info: data from event
1062 * @len: length
1063 *
1064 * Return: 0 for success or error code
1065 */
1066 int wma_link_status_event_handler(void *handle, uint8_t *cmd_param_info,
1067 uint32_t len);
1068
1069 /**
1070 * wma_rso_cmd_status_event_handler() - RSO Command status event handler
1071 * @vdev_id: VDEV id
1072 * @notif: roam notification
1073 *
1074 * This function is used to send RSO command status to upper layer
1075 *
1076 * Return: 0 for success
1077 */
1078 int wma_rso_cmd_status_event_handler(uint8_t vdev_id, uint32_t notif);
1079
1080 QDF_STATUS wma_send_link_speed(uint32_t link_speed);
1081
1082 int wma_link_speed_event_handler(void *handle, uint8_t *cmd_param_info,
1083 uint32_t len);
1084
1085 int wma_unified_debug_print_event_handler(void *handle, uint8_t *datap,
1086 uint32_t len);
1087
1088 /**
1089 * wma_peer_phymode() - get phymode
1090 * @nw_type: nw type
1091 * @sta_type: sta type
1092 * @is_ht: is ht supported
1093 * @ch_width: supported channel width
1094 * @is_vht: is vht supported
1095 * @is_he: is HE supported
1096 * @is_eht: is EHT supported
1097 *
1098 * Return: host phymode
1099 */
1100 enum wlan_phymode
1101 wma_peer_phymode(tSirNwType nw_type, uint8_t sta_type,
1102 uint8_t is_ht, uint8_t ch_width,
1103 uint8_t is_vht, bool is_he, bool is_eht);
1104
1105 int32_t wma_txrx_fw_stats_reset(tp_wma_handle wma_handle,
1106 uint8_t vdev_id, uint32_t value);
1107
1108 int32_t wma_set_txrx_fw_stats_level(tp_wma_handle wma_handle,
1109 uint8_t vdev_id, uint32_t value);
1110
1111 /*
1112 * wma_features.c functions declarations
1113 */
1114
1115 /**
1116 * wma_sar_register_event_handlers() - Register SAR event handlers
1117 * @handle: WMA Handle
1118 *
1119 * Function to be called during WMA initialization to register SAR
1120 * event handlers with WMI
1121 *
1122 * Return: QDF_STATUS_SUCCESS if registration is successful, otherwise
1123 * an error enumeration
1124 */
1125 QDF_STATUS wma_sar_register_event_handlers(WMA_HANDLE handle);
1126
1127 void wma_process_link_status_req(tp_wma_handle wma,
1128 tAniGetLinkStatus *pGetLinkStatus);
1129
1130 /**
1131 * wma_get_isolation() - get antenna isolation
1132 * @handle: wma interface
1133 *
1134 * This function will send WMI_COEX_GET_ANTENNA_ISOLATION_CMDID to FW
1135 *
1136 * Return: 0 on success, otherwise error value
1137 */
1138 QDF_STATUS wma_get_isolation(tp_wma_handle wma);
1139
1140 int wma_profile_data_report_event_handler(void *handle, uint8_t *event_buf,
1141 uint32_t len);
1142
1143 QDF_STATUS wma_unified_fw_profiling_cmd(wmi_unified_t wmi_handle,
1144 uint32_t cmd, uint32_t value1, uint32_t value2);
1145
1146 int wma_unified_csa_offload_enable(tp_wma_handle wma, uint8_t vdev_id);
1147
1148 #ifdef FEATURE_WLAN_TDLS
1149 int wma_tdls_event_handler(void *handle, uint8_t *event, uint32_t len);
1150 #endif
1151
1152 int wma_csa_offload_handler(void *handle, uint8_t *event, uint32_t len);
1153
1154 #ifdef FEATURE_OEM_DATA_SUPPORT
1155 int wma_oem_data_response_handler(void *handle, uint8_t *datap,
1156 uint32_t len);
1157 #endif
1158
1159 #if !defined(REMOVE_PKT_LOG)
1160 QDF_STATUS wma_pktlog_wmi_send_cmd(WMA_HANDLE handle,
1161 struct ath_pktlog_wmi_params *params);
1162 #endif
1163
1164 int wma_wow_wakeup_host_event(void *handle, uint8_t *event,
1165 uint32_t len);
1166
1167 int wma_d0_wow_disable_ack_event(void *handle, uint8_t *event, uint32_t len);
1168
1169 int wma_pdev_resume_event_handler(void *handle, uint8_t *event, uint32_t len);
1170
1171 void wma_del_ts_req(tp_wma_handle wma, struct del_ts_params *msg);
1172
1173 /**
1174 * wma_aggr_qos_req() - send aggr qos request to fw
1175 * @wma: handle to wma
1176 * @pAggrQosRspMsg - combined struct for all ADD_TS requests.
1177 *
1178 * A function to handle WMA_AGGR_QOS_REQ. This will send out
1179 * ADD_TS requests to firmware in loop for all the ACs with
1180 * active flow.
1181 *
1182 * Return: none
1183 */
1184 void wma_aggr_qos_req(tp_wma_handle wma,
1185 struct aggr_add_ts_param *pAggrQosRspMsg);
1186
1187 void wma_add_ts_req(tp_wma_handle wma, struct add_ts_param *msg);
1188
1189 #ifdef FEATURE_WLAN_ESE
1190 QDF_STATUS wma_process_tsm_stats_req(tp_wma_handle wma_handler,
1191 void *pTsmStatsMsg);
1192 void wma_config_plm(tp_wma_handle wma, struct plm_req_params *plm);
1193 #endif
1194
1195 QDF_STATUS wma_process_mcbc_set_filter_req(tp_wma_handle wma_handle,
1196 tSirRcvFltMcAddrList * mcbc_param);
1197
1198 QDF_STATUS wma_process_add_periodic_tx_ptrn_ind(WMA_HANDLE handle,
1199 tSirAddPeriodicTxPtrn *pattern);
1200
1201 QDF_STATUS wma_process_del_periodic_tx_ptrn_ind(WMA_HANDLE handle,
1202 tSirDelPeriodicTxPtrn *
1203 pDelPeriodicTxPtrnParams);
1204
1205 #ifdef WLAN_FEATURE_STATS_EXT
1206 /**
1207 * wma_stats_ext_req() - request ext stats from fw
1208 * @wma_ptr: wma handle
1209 * @preq: stats ext params
1210 *
1211 * Return: QDF status
1212 */
1213 QDF_STATUS wma_stats_ext_req(void *wma_ptr, tpStatsExtRequest preq);
1214 #endif
1215
1216 #ifdef WLAN_FEATURE_EXTWOW_SUPPORT
1217 QDF_STATUS wma_enable_ext_wow(tp_wma_handle wma, tpSirExtWoWParams params);
1218
1219 int wma_set_app_type1_params_in_fw(tp_wma_handle wma,
1220 tpSirAppType1Params appType1Params);
1221
1222 QDF_STATUS wma_set_app_type2_params_in_fw(tp_wma_handle wma,
1223 tpSirAppType2Params appType2Params);
1224 #endif
1225
1226 #ifdef FEATURE_WLAN_AUTO_SHUTDOWN
1227 int wma_auto_shutdown_event_handler(void *handle, uint8_t *event,
1228 uint32_t len);
1229
1230 /**
1231 * wma_set_auto_shutdown_timer_req() - sets auto shutdown timer in firmware
1232 * @wma_handle: wma handle
1233 * @auto_sh_cmd: auto shutdown timer params
1234 *
1235 * Return: QDF status
1236 */
1237 QDF_STATUS
1238 wma_set_auto_shutdown_timer_req(tp_wma_handle wma_handle,
1239 struct auto_shutdown_cmd *auto_sh_cmd);
1240 #endif
1241
1242 #ifdef WLAN_FEATURE_TSF
1243 int wma_vdev_tsf_handler(void *handle, uint8_t *data, uint32_t data_len);
1244 QDF_STATUS wma_capture_tsf(tp_wma_handle wma_handle, uint32_t vdev_id);
1245 QDF_STATUS wma_reset_tsf_gpio(tp_wma_handle wma_handle, uint32_t vdev_id);
1246 QDF_STATUS wma_set_tsf_gpio_pin(WMA_HANDLE handle, uint32_t pin);
1247
1248 #ifdef WLAN_FEATURE_TSF_AUTO_REPORT
1249 /**
1250 * wma_set_tsf_auto_report() - Set TSF auto report in firmware
1251 * @wma_handle: wma handle
1252 * @vdev_id: vdev id
1253 * @param_id: enum GEN_PARAM
1254 * @ena: true for enable, and false for disable
1255 *
1256 * Return: QDF_STATUS_SUCCESS for success, otherwise for failure
1257 */
1258 QDF_STATUS wma_set_tsf_auto_report(WMA_HANDLE handle, uint32_t vdev_id,
1259 uint32_t param_id, bool ena);
1260 #else /* !WLAN_FEATURE_TSF_AUTO_REPORT */
wma_set_tsf_auto_report(WMA_HANDLE handle,uint32_t vdev_id,uint32_t param_id,bool ena)1261 static inline QDF_STATUS wma_set_tsf_auto_report(WMA_HANDLE handle,
1262 uint32_t vdev_id,
1263 uint32_t param_id, bool ena)
1264 {
1265 return QDF_STATUS_E_NOSUPPORT;
1266 }
1267 #endif /* WLAN_FEATURE_TSF_AUTO_REPORT */
1268
1269 #else
wma_capture_tsf(tp_wma_handle wma_handle,uint32_t vdev_id)1270 static inline QDF_STATUS wma_capture_tsf(tp_wma_handle wma_handle,
1271 uint32_t vdev_id)
1272 {
1273 return QDF_STATUS_SUCCESS;
1274 }
1275
wma_reset_tsf_gpio(tp_wma_handle wma_handle,uint32_t vdev_id)1276 static inline QDF_STATUS wma_reset_tsf_gpio(tp_wma_handle wma_handle,
1277 uint32_t vdev_id)
1278 {
1279 return QDF_STATUS_SUCCESS;
1280 }
1281
wma_vdev_tsf_handler(void * handle,uint8_t * data,uint32_t data_len)1282 static inline int wma_vdev_tsf_handler(void *handle, uint8_t *data,
1283 uint32_t data_len)
1284 {
1285 return 0;
1286 }
1287
wma_set_tsf_gpio_pin(WMA_HANDLE handle,uint32_t pin)1288 static inline QDF_STATUS wma_set_tsf_gpio_pin(WMA_HANDLE handle, uint32_t pin)
1289 {
1290 return QDF_STATUS_E_INVAL;
1291 }
1292 #endif
1293
1294 QDF_STATUS wma_set_wisa_params(tp_wma_handle wma, struct sir_wisa_params *wisa);
1295
1296 #ifdef DHCP_SERVER_OFFLOAD
1297 /**
1298 * wma_process_dhcpserver_offload() - enable DHCP server offload
1299 * @wma_handle: wma handle
1300 * @params: DHCP server offload information
1301 *
1302 * Return: QDF_STATUS_SUCCESS for success or error code
1303 */
1304 QDF_STATUS
1305 wma_process_dhcpserver_offload(tp_wma_handle wma_handle,
1306 struct dhcp_offload_info_params *params);
1307 #endif
1308
1309 #ifdef WLAN_FEATURE_GPIO_LED_FLASHING
1310 QDF_STATUS wma_set_led_flashing(tp_wma_handle wma_handle,
1311 struct flashing_req_params *flashing);
1312 #endif
1313
1314 /**
1315 * wma_sar_rsp_evt_handler() - process sar response event from FW.
1316 * @handle: ol scn handle
1317 * @event: event buffer
1318 * @len: buffer length
1319 *
1320 * Return: 0 for success or error code
1321 */
1322 int wma_sar_rsp_evt_handler(ol_scn_t handle, uint8_t *event, uint32_t len);
1323
1324 #ifdef FEATURE_WLAN_CH_AVOID
1325 QDF_STATUS wma_process_ch_avoid_update_req(tp_wma_handle wma_handle,
1326 tSirChAvoidUpdateReq *
1327 ch_avoid_update_req);
1328 #endif
1329
1330 #ifdef FEATURE_WLAN_TDLS
1331 int wma_update_tdls_peer_state(WMA_HANDLE handle,
1332 struct tdls_peer_update_state *peer_state);
1333 #endif
1334
1335 void wma_set_vdev_mgmt_rate(tp_wma_handle wma, uint8_t vdev_id);
1336 void wma_set_sap_keepalive(tp_wma_handle wma, uint8_t vdev_id);
1337
1338 #ifdef FEATURE_RSSI_MONITOR
1339 int wma_rssi_breached_event_handler(void *handle,
1340 u_int8_t *cmd_param_info, u_int32_t len);
1341 #else /* FEATURE_RSSI_MONITOR */
1342 static inline
wma_rssi_breached_event_handler(void * handle,u_int8_t * cmd_param_info,u_int32_t len)1343 int wma_rssi_breached_event_handler(void *handle,
1344 u_int8_t *cmd_param_info, u_int32_t len)
1345 {
1346 return 0;
1347 }
1348 #endif /* FEATURE_RSSI_MONITOR */
1349
1350 QDF_STATUS wma_process_cfg_action_frm_tb_ppdu(tp_wma_handle wma,
1351 struct cfg_action_frm_tb_ppdu *cfg_info);
1352
1353 QDF_STATUS wma_process_set_ie_info(tp_wma_handle wma,
1354 struct vdev_ie_info *ie_info);
1355 int wma_peer_assoc_conf_handler(void *handle, uint8_t *cmd_param_info,
1356 uint32_t len);
1357
1358 /**
1359 * wma_peer_create_confirm_handler - Handle peer create confirmation
1360 * result
1361 * @handle: wma_handle
1362 * @evt_param_info: event data
1363 * @len: event length
1364 *
1365 * Return: 0 on success. Error value on failure
1366 */
1367 int wma_peer_create_confirm_handler(void *handle, uint8_t *evt_param_info,
1368 uint32_t len);
1369
1370 int wma_peer_delete_handler(void *handle, uint8_t *cmd_param_info,
1371 uint32_t len);
1372
1373 void wma_remove_req(tp_wma_handle wma, uint8_t vdev_id,
1374 uint8_t type);
1375
1376 /**
1377 * wma_find_remove_req_msgtype() - find and remove request for vdev id
1378 * @wma: wma handle
1379 * @vdev_id: vdev id
1380 * @msg_type: message request type
1381 *
1382 * Find target request for given vdev id & sub type of request.
1383 * Remove the same from active list.
1384 *
1385 * Return: Success if request found, failure other wise
1386 */
1387 struct wma_target_req *wma_find_remove_req_msgtype(tp_wma_handle wma,
1388 uint8_t vdev_id,
1389 uint32_t msg_type);
1390
1391 /**
1392 * wma_remove_peer_req - Remove the peer create
1393 * request from WMA queue
1394 * @wma: wma handle
1395 * @vdev_id: vdev id
1396 * @type: peer type
1397 * @peer_addr: peer address
1398 */
1399 void wma_remove_peer_req(tp_wma_handle wma, uint8_t vdev_id,
1400 uint8_t type, struct qdf_mac_addr *peer_addr);
1401
1402 QDF_STATUS wma_process_hal_pwr_dbg_cmd(WMA_HANDLE handle,
1403 struct sir_mac_pwr_dbg_cmd *
1404 sir_pwr_dbg_params);
1405
1406 /**
1407 * wma_lost_link_info_handler() - collect lost link information and inform SME
1408 * @wma: WMA handle
1409 * @vdev_id: vdev ID
1410 * @rssi: rssi at disconnection time
1411 *
1412 * Return: none
1413 */
1414 void wma_lost_link_info_handler(tp_wma_handle wma, uint32_t vdev_id,
1415 int32_t rssi);
1416 int wma_unified_power_debug_stats_event_handler(void *handle,
1417 uint8_t *cmd_param_info, uint32_t len);
1418 /**
1419 * wma_unified_beacon_debug_stats_event_handler() - collect beacon debug stats
1420 * @handle: WMA handle
1421 * @cmd_param_info: data from event
1422 * @len: length
1423 *
1424 * Return: 0 for success or error code
1425 */
1426 int wma_unified_beacon_debug_stats_event_handler(void *handle,
1427 uint8_t *cmd_param_info,
1428 uint32_t len);
1429
1430 #if defined(CLD_PM_QOS) && defined(WLAN_FEATURE_LL_MODE)
1431 /**
1432 * wma_vdev_bcn_latency_event_handler() - Get the latency info received in bcn
1433 * @handle: WMA handle
1434 * @event: data in event
1435 * @len: length
1436 *
1437 * Return: 0 for success or error code
1438 */
1439 int wma_vdev_bcn_latency_event_handler(void *handle, uint8_t *event,
1440 uint32_t len);
1441 #else
wma_vdev_bcn_latency_event_handler(void * handle,uint8_t * event,uint32_t len)1442 static inline int wma_vdev_bcn_latency_event_handler(void *handle,
1443 uint8_t *event,
1444 uint32_t len)
1445 {
1446 return 0;
1447 }
1448 #endif
1449
1450 #ifdef FEATURE_WLAN_DIAG_SUPPORT
1451 /**
1452 * wma_sta_kickout_event()- send sta kickout event
1453 * @kickout_reason - reasoncode for kickout
1454 * @macaddr[QDF_MAC_ADDR_SIZE]: Peer mac address
1455 * @vdev_id: Unique id for identifying the VDEV
1456 *
1457 * This function sends sta kickout diag event
1458 *
1459 * Return: void.
1460 */
1461 void wma_sta_kickout_event(uint32_t kickout_reason, uint8_t vdev_id,
1462 uint8_t *macaddr);
1463 #else
wma_sta_kickout_event(uint32_t kickout_reason,uint8_t vdev_id,uint8_t * macaddr)1464 static inline void wma_sta_kickout_event(uint32_t kickout_reason,
1465 uint8_t vdev_id, uint8_t *macaddr)
1466 {
1467
1468 };
1469 #endif /* FEATURE_WLAN_DIAG_SUPPORT */
1470
1471 /**
1472 * wma_get_rcpi_req() - get rcpi request
1473 * @handle: wma handle
1474 * @rcpi_request: rcpi params
1475 *
1476 * Return: none
1477 */
1478 QDF_STATUS wma_get_rcpi_req(WMA_HANDLE handle,
1479 struct sme_rcpi_req *rcpi_request);
1480
1481 /**
1482 * wma_rcpi_event_handler() - rcpi event handler
1483 * @handle: wma handle
1484 * @cmd_param_info: data from event
1485 * @len: length
1486 *
1487 * Return: 0 for success or error code
1488 */
1489 int wma_rcpi_event_handler(void *handle, uint8_t *cmd_param_info,
1490 uint32_t len);
1491
1492 /**
1493 * wma_acquire_wakelock() - acquire the given wakelock
1494 * @wl: the wakelock to acquire
1495 * @msec: the wakelock duration in milliseconds
1496 *
1497 * This also acquires the wma runtime pm lock.
1498 *
1499 * Return: None
1500 */
1501 void wma_acquire_wakelock(qdf_wake_lock_t *wl, uint32_t msec);
1502
1503 /**
1504 * wma_release_wakelock() - release the given wakelock
1505 * @wl: the wakelock to release
1506 *
1507 * This also releases the wma runtime pm lock.
1508 *
1509 * Return: None
1510 */
1511 void wma_release_wakelock(qdf_wake_lock_t *wl);
1512
1513 /**
1514 * wma_send_vdev_stop_to_fw() - send the vdev stop command to firmware
1515 * @wma: a reference to the global WMA handle
1516 * @vdev_id: the Id of the vdev to stop
1517 *
1518 * Consumers should call wma_release_wakelock() upon receipt of the vdev stop
1519 * response from firmware to avoid power penalties.
1520 *
1521 * Return: QDF_STATUS
1522 */
1523 QDF_STATUS wma_send_vdev_stop_to_fw(t_wma_handle *wma, uint8_t vdev_id);
1524
1525 int wma_get_arp_stats_handler(void *handle, uint8_t *data, uint32_t data_len);
1526
1527 /**
1528 * wma_send_vdev_down_to_fw() - send the vdev down command to firmware
1529 * @wma: a reference to the global WMA handle
1530 * @vdev_id: the Id of the vdev to down
1531 *
1532 * This also releases the vdev start wakelock.
1533 *
1534 * Return: QDF_STATUS
1535 */
1536 QDF_STATUS wma_send_vdev_down_to_fw(t_wma_handle *wma, uint8_t vdev_id);
1537
1538 /*
1539 * wma_rx_aggr_failure_event_handler - event handler to handle rx aggr failure
1540 * @handle: the wma handle
1541 * @event_buf: buffer with event
1542 * @len: buffer length
1543 *
1544 * This function receives rx aggregation failure event and then pass to upper
1545 * layer
1546 *
1547 * Return: 0 on success
1548 */
1549 int wma_rx_aggr_failure_event_handler(void *handle, u_int8_t *event_buf,
1550 u_int32_t len);
1551
1552 /**
1553 * wma_wlan_bt_activity_evt_handler - event handler to handle bt activity
1554 * @handle: the WMA handle
1555 * @event: buffer with the event parameters
1556 * @len: length of the buffer
1557 *
1558 * This function receives BT activity event from firmware and passes the event
1559 * information to upper layers
1560 *
1561 * Return: 0 on success
1562 */
1563 int wma_wlan_bt_activity_evt_handler(void *handle, uint8_t *event,
1564 uint32_t len);
1565
1566 /**
1567 * wma_pdev_div_info_evt_handler - event handler to handle antenna info
1568 * @handle: the wma handle
1569 * @event_buf: buffer with event
1570 * @len: buffer length
1571 *
1572 * This function receives antenna info from firmware and passes the event
1573 * to upper layer
1574 *
1575 * Return: 0 on success
1576 */
1577 int wma_pdev_div_info_evt_handler(void *handle, u_int8_t *event_buf,
1578 u_int32_t len);
1579
1580 /**
1581 * wma_update_beacon_interval() - update beacon interval in fw
1582 * @wma: wma handle
1583 * @vdev_id: vdev id
1584 * @beaconInterval: becon interval
1585 *
1586 * Return: none
1587 */
1588 void
1589 wma_update_beacon_interval(tp_wma_handle wma, uint8_t vdev_id,
1590 uint16_t beaconInterval);
1591
1592 #define RESET_BEACON_INTERVAL_TIMEOUT 200
1593
1594 struct wma_beacon_interval_reset_req {
1595 qdf_timer_t event_timeout;
1596 uint8_t vdev_id;
1597 uint16_t interval;
1598 };
1599
1600 /**
1601 * wma_fill_beacon_interval_reset_req() - req to reset beacon interval
1602 * @wma: wma handle
1603 * @vdev_id: vdev id
1604 * @beacon_interval: beacon interval
1605 * @timeout: timeout val
1606 *
1607 * Return: status
1608 */
1609 int wma_fill_beacon_interval_reset_req(tp_wma_handle wma, uint8_t vdev_id,
1610 uint16_t beacon_interval, uint32_t timeout);
1611 /*
1612 * wma_is_vdev_valid() - check the vdev status
1613 * @vdev_id: vdev identifier
1614 *
1615 * This function verifies the vdev validity
1616 *
1617 * Return: 'true' on valid vdev else 'false'
1618 */
1619 bool wma_is_vdev_valid(uint32_t vdev_id);
1620
1621 /**
1622 * wma_vdev_obss_detection_info_handler - event handler to handle obss detection
1623 * @handle: the wma handle
1624 * @event: buffer with event
1625 * @len: buffer length
1626 *
1627 * This function receives obss detection info from firmware which is used to
1628 * decide obss protection.
1629 *
1630 * Return: 0 on success
1631 */
1632 int wma_vdev_obss_detection_info_handler(void *handle, uint8_t *event,
1633 uint32_t len);
1634
1635 /**
1636 * wma_vdev_bss_color_collision_info_handler - event handler to
1637 * handle obss color collision detection.
1638 * @handle: the wma handle
1639 * @event: buffer with event
1640 * @len: buffer length
1641 *
1642 * This function receives obss color collision detection info from firmware
1643 * which is used to select new bss color.
1644 *
1645 * Return: 0 on success
1646 */
1647 int wma_vdev_bss_color_collision_info_handler(void *handle,
1648 uint8_t *event,
1649 uint32_t len);
1650
1651 #ifdef WLAN_SUPPORT_TWT
1652 /**
1653 * wma_register_twt_events - Register TWT wmi event handlers
1654 * @handle: wma handle
1655 *
1656 * Return: None
1657 */
1658 void wma_register_twt_events(tp_wma_handle wma_handle);
1659 #endif
1660
1661 /**
1662 * wma_get_roam_scan_stats() - Get roam scan stats request
1663 * @handle: wma handle
1664 * @req: request details
1665 *
1666 * Return: QDF_STATUS
1667 */
1668 QDF_STATUS wma_get_roam_scan_stats(WMA_HANDLE handle,
1669 struct sir_roam_scan_stats *req);
1670
1671 /**
1672 * wma_roam_scan_stats_event_handler() - roam scan stats event handler
1673 * @handle: wma handle
1674 * @event: event data
1675 * @len: length of data
1676 *
1677 * Return: Success or Failure status
1678 */
1679 int wma_roam_scan_stats_event_handler(void *handle, uint8_t *event,
1680 uint32_t len);
1681
1682 /**
1683 * wma_send_vdev_down() - send del bss req to firmware
1684 * @wma: wma handle.
1685 * @req: pointer to del bss response
1686 *
1687 * This function sends del bss resp to upper layer
1688 *
1689 * Return: Success or Failure status
1690 */
1691 QDF_STATUS wma_send_vdev_down(tp_wma_handle wma, struct del_bss_resp *req);
1692
1693 /**
1694 * wma_cold_boot_cal_event_handler() - Cold boot cal event handler
1695 * @wma_ctx: wma handle
1696 * @event_buff: event data
1697 * @len: length of data
1698 *
1699 * Return: Success or Failure status
1700 */
1701 int wma_cold_boot_cal_event_handler(void *wma_ctx, uint8_t *event_buff,
1702 uint32_t len);
1703
1704 #ifdef FEATURE_OEM_DATA
1705 /**
1706 * wma_oem_event_handler() - oem data event handler
1707 * @wma_ctx: wma handle
1708 * @event_buff: event data
1709 * @len: length of event buffer
1710 *
1711 * Return: Success or Failure status
1712 */
1713 int wma_oem_event_handler(void *wma_ctx, uint8_t *event_buff, uint32_t len);
1714 #endif
1715
1716 #ifdef MULTI_CLIENT_LL_SUPPORT
1717 /**
1718 * wma_latency_level_event_handler() - latency level event handler
1719 * @wma_ctx: wma handle
1720 * @event_buff: event data
1721 * @len: length of event buffer
1722 *
1723 * Return: Success or Failure status
1724 */
1725 int wma_latency_level_event_handler(void *wma_ctx, uint8_t *event_buff,
1726 uint32_t len);
1727 #endif
1728
1729 /**
1730 * wma_get_ani_level_evt_handler - event handler to fetch ani level
1731 * @handle: the wma handle
1732 * @event_buf: buffer with event
1733 * @len: buffer length
1734 *
1735 * This function receives ani level from firmware and passes the event
1736 * to upper layer
1737 *
1738 * Return: 0 on success
1739 */
1740 int wma_get_ani_level_evt_handler(void *handle, uint8_t *event_buf,
1741 uint32_t len);
1742 /**
1743 * wma_mcs_rate_match() - find the match mcs rate
1744 * @raw_rate: the rate to look up
1745 * @is_he: if it is he rate
1746 * @nss1_rate: the nss1 rate
1747 * @nss2_rate: the nss2 rate
1748 * @nss: the nss in use
1749 * @guard_interval: to get guard interval from rate
1750 *
1751 * This is a helper function to find the match of the tx_rate
1752 * and return nss/guard interval.
1753 *
1754 * Return: the found rate or 0 otherwise
1755 */
1756 uint16_t wma_mcs_rate_match(uint16_t raw_rate, bool is_he,
1757 const uint16_t *nss1_rate,
1758 const uint16_t *nss2_rate,
1759 uint8_t *nss, enum txrate_gi *guard_interval);
1760
1761 /**
1762 * wma_update_edca_pifs_param() - Update edca/pifs param
1763 * @handle: wma handle
1764 * @edca_pifs_param: pointer to edca_pifs_vparam struct
1765 *
1766 * This is a helper function to update edca/pifs param for ll sap
1767 *
1768 * Return: QDF_STATUS
1769 */
1770 QDF_STATUS
1771 wma_update_edca_pifs_param(WMA_HANDLE handle,
1772 struct edca_pifs_vparam *edca_pifs_param);
1773
1774 /**
1775 * wma_update_bss_peer_phy_mode() - Update phymode of peer object
1776 * @des_chan: des_chan object which has channel information
1777 * @vdev: pointer to vdev object
1778 *
1779 * This is a helper function to update phymode of peer object
1780 *
1781 * Return: QDF_STATUS
1782 */
1783 QDF_STATUS
1784 wma_update_bss_peer_phy_mode(struct wlan_channel *des_chan,
1785 struct wlan_objmgr_vdev *vdev);
1786 #endif
1787