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 int wifi_uap_prepare_and_send_cmd(mlan_private *pmpriv,
209                                   t_u16 cmd_no,
210                                   t_u16 cmd_action,
211                                   t_u32 cmd_oid,
212                                   t_void *pioctl_buf,
213                                   t_void *pdata_buf,
214                                   mlan_bss_type bss_type,
215                                   void *priv);
216 
217 bool wmsdk_is_11N_enabled(void);
218 
219 /**
220  * Abort the split scan if it is in progress.
221  *
222  * After this call returns this scan function will abort the current split
223  * scan and return back to the caller. The scan list may be incomplete at
224  * this moment. There are no other side effects on the scan function apart
225  * from this. The next call to scan function should proceed as normal.
226  */
227 void wlan_abort_split_scan(void);
228 
229 void wlan_scan_process_results(IN mlan_private *pmpriv);
230 bool wlan_use_non_default_ht_vht_cap(IN BSSDescriptor_t *pbss_desc);
231 bool check_for_wpa2_entp_ie(bool *wpa2_entp_IE_exist, const void *element_data, unsigned element_len);
232 
233 #if CONFIG_WPA2_ENTP
234 bool wifi_get_scan_enable_wpa2_enterprise_ap_only();
235 
wifi_check_bss_entry_wpa2_entp_only(BSSDescriptor_t * pbss_entry,t_u8 element_id)236 static inline mlan_status wifi_check_bss_entry_wpa2_entp_only(BSSDescriptor_t *pbss_entry, t_u8 element_id)
237 {
238     if (element_id == RSN_IE)
239     {
240         if ((wifi_get_scan_enable_wpa2_enterprise_ap_only()) &&
241             (!check_for_wpa2_entp_ie(&pbss_entry->wpa2_entp_IE_exist, pbss_entry->rsn_ie_buff + 8,
242                                      pbss_entry->rsn_ie_buff_len - 10)))
243         {
244             return MLAN_STATUS_RESOURCE;
245         }
246         else
247         {
248             check_for_wpa2_entp_ie(&pbss_entry->wpa2_entp_IE_exist, pbss_entry->rsn_ie_buff + 8,
249                                    pbss_entry->rsn_ie_buff_len - 10);
250         }
251     }
252     else if (element_id == VENDOR_SPECIFIC_221)
253     {
254         if (wifi_get_scan_enable_wpa2_enterprise_ap_only())
255             return MLAN_STATUS_RESOURCE;
256     }
257     else if (!element_id)
258     {
259         if ((wifi_get_scan_enable_wpa2_enterprise_ap_only()) && (pbss_entry->privacy != Wlan802_11PrivFilter8021xWEP) &&
260             (!pbss_entry->pwpa_ie) && (!pbss_entry->prsn_ie))
261             return MLAN_STATUS_RESOURCE;
262     }
263 
264     return MLAN_STATUS_SUCCESS;
265 }
266 #else
wifi_check_bss_entry_wpa2_entp_only(BSSDescriptor_t * pbss_entry,IEEEtypes_ElementId_e element_id)267 static inline mlan_status wifi_check_bss_entry_wpa2_entp_only(BSSDescriptor_t *pbss_entry,
268                                                               IEEEtypes_ElementId_e element_id)
269 {
270     if (element_id == RSN_IE)
271     {
272         (void)check_for_wpa2_entp_ie(&pbss_entry->wpa2_entp_IE_exist, pbss_entry->rsn_ie_buff + 8,
273                                      pbss_entry->rsn_ie_buff_len - 10);
274     }
275     return MLAN_STATUS_SUCCESS;
276 }
277 #endif
278 #if CONFIG_BG_SCAN
279 int wifi_request_bgscan_query(mlan_private *pmpriv);
280 int wifi_send_scan_query(void);
281 void wifi_get_band(mlan_private *pmpriv, int *band);
282 #endif
283 
284 int wifi_send_hostcmd(
285     const void *cmd_buf, uint32_t cmd_buf_len, void *resp_buf, uint32_t resp_buf_len, uint32_t *reqd_resp_len);
286 
287 int wifi_send_get_wpa_pmk(int mode, char *ssid);
288 int wifi_deauthenticate(uint8_t *bssid);
289 #if CONFIG_WPA_SUPP
290 int wifi_nxp_deauthenticate(unsigned int bss_type, const uint8_t *bssid, uint16_t reason_code);
291 void wifi_get_scan_table(mlan_private *pmpriv, mlan_scan_resp *pscan_resp);
292 #endif
293 int wifi_get_eeprom_data(uint32_t offset, uint32_t byte_count, uint8_t *buf);
294 int wifi_get_mgmt_ie(mlan_bss_type bss_type, IEEEtypes_ElementId_t index, void *buf, unsigned int *buf_len);
295 int wifi_send_remain_on_channel_cmd(unsigned int bss_type, wifi_remain_on_channel_t *remain_on_channel);
296 int wifi_set_smart_mode_cfg(char *ssid,
297                             int beacon_period,
298                             wifi_chan_list_param_set_t *chan_list,
299                             uint8_t *smc_start_addr,
300                             uint8_t *smc_end_addr,
301                             uint16_t filter_type,
302                             int smc_frame_filter_len,
303                             uint8_t *smc_frame_filter,
304                             int custom_ie_len,
305                             uint8_t *custom_ie);
306 int wifi_set_mgmt_ie(mlan_bss_type bss_type, IEEEtypes_ElementId_t id, void *buf, unsigned int buf_len);
307 #ifdef SD8801
308 int wifi_get_ext_coex_stats(wifi_ext_coex_stats_t *ext_coex_stats);
309 int wifi_set_ext_coex_config(const wifi_ext_coex_config_t *ext_coex_config);
310 #endif
311 int wifi_send_enable_supplicant(int mode, const char *ssid);
312 int wifi_send_clear_wpa_psk(int mode, const char *ssid);
313 int wifi_send_add_wpa_psk(int mode, char *ssid, char *passphrase, unsigned int len);
314 int wifi_send_add_wpa3_password(int mode, char *ssid, char *password, unsigned int len);
315 int wifi_send_add_wpa_pmk(int mode, char *ssid, char *bssid, char *pmk, unsigned int len);
316 bool wifi_11d_is_channel_allowed(int channel);
317 
318 #if CONFIG_11AX
319 void wifi_request_get_fw_info(mlan_private *priv, mlan_fw_info *fw_info);
320 
321 #if CONFIG_MMSF
322 int wifi_mmsf_cfg(const t_u16 action, t_u8 *enable, t_u8 *Density, t_u8 *MMSF);
323 #endif
324 #endif
325 
326 #if CONFIG_WIFI_RECOVERY
327 int wifi_recovery_test(void);
328 #endif
329 
330 /**
331  * Get the string representation of the wlan firmware extended version.
332  *
333  * @param[out] version_ext Extended Version
334  *
335  * @return WM_SUCCESS on success or error code.
336  */
337 int wifi_get_firmware_version_ext(wifi_fw_version_ext_t *version_ext);
338 /**
339  * Get the string representation of the wlan firmware version.
340  *
341  * @param[out] ver Version
342  *
343  * @return WM_SUCCESS on success or error code.
344  */
345 int wifi_get_firmware_version(wifi_fw_version_t *ver);
346 int wifi_get_smart_mode_cfg(void);
347 int wifi_start_smart_mode(void);
348 /**
349  * Get Calibration data from WLAN firmware
350  *
351  * \param[out] cal_data Pointer to calibration data structure where
352  *	      calibration data and it's length will be stored.
353  *
354  * \return WM_SUCCESS if cal data read operation is successful.
355  * \return -WM_FAIL if cal data field is not present or command fails.
356  *
357  * \note The user of this API should free the allocated buffer for
358  *	 calibration data.
359  *
360  */
361 int wifi_get_cal_data(wifi_cal_data_t *cal_data);
362 int wifi_set_key(int bss_index,
363                  bool is_pairwise,
364                  const uint8_t key_index,
365                  const uint8_t *key,
366                  unsigned key_len,
367                  const uint8_t *seq,
368                  unsigned seq_len,
369                  const uint8_t *mac_addr,
370                  unsigned int flags);
371 int wifi_set_rekey_info(
372     int bss_index, const t_u8 *kek, size_t kek_len, const t_u8 *kck, size_t kck_len, const t_u8 *replay_ctr);
373 
374 /**
375  * Get User Data from OTP Memory
376  *
377  * \param[in] buf Pointer to buffer where data will be stored
378  * \param[in] len Number of bytes to read
379  *
380  * \return WM_SUCCESS if user data read operation is successful.
381  * \return -WM_FAIL if user data field is not present or command fails.
382  */
383 int wifi_get_otp_user_data(uint8_t *buf, uint16_t len);
384 int wifi_reg_access(wifi_reg_t reg_type, uint16_t action, uint32_t offset, uint32_t *value);
385 int wifi_enable_11d_support_APIs(void);
386 int wifi_get_tsf(uint32_t *tsf_high, uint32_t *tsf_low);
387 int wifi_set_igtk_key(int bss_index, const uint8_t *pn, const uint16_t key_index, const uint8_t *key, unsigned key_len);
388 int wifi_send_scan_cmd(t_u8 bss_mode,
389                        const t_u8 *specific_bssid,
390                        const char *ssid,
391                        uint8_t ssid_num,
392                        const t_u8 num_channels,
393                        const wifi_scan_channel_list_t *chan_list,
394                        const t_u8 num_probes,
395 #if CONFIG_SCAN_WITH_RSSIFILTER
396                        const t_s16 rssi_threshold,
397 #endif
398 #if CONFIG_SCAN_CHANNEL_GAP
399                        const t_u16 scan_chan_gap,
400 #endif
401                        const bool keep_previous_scan,
402                        const bool active_scan_triggered);
403 int wifi_stop_smart_mode(void);
404 int wifi_remove_key(int bss_index, bool is_pairwise, const uint8_t key_index, const uint8_t *mac_addr);
405 int wifi_enable_ecsa_support(void);
406 int wifi_set_ed_mac_mode(wifi_ed_mac_ctrl_t *wifi_ed_mac_ctrl, int bss_type);
407 int wifi_get_pmfcfg(t_u8 *mfpc, t_u8 *mfpr);
408 int wifi_get_ed_mac_mode(wifi_ed_mac_ctrl_t *wifi_ed_mac_ctrl, int bss_type);
409 int wifi_set_pmfcfg(t_u8 mfpc, t_u8 mfpr);
410 int wifi_set_chanlist(wifi_chanlist_t *chanlist);
411 int wifi_get_txpwrlimit(wifi_SubBand_t subband, wifi_txpwrlimit_t *txpwrlimit);
412 int wifi_get_data_rate(wifi_ds_rate *ds_rate, mlan_bss_type bss_type);
413 void wifi_get_active_channel_list(t_u8 *chan_list, t_u8 *num_chans, t_u16 acs_band);
414 bool wifi_is_ecsa_enabled(void);
415 int wifi_set_txpwrlimit(wifi_txpwrlimit_t *txpwrlimit);
416 int wifi_send_rssi_info_cmd(wifi_rssi_info_t *rssi_info);
417 void wifi_set_curr_bss_channel(uint8_t channel);
418 int wifi_get_chanlist(wifi_chanlist_t *chanlist);
419 #if (CONFIG_IPS)
420 int wifi_set_ips_config(mlan_bss_type interface, int option);
421 #endif
422 #if CONFIG_WIFI_EU_CRYPTO
423 int wifi_set_eu_crypto(EU_Crypto *Crypto_Data, enum _crypto_algorithm Algorithm, t_u16 EncDec);
424 #endif
425 int wifi_set_rx_mgmt_indication(unsigned int bss_type, unsigned int mgmt_subtype_mask);
426 mlan_status wlan_cmd_rx_mgmt_indication(IN pmlan_private pmpriv,
427                                         IN HostCmd_DS_COMMAND *cmd,
428                                         IN t_u16 cmd_action,
429                                         IN t_void *pdata_buf);
430 wlan_mgmt_pkt *wifi_PrepDefaultMgtMsg(t_u8 sub_type,
431                                       mlan_802_11_mac_addr *DestAddr,
432                                       mlan_802_11_mac_addr *SrcAddr,
433                                       mlan_802_11_mac_addr *Bssid,
434                                       t_u16 pkt_len);
435 
436 #if CONFIG_11MC
437 void wlan_location_ftm_cfg(location_cfg_info_t *ftm_location_cfg);
438 void wlan_civic_ftm_cfg(location_civic_rep_t *ftm_civic_cfg);
439 void wlan_dot11mc_ftm_cfg(void *cmd, ftm_11mc_nego_cfg_t *ftm_11mc_nego_cfg);
440 #endif
441 #if CONFIG_11AZ
442 void wlan_dto11az_ranging_cfg(void *cmd, const t_u8 protocl, HostCmd_FTM_SESSION_CFG *ftm_session_cfg);
443 #endif
444 
445 #if (CONFIG_11MC) || (CONFIG_11AZ)
446 /* ftm ctrl params */
447 typedef struct
448 {
449     int loop_cnt;
450     t_u8 channel;
451     t_u8 peer_mac[MLAN_MAC_ADDR_LENGTH];
452     t_u8 status;
453 } ftm_start_param;
454 
455 int wifi_ftm_start_stop(const t_u16 action, const t_u8 loop_cnt, const t_u8 *mac, const t_u8 channel);
456 int wifi_ftm_start(const t_u16 action, const t_u8 *mac, const t_u8 channel);
457 int wifi_ftm_stop(const t_u16 action, const t_u8 *mac, const t_u8 channel);
458 int wifi_ftm_cfg(const t_u8 protocol, ranging_11az_cfg_t *ftm_ranging_cfg);
459 int wifi_ftm_11mc_cfg(ftm_11mc_nego_cfg_t *ftm_11mc_nego_cfg);
460 int wifi_ftm_location_cfg(location_cfg_info_t *ftm_location_cfg);
461 int wifi_ftm_civic_cfg(location_civic_rep_t *ftm_civic_cfg);
462 int wifi_process_wlc_ftm_event();
463 void wifi_ftm_process_cfg_resp(void *resp_buff);
464 void wifi_ftm_process_ctrl_resp(void *resp_buff);
465 void wifi_ftm_process_event(void *p_data);
466 #if CONFIG_WLS_CSI_PROC
467 int wifi_process_wls_csi_event(void *p_data);
468 void wls_csi_process_event(void *p_data);
469 #endif
470 #endif
471 
472 int wifi_set_custom_ie(custom_ie *beacon_ies_data,
473                        custom_ie *beacon_wps_ies_data,
474                        custom_ie *proberesp_ies_data,
475                        custom_ie *assocresp_ies_data);
476 
477 #if CONFIG_11K
478 /**
479  * rrm scan callback function to process scan results
480  *
481  * \param[in] count the count of available scan results
482  * \return WM_SUCCESS if successful otherwise failure.
483  *
484  */
485 int _wlan_rrm_scan_cb(unsigned int count);
486 
487 /**
488  * rrm scan request
489  *
490  * \param[in] wlan_scan_param the scan parameters
491  * \param[in] scan_cb_param the rm scan parameters
492  *
493  */
494 void wlan_rrm_request_scan(wlan_scan_params_v2_t *wlan_scan_param, wlan_rrm_scan_cb_param *scan_cb_param);
495 #endif
496 
497 int wrapper_bssdesc_first_set(int bss_index,
498                               uint8_t *BssId,
499                               bool *is_ibss_bit_set,
500                               int *ssid_len,
501                               uint8_t *ssid,
502                               uint8_t *Channel,
503                               uint8_t *RSSI,
504                               uint16_t *beacon_period,
505                               uint16_t *dtim_period,
506                               _SecurityMode_t *WPA_WPA2_WEP,
507                               _Cipher_t *wpa_mcstCipher,
508                               _Cipher_t *wpa_ucstCipher,
509                               _Cipher_t *rsn_mcstCipher,
510                               _Cipher_t *rsn_ucstCipher,
511                               t_u8 *ap_mfpc,
512                               t_u8 *ap_mfpr,
513                               t_u8 *ap_pwe);
514 
515 int wrapper_bssdesc_second_set(int bss_index,
516                                bool *phtcap_ie_present,
517                                bool *phtinfo_ie_present,
518 #if CONFIG_11AC
519                                bool *pvhtcap_ie_present,
520 #endif
521 #if CONFIG_11AX
522                                bool *phecap_ie_present,
523 #endif
524                                bool *wmm_ie_present,
525                                uint16_t *band,
526                                bool *wps_IE_exist,
527                                uint16_t *wps_session,
528                                bool *wpa2_entp_IE_exist,
529 #if CONFIG_11R
530                                uint16_t *mdid,
531 #endif
532 #if CONFIG_11K
533                                bool *neighbor_report_supported,
534 #endif
535 #if CONFIG_11V
536                                bool *bss_transition_supported,
537 #endif
538                                uint8_t *trans_mode,
539                                uint8_t *trans_bssid,
540                                int *trans_ssid_len,
541                                uint8_t *trans_ssid
542 #if CONFIG_DRIVER_MBO
543                                ,
544                                bool *mbo_assoc_disallowed
545 #endif
546 );
547 
548 int wifi_get_mgmt_ie2(mlan_bss_type bss_type, void *buf, unsigned int *buf_len);
549 int wifi_set_mgmt_ie2(mlan_bss_type bss_type, unsigned short mask, void *buf, unsigned int buf_len);
550 int wifi_clear_mgmt_ie2(mlan_bss_type bss_type, int mgmt_bitmap_index);
551 
552 #if CONFIG_BG_SCAN
553 int wifi_request_bgscan(mlan_private *pmpriv);
554 #endif
555 
556 #if CONFIG_WPA_SUPP
557 int wifi_send_sched_scan_cmd(nxp_wifi_trigger_sched_scan_t *params);
558 int wifi_send_stop_sched_scan_cmd(void);
559 #endif
560 
561 #if CONFIG_SUBSCRIBE_EVENT_SUPPORT
562 /*submit subscribe event cmd to firmware*/
563 int wifi_subscribe_event_submit(mlan_private *pmpriv, mlan_ds_subscribe_evt *sub_evt);
564 
565 /*get subscribe event*/
566 int wifi_get_subscribe_event(mlan_private *pmpriv, mlan_ds_subscribe_evt *sub_evt);
567 
568 /*disable specific subscribe event*/
569 int wifi_clear_subscribe_event(mlan_private *pmpriv, int evt_bitmap);
570 
571 /*set subscribe event thresh_value and freq*/
572 int wifi_set_threshold_rssi_low(mlan_private *pmpriv, unsigned int rssi_low, unsigned int freq);
573 int wifi_set_threshold_rssi_high(mlan_private *pmpriv, unsigned int rssi_high, unsigned int freq);
574 int wifi_set_threshold_snr_low(mlan_private *pmpriv, unsigned int snr_low, unsigned int freq);
575 int wifi_set_threshold_snr_high(mlan_private *pmpriv, unsigned int snr_high, unsigned int freq);
576 int wifi_set_threshold_max_fail(mlan_private *pmpriv, unsigned int max_fail, unsigned int freq);
577 int wifi_set_threshold_beacon_miss(mlan_private *pmpriv, unsigned int beacon_miss, unsigned int freq);
578 int wifi_set_threshold_data_rssi_low(mlan_private *pmpriv, unsigned int data_rssi_low, unsigned int freq);
579 int wifi_set_threshold_data_rssi_high(mlan_private *pmpriv, unsigned int data_rssi_high, unsigned int freq);
580 int wifi_set_threshold_data_snr_low(mlan_private *pmpriv, unsigned int data_snr_low, unsigned int freq);
581 int wifi_set_threshold_data_snr_high(mlan_private *pmpriv, unsigned int data_snr_high, unsigned int freq);
582 int wifi_set_threshold_link_quality(mlan_private *pmpriv,
583                                     unsigned int link_snr,
584                                     unsigned int link_snr_freq,
585                                     unsigned int link_rate,
586                                     unsigned int link_rate_freq,
587                                     unsigned int link_tx_latency,
588                                     unsigned int link_tx_lantency_freq);
589 int wifi_set_threshold_pre_beacon_lost(mlan_private *pmpriv, unsigned int pre_beacon_lost, unsigned int freq);
590 #endif
591 
592 #if CONFIG_TSP
593 int wifi_tsp_cfg(const t_u16 action,
594                  t_u16 *enable,
595                  t_u32 *back_off,
596                  t_u32 *highThreshold,
597                  t_u32 *lowThreshold,
598                  t_u32 *dutycycstep,
599                  t_u32 *dutycycmin,
600                  int *highthrtemp,
601                  int *lowthrtemp,
602                  int *currCAUTemp,
603                  int *currRFUTemp);
604 #endif
605 
606 #if CONFIG_TX_AMPDU_PROT_MODE
607 int wifi_tx_ampdu_prot_mode(tx_ampdu_prot_mode_para *prot_mode, t_u16 action);
608 #endif
609 
610 #if CONFIG_EXTERNAL_COEX_PTA
611 int wifi_external_coex_pta_cfg(ext_coex_pta_cfg coex_pta_config);
612 #endif
613 
614 #if CONFIG_IMD3_CFG
615 int wifi_imd3_cfg(t_u8 imd3_value);
616 #endif
617 
618 #if CONFIG_AUTO_RECONNECT
619 int wifi_auto_reconnect_enable(wifi_auto_reconnect_config_t auto_reconnect_config);
620 int wifi_auto_reconnect_disable(void);
621 int wifi_get_auto_reconnect_config(wifi_auto_reconnect_config_t *auto_reconnect_config);
622 #endif
623 
624 #if CONFIG_INACTIVITY_TIMEOUT_EXT
625 int wifi_sta_inactivityto(wifi_inactivity_to_t *inac_to, t_u16 cmd_action);
626 #endif
627 #endif /* __MLAN_API_H__ */
628