1 /** @file mlan_api.h
2  *
3  *  @brief MLAN Interface
4  *
5  *  Copyright 2008-2024 NXP
6  *
7  *  SPDX-License-Identifier: BSD-3-Clause
8  *
9  */
10 
11 #ifndef __MLAN_API_H__
12 #define __MLAN_API_H__
13 #include <string.h>
14 #include <wmtypes.h>
15 #include <wlan.h>
16 
17 #define MLAN_WMSDK_MAX_WPA_IE_LEN 64U
18 #define MLAN_MAX_MDIE_LEN         10U
19 #define MLAN_MAX_VENDOR_IE_LEN    100U
20 
21 #include "mlan.h"
22 #include "mlan_join.h"
23 #include "mlan_util.h"
24 #include "mlan_fw.h"
25 #include "mlan_main.h"
26 #ifndef RW610
27 #include "mlan_main_defs.h"
28 #endif
29 #include "mlan_wmm.h"
30 #include "mlan_11n.h"
31 #include "mlan_11h.h"
32 #include "mlan_11ac.h"
33 #if CONFIG_11AX
34 #include "mlan_11ax.h"
35 #endif
36 #include "mlan_11n_aggr.h"
37 #ifndef RW610
38 #include "mlan_sdio.h"
39 #endif
40 #include "mlan_11n_rxreorder.h"
41 #include "mlan_meas.h"
42 #include "mlan_uap.h"
43 #include <wifi-debug.h>
44 #ifndef RW610
45 #include <wifi-sdio.h>
46 #endif
47 #include "wifi-internal.h"
48 #include "mlan_action.h"
49 #if CONFIG_11V
50 #include "mlan_11v.h"
51 #endif
52 #if CONFIG_11K
53 #include "mlan_11k.h"
54 #endif
55 /* #define CONFIG_WIFI_DEBUG */
56 
panic(const char * msg)57 static inline void panic(const char *msg)
58 {
59     PRINTF("%s\r\n", msg);
60     assert(0);
61 }
62 
63 /** Wait until a condition becomes true */
64 #define ASSERT(cond)                                          \
65     do                                                        \
66     {                                                         \
67         if (!(cond))                                          \
68         {                                                     \
69             PRINTF("ASSERT: %s: %d\r\n", __func__, __LINE__); \
70             panic("Assert failed: Panic!");                   \
71         }                                                     \
72     } while (0)
73 
74 #if CONFIG_WIFI_DEBUG
75 /* #define DEBUG_11N_ASSOC */
76 /* #define DEBUG_11N_AGGR */
77 /* #define DEBUG_11N_REORDERING */
78 #define DEBUG_MLAN
79 /* #define DEBUG_DEVELOPMENT */
80 /* #define DUMP_PACKET_MAC */
81 #endif /* CONFIG_WIFI_DEBUG */
82 
83 #ifdef EXIT
84 #undef EXIT
85 #define EXIT(...)
86 #endif /* EXIT */
87 
88 #ifdef DEBUG_MLAN
89 
90 #ifdef PRINTM
91 #undef PRINTM
92 #define PRINTM(level, ...)                   \
93     do                                       \
94     {                                        \
95         (void)PRINTF("[mlan] " __VA_ARGS__); \
96         (void)PRINTF("\n\r");                \
97     } while (0)
98 #else
99 #define PRINTM(...)
100 #endif /* PRINTM */
101 
102 #ifdef DBG_HEXDUMP
103 #undef DBG_HEXDUMP
104 #define DBG_HEXDUMP(level, x, y, z)       \
105     do                                    \
106     {                                     \
107         (void)PRINTF("[mlan] %s\r\n", x); \
108         dump_hex(y, z);                   \
109         (void)PRINTF("\r\n");             \
110     } while (0)
111 #else
112 #define DBG_HEXDUMP(...)
113 #endif /* DBG_HEXDUMP */
114 
115 #ifdef HEXDUMP
116 #undef HEXDUMP
117 #define HEXDUMP(x, y, z)                  \
118     do                                    \
119     {                                     \
120         (void)PRINTF("[mlan] %s\r\n", x); \
121         dump_hex(y, z);                   \
122         (void)PRINTF("\r\n");             \
123     } while (0)
124 #else
125 #define HEXDUMP(...)
126 #endif /* HEXDUMP */
127 #endif /* DEBUG_MLAN */
128 
129 #define DOT11N_CFG_ENABLE_RIFS            0x08
130 #define DOT11N_CFG_ENABLE_GREENFIELD_XMIT (1U << 4)
131 #define DOT11N_CFG_ENABLE_SHORT_GI_20MHZ  (1U << 5)
132 #define DOT11N_CFG_ENABLE_SHORT_GI_40MHZ  (1U << 6)
133 
134 #define CLOSEST_DTIM_TO_LISTEN_INTERVAL 65534
135 
136 #define SDIO_DMA_ALIGNMENT 4
137 
138 #define MAX_WAIT_WAKEUP_TIME 3000
139 
140 /*
141  * Bit 0 : Assoc Req
142  * Bit 1 : Assoc Resp
143  * Bit 2 : ReAssoc Req
144  * Bit 3 : ReAssoc Resp
145  * Bit 4 : Probe Req
146  * Bit 5 : Probe Resp
147  * Bit 8 : Beacon
148  */
149 /** Mask for Assoc request frame */
150 #define MGMT_MASK_ASSOC_REQ 0x01
151 /** Mask for ReAssoc request frame */
152 #define MGMT_MASK_REASSOC_REQ 0x04
153 /** Mask for Assoc response frame */
154 #define MGMT_MASK_ASSOC_RESP 0x02
155 /** Mask for ReAssoc response frame */
156 #define MGMT_MASK_REASSOC_RESP 0x08
157 /** Mask for probe request frame */
158 #define MGMT_MASK_PROBE_REQ 0x10
159 /** Mask for probe response frame */
160 #define MGMT_MASK_PROBE_RESP 0x20
161 /** Mask for beacon frame */
162 #define MGMT_MASK_BEACON 0x100
163 /** Mask for action frame */
164 #define MGMT_MASK_ACTION 0x2000
165 /** Mask to clear previous settings */
166 #define MGMT_MASK_CLEAR 0x000
167 
168 /* Following is allocated in mlan_register */
169 extern mlan_adapter *mlan_adap;
170 
171 #if CONFIG_WPS2
172 extern int wps_session_attempt;
173 #endif
174 
175 extern osa_rw_lock_t sleep_rwlock;
176 
177 #if CONFIG_WMM_UAPSD
178 extern OSA_SEMAPHORE_HANDLE_DEFINE(uapsd_sem);
179 #endif
180 
181 #if CONFIG_WMM
182 extern OSA_SEMAPHORE_HANDLE_DEFINE(txbuf_sem);
183 #endif
184 
185 #if CONFIG_STA_AMPDU_RX
186 extern bool sta_ampdu_rx_enable;
187 #endif
188 #ifdef DUMP_PACKET_MAC
189 void dump_mac_addr(const char *msg, unsigned char *addr);
190 #endif /* DUMP_PACKET_MAC */
191 #ifdef DEBUG_11N_ASSOC
192 void dump_htcap_info(const MrvlIETypes_HTCap_t *htcap);
193 void dump_ht_info(const MrvlIETypes_HTInfo_t *htinfo);
194 #endif /* DEBUG_11N_ASSOC */
195 mlan_status wlan_setup_rates_from_bssdesc(mlan_private *pmpriv,
196                                           BSSDescriptor_t *pbss_desc,
197                                           t_u8 *pout_rates,
198                                           t_u32 *pout_rates_size);
199 
200 mlan_status wifi_prepare_and_send_cmd(IN mlan_private *pmpriv,
201                                       IN t_u16 cmd_no,
202                                       IN t_u16 cmd_action,
203                                       IN t_u32 cmd_oid,
204                                       IN t_void *pioctl_buf,
205                                       IN t_void *pdata_buf,
206                                       mlan_bss_type bss_type,
207                                       void *priv);
208 #if UAP_SUPPORT
209 int wifi_uap_prepare_and_send_cmd(mlan_private *pmpriv,
210                                   t_u16 cmd_no,
211                                   t_u16 cmd_action,
212                                   t_u32 cmd_oid,
213                                   t_void *pioctl_buf,
214                                   t_void *pdata_buf,
215                                   mlan_bss_type bss_type,
216                                   void *priv);
217 #else
wifi_uap_prepare_and_send_cmd(mlan_private * pmpriv,t_u16 cmd_no,t_u16 cmd_action,t_u32 cmd_oid,t_void * pioctl_buf,t_void * pdata_buf,mlan_bss_type bss_type,void * priv)218 static inline int wifi_uap_prepare_and_send_cmd(mlan_private *pmpriv,
219                                                 t_u16 cmd_no,
220                                                 t_u16 cmd_action,
221                                                 t_u32 cmd_oid,
222                                                 t_void *pioctl_buf,
223                                                 t_void *pdata_buf,
224                                                 mlan_bss_type bss_type,
225                                                 void *priv)
226 {
227     (void)PRINTF("wifi_uap_prepare_and_send_cmd UAP not suppored %s:%d\r\n", __func__, __LINE__);
228     return -1;
229 }
230 #endif
231 
232 bool wmsdk_is_11N_enabled(void);
233 
234 /**
235  * Abort the split scan if it is in progress.
236  *
237  * After this call returns this scan function will abort the current split
238  * scan and return back to the caller. The scan list may be incomplete at
239  * this moment. There are no other side effects on the scan function apart
240  * from this. The next call to scan function should proceed as normal.
241  */
242 void wlan_abort_split_scan(void);
243 
244 void wlan_scan_process_results(IN mlan_private *pmpriv);
245 bool wlan_use_non_default_ht_vht_cap(IN BSSDescriptor_t *pbss_desc);
246 bool check_for_wpa2_entp_ie(bool *wpa2_entp_IE_exist, const void *element_data, unsigned element_len);
247 
248 #if CONFIG_WPA2_ENTP
249 bool wifi_get_scan_enable_wpa2_enterprise_ap_only();
250 
wifi_check_bss_entry_wpa2_entp_only(BSSDescriptor_t * pbss_entry,t_u8 element_id)251 static inline mlan_status wifi_check_bss_entry_wpa2_entp_only(BSSDescriptor_t *pbss_entry, t_u8 element_id)
252 {
253     if (element_id == RSN_IE)
254     {
255         if ((wifi_get_scan_enable_wpa2_enterprise_ap_only()) &&
256             (!check_for_wpa2_entp_ie(&pbss_entry->wpa2_entp_IE_exist, pbss_entry->rsn_ie_buff + 8,
257                                      pbss_entry->rsn_ie_buff_len - 10)))
258         {
259             return MLAN_STATUS_RESOURCE;
260         }
261         else
262         {
263             check_for_wpa2_entp_ie(&pbss_entry->wpa2_entp_IE_exist, pbss_entry->rsn_ie_buff + 8,
264                                    pbss_entry->rsn_ie_buff_len - 10);
265         }
266     }
267     else if (element_id == VENDOR_SPECIFIC_221)
268     {
269         if (wifi_get_scan_enable_wpa2_enterprise_ap_only())
270             return MLAN_STATUS_RESOURCE;
271     }
272     else if (!element_id)
273     {
274         if ((wifi_get_scan_enable_wpa2_enterprise_ap_only()) && (pbss_entry->privacy != Wlan802_11PrivFilter8021xWEP) &&
275             (!pbss_entry->pwpa_ie) && (!pbss_entry->prsn_ie))
276             return MLAN_STATUS_RESOURCE;
277     }
278 
279     return MLAN_STATUS_SUCCESS;
280 }
281 #else
wifi_check_bss_entry_wpa2_entp_only(BSSDescriptor_t * pbss_entry,IEEEtypes_ElementId_e element_id)282 static inline mlan_status wifi_check_bss_entry_wpa2_entp_only(BSSDescriptor_t *pbss_entry,
283                                                               IEEEtypes_ElementId_e element_id)
284 {
285     if (element_id == RSN_IE)
286     {
287         (void)check_for_wpa2_entp_ie(&pbss_entry->wpa2_entp_IE_exist, pbss_entry->rsn_ie_buff + 8,
288                                      pbss_entry->rsn_ie_buff_len - 10);
289     }
290     return MLAN_STATUS_SUCCESS;
291 }
292 #endif
293 #if CONFIG_BG_SCAN
294 int wifi_request_bgscan_query(mlan_private *pmpriv);
295 int wifi_send_scan_query(void);
296 void wifi_get_band(mlan_private *pmpriv, int *band);
297 #endif
298 
299 int wifi_send_hostcmd(
300     const void *cmd_buf, uint32_t cmd_buf_len, void *resp_buf, uint32_t resp_buf_len, uint32_t *reqd_resp_len);
301 
302 int wifi_send_get_wpa_pmk(int mode, char *ssid);
303 int wifi_deauthenticate(uint8_t *bssid);
304 #if CONFIG_WPA_SUPP
305 int wifi_nxp_deauthenticate(unsigned int bss_type, const uint8_t *bssid, uint16_t reason_code);
306 void wifi_get_scan_table(mlan_private *pmpriv, mlan_scan_resp *pscan_resp);
307 #endif
308 int wifi_get_eeprom_data(uint32_t offset, uint32_t byte_count, uint8_t *buf);
309 int wifi_get_mgmt_ie(mlan_bss_type bss_type, IEEEtypes_ElementId_t index, void *buf, unsigned int *buf_len);
310 int wifi_send_remain_on_channel_cmd(unsigned int bss_type, wifi_remain_on_channel_t *remain_on_channel);
311 int wifi_set_mgmt_ie(mlan_bss_type bss_type, IEEEtypes_ElementId_t id, void *buf, unsigned int buf_len);
312 #ifdef SD8801
313 int wifi_get_ext_coex_stats(wifi_ext_coex_stats_t *ext_coex_stats);
314 int wifi_set_ext_coex_config(const wifi_ext_coex_config_t *ext_coex_config);
315 #endif
316 int wifi_send_enable_supplicant(int mode, const char *ssid);
317 int wifi_send_clear_wpa_psk(int mode, const char *ssid);
318 int wifi_send_add_wpa_psk(int mode, char *ssid, char *passphrase, unsigned int len);
319 int wifi_send_add_wpa3_password(int mode, char *ssid, char *password, unsigned int len);
320 int wifi_send_add_wpa_pmk(int mode, char *ssid, char *bssid, char *pmk, unsigned int len);
321 bool wifi_11d_is_channel_allowed(int channel);
322 
323 #if CONFIG_11AX
324 void wifi_request_get_fw_info(mlan_private *priv, mlan_fw_info *fw_info);
325 
326 #if CONFIG_MMSF
327 int wifi_mmsf_cfg(const t_u16 action, t_u8 *enable, t_u8 *Density, t_u8 *MMSF);
328 #endif
329 #endif
330 
331 #if CONFIG_WIFI_RECOVERY
332 int wifi_recovery_test(void);
333 #endif
334 
335 /**
336  * Get the string representation of the wlan firmware extended version.
337  *
338  * @param[out] version_ext Extended Version
339  *
340  * @return WM_SUCCESS on success or error code.
341  */
342 int wifi_get_firmware_version_ext(wifi_fw_version_ext_t *version_ext);
343 /**
344  * Get the string representation of the wlan firmware version.
345  *
346  * @param[out] ver Version
347  *
348  * @return WM_SUCCESS on success or error code.
349  */
350 int wifi_get_firmware_version(wifi_fw_version_t *ver);
351 
352 #if UAP_SUPPORT
353 int wifi_set_smart_mode_cfg(char *ssid,
354                             int beacon_period,
355                             wifi_chan_list_param_set_t *chan_list,
356                             uint8_t *smc_start_addr,
357                             uint8_t *smc_end_addr,
358                             uint16_t filter_type,
359                             int smc_frame_filter_len,
360                             uint8_t *smc_frame_filter,
361                             int custom_ie_len,
362                             uint8_t *custom_ie);
363 int wifi_get_smart_mode_cfg(void);
364 int wifi_start_smart_mode(void);
365 int wifi_stop_smart_mode(void);
366 #endif
367 
368 /**
369  * Get Calibration data from WLAN firmware
370  *
371  * \param[out] cal_data Pointer to calibration data structure where
372  *	      calibration data and it's length will be stored.
373  *
374  * \return WM_SUCCESS if cal data read operation is successful.
375  * \return -WM_FAIL if cal data field is not present or command fails.
376  *
377  * \note The user of this API should free the allocated buffer for
378  *	 calibration data.
379  *
380  */
381 int wifi_get_cal_data(wifi_cal_data_t *cal_data);
382 int wifi_set_key(int bss_index,
383                  bool is_pairwise,
384                  const uint8_t key_index,
385                  const uint8_t *key,
386                  unsigned key_len,
387                  const uint8_t *seq,
388                  unsigned seq_len,
389                  const uint8_t *mac_addr,
390                  unsigned int flags);
391 int wifi_set_rekey_info(
392     int bss_index, const t_u8 *kek, size_t kek_len, const t_u8 *kck, size_t kck_len, const t_u8 *replay_ctr);
393 
394 /**
395  * Get User Data from OTP Memory
396  *
397  * \param[in] buf Pointer to buffer where data will be stored
398  * \param[in] len Number of bytes to read
399  *
400  * \return WM_SUCCESS if user data read operation is successful.
401  * \return -WM_FAIL if user data field is not present or command fails.
402  */
403 int wifi_get_otp_user_data(uint8_t *buf, uint16_t len);
404 int wifi_reg_access(wifi_reg_t reg_type, uint16_t action, uint32_t offset, uint32_t *value);
405 int wifi_enable_11d_support_APIs(void);
406 int wifi_get_tsf(uint32_t *tsf_high, uint32_t *tsf_low);
407 int wifi_set_igtk_key(int bss_index, const uint8_t *pn, const uint16_t key_index, const uint8_t *key, unsigned key_len);
408 int wifi_send_scan_cmd(t_u8 bss_mode,
409                        const t_u8 *specific_bssid,
410                        const char *ssid,
411                        uint8_t ssid_num,
412                        const t_u8 num_channels,
413                        const wifi_scan_channel_list_t *chan_list,
414                        const t_u8 num_probes,
415 #if CONFIG_SCAN_WITH_RSSIFILTER
416                        const t_s16 rssi_threshold,
417 #endif
418 #if CONFIG_SCAN_CHANNEL_GAP
419                        const t_u16 scan_chan_gap,
420 #endif
421                        const bool keep_previous_scan,
422                        const bool active_scan_triggered);
423 int wifi_remove_key(int bss_index, bool is_pairwise, const uint8_t key_index, const uint8_t *mac_addr);
424 int wifi_enable_ecsa_support(void);
425 int wifi_set_ed_mac_mode(wifi_ed_mac_ctrl_t *wifi_ed_mac_ctrl, int bss_type);
426 int wifi_get_pmfcfg(t_u8 *mfpc, t_u8 *mfpr);
427 int wifi_get_ed_mac_mode(wifi_ed_mac_ctrl_t *wifi_ed_mac_ctrl, int bss_type);
428 int wifi_set_pmfcfg(t_u8 mfpc, t_u8 mfpr);
429 int wifi_set_chanlist(wifi_chanlist_t *chanlist);
430 int wifi_get_txpwrlimit(wifi_SubBand_t subband, wifi_txpwrlimit_t *txpwrlimit);
431 int wifi_get_data_rate(wifi_ds_rate *ds_rate, mlan_bss_type bss_type);
432 #if UAP_SUPPORT
433 void wifi_get_active_channel_list(t_u8 *chan_list, t_u8 *num_chans, t_u16 acs_band);
434 #endif
435 bool wifi_is_ecsa_enabled(void);
436 int wifi_set_txpwrlimit(wifi_txpwrlimit_t *txpwrlimit);
437 int wifi_send_rssi_info_cmd(wifi_rssi_info_t *rssi_info);
438 void wifi_set_curr_bss_channel(uint8_t channel);
439 int wifi_get_chanlist(wifi_chanlist_t *chanlist);
440 int wifi_get_set_bandcfg(wifi_bandcfg_t *bandcfg, mlan_act_ioctl action);
441 #if (CONFIG_IPS)
442 int wifi_set_ips_config(mlan_bss_type interface, int option);
443 #endif
444 #if CONFIG_WIFI_EU_CRYPTO
445 int wifi_set_eu_crypto(EU_Crypto *Crypto_Data, enum _crypto_algorithm Algorithm, t_u16 EncDec);
446 #endif
447 int wifi_set_rx_mgmt_indication(unsigned int bss_type, unsigned int mgmt_subtype_mask);
448 mlan_status wlan_cmd_rx_mgmt_indication(IN pmlan_private pmpriv,
449                                         IN HostCmd_DS_COMMAND *cmd,
450                                         IN t_u16 cmd_action,
451                                         IN t_void *pdata_buf);
452 wlan_mgmt_pkt *wifi_PrepDefaultMgtMsg(t_u8 sub_type,
453                                       mlan_802_11_mac_addr *DestAddr,
454                                       mlan_802_11_mac_addr *SrcAddr,
455                                       mlan_802_11_mac_addr *Bssid,
456                                       t_u16 pkt_len);
457 
458 #if CONFIG_11MC
459 void wlan_location_ftm_cfg(location_cfg_info_t *ftm_location_cfg);
460 void wlan_civic_ftm_cfg(location_civic_rep_t *ftm_civic_cfg);
461 void wlan_dot11mc_ftm_cfg(void *cmd, ftm_11mc_nego_cfg_t *ftm_11mc_nego_cfg);
462 #endif
463 #if CONFIG_11AZ
464 void wlan_dto11az_ranging_cfg(void *cmd, const t_u8 protocl, HostCmd_FTM_SESSION_CFG *ftm_session_cfg);
465 #endif
466 
467 #if (CONFIG_11MC) || (CONFIG_11AZ)
468 /* ftm ctrl params */
469 typedef struct
470 {
471     int loop_cnt;
472     t_u8 channel;
473     t_u8 peer_mac[MLAN_MAC_ADDR_LENGTH];
474     t_u8 status;
475 } ftm_start_param;
476 
477 int wifi_ftm_start_stop(const t_u16 action, const t_u8 loop_cnt, const t_u8 *mac, const t_u8 channel);
478 int wifi_ftm_start(const t_u16 action, const t_u8 *mac, const t_u8 channel);
479 int wifi_ftm_stop(const t_u16 action, const t_u8 *mac, const t_u8 channel);
480 int wifi_ftm_cfg(const t_u8 protocol, ranging_11az_cfg_t *ftm_ranging_cfg);
481 int wifi_ftm_11mc_cfg(ftm_11mc_nego_cfg_t *ftm_11mc_nego_cfg);
482 int wifi_ftm_location_cfg(location_cfg_info_t *ftm_location_cfg);
483 int wifi_ftm_civic_cfg(location_civic_rep_t *ftm_civic_cfg);
484 int wifi_process_wlc_ftm_event();
485 void wifi_ftm_process_cfg_resp(void *resp_buff);
486 void wifi_ftm_process_ctrl_resp(void *resp_buff);
487 void wifi_ftm_process_event(void *p_data);
488 #if CONFIG_WLS_CSI_PROC
489 int wifi_process_wls_csi_event(void *p_data);
490 void wls_csi_process_event(void *p_data);
491 #endif
492 #endif
493 
494 #if UAP_SUPPORT
495 int wifi_set_custom_ie(custom_ie *beacon_ies_data,
496                        custom_ie *beacon_wps_ies_data,
497                        custom_ie *proberesp_ies_data,
498                        custom_ie *assocresp_ies_data);
499 #endif
500 
501 #if CONFIG_11K
502 /**
503  * rrm scan callback function to process scan results
504  *
505  * \param[in] count the count of available scan results
506  * \return WM_SUCCESS if successful otherwise failure.
507  *
508  */
509 int _wlan_rrm_scan_cb(unsigned int count);
510 
511 /**
512  * rrm scan request
513  *
514  * \param[in] wlan_scan_param the scan parameters
515  * \param[in] scan_cb_param the rm scan parameters
516  *
517  */
518 void wlan_rrm_request_scan(wlan_scan_params_v2_t *wlan_scan_param, wlan_rrm_scan_cb_param *scan_cb_param);
519 #endif
520 
521 int wrapper_bssdesc_first_set(int bss_index,
522                               uint8_t *BssId,
523                               bool *is_ibss_bit_set,
524                               int *ssid_len,
525                               uint8_t *ssid,
526                               uint8_t *Channel,
527                               uint8_t *RSSI,
528                               uint16_t *beacon_period,
529                               uint16_t *dtim_period,
530                               _SecurityMode_t *WPA_WPA2_WEP,
531                               _Cipher_t *wpa_mcstCipher,
532                               _Cipher_t *wpa_ucstCipher,
533                               _Cipher_t *rsn_mcstCipher,
534                               _Cipher_t *rsn_ucstCipher,
535                               t_u8 *ap_mfpc,
536                               t_u8 *ap_mfpr,
537                               t_u8 *ap_pwe);
538 
539 int wrapper_bssdesc_second_set(int bss_index,
540                                bool *phtcap_ie_present,
541                                bool *phtinfo_ie_present,
542 #if CONFIG_11AC
543                                bool *pvhtcap_ie_present,
544 #endif
545 #if CONFIG_11AX
546                                bool *phecap_ie_present,
547 #endif
548                                bool *wmm_ie_present,
549                                uint16_t *band,
550                                bool *wps_IE_exist,
551                                uint16_t *wps_session,
552                                bool *wpa2_entp_IE_exist,
553 #if CONFIG_11R
554                                uint16_t *mdid,
555 #endif
556 #if CONFIG_11K
557                                bool *neighbor_report_supported,
558 #endif
559 #if CONFIG_11V
560                                bool *bss_transition_supported,
561 #endif
562                                uint8_t *trans_mode,
563                                uint8_t *trans_bssid,
564                                int *trans_ssid_len,
565                                uint8_t *trans_ssid
566 #if CONFIG_DRIVER_MBO
567                                ,
568                                bool *mbo_assoc_disallowed
569 #endif
570 );
571 
572 int wifi_get_mgmt_ie2(mlan_bss_type bss_type, void *buf, unsigned int *buf_len);
573 int wifi_set_mgmt_ie2(mlan_bss_type bss_type, unsigned short mask, void *buf, unsigned int buf_len);
574 int wifi_clear_mgmt_ie2(mlan_bss_type bss_type, int mgmt_bitmap_index);
575 
576 #if CONFIG_BG_SCAN
577 int wifi_request_bgscan(mlan_private *pmpriv);
578 #endif
579 
580 #if CONFIG_WPA_SUPP
581 int wifi_send_sched_scan_cmd(nxp_wifi_trigger_sched_scan_t *params);
582 int wifi_send_stop_sched_scan_cmd(void);
583 #endif
584 
585 #if CONFIG_SUBSCRIBE_EVENT_SUPPORT
586 /*submit subscribe event cmd to firmware*/
587 int wifi_subscribe_event_submit(mlan_private *pmpriv, mlan_ds_subscribe_evt *sub_evt);
588 
589 /*get subscribe event*/
590 int wifi_get_subscribe_event(mlan_private *pmpriv, mlan_ds_subscribe_evt *sub_evt);
591 
592 /*disable specific subscribe event*/
593 int wifi_clear_subscribe_event(mlan_private *pmpriv, int evt_bitmap);
594 
595 /*set subscribe event thresh_value and freq*/
596 int wifi_set_threshold_rssi_low(mlan_private *pmpriv, unsigned int rssi_low, unsigned int freq);
597 int wifi_set_threshold_rssi_high(mlan_private *pmpriv, unsigned int rssi_high, unsigned int freq);
598 int wifi_set_threshold_snr_low(mlan_private *pmpriv, unsigned int snr_low, unsigned int freq);
599 int wifi_set_threshold_snr_high(mlan_private *pmpriv, unsigned int snr_high, unsigned int freq);
600 int wifi_set_threshold_max_fail(mlan_private *pmpriv, unsigned int max_fail, unsigned int freq);
601 int wifi_set_threshold_beacon_miss(mlan_private *pmpriv, unsigned int beacon_miss, unsigned int freq);
602 int wifi_set_threshold_data_rssi_low(mlan_private *pmpriv, unsigned int data_rssi_low, unsigned int freq);
603 int wifi_set_threshold_data_rssi_high(mlan_private *pmpriv, unsigned int data_rssi_high, unsigned int freq);
604 int wifi_set_threshold_data_snr_low(mlan_private *pmpriv, unsigned int data_snr_low, unsigned int freq);
605 int wifi_set_threshold_data_snr_high(mlan_private *pmpriv, unsigned int data_snr_high, unsigned int freq);
606 int wifi_set_threshold_link_quality(mlan_private *pmpriv,
607                                     unsigned int link_snr,
608                                     unsigned int link_snr_freq,
609                                     unsigned int link_rate,
610                                     unsigned int link_rate_freq,
611                                     unsigned int link_tx_latency,
612                                     unsigned int link_tx_lantency_freq);
613 int wifi_set_threshold_pre_beacon_lost(mlan_private *pmpriv, unsigned int pre_beacon_lost, unsigned int freq);
614 #endif
615 
616 #if CONFIG_TSP
617 int wifi_tsp_cfg(const t_u16 action,
618                  t_u16 *enable,
619                  t_u32 *back_off,
620                  t_u32 *highThreshold,
621                  t_u32 *lowThreshold,
622                  t_u32 *dutycycstep,
623                  t_u32 *dutycycmin,
624                  int *highthrtemp,
625                  int *lowthrtemp,
626                  int *currCAUTemp,
627                  int *currRFUTemp);
628 #endif
629 
630 #if CONFIG_TX_AMPDU_PROT_MODE
631 int wifi_tx_ampdu_prot_mode(tx_ampdu_prot_mode_para *prot_mode, t_u16 action);
632 #endif
633 
634 #if CONFIG_EXTERNAL_COEX_PTA
635 int wifi_external_coex_pta_cfg(ext_coex_pta_cfg coex_pta_config);
636 #endif
637 
638 #if CONFIG_IMD3_CFG
639 int wifi_imd3_cfg(t_u8 imd3_value);
640 #endif
641 
642 int send_wifi_driver_bypass_data_event(t_u8 interface);
643 
644 #if CONFIG_AUTO_RECONNECT
645 int wifi_auto_reconnect_enable(wifi_auto_reconnect_config_t auto_reconnect_config);
646 int wifi_auto_reconnect_disable(void);
647 int wifi_get_auto_reconnect_config(wifi_auto_reconnect_config_t *auto_reconnect_config);
648 #endif
649 
650 #if CONFIG_INACTIVITY_TIMEOUT_EXT
651 int wifi_sta_inactivityto(wifi_inactivity_to_t *inac_to, t_u16 cmd_action);
652 #endif
653 #endif /* __MLAN_API_H__ */
654