1 /** @file mlan_ioctl.h
2  *
3  *  @brief This file declares the IOCTL data structures and APIs.
4  *
5  *  Copyright 2008-2024 NXP
6  *
7  *  SPDX-License-Identifier: BSD-3-Clause
8  *
9  */
10 
11 /******************************************************
12 Change log:
13     11/07/2008: initial version
14 ******************************************************/
15 
16 #ifndef _MLAN_IOCTL_H_
17 #define _MLAN_IOCTL_H_
18 
19 /** Enumeration for IOCTL request ID */
20 typedef enum _mlan_ioctl_req_id
21 {
22     /* Scan Group */
23     MLAN_IOCTL_SCAN = 0x00010000,
24     MLAN_OID_SCAN_NORMAL,
25     MLAN_OID_SCAN_SPECIFIC_SSID,
26     MLAN_OID_SCAN_USER_CONFIG,
27     MLAN_OID_SCAN_CONFIG,
28     MLAN_OID_SCAN_GET_CURRENT_BSS,
29     MLAN_OID_SCAN_CANCEL,
30     MLAN_OID_SCAN_TABLE_FLUSH,
31     MLAN_OID_SCAN_BGSCAN_CONFIG,
32     /* BSS Configuration Group */
33     MLAN_IOCTL_BSS = 0x00020000,
34     MLAN_OID_BSS_START,
35     MLAN_OID_BSS_STOP,
36     MLAN_OID_BSS_MODE,
37     MLAN_OID_BSS_CHANNEL,
38     MLAN_OID_BSS_CHANNEL_LIST,
39     MLAN_OID_BSS_MAC_ADDR,
40     MLAN_OID_BSS_MULTICAST_LIST,
41     MLAN_OID_BSS_FIND_BSS,
42     MLAN_OID_IBSS_BCN_INTERVAL,
43     MLAN_OID_IBSS_ATIM_WINDOW,
44     MLAN_OID_IBSS_CHANNEL,
45 #ifdef UAP_SUPPORT
46     MLAN_OID_UAP_BSS_CONFIG,
47     MLAN_OID_UAP_DEAUTH_STA,
48     MLAN_OID_UAP_BSS_RESET,
49 #endif
50 #if defined(STA_SUPPORT) && defined(UAP_SUPPORT)
51     MLAN_OID_BSS_ROLE,
52 #endif
53 #ifdef WIFI_DIRECT_SUPPORT
54     MLAN_OID_WIFI_DIRECT_MODE,
55 #endif
56 #ifdef UAP_HOST_MLME
57 #ifdef UAP_SUPPORT
58     MLAN_OID_UAP_ADD_STATION = 0x0002001C,
59 #endif
60 #endif
61 #if CONFIG_ECSA
62     MLAN_OID_ACTION_CHAN_SWITCH = 0x0002001E,
63 #endif
64 
65     /* Radio Configuration Group */
66     MLAN_IOCTL_RADIO_CFG = 0x00030000,
67     MLAN_OID_RADIO_CTRL,
68     MLAN_OID_BAND_CFG,
69     MLAN_OID_ANT_CFG,
70 #ifdef WIFI_DIRECT_SUPPORT
71     MLAN_OID_REMAIN_CHAN_CFG,
72 #endif
73 
74     /* SNMP MIB Group */
75     MLAN_IOCTL_SNMP_MIB = 0x00040000,
76     MLAN_OID_SNMP_MIB_RTS_THRESHOLD,
77     MLAN_OID_SNMP_MIB_FRAG_THRESHOLD,
78     MLAN_OID_SNMP_MIB_RETRY_COUNT,
79 #if defined(UAP_SUPPORT)
80     MLAN_OID_SNMP_MIB_DOT11D,
81     MLAN_OID_SNMP_MIB_DOT11H,
82 #endif
83     MLAN_OID_SNMP_MIB_DTIM_PERIOD,
84     MLAN_OID_SNMP_MIB_CTRL_DEAUTH,
85 
86     /* Status Information Group */
87     MLAN_IOCTL_GET_INFO = 0x00050000,
88     MLAN_OID_GET_STATS,
89     MLAN_OID_GET_SIGNAL,
90     MLAN_OID_GET_FW_INFO,
91     MLAN_OID_GET_VER_EXT,
92     MLAN_OID_GET_BSS_INFO,
93     MLAN_OID_GET_DEBUG_INFO,
94 #ifdef UAP_SUPPORT
95     MLAN_OID_UAP_STA_LIST,
96 #endif
97 
98     /* Security Configuration Group */
99     MLAN_IOCTL_SEC_CFG = 0x00060000,
100     MLAN_OID_SEC_CFG_AUTH_MODE,
101     MLAN_OID_SEC_CFG_ENCRYPT_MODE,
102     MLAN_OID_SEC_CFG_WPA_ENABLED,
103     MLAN_OID_SEC_CFG_ENCRYPT_KEY,
104     MLAN_OID_SEC_CFG_PASSPHRASE,
105     MLAN_OID_SEC_CFG_PASSWORD,
106     MLAN_OID_SEC_CFG_EWPA_ENABLED,
107     MLAN_OID_SEC_CFG_ESUPP_MODE,
108     MLAN_OID_SEC_CFG_WAPI_ENABLED,
109     MLAN_OID_SEC_CFG_PORT_CTRL_ENABLED,
110     MLAN_OID_SEC_CFG_REPORT_MIC_ERR,
111     MLAN_OID_SEC_QUERY_KEY,
112 
113     /* Rate Group */
114     MLAN_IOCTL_RATE = 0x00070000,
115     MLAN_OID_RATE_CFG,
116     MLAN_OID_GET_DATA_RATE,
117     MLAN_OID_SUPPORTED_RATES,
118 
119     /* Power Configuration Group */
120     MLAN_IOCTL_POWER_CFG = 0x00080000,
121     MLAN_OID_POWER_CFG,
122     MLAN_OID_POWER_CFG_EXT,
123 
124     /* Power Management Configuration Group */
125     MLAN_IOCTL_PM_CFG = 0x00090000,
126     MLAN_OID_PM_CFG_IEEE_PS,
127     MLAN_OID_PM_CFG_HS_CFG,
128     MLAN_OID_PM_CFG_INACTIVITY_TO,
129     MLAN_OID_PM_CFG_DEEP_SLEEP,
130     MLAN_OID_PM_CFG_SLEEP_PD,
131     MLAN_OID_PM_CFG_PS_CFG,
132     MLAN_OID_PM_CFG_SLEEP_PARAMS,
133 #ifdef UAP_SUPPORT
134     MLAN_OID_PM_CFG_PS_MODE,
135 #endif /* UAP_SUPPORT */
136     MLAN_OID_PM_INFO,
137     MLAN_OID_PM_HS_WAKEUP_REASON = 0x0009000B,
138 
139     /* WMM Configuration Group */
140     MLAN_IOCTL_WMM_CFG = 0x000A0000,
141     MLAN_OID_WMM_CFG_ENABLE,
142     MLAN_OID_WMM_CFG_QOS,
143     MLAN_OID_WMM_CFG_ADDTS,
144     MLAN_OID_WMM_CFG_DELTS,
145     MLAN_OID_WMM_CFG_QUEUE_CONFIG,
146     MLAN_OID_WMM_CFG_QUEUE_STATS,
147     MLAN_OID_WMM_CFG_QUEUE_STATUS,
148     MLAN_OID_WMM_CFG_TS_STATUS,
149 
150     /* WPS Configuration Group */
151     MLAN_IOCTL_WPS_CFG = 0x000B0000,
152     MLAN_OID_WPS_CFG_SESSION,
153 
154     /* 802.11n Configuration Group */
155     MLAN_IOCTL_11N_CFG = 0x000C0000,
156     MLAN_OID_11N_CFG_TX,
157     MLAN_OID_11N_HTCAP_CFG,
158     MLAN_OID_11N_CFG_ADDBA_REJECT,
159     MLAN_OID_11N_CFG_AGGR_PRIO_TBL,
160     MLAN_OID_11N_CFG_ADDBA_PARAM,
161     MLAN_OID_11N_CFG_MAX_TX_BUF_SIZE,
162     MLAN_OID_11N_CFG_AMSDU_AGGR_CTRL,
163     MLAN_OID_11N_CFG_SUPPORTED_MCS_SET,
164     MLAN_OID_11N_CFG_TX_BF_CAP,
165 
166     MLAN_OID_11N_CFG_DELBA            = 0x000C000C,
167     MLAN_OID_11N_CFG_REJECT_ADDBA_REQ = 0x000C000D,
168 
169     /* 802.11d Configuration Group */
170     MLAN_IOCTL_11D_CFG = 0x000D0000,
171 #ifdef STA_SUPPORT
172     MLAN_OID_11D_CFG_ENABLE,
173     MLAN_OID_11D_CLR_CHAN_TABLE,
174 #endif /* STA_SUPPORT */
175     MLAN_OID_11D_DOMAIN_INFO,
176 
177     /* Register Memory Access Group */
178     MLAN_IOCTL_REG_MEM = 0x000E0000,
179     MLAN_OID_REG_RW,
180     MLAN_OID_EEPROM_RD,
181     MLAN_OID_MEM_RW,
182 
183     /* Multi-Radio Configuration Group */
184     MLAN_IOCTL_MFR_CFG = 0x00100000,
185 
186     /* 802.11h Configuration Group */
187     MLAN_IOCTL_11H_CFG = 0x00110000,
188     MLAN_OID_11H_CHANNEL_CHECK,
189     MLAN_OID_11H_LOCAL_POWER_CONSTRAINT,
190 #if defined(DFS_TESTING_SUPPORT)
191     MLAN_OID_11H_DFS_TESTING,
192 #endif
193 
194 #if CONFIG_11K_OFFLOAD
195     MLAN_IOCTL_11K_CFG      = 0x00130000,
196     MLAN_OID_11K_CFG_ENABLE = 0x00130001,
197 #endif
198 
199 #if CONFIG_11AX
200     /* 802.11ax Configuration Group  */
201     MLAN_IOCTL_11AX_CFG   = 0x00170000,
202     MLAN_OID_11AX_HE_CFG  = 0x00170001,
203     MLAN_OID_11AX_CMD_CFG = 0x00170002,
204 #endif /* ENABLE_802_11AX */
205 
206     /* Miscellaneous Configuration Group */
207     MLAN_IOCTL_MISC_CFG = 0x00200000,
208     MLAN_OID_MISC_GEN_IE,
209     MLAN_OID_MISC_REGION,
210     MLAN_OID_MISC_WARM_RESET,
211 #if defined(SDIO_MULTI_PORT_TX_AGGR) || defined(SDIO_MULTI_PORT_RX_AGGR)
212     MLAN_OID_MISC_SDIO_MPA_CTRL,
213 #endif
214     MLAN_OID_MISC_HOST_CMD,
215     MLAN_OID_MISC_SYS_CLOCK,
216     MLAN_OID_MISC_SOFT_RESET,
217     MLAN_OID_MISC_WWS,
218     MLAN_OID_MISC_INIT_SHUTDOWN,
219     MLAN_OID_MISC_CUSTOM_IE,
220     MLAN_OID_MISC_TX_DATAPAUSE,
221     MLAN_OID_MISC_IP_ADDR,
222     MLAN_OID_MISC_MAC_CONTROL,
223     MLAN_OID_MISC_MEF_CFG,
224     MLAN_OID_MISC_CFP_CODE,
225     MLAN_OID_MISC_COUNTRY_CODE,
226     MLAN_OID_MISC_THERMAL,
227     MLAN_OID_MISC_RX_MGMT_IND,
228     MLAN_OID_MISC_SUBSCRIBE_EVENT,
229 #ifdef DEBUG_LEVEL1
230     MLAN_OID_MISC_DRVDBG,
231 #endif
232     MLAN_OID_MISC_HOTSPOT_CFG,
233     MLAN_OID_MISC_OTP_USER_DATA,
234 #ifdef WLAN_LOW_POWER_ENABLE
235     MLAN_OID_MISC_LOW_PWR_MODE,
236 #endif // WLAN_LOW_POWER_ENABLE
237 #if CONFIG_GTK_REKEY_OFFLOAD
238     MLAN_OID_MISC_CONFIG_GTK_REKEY_OFFLOAD = 0x00200037,
239 #endif
240 #if CONFIG_ECSA
241     MLAN_OID_MISC_OPER_CLASS = 0x00200038,
242 #endif
243 #if (CONFIG_WIFI_IND_RESET) && (CONFIG_WIFI_IND_DNLD)
244     MLAN_OID_MISC_IND_RST_CFG = 0x00200040,
245 #endif
246 #if CONFIG_ECSA
247     MLAN_OID_MISC_OPER_CLASS_CHECK = 0x00200049,
248 #endif
249     MLAN_OID_MISC_GET_REGIONPWR_CFG,
250 #if CONFIG_WIFI_CLOCKSYNC
251     MLAN_OID_MISC_GPIO_TSF_LATCH = 0x00200082,
252     MLAN_OID_MISC_GET_TSF_INFO   = 0x00200083
253 #endif /* CONFIG_WIFI_CLOCKSYNC */
254 } mlan_ioctl_req_id;
255 
256 /** Sub command size */
257 #define MLAN_SUB_COMMAND_SIZE 4U
258 
259 /** Enumeration for the action of IOCTL request */
260 typedef enum _mlan_act_ioctl
261 {
262     MLAN_ACT_SET = 1,
263     MLAN_ACT_GET,
264     MLAN_ACT_CANCEL,
265     MLAN_ACT_CLEAR,
266     MLAN_ACT_RESET,
267     MLAN_ACT_DEFAULT
268 } mlan_act_ioctl;
269 
270 /** Enumeration for generic enable/disable */
271 enum _mlan_act_generic
272 {
273     MLAN_ACT_DISABLE = 0,
274     MLAN_ACT_ENABLE  = 1
275 };
276 
277 /** Enumeration for scan mode */
278 enum _mlan_scan_mode
279 {
280     MLAN_SCAN_MODE_UNCHANGED = 0,
281     MLAN_SCAN_MODE_BSS,
282     MLAN_SCAN_MODE_IBSS,
283     MLAN_SCAN_MODE_ANY
284 };
285 
286 /** Enumeration for scan type */
287 typedef enum _mlan_scan_type
288 {
289     MLAN_SCAN_TYPE_UNCHANGED = 0,
290     MLAN_SCAN_TYPE_ACTIVE,
291     MLAN_SCAN_TYPE_PASSIVE,
292 #if defined(RW610) || defined(SD9177)
293     MLAN_SCAN_TYPE_PASSIVE_TO_ACTIVE,
294 #endif
295 } mlan_scan_type;
296 
297 /** mlan_ioctl_req data structure */
298 typedef struct _mlan_ioctl_req
299 {
300     /** Status code from firmware/driver */
301     mlan_error_code status_code;
302     /** BSS index number for multiple BSS support */
303     t_u32 bss_index;
304     /** Request id */
305     t_u32 req_id;
306     /** Action: set or get */
307     mlan_act_ioctl action;
308 
309     /** Pointer to buffer */
310     t_u8 *pbuf;
311     /** Length of buffer */
312     t_u32 buf_len;
313     /** Length of the data read/written in buffer */
314     t_u32 data_read_written;
315     /** Length of buffer needed */
316     t_u32 buf_len_needed;
317     /** Reserved for MOAL module */
318     t_ptr reserved_1;
319 } mlan_ioctl_req, *pmlan_ioctl_req;
320 
321 /** Max number of supported rates */
322 #define MLAN_SUPPORTED_RATES 32
323 
324 /** RSSI scan */
325 #define SCAN_RSSI(RSSI) (0x100U - ((t_u8)(RSSI)))
326 
327 /** Max passive scan time for each channel in milliseconds */
328 #define MRVDRV_MAX_PASSIVE_SCAN_CHAN_TIME 2000
329 
330 /** Max active scan time for each channel in milliseconds  */
331 #define MRVDRV_MAX_ACTIVE_SCAN_CHAN_TIME 500
332 
333 #if CONFIG_SCAN_CHANNEL_GAP
334 /** Max gap time between 2 scan in milliseconds  */
335 #define MRVDRV_MAX_SCAN_CHAN_GAP_TIME 500
336 #endif
337 
338 /** Maximum number of probes to send on each channel */
339 #define MAX_PROBES 4U
340 
341 /** Default number of probes to send on each channel */
342 #define DEFAULT_PROBES 2
343 
344 /**
345  *  @brief Sub-structure passed in wlan_ioctl_get_scan_table_entry for each BSS
346  *
347  *  Fixed field information returned for the scan response in the IOCTL
348  *    response.
349  */
350 typedef struct _wlan_get_scan_table_fixed
351 {
352     /** BSSID of this network */
353     t_u8 bssid[MLAN_MAC_ADDR_LENGTH];
354     /** Channel this beacon/probe response was detected */
355     t_u8 channel;
356     /** RSSI for the received packet */
357     t_u8 rssi;
358 #if CONFIG_SCAN_CHANNEL_GAP
359     /** channel load */
360     t_u8 chan_load;
361 #endif
362     /** TSF value in microseconds from the firmware at packet reception */
363     t_u64 network_tsf;
364 } wlan_get_scan_table_fixed;
365 
366 /** mlan_802_11_ssid data structure */
367 typedef struct _mlan_802_11_ssid
368 {
369     /** SSID Length */
370     t_u32 ssid_len;
371     /** SSID information field */
372     t_u8 ssid[MLAN_MAX_SSID_LENGTH];
373 } mlan_802_11_ssid, *pmlan_802_11_ssid;
374 
375 typedef MLAN_PACK_START struct _tx_status_event
376 {
377     /** packet type */
378     t_u8 packet_type;
379     /** tx_token_id */
380     t_u8 tx_token_id;
381     /** 0--success, 1--fail, 2--watchdogtimeout */
382     t_u8 status;
383 #if CONFIG_1AS
384     /** t1 time stamp */
385     t_u64 t1_tstamp;
386     /** t4 time stamp */
387     t_u64 t4_tstamp;
388     /** t1 error */
389     t_u64 t1_error;
390     /** t4 error */
391     t_u64 t4_error;
392     /** egress time */
393     t_u64 egress_time;
394 #endif
395 } MLAN_PACK_END tx_status_event;
396 
397 /**
398  *  Sructure to retrieve the scan table
399  */
400 typedef struct
401 {
402     /**
403      *  - Zero based scan entry to start retrieval in command request
404      *  - Number of scans entries returned in command response
405      */
406     t_u32 scan_number;
407     /**
408      * Buffer marker for multiple wlan_ioctl_get_scan_table_entry structures.
409      *   Each struct is padded to the nearest 32 bit boundary.
410      */
411     t_u8 scan_table_entry_buf[1];
412 } wlan_ioctl_get_scan_table_info;
413 
414 /**
415  *  Structure passed in the wlan_ioctl_get_scan_table_info for each
416  *    BSS returned in the WLAN_GET_SCAN_RESP IOCTL
417  */
418 typedef struct _wlan_ioctl_get_scan_table_entry
419 {
420     /**
421      *  Fixed field length included in the response.
422      *
423      *  Length value is included so future fixed fields can be added to the
424      *   response without breaking backwards compatibility.  Use the length
425      *   to find the offset for the bssInfoLength field, not a sizeof() calc.
426      */
427     t_u32 fixed_field_length;
428 
429     /**
430      *  Length of the BSS Information (probe resp or beacon) that
431      *    follows after the fixed_field_length
432      */
433     t_u32 bss_info_length;
434 
435     /**
436      *  Always present, fixed length data fields for the BSS
437      */
438     wlan_get_scan_table_fixed fixed_fields;
439 
440     /*
441      *  Probe response or beacon scanned for the BSS.
442      *
443      *  Field layout:
444      *   - TSF              8 octets
445      *   - Beacon Interval  2 octets
446      *   - Capability Info  2 octets
447      *
448      *   - IEEE Infomation Elements; variable number & length per 802.11 spec
449      */
450     /* t_u8 bss_info_buffer[0]; */
451 } wlan_ioctl_get_scan_table_entry;
452 
453 /** Type definition of mlan_scan_time_params */
454 typedef struct _mlan_scan_time_params
455 {
456     /** Scan channel time for specific scan in milliseconds */
457     t_u32 specific_scan_time;
458     /** Scan channel time for active scan in milliseconds */
459     t_u32 active_scan_time;
460     /** Scan channel time for passive scan in milliseconds */
461     t_u32 passive_scan_time;
462 } mlan_scan_time_params, *pmlan_scan_time_params;
463 
464 /** Type definition of mlan_user_scan */
465 typedef struct _mlan_user_scan
466 {
467     /** Length of scan_cfg_buf */
468     t_u32 scan_cfg_len;
469     /** Buffer of scan config */
470     t_u8 scan_cfg_buf[1];
471 } mlan_user_scan, *pmlan_user_scan;
472 
473 /** Type definition of mlan_scan_req */
474 typedef struct _mlan_scan_req
475 {
476     /** BSS mode for scanning */
477     t_u32 scan_mode;
478     /** Scan type */
479     mlan_scan_type scan_type;
480     /** SSID */
481     mlan_802_11_ssid scan_ssid;
482     /** Scan time parameters */
483     mlan_scan_time_params scan_time;
484     /** Scan config parameters in user scan */
485     mlan_user_scan user_scan;
486 } mlan_scan_req, *pmlan_scan_req;
487 
488 /** Type definition of mlan_ds_misc_tx_frame for MLAN_OID_MISC_TX_FRAME */
489 typedef struct _mlan_ds_misc_tx_frame
490 {
491     /** Band Configuration */
492     Band_Config_t bandcfg;
493     /** channel */
494     t_u8 channel;
495     /** Buffer type: data, cmd, event etc. */
496     mlan_buf_type buf_type;
497     /** QoS priority */
498     t_u32 priority;
499     /** Flags for this buffer */
500     t_u32 flags;
501     /** tx_seq_num */
502     t_u32 tx_seq_num;
503     /** tx_buf length */
504     t_u16 data_len;
505     /** Tx buffer */
506     t_u8 tx_buf[512];
507 } mlan_ds_misc_tx_frame;
508 
509 /** Type defnition of mlan_scan_resp */
510 typedef struct _mlan_scan_resp
511 {
512     /** Number of scan result */
513     t_u32 num_in_scan_table;
514     /** Scan table */
515     t_u8 *pscan_table;
516     /* Age in seconds */
517     t_u32 age_in_secs;
518 #if CONFIG_SCAN_CHANNEL_GAP
519     /** channel statstics */
520     t_u8 *pchan_stats;
521     /** Number of records in the chan_stats */
522     t_u32 num_in_chan_stats;
523 #endif
524 } mlan_scan_resp, *pmlan_scan_resp;
525 
526 /** Type definition of mlan_scan_cfg */
527 typedef struct _mlan_scan_cfg
528 {
529     /** Scan type */
530     mlan_scan_type scan_type;
531     /** BSS mode for scanning */
532     t_u32 scan_mode;
533     /** Scan probe */
534     t_u32 scan_probe;
535     /** Scan time parameters */
536     mlan_scan_time_params scan_time;
537 #if CONFIG_EXT_SCAN_SUPPORT
538     /** Extended Scan */
539     t_u32 ext_scan;
540 #if CONFIG_SCAN_CHANNEL_GAP
541     /** scan channel gap */
542     t_u32 scan_chan_gap;
543 #endif
544 #endif
545 } mlan_scan_cfg, *pmlan_scan_cfg;
546 
547 /** Type defnition of mlan_ds_scan for MLAN_IOCTL_SCAN */
548 typedef struct _mlan_ds_scan
549 {
550     /** Sub-command */
551     t_u32 sub_command;
552     /** Scan request/response */
553     union
554     {
555         /** Scan request */
556         mlan_scan_req scan_req;
557         /** Scan response */
558         mlan_scan_resp scan_resp;
559         /** Scan config parameters in user scan */
560         mlan_user_scan user_scan;
561         /** Scan config parameters */
562         mlan_scan_cfg scan_cfg;
563     } param;
564 } mlan_ds_scan, *pmlan_ds_scan;
565 
566 /*-----------------------------------------------------------------*/
567 /** BSS Configuration Group */
568 /*-----------------------------------------------------------------*/
569 /** Enumeration for BSS mode */
570 typedef enum _mlan_bss_mode
571 {
572     MLAN_BSS_MODE_NEGATIVE = -1,
573     MLAN_BSS_MODE_INFRA    = 1,
574     MLAN_BSS_MODE_IBSS,
575     MLAN_BSS_MODE_AUTO
576 } mlan_bss_mode;
577 
578 /** Maximum key length */
579 #define MLAN_MAX_KEY_LENGTH 32U
580 
581 /** max Wmm AC queues */
582 #define MAX_AC_QUEUES 4
583 
584 /** Maximum atim window in milliseconds */
585 #define MLAN_MAX_ATIM_WINDOW 50
586 
587 /** Minimum beacon interval */
588 #define MLAN_MIN_BEACON_INTERVAL 20
589 /** Maximum beacon interval */
590 #define MLAN_MAX_BEACON_INTERVAL 1000
591 /** Default beacon interval */
592 #define MLAN_BEACON_INTERVAL 100
593 
594 /** Receive all packets */
595 #define MLAN_PROMISC_MODE 1
596 /** Receive multicast packets in multicast list */
597 #define MLAN_MULTICAST_MODE 2
598 /** Receive all multicast packets */
599 #define MLAN_ALL_MULTI_MODE 4
600 
601 /** Maximum size of multicast list */
602 #define MLAN_MAX_MULTICAST_LIST_SIZE 32U
603 
604 /** mlan_multicast_list data structure for MLAN_OID_BSS_MULTICAST_LIST */
605 typedef struct _mlan_multicast_list
606 {
607     /** Multicast mode */
608     t_u32 mode;
609     /** Number of multicast addresses in the list */
610     t_u32 num_multicast_addr;
611     /** Multicast address list */
612     mlan_802_11_mac_addr mac_list[MLAN_MAX_MULTICAST_LIST_SIZE];
613 } mlan_multicast_list, *pmlan_multicast_list;
614 
615 /** World Wide Safe Mode Max channel */
616 #if CONFIG_5GHz_SUPPORT
617 #define MLAN_WWSM_MAX_CHANNEL 15
618 #else
619 #define MLAN_WWSM_MAX_CHANNEL 11
620 #endif
621 
622 /** Max channel */
623 #if CONFIG_5GHz_SUPPORT
624 #if (CONFIG_UNII4_BAND_SUPPORT)
625 #define MLAN_MAX_CHANNEL 177U
626 #else
627 #define MLAN_MAX_CHANNEL 165U
628 #endif
629 #else
630 #define MLAN_MAX_CHANNEL 14U
631 #endif
632 
633 /** Maximum number of channels in table */
634 #define MLAN_MAX_CHANNEL_NUM 128
635 
636 /** Channel/frequence for MLAN_OID_BSS_CHANNEL */
637 typedef struct _chan_freq
638 {
639     /** Channel Number */
640     t_u32 channel;
641     /** Frequency of this Channel */
642     t_u32 freq;
643 } chan_freq_t;
644 
645 /** mlan_chan_list data structure for MLAN_OID_BSS_CHANNEL_LIST */
646 typedef struct _mlan_chan_list
647 {
648     /** Number of channel */
649     t_u32 num_of_chan;
650     /** Channel-Frequency table */
651     chan_freq_t cf[MLAN_MAX_CHANNEL_NUM];
652 } mlan_chan_list;
653 
654 /** mlan_ssid_bssid  data structure for MLAN_OID_BSS_START and MLAN_OID_BSS_FIND_BSS */
655 typedef struct _mlan_ssid_bssid
656 {
657     /** SSID */
658     mlan_802_11_ssid ssid;
659     /** BSSID */
660     mlan_802_11_mac_addr bssid;
661     /** index in BSSID list, start from 1 */
662     t_u32 idx;
663 } mlan_ssid_bssid;
664 
665 #ifdef UAP_SUPPORT
666 /** UAP FLAG: Host based */
667 #define UAP_FLAG_HOST_BASED MBIT(0)
668 #ifdef UAP_HOST_MLME
669 /** UAP FLAG: Host mlme */
670 #define UAP_FLAG_HOST_MLME MBIT(1)
671 #endif
672 #endif
673 
674 #if CONFIG_11AX
675 #define MLAN_11AXCMD_SR_SUBID           0x102
676 #define MLAN_11AXCMD_BEAM_SUBID         0x103
677 #define MLAN_11AXCMD_HTC_SUBID          0x104
678 #define MLAN_11AXCMD_TXOMI_SUBID        0x105
679 #define MLAN_11AXCMD_OBSS_TOLTIME_SUBID 0x106
680 #define MLAN_11AXCMD_TXOPRTS_SUBID      0x108
681 #define MLAN_11AXCMD_RUPOWER_SUBID      0x117
682 
683 #if CONFIG_11AX_TWT
684 #define MLAN_11AX_TWT_SETUP_SUBID       0x114
685 #define MLAN_11AX_TWT_TEARDOWN_SUBID    0x115
686 #define MLAN_11AX_TWT_REPORT_SUBID      0x116
687 #define MLAN_11AX_TWT_INFORMATION_SUBID 0x119
688 #endif /* CONFIG_11AX_TWT */
689 
690 #if CONFIG_MMSF
691 #define MLAN_11AX_DEBUG_MMSF_SUBID 0x12d
692 #endif
693 #endif /* CONFIG_11AX */
694 
695 #if CONFIG_WIFI_RECOVERY
696 #define MLAN_RECOVERY_TEST_SUBID 0x117
697 #endif
698 
699 #ifdef UAP_SUPPORT
700 /** Maximum packet forward control value */
701 #define MAX_PKT_FWD_CTRL 15
702 /** Maximum BEACON period */
703 #define MAX_BEACON_PERIOD 4000U
704 /** Minimum BEACON period */
705 #define MIN_BEACON_PERIOD 50U
706 /** Maximum Channel Switch count */
707 #define MAX_CHSW_COUNT 15U
708 /** Minimum Channel Switch count */
709 #define MIN_CHSW_COUNT 5U
710 /** Maximum DTIM period */
711 #define MAX_DTIM_PERIOD 100U
712 /** Minimum DTIM period */
713 #define MIN_DTIM_PERIOD 1U
714 /** Maximum TX Power Limit */
715 #define MAX_TX_POWER 20
716 /** Minimum TX Power Limit */
717 #define MIN_TX_POWER 0
718 /** MAX station count */
719 #define MAX_UAP_STA_COUNT 10
720 /** Maximum RTS threshold */
721 #define MAX_RTS_THRESHOLD 2347
722 /** Maximum fragmentation threshold */
723 #define MAX_FRAG_THRESHOLD 2346
724 /** Minimum fragmentation threshold */
725 #define MIN_FRAG_THRESHOLD 256
726 /** data rate 54 M */
727 #define DATA_RATE_54M 108
728 /** Maximum value of bcast_ssid_ctl */
729 #define MAX_BCAST_SSID_CTL 2
730 /** antenna A */
731 #define ANTENNA_MODE_A 0
732 /** antenna B */
733 #define ANTENNA_MODE_B 1
734 /** transmit antenna */
735 #define TX_ANTENNA 1
736 /** receive antenna */
737 #define RX_ANTENNA 0
738 /** Maximum stage out time */
739 #define MAX_STAGE_OUT_TIME 864000
740 /** Minimum stage out time */
741 #define MIN_STAGE_OUT_TIME 300
742 /** Maximum Retry Limit */
743 #define MAX_RETRY_LIMIT 14
744 
745 /** Maximum group key timer in seconds */
746 #define MAX_GRP_TIMER 86400
747 
748 /** Maximum value of 4 byte configuration */
749 #define MAX_VALID_DWORD 0x7FFFFFFF /* (1 << 31) - 1 */
750 
751 /** Band config ACS mode */
752 #define BAND_CONFIG_ACS_MODE 0x40U
753 /** Band config manual */
754 #define BAND_CONFIG_MANUAL 0x00
755 
756 /** Maximum channel number in bg mode */
757 #define MAX_CHANNELS_BG 14U
758 
759 /** Maximum data rates */
760 #define MAX_DATA_RATES 14U
761 
762 /** auto data rate */
763 #define DATA_RATE_AUTO 0
764 
765 /**filter mode: disable */
766 #define MAC_FILTER_MODE_DISABLE 0
767 /**filter mode: block mac address */
768 #define MAC_FILTER_MODE_ALLOW_MAC 1
769 /**filter mode: block mac address */
770 #define MAC_FILTER_MODE_BLOCK_MAC 2
771 /** Maximum mac filter num */
772 #define MAX_MAC_FILTER_NUM 16
773 
774 /* Bitmap for protocol to use */
775 /** No security */
776 #define PROTOCOL_NO_SECURITY 0x01
777 /** Static WEP */
778 #define PROTOCOL_STATIC_WEP 0x02
779 /** WPA */
780 #define PROTOCOL_WPA 0x08U
781 /** WPA2 */
782 #define PROTOCOL_WPA2 0x20U
783 /** WP2 Mixed */
784 #define PROTOCOL_WPA2_MIXED 0x28U
785 /** EAP */
786 #define PROTOCOL_EAP 0x40U
787 /** WAPI */
788 #define PROTOCOL_WAPI 0x80U
789 /** WPA3 SAE */
790 #define PROTOCOL_WPA3_SAE 256U
791 #if CONFIG_DRIVER_OWE
792 /** OWE */
793 #define PROTOCOL_OWE 512U
794 #endif
795 
796 /** Key_mgmt_psk_sha256 */
797 #define KEY_MGMT_PSK_SHA256 0x100
798 /** Key_mgmt_sae */
799 #define KEY_MGMT_SAE 0x400
800 #if CONFIG_DRIVER_OWE
801 /** Key_mgmt_owe */
802 #define KEY_MGMT_OWE 0x200
803 #endif
804 /** Key_mgmt_none */
805 #define KEY_MGMT_NONE 0x04
806 /** Key_mgmt_psk */
807 #define KEY_MGMT_PSK 0x02
808 /** Key_mgmt_psk_sha256 */
809 #define KEY_MGMT_PSK_SHA256 0x100
810 /** Key_mgmt_eap  */
811 #define KEY_MGMT_EAP 0x01
812 /** Key_mgmt_psk sha256 */
813 #define KEY_MGMT_PSK_SHA256 0x100
814 
815 /** TKIP */
816 #define CIPHER_TKIP 0x04
817 /** AES CCMP */
818 #define CIPHER_AES_CCMP 0x08
819 
820 /** Valid cipher bitmap */
821 #define VALID_CIPHER_BITMAP 0x0cU
822 
823 #if CONFIG_NET_MONITOR
824 /** Maximum monior mac filter num */
825 #define MAX_MONIT_MAC_FILTER_NUM 3
826 #endif
827 
828 /** Channel List Entry */
829 typedef struct _channel_list
830 {
831     /** Channel Number */
832     t_u8 chan_number;
833     /** Band Config */
834     t_u8 band_config_type;
835 } scan_chan_list;
836 
837 /** mac_filter data structure */
838 typedef struct _mac_filter
839 {
840     /** mac filter mode */
841     t_u16 filter_mode;
842     /** mac adress count */
843     t_u16 mac_count;
844     /** mac address list */
845     mlan_802_11_mac_addr mac_list[MAX_MAC_FILTER_NUM];
846 } mac_filter;
847 
848 /** wpa parameter */
849 typedef struct _wpa_param
850 {
851     /** Pairwise cipher WPA */
852     t_u8 pairwise_cipher_wpa;
853     /** Pairwise cipher WPA2 */
854     t_u8 pairwise_cipher_wpa2;
855     /** group cipher */
856     t_u8 group_cipher;
857     /** RSN replay protection */
858     t_u8 rsn_protection;
859     /** passphrase length */
860     t_u32 length;
861     /** passphrase */
862     t_u8 passphrase[64];
863     /** password length */
864     t_u32 password_length;
865     /** wpa3 sae password */
866     t_u8 password[255];
867     /**group key rekey time in seconds */
868     t_u32 gk_rekey_time;
869 } wpa_param;
870 
871 /** wep key */
872 typedef struct _wep_key
873 {
874     /** key index 0-3 */
875     t_u8 key_index;
876     /** is default */
877     t_u8 is_default;
878     /** length */
879     t_u16 length;
880     /** key data */
881     t_u8 key[26];
882 } wep_key;
883 
884 /** wep param */
885 typedef struct _wep_param
886 {
887     /** key 0 */
888     wep_key key0;
889     /** key 1 */
890     wep_key key1;
891     /** key 2 */
892     wep_key key2;
893     /** key 3 */
894     wep_key key3;
895 } wep_param;
896 
897 /** Data structure of WMM QoS information */
898 typedef struct _wmm_qos_info_t
899 {
900 #ifdef BIG_ENDIAN_SUPPORT
901     /** QoS UAPSD */
902     t_u8 qos_uapsd : 1;
903     /** Reserved */
904     t_u8 reserved : 3;
905     /** Parameter set count */
906     t_u8 para_set_count : 4;
907 #else
908     /** Parameter set count */
909     t_u8 para_set_count : 4;
910     /** Reserved */
911     t_u8 reserved : 3;
912     /** QoS UAPSD */
913     t_u8 qos_uapsd : 1;
914 #endif /* BIG_ENDIAN_SUPPORT */
915 } wmm_qos_info_t, *pwmm_qos_info_t;
916 
917 /** Data structure of WMM ECW */
918 typedef struct _wmm_ecw_t
919 {
920 #ifdef BIG_ENDIAN_SUPPORT
921     /** Maximum Ecw */
922     t_u8 ecw_max : 4;
923     /** Minimum Ecw */
924     t_u8 ecw_min : 4;
925 #else
926     /** Minimum Ecw */
927     t_u8 ecw_min : 4;
928     /** Maximum Ecw */
929     t_u8 ecw_max : 4;
930 #endif /* BIG_ENDIAN_SUPPORT */
931 } wmm_ecw_t, *pwmm_ecw_t;
932 
933 /** Data structure of WMM Aci/Aifsn */
934 typedef struct _wmm_aci_aifsn_t
935 {
936 #ifdef BIG_ENDIAN_SUPPORT
937     /** Reserved */
938     t_u8 reserved : 1;
939     /** Aci */
940     t_u8 aci : 2;
941     /** Acm */
942     t_u8 acm : 1;
943     /** Aifsn */
944     t_u8 aifsn : 4;
945 #else
946     /** Aifsn */
947     t_u8 aifsn : 4;
948     /** Acm */
949     t_u8 acm : 1;
950     /** Aci */
951     t_u8 aci : 2;
952     /** Reserved */
953     t_u8 reserved : 1;
954 #endif /* BIG_ENDIAN_SUPPORT */
955 } wmm_aci_aifsn_t, *pwmm_aci_aifsn_t;
956 
957 /** Data structure of WMM AC parameters  */
958 typedef struct _wmm_ac_parameters_t
959 {
960     wmm_aci_aifsn_t aci_aifsn; /**< AciAifSn */
961     wmm_ecw_t ecw;             /**< Ecw */
962     t_u16 tx_op_limit;         /**< Tx op limit */
963 } wmm_ac_parameters_t, *pwmm_ac_parameters_t;
964 
965 /** Data structure of WMM parameter IE  */
966 typedef struct _wmm_parameter_t
967 {
968     /** OuiType:  00:50:f2:02 */
969     t_u8 ouitype[4];
970     /** Oui subtype: 01 */
971     t_u8 ouisubtype;
972     /** version: 01 */
973     t_u8 version;
974     /** QoS information */
975     t_u8 qos_info;
976     /** Reserved */
977     t_u8 reserved;
978     /** AC Parameters Record WMM_AC_BE, WMM_AC_BK, WMM_AC_VI, WMM_AC_VO */
979     wmm_ac_parameters_t ac_params[MAX_AC_QUEUES];
980 } wmm_parameter_t, *pwmm_parameter_t;
981 
982 /** mlan_bss_param
983  * Note: For each entry you must enter an invalid value
984  * in the MOAL function woal_set_sys_config_invalid_data().
985  * Otherwise for a valid data an unwanted TLV will be
986  * added to that command.
987  */
988 typedef struct _mlan_uap_bss_param
989 {
990     /** AP mac addr */
991     mlan_802_11_mac_addr mac_addr;
992     /** SSID */
993     mlan_802_11_ssid ssid;
994     /** Broadcast ssid control */
995     t_u8 bcast_ssid_ctl;
996     /** Radio control: on/off */
997     t_u8 radio_ctl;
998     /** dtim period */
999     t_u8 dtim_period;
1000     /** beacon period */
1001     t_u16 beacon_period;
1002     /** channel switch time to send ECSA */
1003     t_u8 chan_sw_count;
1004     /** rates */
1005     t_u8 rates[MAX_DATA_RATES];
1006     /** Tx data rate */
1007     t_u16 tx_data_rate;
1008     /** multicast/broadcast data rate */
1009     t_u16 mcbc_data_rate;
1010     /** Tx power level in dBm */
1011     t_u8 tx_power_level;
1012     /** Tx antenna */
1013     t_u8 tx_antenna;
1014     /** Rx antenna */
1015     t_u8 rx_antenna;
1016     /** packet forward control */
1017     t_u8 pkt_forward_ctl;
1018     /** max station count */
1019     t_u16 max_sta_count;
1020     /** mac filter */
1021     mac_filter filter;
1022     /** station ageout timer in unit of 100ms  */
1023     t_u32 sta_ageout_timer;
1024     /** PS station ageout timer in unit of 100ms  */
1025     t_u32 ps_sta_ageout_timer;
1026     /** RTS threshold */
1027     t_u16 rts_threshold;
1028     /** fragmentation threshold */
1029     t_u16 frag_threshold;
1030     /**  retry_limit */
1031     t_u16 retry_limit;
1032     /**  pairwise update timeout in milliseconds */
1033     t_u32 pairwise_update_timeout;
1034     /** pairwise handshake retries */
1035     t_u32 pwk_retries;
1036     /**  groupwise update timeout in milliseconds */
1037     t_u32 groupwise_update_timeout;
1038     /** groupwise handshake retries */
1039     t_u32 gwk_retries;
1040     /** preamble type */
1041     t_u8 preamble_type;
1042     /** band cfg */
1043     t_u8 band_cfg;
1044     /** channel */
1045     t_u8 channel;
1046     /** auth mode */
1047     t_u16 auth_mode;
1048     /** PWE derivation */
1049     t_u8 pwe_derivation;
1050     /** transition disable */
1051     t_u8 transition_disable;
1052     /** encryption protocol */
1053     t_u16 protocol;
1054     /** key managment type */
1055     t_u16 key_mgmt;
1056     /** wep param */
1057     wep_param wep_cfg;
1058     /** wpa param */
1059     wpa_param wpa_cfg;
1060     /** Mgmt IE passthru mask */
1061     t_u32 mgmt_ie_passthru_mask;
1062     /*
1063      * 11n HT Cap  HTCap_t  ht_cap
1064      */
1065     /** HT Capabilities Info field */
1066     t_u16 ht_cap_info;
1067     /** A-MPDU Parameters field */
1068     t_u8 ampdu_param;
1069     /** Supported MCS Set field */
1070     t_u8 supported_mcs_set[16];
1071     /** HT Extended Capabilities field */
1072     t_u16 ht_ext_cap;
1073     /** Transmit Beamforming Capabilities field */
1074     t_u32 tx_bf_cap;
1075     /** Antenna Selection Capability field */
1076     t_u8 asel;
1077     /** Enable 2040 Coex */
1078     t_u8 enable_2040coex;
1079     /** key management operation */
1080     t_u16 key_mgmt_operation;
1081     /** BSS status */
1082     t_u16 bss_status;
1083 #ifdef WIFI_DIRECT_SUPPORT
1084     /* pre shared key */
1085     t_u8 psk[MLAN_MAX_KEY_LENGTH];
1086 #endif /* WIFI_DIRECT_SUPPORT */
1087     /** Number of channels in scan_channel_list */
1088     t_u32 num_of_chan;
1089     /** scan channel list in ACS mode */
1090     scan_chan_list chan_list[MLAN_MAX_CHANNEL];
1091     /** Wmm parameters */
1092     wmm_parameter_t wmm_para;
1093     /** uap host based config */
1094     t_u32 uap_host_based_config;
1095 } mlan_uap_bss_param;
1096 
1097 /** mlan_deauth_param */
1098 typedef struct _mlan_deauth_param
1099 {
1100     /** STA mac addr */
1101     t_u8 mac_addr[MLAN_MAC_ADDR_LENGTH];
1102     /** deauth reason */
1103     t_u16 reason_code;
1104 } mlan_deauth_param;
1105 #endif
1106 
1107 #ifdef WIFI_DIRECT_SUPPORT
1108 /** mode: disable wifi direct */
1109 #define WIFI_DIRECT_MODE_DISABLE 0
1110 /** mode: listen */
1111 #define WIFI_DIRECT_MODE_LISTEN 1
1112 /** mode: GO */
1113 #define WIFI_DIRECT_MODE_GO 2
1114 /** mode: client */
1115 #define WIFI_DIRECT_MODE_CLIENT 3
1116 /** mode: find */
1117 #define WIFI_DIRECT_MODE_FIND 4
1118 /** mode: stop find */
1119 #define WIFI_DIRECT_MODE_STOP_FIND 5
1120 #endif
1121 
1122 #if CONFIG_ECSA
1123 /** mlan_chan_switch_param */
1124 typedef struct _mlan_action_chan_switch
1125 {
1126     /** mode*/
1127     t_u8 mode;
1128     /** switch mode*/
1129     t_u8 chan_switch_mode;
1130     /** oper class*/
1131     t_u8 new_oper_class;
1132     /** new channel */
1133     t_u8 new_channel_num;
1134     /** chan_switch_count */
1135     t_u8 chan_switch_count;
1136 } mlan_action_chan_switch;
1137 
1138 typedef struct _mlan_ds_bw_chan_oper
1139 {
1140     /* bandwidth 20:20M 40:40M 80:80M*/
1141     t_u8 bandwidth;
1142     /* channel number */
1143     t_u8 channel;
1144     /* Non-global operating class */
1145     t_u8 oper_class;
1146 } mlan_ds_bw_chan_oper;
1147 #endif
1148 
1149 /** mlan_uap_acs_scan */
1150 typedef struct _mlan_uap_acs_scan
1151 {
1152     /** band */
1153     Band_Config_t bandcfg;
1154     /** channel */
1155     t_u8 chan;
1156 } mlan_uap_acs_scan;
1157 
1158 #ifdef UAP_HOST_MLME
1159 /** station is authorized (802.1X) */
1160 #define STA_FLAG_AUTHORIZED MBIT(1)
1161 /** Station is capable of receiving frames with short barker preamble */
1162 #define STA_FLAG_SHORT_PREAMBLE MBIT(2)
1163 /** station is WME/QoS capable */
1164 #define STA_FLAG_WME MBIT(3)
1165 /** station uses management frame protection */
1166 #define STA_FLAG_MFP MBIT(4)
1167 /** station is authenticated */
1168 #define STA_FLAG_AUTHENTICATED MBIT(5)
1169 /** station is a TDLS peer */
1170 #define STA_FLAG_TDLS_PEER MBIT(6)
1171 /** station is associated */
1172 #define STA_FLAG_ASSOCIATED MBIT(7)
1173 /** mlan_ds_sta_info */
1174 typedef struct _mlan_ds_sta_info
1175 {
1176     /** aid */
1177     t_u16 aid;
1178     /** peer_mac */
1179     t_u8 peer_mac[MLAN_MAC_ADDR_LENGTH];
1180     /** Listen Interval */
1181     int listen_interval;
1182     /** Capability Info */
1183     t_u16 cap_info;
1184     /** station flag */
1185     t_u32 sta_flags;
1186     /** tlv len */
1187     t_u16 tlv_len;
1188     /** tlv start */
1189     t_u8 tlv[];
1190 } mlan_ds_sta_info;
1191 #endif
1192 
1193 /** Type definition of mlan_embedded_dhcp_config */
1194 typedef MLAN_PACK_START struct _mlan_embedded_dhcp_config
1195 {
1196     /** Host IP address */
1197     t_u32 host_ip_addr;
1198     /** Start IP address */
1199     t_u32 start_ip_addr;
1200     /** Sub mask */
1201     t_u32 subnet_mask;
1202     /** Lease time */
1203     t_u32 lease_time;
1204     /** Limit count */
1205     t_u8 limit_count;
1206     /** Enabled/disbaled */
1207     t_u8 is_enabled;
1208     /** Get / Set action*/
1209     t_u16 action;
1210 } MLAN_PACK_END mlan_embedded_dhcp_config, *pmlan_embedded_dhcp_config;
1211 
1212 /** Type definition of mlan_ds_bss for MLAN_IOCTL_BSS */
1213 typedef struct _mlan_ds_bss
1214 {
1215     /** Sub-command */
1216     mlan_ioctl_req_id sub_command;
1217     /** BSS parameter */
1218     union
1219     {
1220         /** SSID-BSSID for MLAN_OID_BSS_START */
1221         mlan_ssid_bssid ssid_bssid;
1222 #if 0
1223         /** BSSID for MLAN_OID_BSS_STOP */
1224         mlan_802_11_mac_addr bssid;
1225         /** BSS mode for MLAN_OID_BSS_MODE */
1226         t_u32 bss_mode;
1227         /** BSS channel/frequency for MLAN_OID_BSS_CHANNEL */
1228         chan_freq bss_chan;
1229         /** BSS channel list for MLAN_OID_BSS_CHANNEL_LIST */
1230         mlan_chan_list chanlist;
1231         /** MAC address for MLAN_OID_BSS_MAC_ADDR */
1232         mlan_802_11_mac_addr mac_addr;
1233         /** Multicast list for MLAN_OID_BSS_MULTICAST_LIST */
1234         mlan_multicast_list multicast_list;
1235         /** Beacon interval for MLAN_OID_IBSS_BCN_INTERVAL */
1236         t_u32 bcn_interval;
1237         /** ATIM window for MLAN_OID_IBSS_ATIM_WINDOW */
1238         t_u32 atim_window;
1239 #endif
1240 #ifdef UAP_SUPPORT
1241         /** BSS param for AP mode */
1242         mlan_uap_bss_param bss_config;
1243 #if CONFIG_ECSA
1244         /** channel switch for MLAN_OID_UAP_CHAN_SWITCH */
1245         mlan_action_chan_switch chanswitch;
1246 #endif
1247 #if 0
1248         /** deauth param for MLAN_OID_UAP_DEAUTH_STA */
1249         mlan_deauth_param deauth_param;
1250 #endif
1251 #endif
1252 #if defined(STA_SUPPORT) && defined(UAP_SUPPORT)
1253         /** BSS role */
1254         mlan_bss_role bss_role;
1255 #endif
1256 #ifdef WIFI_DIRECT_SUPPORT
1257         t_u16 wfd_mode;
1258 #endif
1259         /** AP acs scan MLAN_OID_UAP_ACS_SCAN */
1260         mlan_uap_acs_scan ap_acs_scan;
1261         /** host based flag for MLAN_OID_BSS_START */
1262         t_u8 host_based;
1263 #ifdef UAP_HOST_MLME
1264 #ifdef UAP_SUPPORT
1265         /** STA info for MLAN_OID_UAP_ADD_STATION */
1266         mlan_ds_sta_info sta_info;
1267 #endif
1268 #endif
1269     } param;
1270 } mlan_ds_bss, *pmlan_ds_bss;
1271 
1272 #ifdef OTP_CHANINFO
1273 /* OTP Region info */
1274 typedef MLAN_PACK_START struct _otp_region_info
1275 {
1276     t_u8 country_code[2];
1277     t_u8 region_code;
1278     t_u8 environment;
1279     t_u16 force_reg : 1;
1280     t_u16 reserved : 15;
1281 } MLAN_PACK_END otp_region_info_t;
1282 
1283 /** Type definition of mlan_ds_custom_reg_domain */
1284 typedef struct _mlan_ds_custom_reg_domain
1285 {
1286     otp_region_info_t region;
1287     /** num of 2g channels in custom_reg_domain */
1288     t_u8 num_bg_chan;
1289 #if CONFIG_5GHz_SUPPORT
1290     /** num of 5g channels in custom_reg_domain */
1291     t_u8 num_a_chan;
1292 #endif
1293     /** cfp table */
1294     chan_freq_power_t cfp_tbl[0];
1295 } mlan_ds_custom_reg_domain;
1296 #endif
1297 
1298 /*-----------------------------------------------------------------*/
1299 /** Radio Control Group */
1300 /*-----------------------------------------------------------------*/
1301 /** Enumeration for band */
1302 #define BAND_B   1U
1303 #define BAND_G   2U
1304 #define BAND_A   4U
1305 #define BAND_GN  8U
1306 #define BAND_AN  16U
1307 #define BAND_GAC 32U
1308 #define BAND_AAC 64U
1309 #if CONFIG_11AX
1310 #define BAND_GAX 256U
1311 #define BAND_AAX 512U
1312 #endif
1313 
1314 #if CONFIG_BG_SCAN
1315 /** band AUTO */
1316 #define WIFI_FREQUENCY_BAND_AUTO 0
1317 /** band 5G */
1318 #define WIFI_FREQUENCY_BAND_5GHZ 1
1319 /** band 2G */
1320 #define WIFI_FREQUENCY_BAND_2GHZ 2
1321 /** All band */
1322 #define WIFI_FREQUENCY_ALL_BAND 3
1323 #endif
1324 
1325 /** NO secondary channel */
1326 #define NO_SEC_CHANNEL 0
1327 /** secondary channel is above primary channel */
1328 #define SEC_CHANNEL_ABOVE 1
1329 /** secondary channel is below primary channel */
1330 #define SEC_CHANNEL_BELOW 3
1331 /** secondary channel is 80Mhz bandwidth for 11ac */
1332 #define CHANNEL_BW_80MHZ  4
1333 #define CHANNEL_BW_160MHZ 5
1334 /** Channel bandwidth */
1335 #define CHANNEL_BW_20MHZ       0
1336 #define CHANNEL_BW_40MHZ_ABOVE 1
1337 #define CHANNEL_BW_40MHZ_BELOW 3
1338 
1339 /** Type definition of mlan_ds_band_cfg for MLAN_OID_BAND_CFG */
1340 typedef struct _mlan_ds_band_cfg
1341 {
1342     /** Infra band */
1343     t_u16 config_bands;
1344     /** Ad-hoc start band */
1345     t_u16 adhoc_start_band;
1346     /** Ad-hoc start channel */
1347     t_u32 adhoc_channel;
1348     /** Ad-hoc channel bandwidth */
1349     t_u32 sec_chan_offset;
1350     /** fw supported band */
1351     t_u16 fw_bands;
1352 } mlan_ds_band_cfg;
1353 
1354 /** Type definition of mlan_ds_remain_chan for MLAN_OID_REMAIN_CHAN_CFG */
1355 typedef struct _mlan_ds_remain_chan
1356 {
1357     /** remove flag */
1358     t_u16 remove;
1359     /** status */
1360     t_u8 status;
1361     /** Band cfg */
1362     t_u8 bandcfg;
1363     /** channel */
1364     t_u8 channel;
1365     /** remain time: Unit ms*/
1366     t_u32 remain_period;
1367 } mlan_ds_remain_chan, *pmlan_ds_remain_chan;
1368 
1369 /** Type definition of mlan_ds_radio_cfg for MLAN_IOCTL_RADIO_CFG */
1370 typedef struct _mlan_ds_radio_cfg
1371 {
1372     /** Sub-command */
1373     t_u32 sub_command;
1374     /** Radio control parameter */
1375     union
1376     {
1377         /** Radio on/off for MLAN_OID_RADIO_CTRL */
1378         t_u32 radio_on_off;
1379         /** Band info for MLAN_OID_BAND_CFG */
1380         mlan_ds_band_cfg band_cfg;
1381         /** Antenna info for MLAN_OID_ANT_CFG */
1382         t_u32 antenna;
1383 #ifdef WIFI_DIRECT_SUPPORT
1384         /** remain on channel for MLAN_OID_REMAIN_CHAN_CFG */
1385         mlan_ds_remain_chan remain_chan;
1386 #endif
1387     } param;
1388 } mlan_ds_radio_cfg, *pmlan_ds_radio_cfg;
1389 
1390 /** Type definition of mlan_ds_ant_cfg_1x1 for MLAN_OID_ANT_CFG */
1391 typedef struct _mlan_ds_ant_cfg_1x1
1392 {
1393     /** Antenna mode */
1394     t_u32 antenna;
1395     /** Evaluate time */
1396     t_u16 evaluate_time;
1397     /** Current antenna */
1398     t_u16 current_antenna;
1399 #ifdef RW610
1400     /** Evaluate time */
1401     t_u8 evaluate_mode;
1402 #endif
1403 } mlan_ds_ant_cfg_1x1, *pmlan_ds_ant_cfg_1x1;
1404 
1405 #ifdef STREAM_2X2
1406 /** Type definition of mlan_ds_ant_cfg for MLAN_OID_ANT_CFG */
1407 typedef struct _mlan_ds_ant_cfg
1408 {
1409     /** Tx antenna mode */
1410     t_u32 tx_antenna;
1411     /** Rx antenna mode */
1412     t_u32 rx_antenna;
1413 } mlan_ds_ant_cfg, *pmlan_ds_ant_cfg;
1414 #endif
1415 
1416 /*-----------------------------------------------------------------*/
1417 /** SNMP MIB Group */
1418 /*-----------------------------------------------------------------*/
1419 /** Type definition of mlan_ds_snmp_mib for MLAN_IOCTL_SNMP_MIB */
1420 typedef struct _mlan_ds_snmp_mib
1421 {
1422     /** Sub-command */
1423     t_u32 sub_command;
1424     /** SNMP MIB parameter */
1425     union
1426     {
1427         /** RTS threshold for MLAN_OID_SNMP_MIB_RTS_THRESHOLD */
1428         t_u32 rts_threshold;
1429         /** Fragment threshold for MLAN_OID_SNMP_MIB_FRAG_THRESHOLD */
1430         t_u32 frag_threshold;
1431         /** Retry count for MLAN_OID_SNMP_MIB_RETRY_COUNT */
1432         t_u32 retry_count;
1433 #if defined(UAP_SUPPORT)
1434         /** OID value for MLAN_OID_SNMP_MIB_DOT11D/H */
1435         t_u32 oid_value;
1436 #endif
1437         /** DTIM period for MLAN_OID_SNMP_MIB_DTIM_PERIOD */
1438         t_u32 dtim_period;
1439         /** Control deauth when uap switch channel */
1440         t_u8 deauthctrl;
1441     } param;
1442 } mlan_ds_snmp_mib, *pmlan_ds_snmp_mib;
1443 
1444 /*-----------------------------------------------------------------*/
1445 /** Status Information Group */
1446 /*-----------------------------------------------------------------*/
1447 /** Enumeration for ad-hoc status */
1448 enum _mlan_adhoc_status
1449 {
1450     ADHOC_IDLE,
1451     ADHOC_STARTED,
1452     ADHOC_JOINED,
1453     ADHOC_COALESCED,
1454     ADHOC_STARTING
1455 };
1456 
1457 /** Type definition of mlan_ds_get_stats for MLAN_OID_GET_STATS */
1458 typedef struct _mlan_ds_get_stats
1459 {
1460     /** Statistics counter */
1461     /** Multicast transmitted frame count */
1462     t_u32 mcast_tx_frame;
1463     /** Failure count */
1464     t_u32 failed;
1465     /** Retry count */
1466     t_u32 retry;
1467     /** Multi entry count */
1468     t_u32 multi_retry;
1469     /** Duplicate frame count */
1470     t_u32 frame_dup;
1471     /** RTS success count */
1472     t_u32 rts_success;
1473     /** RTS failure count */
1474     t_u32 rts_failure;
1475     /** Ack failure count */
1476     t_u32 ack_failure;
1477     /** Rx fragmentation count */
1478     t_u32 rx_frag;
1479     /** Multicast Tx frame count */
1480     t_u32 mcast_rx_frame;
1481     /** FCS error count */
1482     t_u32 fcs_error;
1483     /** Tx frame count */
1484     t_u32 tx_frame;
1485     /** WEP ICV error count */
1486     t_u32 wep_icv_error[4];
1487 } mlan_ds_get_stats, *pmlan_ds_get_stats;
1488 
1489 /** Type definition of mlan_ds_uap_stats for MLAN_OID_GET_STATS */
1490 typedef struct _mlan_ds_uap_stats
1491 {
1492     /** tkip mic failures */
1493     t_u32 tkip_mic_failures;
1494     /** ccmp decrypt errors */
1495     t_u32 ccmp_decrypt_errors;
1496     /** wep undecryptable count */
1497     t_u32 wep_undecryptable_count;
1498     /** wep icv error count */
1499     t_u32 wep_icv_error_count;
1500     /** decrypt failure count */
1501     t_u32 decrypt_failure_count;
1502     /** dot11 multicast tx count */
1503     t_u32 mcast_tx_count;
1504     /** dot11 failed count */
1505     t_u32 failed_count;
1506     /** dot11 retry count */
1507     t_u32 retry_count;
1508     /** dot11 multi retry count */
1509     t_u32 multi_retry_count;
1510     /** dot11 frame duplicate count */
1511     t_u32 frame_dup_count;
1512     /** dot11 rts success count */
1513     t_u32 rts_success_count;
1514     /** dot11 rts failure count */
1515     t_u32 rts_failure_count;
1516     /** dot11 ack failure count */
1517     t_u32 ack_failure_count;
1518     /** dot11 rx ragment count */
1519     t_u32 rx_fragment_count;
1520     /** dot11 mcast rx frame count */
1521     t_u32 mcast_rx_frame_count;
1522     /** dot11 fcs error count */
1523     t_u32 fcs_error_count;
1524     /** dot11 tx frame count */
1525     t_u32 tx_frame_count;
1526     /** dot11 rsna tkip cm invoked */
1527     t_u32 rsna_tkip_cm_invoked;
1528     /** dot11 rsna 4way handshake failures */
1529     t_u32 rsna_4way_hshk_failures;
1530 } mlan_ds_uap_stats, *pmlan_ds_uap_stats;
1531 
1532 /** Mask of last beacon RSSI */
1533 #define BCN_RSSI_LAST_MASK 0x00000001
1534 /** Mask of average beacon RSSI */
1535 #define BCN_RSSI_AVG_MASK 0x00000002
1536 /** Mask of last data RSSI */
1537 #define DATA_RSSI_LAST_MASK 0x00000004
1538 /** Mask of average data RSSI */
1539 #define DATA_RSSI_AVG_MASK 0x00000008
1540 /** Mask of last beacon SNR */
1541 #define BCN_SNR_LAST_MASK 0x00000010
1542 /** Mask of average beacon SNR */
1543 #define BCN_SNR_AVG_MASK 0x00000020
1544 /** Mask of last data SNR */
1545 #define DATA_SNR_LAST_MASK 0x00000040
1546 /** Mask of average data SNR */
1547 #define DATA_SNR_AVG_MASK 0x00000080
1548 /** Mask of last beacon NF */
1549 #define BCN_NF_LAST_MASK 0x00000100
1550 /** Mask of average beacon NF */
1551 #define BCN_NF_AVG_MASK 0x00000200
1552 /** Mask of last data NF */
1553 #define DATA_NF_LAST_MASK 0x00000400
1554 /** Mask of average data NF */
1555 #define DATA_NF_AVG_MASK 0x00000800
1556 /** Mask of all RSSI_INFO */
1557 #define ALL_RSSI_INFO_MASK 0x00000fff
1558 
1559 /** Type definition of mlan_ds_get_signal for MLAN_OID_GET_SIGNAL */
1560 typedef struct _mlan_ds_get_signal
1561 {
1562     /** Selector of get operation */
1563     /*
1564      * Bit0:  Last Beacon RSSI,  Bit1:  Average Beacon RSSI,
1565      * Bit2:  Last Data RSSI,    Bit3:  Average Data RSSI,
1566      * Bit4:  Last Beacon SNR,   Bit5:  Average Beacon SNR,
1567      * Bit6:  Last Data SNR,     Bit7:  Average Data SNR,
1568      * Bit8:  Last Beacon NF,    Bit9:  Average Beacon NF,
1569      * Bit10: Last Data NF,      Bit11: Average Data NF
1570      */
1571     t_u16 selector;
1572 
1573     /** RSSI */
1574     /** RSSI of last beacon */
1575     t_s16 bcn_rssi_last;
1576     /** RSSI of beacon average */
1577     t_s16 bcn_rssi_avg;
1578     /** RSSI of last data packet */
1579     t_s16 data_rssi_last;
1580     /** RSSI of data packet average */
1581     t_s16 data_rssi_avg;
1582 
1583     /** SNR */
1584     /** SNR of last beacon */
1585     t_s16 bcn_snr_last;
1586     /** SNR of beacon average */
1587     t_s16 bcn_snr_avg;
1588     /** SNR of last data packet */
1589     t_s16 data_snr_last;
1590     /** SNR of data packet average */
1591     t_s16 data_snr_avg;
1592 
1593     /** NF */
1594     /** NF of last beacon */
1595     t_s16 bcn_nf_last;
1596     /** NF of beacon average */
1597     t_s16 bcn_nf_avg;
1598     /** NF of last data packet */
1599     t_s16 data_nf_last;
1600     /** NF of data packet average */
1601     t_s16 data_nf_avg;
1602 } mlan_ds_get_signal, *pmlan_ds_get_signal;
1603 
1604 #if CONFIG_11K_OFFLOAD
1605 /** Type definition of mlan_ds_11k_cfg for 11k enable/disable */
1606 typedef struct _mlan_ds_11k_cfg
1607 {
1608     /** Sub-command */
1609     t_u32 sub_command;
1610     union
1611     {
1612         t_u32 enable_11k;
1613     } param;
1614 } mlan_ds_11k_cfg;
1615 #endif
1616 
1617 /** mlan_fw_info data structure for MLAN_OID_GET_FW_INFO */
1618 typedef struct _mlan_fw_info
1619 {
1620     /** Firmware version */
1621     t_u32 fw_ver;
1622     /** MAC address */
1623     mlan_802_11_mac_addr mac_addr;
1624     /** Device support for MIMO abstraction of MCSs */
1625     t_u8 hw_dev_mcs_support;
1626     /** fw supported band */
1627     t_u16 fw_bands;
1628 #if CONFIG_11AX
1629     /** length of hw he capability */
1630     t_u8 hw_hecap_len;
1631     /** 802.11ax HE capability */
1632     t_u8 hw_he_cap[54];
1633     /** length of hw 2.4G he capability */
1634     t_u8 hw_2g_hecap_len;
1635     /** 802.11ax 2.4G HE capability */
1636     t_u8 hw_2g_he_cap[54];
1637 #ifdef ENABLE_802_116E
1638     /** 802.11ax 6G HE capability */
1639     t_u16 hw_he_6g_cap;
1640 #endif
1641 #endif
1642 } mlan_fw_info, *pmlan_fw_info;
1643 
1644 /** Version string buffer length */
1645 #define MLAN_MAX_VER_STR_LEN 128
1646 
1647 /** mlan_ver_ext data structure for MLAN_OID_GET_VER_EXT */
1648 typedef struct _mlan_ver_ext
1649 {
1650     /** Selected version string */
1651     t_u32 version_str_sel;
1652     /** Version string */
1653     char version_str[MLAN_MAX_VER_STR_LEN];
1654 } mlan_ver_ext, *pmlan_ver_ext;
1655 
1656 /** mlan_bss_info data structure for MLAN_OID_GET_BSS_INFO */
1657 typedef struct _mlan_bss_info
1658 {
1659     /** BSS mode */
1660     mlan_bss_mode bss_mode;
1661     /** SSID */
1662     mlan_802_11_ssid ssid;
1663     /** Table index */
1664     t_u32 scan_table_idx;
1665     /** Channel */
1666     t_u32 bss_chan;
1667     /** Band */
1668     t_u8 bss_band;
1669     /** Region code */
1670     t_u32 region_code;
1671     /** Connection status */
1672     t_u32 media_connected;
1673     /** Radio on */
1674     t_u32 radio_on;
1675     /** Max power level in dBm */
1676     t_u32 max_power_level;
1677     /** Min power level in dBm */
1678     t_u32 min_power_level;
1679     /** Adhoc state */
1680     t_u32 adhoc_state;
1681     /** NF of last beacon */
1682     t_s32 bcn_nf_last;
1683     /** wep status */
1684     t_u32 wep_status;
1685     /** Host Sleep configured flag */
1686     t_u32 is_hs_configured;
1687     /** Deep Sleep flag */
1688     t_u32 is_deep_sleep;
1689     /** BSSID */
1690     mlan_802_11_mac_addr bssid;
1691 #ifdef STA_SUPPORT
1692     /** Capability Info */
1693     t_u16 capability_info;
1694     /** Beacon Interval */
1695     t_u16 beacon_interval;
1696     /** Listen Interval */
1697     t_u16 listen_interval;
1698     /** Association Id  */
1699     t_u16 assoc_id;
1700     /** AP/Peer supported rates */
1701     t_u8 peer_supp_rates[MLAN_SUPPORTED_RATES];
1702 #endif /* STA_SUPPORT */
1703 } mlan_bss_info, *pmlan_bss_info;
1704 
1705 /** MAXIMUM number of TID */
1706 #define MAX_NUM_TID 8U
1707 
1708 /** Max RX Win size */
1709 #define MAX_RX_WINSIZE 64
1710 
1711 /** rx_reorder_tbl */
1712 typedef struct
1713 {
1714     /** TID */
1715     t_u16 tid;
1716     /** TA */
1717     t_u8 ta[MLAN_MAC_ADDR_LENGTH];
1718     /** Start window */
1719     t_u32 start_win;
1720     /** Window size */
1721     t_u32 win_size;
1722     /** amsdu flag */
1723     t_u8 amsdu;
1724     /** buffer status */
1725     t_u32 buffer[MAX_RX_WINSIZE];
1726 } rx_reorder_tbl;
1727 
1728 /** tx_ba_stream_tbl */
1729 typedef struct
1730 {
1731     /** TID */
1732     t_u16 tid;
1733     /** RA */
1734     t_u8 ra[MLAN_MAC_ADDR_LENGTH];
1735     /** amsdu flag */
1736     t_u8 amsdu;
1737 } tx_ba_stream_tbl;
1738 
1739 /** Debug command number */
1740 #define DBG_CMD_NUM 5
1741 
1742 /** mlan_debug_info data structure for MLAN_OID_GET_DEBUG_INFO */
1743 typedef struct _mlan_debug_info
1744 {
1745     /* WMM AC_BK count */
1746     t_u32 wmm_ac_bk;
1747     /* WMM AC_BE count */
1748     t_u32 wmm_ac_be;
1749     /* WMM AC_VI count */
1750     t_u32 wmm_ac_vi;
1751     /* WMM AC_VO count */
1752     t_u32 wmm_ac_vo;
1753     /** Corresponds to max_tx_buf_size member of mlan_adapter*/
1754     t_u32 max_tx_buf_size;
1755     /** Corresponds to tx_buf_size member of mlan_adapter*/
1756     t_u32 tx_buf_size;
1757     /** Corresponds to curr_tx_buf_size member of mlan_adapter*/
1758     t_u32 curr_tx_buf_size;
1759     /** Tx table num */
1760     t_u32 tx_tbl_num;
1761     /** Tx ba stream table */
1762     tx_ba_stream_tbl tx_tbl[MLAN_MAX_TX_BASTREAM_SUPPORTED];
1763     /** Rx table num */
1764     t_u32 rx_tbl_num;
1765     /** Rx reorder table*/
1766     rx_reorder_tbl rx_tbl[MLAN_MAX_RX_BASTREAM_SUPPORTED];
1767     /** Corresponds to ps_mode member of mlan_adapter */
1768     t_u16 ps_mode;
1769     /** Corresponds to ps_state member of mlan_adapter */
1770     t_u32 ps_state;
1771 #ifdef STA_SUPPORT
1772     /** Corresponds to is_deep_sleep member of mlan_adapter */
1773     t_u8 is_deep_sleep;
1774 #endif /** STA_SUPPORT */
1775     /** Corresponds to pm_wakeup_card_req member of mlan_adapter */
1776     t_u8 pm_wakeup_card_req;
1777     /** Corresponds to pm_wakeup_fw_try member of mlan_adapter */
1778     t_u32 pm_wakeup_fw_try;
1779     /** Corresponds to is_hs_configured member of mlan_adapter */
1780     t_u8 is_hs_configured;
1781     /** Corresponds to hs_activated member of mlan_adapter */
1782     t_u8 hs_activated;
1783     /** Corresponds to pps_uapsd_mode member of mlan_adapter */
1784     t_u16 pps_uapsd_mode;
1785     /** Corresponds to sleep_period.period member of mlan_adapter */
1786     t_u16 sleep_pd;
1787     /** Corresponds to wmm_qosinfo member of mlan_private */
1788     t_u8 qos_cfg;
1789     /** Corresponds to tx_lock_flag member of mlan_adapter */
1790     t_u8 tx_lock_flag;
1791     /** Corresponds to port_open member of mlan_private */
1792     t_u8 port_open;
1793     /** Corresponds to scan_processing member of mlan_adapter */
1794     t_u32 scan_processing;
1795     /** Number of host to card command failures */
1796     t_u32 num_cmd_host_to_card_failure;
1797     /** Number of host to card sleep confirm failures */
1798     t_u32 num_cmd_sleep_cfm_host_to_card_failure;
1799     /** Number of host to card Tx failures */
1800     t_u32 num_tx_host_to_card_failure;
1801     /** Number of card to host command/event failures */
1802     t_u32 num_cmdevt_card_to_host_failure;
1803     /** Number of card to host Rx failures */
1804     t_u32 num_rx_card_to_host_failure;
1805     /** Number of interrupt read failures */
1806     t_u32 num_int_read_failure;
1807     /** Last interrupt status */
1808     t_u32 last_int_status;
1809     /** Number of deauthentication events */
1810     t_u32 num_event_deauth;
1811     /** Number of disassosiation events */
1812     t_u32 num_event_disassoc;
1813     /** Number of link lost events */
1814     t_u32 num_event_link_lost;
1815     /** Number of deauthentication commands */
1816     t_u32 num_cmd_deauth;
1817     /** Number of association comamnd successes */
1818     t_u32 num_cmd_assoc_success;
1819     /** Number of association command failures */
1820     t_u32 num_cmd_assoc_failure;
1821     /** Number of Tx timeouts */
1822     t_u32 num_tx_timeout;
1823     /** Number of command timeouts */
1824     t_u32 num_cmd_timeout;
1825     /** Timeout command ID */
1826     t_u16 timeout_cmd_id;
1827     /** Timeout command action */
1828     t_u16 timeout_cmd_act;
1829     /** List of last command IDs */
1830     t_u16 last_cmd_id[DBG_CMD_NUM];
1831     /** List of last command actions */
1832     t_u16 last_cmd_act[DBG_CMD_NUM];
1833     /** Last command index */
1834     t_u16 last_cmd_index;
1835     /** List of last command response IDs */
1836     t_u16 last_cmd_resp_id[DBG_CMD_NUM];
1837     /** Last command response index */
1838     t_u16 last_cmd_resp_index;
1839     /** List of last events */
1840     t_u16 last_event[DBG_CMD_NUM];
1841     /** Last event index */
1842     t_u16 last_event_index;
1843 
1844     /** Corresponds to data_sent member of mlan_adapter */
1845     t_u8 data_sent;
1846     /** Corresponds to cmd_sent member of mlan_adapter */
1847     t_u8 cmd_sent;
1848     /** SDIO multiple port read bitmap */
1849     t_u32 mp_rd_bitmap;
1850     /** SDIO multiple port write bitmap */
1851     t_u32 mp_wr_bitmap;
1852     /** Current available port for read */
1853     t_u8 curr_rd_port;
1854     /** Current available port for write */
1855     t_u8 curr_wr_port;
1856     /** Corresponds to cmdresp_received member of mlan_adapter */
1857     t_u8 cmd_resp_received;
1858     /** Corresponds to event_received member of mlan_adapter */
1859     t_u8 event_received;
1860     /**  pendig tx pkts */
1861     t_u32 tx_pkts_queued;
1862 #ifdef UAP_SUPPORT
1863     /**  pending bridge pkts */
1864     t_u16 num_bridge_pkts;
1865     /**  dropped pkts */
1866     t_u32 num_drop_pkts;
1867 #endif
1868 } mlan_debug_info, *pmlan_debug_info;
1869 
1870 #ifdef UAP_SUPPORT
1871 /** Maximum number of clients supported by AP */
1872 #define MAX_NUM_CLIENTS 16U
1873 
1874 /** station info */
1875 typedef struct _sta_info
1876 {
1877     /** STA MAC address */
1878     t_u8 mac_address[MLAN_MAC_ADDR_LENGTH];
1879     /** Power mfg status */
1880     t_u8 power_mfg_status;
1881     /** RSSI */
1882     t_s8 rssi;
1883 } sta_info;
1884 
1885 /** mlan_ds_sta_list structure for MLAN_OID_UAP_STA_LIST */
1886 typedef struct _mlan_ds_sta_list
1887 {
1888     /** station count */
1889     t_u16 sta_count;
1890     /** station list */
1891     sta_info info[MAX_NUM_CLIENTS];
1892 } mlan_ds_sta_list, *pmlan_ds_sta_list;
1893 #endif
1894 
1895 /** Type definition of mlan_ds_get_info for MLAN_IOCTL_GET_INFO */
1896 typedef struct _mlan_ds_get_info
1897 {
1898     /** Sub-command */
1899     t_u32 sub_command;
1900 
1901     /** Status information parameter */
1902     union
1903     {
1904         /** Signal information for MLAN_OID_GET_SIGNAL */
1905         mlan_ds_get_signal signal;
1906         /** Statistics information for MLAN_OID_GET_STATS */
1907         mlan_ds_get_stats stats;
1908         /** Firmware information for MLAN_OID_GET_FW_INFO */
1909         mlan_fw_info fw_info;
1910         /** Extended version information for MLAN_OID_GET_VER_EXT */
1911         mlan_ver_ext ver_ext;
1912         /** BSS information for MLAN_OID_GET_BSS_INFO */
1913         mlan_bss_info bss_info;
1914         /** Debug information for MLAN_OID_GET_DEBUG_INFO */
1915         mlan_debug_info debug_info;
1916 #ifdef UAP_SUPPORT
1917         /** UAP Statistics information for MLAN_OID_GET_STATS */
1918         mlan_ds_uap_stats ustats;
1919         /** UAP station list for MLAN_OID_UAP_STA_LIST */
1920         mlan_ds_sta_list sta_list;
1921 #endif
1922     } param;
1923 } mlan_ds_get_info, *pmlan_ds_get_info;
1924 
1925 /*-----------------------------------------------------------------*/
1926 /** Security Configuration Group */
1927 /*-----------------------------------------------------------------*/
1928 /** Enumeration for authentication mode */
1929 typedef enum _mlan_auth_mode
1930 {
1931     MLAN_AUTH_MODE_OPEN   = 0x00,
1932     MLAN_AUTH_MODE_SHARED = 0x01,
1933     MLAN_AUTH_MODE_FT     = 0x02,
1934     MLAN_AUTH_MODE_SAE    = 0x03,
1935 #if CONFIG_DRIVER_OWE
1936     MLAN_AUTH_MODE_OWE = 0x04,
1937 #endif
1938     MLAN_AUTH_MODE_NETWORKEAP = 0x80,
1939     MLAN_AUTH_MODE_AUTO       = 0xFF,
1940 } mlan_auth_mode;
1941 
1942 /**Enumeration for AssocAgent authentication mode, sync from FW.*/
1943 typedef enum
1944 {
1945     AssocAgentAuth_Open,
1946     AssocAgentAuth_Shared,
1947     AssocAgentAuth_FastBss,
1948     AssocAgentAuth_FastBss_Skip,
1949     AssocAgentAuth_FastBss_SAE,
1950     AssocAgentAuth_Wpa3Sae = 6,
1951 #if CONFIG_DRIVER_OWE
1952     AssocAgentAuth_Owe = 7,
1953 #endif
1954     AssocAgentAuth_Auto,
1955 } AssocAgentAuthType_e;
1956 
1957 /** Enumeration for encryption mode */
1958 typedef enum _mlan_encryption_mode
1959 {
1960     MLAN_ENCRYPTION_MODE_NONE   = 0,
1961     MLAN_ENCRYPTION_MODE_WEP40  = 1,
1962     MLAN_ENCRYPTION_MODE_TKIP   = 2,
1963     MLAN_ENCRYPTION_MODE_CCMP   = 3,
1964     MLAN_ENCRYPTION_MODE_WEP104 = 4,
1965 } mlan_encryption_mode;
1966 
1967 /** Enumeration for PSK */
1968 typedef enum _mlan_psk_type
1969 {
1970     MLAN_PSK_PASSPHRASE = 1,
1971     MLAN_PSK_PMK,
1972     MLAN_PSK_CLEAR,
1973     MLAN_PSK_QUERY,
1974     MLAN_PSK_PASSWORD,
1975 } mlan_psk_type;
1976 
1977 /** The bit to indicate the key is for unicast */
1978 #define MLAN_KEY_INDEX_UNICAST 0x40000000
1979 /** The key index to indicate default key */
1980 #define MLAN_KEY_INDEX_DEFAULT 0x000000ffU
1981 /** Maximum key length */
1982 // #define MLAN_MAX_KEY_LENGTH        32
1983 /** Minimum passphrase length */
1984 #define MLAN_MIN_PASSPHRASE_LENGTH 8U
1985 /** Maximum passphrase length */
1986 /** FIXME: This macro is used for both passphrase and PSK length
1987  * As per standards maximum passphrase length is 63 and
1988  * maximum PSK length is 64.
1989  *
1990  * For now setting it to 64 to avoid 4 way Handshake timeout issue
1991  * if connection attempt is with PSK.
1992  */
1993 #define MLAN_MAX_PASSPHRASE_LENGTH 64U
1994 /** PMK length */
1995 #define MLAN_PMK_HEXSTR_LENGTH 64
1996 /* A few details needed for WEP (Wireless Equivalent Privacy) */
1997 /** Minimum password length */
1998 #define MLAN_MIN_PASSWORD_LENGTH 1U
1999 /** Maximum passphrase length */
2000 #define MLAN_MAX_PASSWORD_LENGTH 255U
2001 /** 104 bits */
2002 #define MAX_WEP_KEY_SIZE 13U
2003 /** 40 bits RC4 - WEP */
2004 #define MIN_WEP_KEY_SIZE 5
2005 /** packet number size */
2006 #define PN_SIZE 16
2007 /** max seq size of wpa/wpa2 key */
2008 #define SEQ_MAX_SIZE 8
2009 
2010 /** key flag for tx_seq */
2011 #define KEY_FLAG_TX_SEQ_VALID 0x00000001
2012 /** key flag for rx_seq */
2013 #define KEY_FLAG_RX_SEQ_VALID 0x00000002
2014 /** key flag for group key */
2015 #define KEY_FLAG_GROUP_KEY 0x00000004U
2016 /** key flag for tx and rx */
2017 #define KEY_FLAG_SET_TX_KEY 0x00000008U
2018 /** key flag for mcast IGTK */
2019 #define KEY_FLAG_AES_MCAST_IGTK 0x00000010U
2020 #ifdef MAC80211_SUPPORT_MESH
2021 /** key flag for mesh group Rx key */
2022 #define KEY_FLAG_SET_GRP_TX_KEY 0x00000100
2023 #endif
2024 /** key flag for remove key */
2025 #define KEY_FLAG_REMOVE_KEY 0x80000000
2026 /** key flag for GCMP */
2027 #define KEY_FLAG_GCMP 0x00000020
2028 /** key flag for GCMP_256 */
2029 #define KEY_FLAG_GCMP_256 0x00000040
2030 /** key flag for ccmp 256 */
2031 #define KEY_FLAG_CCMP_256 0x00000080
2032 /** key flag for GMAC_128 */
2033 #define KEY_FLAG_GMAC_128 0x00000100
2034 /** key flag for GMAC_256 */
2035 #define KEY_FLAG_GMAC_256 0x00000200
2036 
2037 /* Clear all key indexes */
2038 #define KEY_INDEX_CLEAR_ALL 0x0000000F
2039 
2040 /** Type definition of mlan_ds_encrypt_key for MLAN_OID_SEC_CFG_ENCRYPT_KEY */
2041 typedef struct _mlan_ds_encrypt_key
2042 {
2043     /** Key disabled, all other fields will be ignore when this flag set to MTRUE */
2044     t_u32 key_disable;
2045     /** key removed flag, when this flag is set to MTRUE, only key_index will be check */
2046     t_u32 key_remove;
2047     /** Key index, used as current tx key index when is_current_wep_key is set to MTRUE */
2048     t_u32 key_index;
2049     /** Current Tx key flag */
2050     bool is_current_wep_key;
2051     /** Key length */
2052     t_u32 key_len;
2053     /** Key */
2054     t_u8 key_material[MLAN_MAX_KEY_LENGTH];
2055     /** mac address */
2056     t_u8 mac_addr[MLAN_MAC_ADDR_LENGTH];
2057     /** wapi key flag */
2058     t_u32 is_wapi_key;
2059     /** Initial packet number */
2060     t_u8 pn[PN_SIZE];
2061     /** key flags */
2062     t_u32 key_flags;
2063 } mlan_ds_encrypt_key, *pmlan_ds_encrypt_key;
2064 
2065 /** Type definition of mlan_passphrase_t */
2066 typedef struct _mlan_passphrase_t
2067 {
2068     /** Length of passphrase */
2069     t_u32 passphrase_len;
2070     /** Passphrase */
2071     t_u8 passphrase[MLAN_MAX_PASSPHRASE_LENGTH];
2072 } mlan_passphrase_t;
2073 
2074 /** Type defnition of mlan_pmk_t */
2075 typedef struct _mlan_pmk_t
2076 {
2077     /** PMK */
2078     t_u8 pmk[MLAN_MAX_KEY_LENGTH];
2079 } mlan_pmk_t;
2080 
2081 /** Type definition of mlan_passphrase_t */
2082 typedef struct _mlan_password_t
2083 {
2084     /** Length of passphrase */
2085     t_u32 password_len;
2086     /** Passphrase */
2087     t_u8 password[MLAN_MAX_PASSWORD_LENGTH];
2088 } mlan_password_t;
2089 
2090 /** Embedded supplicant RSN type: No RSN */
2091 #define RSN_TYPE_NO_RSN MBIT(0)
2092 /** Embedded supplicant RSN type: WPA */
2093 #define RSN_TYPE_WPA MBIT(3)
2094 /** Embedded supplicant RSN type: WPA-NONE */
2095 #define RSN_TYPE_WPANONE MBIT(4)
2096 /** Embedded supplicant RSN type: WPA2 */
2097 #define RSN_TYPE_WPA2 MBIT(5)
2098 /** Embedded supplicant RSN type: RFU */
2099 #define RSN_TYPE_VALID_BITS (RSN_TYPE_NO_RSN | RSN_TYPE_WPA | RSN_TYPE_WPANONE | RSN_TYPE_WPA2)
2100 
2101 /** Embedded supplicant cipher type: TKIP */
2102 #define EMBED_CIPHER_TKIP MBIT(2)
2103 /** Embedded supplicant cipher type: AES */
2104 #define EMBED_CIPHER_AES MBIT(3)
2105 /** Embedded supplicant cipher type: RFU */
2106 #define EMBED_CIPHER_VALID_BITS (EMBED_CIPHER_TKIP | EMBED_CIPHER_AES)
2107 
2108 /** Type definition of mlan_ds_passphrase for MLAN_OID_SEC_CFG_PASSPHRASE */
2109 typedef struct _mlan_ds_passphrase
2110 {
2111     /** SSID may be used */
2112     mlan_802_11_ssid ssid;
2113     /** BSSID may be used */
2114     mlan_802_11_mac_addr bssid;
2115     /** Flag for passphrase or pmk used */
2116     mlan_psk_type psk_type;
2117     /** Passphrase or PMK */
2118     union
2119     {
2120         /** Passphrase */
2121         mlan_passphrase_t passphrase;
2122         /** PMK */
2123         mlan_pmk_t pmk;
2124     } psk;
2125     /** Password */
2126     mlan_password_t password;
2127 } mlan_ds_passphrase, *pmlan_ds_passphrase;
2128 
2129 /** Type definition of mlan_ds_esupp_mode for MLAN_OID_SEC_CFG_ESUPP_MODE */
2130 typedef struct _mlan_ds_ewpa_mode
2131 {
2132     /** RSN mode */
2133     t_u32 rsn_mode;
2134     /** Active pairwise cipher */
2135     t_u32 act_paircipher;
2136     /** Active pairwise cipher */
2137     t_u32 act_groupcipher;
2138 } mlan_ds_esupp_mode, *pmlan_ds_esupp_mode;
2139 
2140 /** Type definition of mlan_ds_sec_cfg for MLAN_IOCTL_SEC_CFG */
2141 typedef struct _mlan_ds_sec_cfg
2142 {
2143     /** Sub-command */
2144     t_u32 sub_command;
2145     /** Security configuration parameter */
2146     union
2147     {
2148         /** Authentication mode for MLAN_OID_SEC_CFG_AUTH_MODE */
2149         t_u32 auth_mode;
2150         /** Encryption mode for MLAN_OID_SEC_CFG_ENCRYPT_MODE */
2151         t_u32 encrypt_mode;
2152         /** WPA enabled flag for MLAN_OID_SEC_CFG_WPA_ENABLED */
2153         t_u32 wpa_enabled;
2154         /** WAPI enabled flag for MLAN_OID_SEC_CFG_WAPI_ENABLED */
2155         t_u32 wapi_enabled;
2156         /** Port Control enabled flag for MLAN_OID_SEC_CFG_PORT_CTRL */
2157         t_u32 port_ctrl_enabled;
2158         /** Encryption key for MLAN_OID_SEC_CFG_ENCRYPT_KEY */
2159         mlan_ds_encrypt_key encrypt_key;
2160         /** Passphrase for MLAN_OID_SEC_CFG_PASSPHRASE */
2161         mlan_ds_passphrase passphrase;
2162         /** Embedded supplicant WPA enabled flag for MLAN_OID_SEC_CFG_EWPA_ENABLED */
2163         t_u32 ewpa_enabled;
2164         /** Embedded supplicant mode for MLAN_OID_SEC_CFG_ESUPP_MODE */
2165         mlan_ds_esupp_mode esupp_mode;
2166 #ifdef HOST_AUTHENTICATOR
2167 #ifdef UAP_SUPPORT
2168         t_u8 sta_mac[MLAN_MAC_ADDR_LENGTH];
2169 #endif
2170 #endif
2171     } param;
2172 } mlan_ds_sec_cfg, *pmlan_ds_sec_cfg;
2173 
2174 /*-----------------------------------------------------------------*/
2175 /** Rate Configuration Group */
2176 /*-----------------------------------------------------------------*/
2177 /** Enumeration for rate type */
2178 enum _mlan_rate_type
2179 {
2180     MLAN_RATE_INDEX,
2181     MLAN_RATE_VALUE,
2182     MLAN_RATE_BITMAP
2183 };
2184 
2185 /** Enumeration for rate format */
2186 typedef enum _mlan_rate_format
2187 {
2188     MLAN_RATE_FORMAT_LG = 0,
2189     MLAN_RATE_FORMAT_HT,
2190 #if CONFIG_11AC
2191     MLAN_RATE_FORMAT_VHT,
2192 #endif
2193 #if CONFIG_11AX
2194     MLAN_RATE_FORMAT_HE,
2195 #endif
2196     MLAN_RATE_FORMAT_AUTO = 0xFF,
2197 } mlan_rate_format;
2198 
2199 #if CONFIG_11AX
2200 #define MAX_BITMAP_RATES_SIZE 26
2201 #else
2202 /** Max bitmap rates size */
2203 #define MAX_BITMAP_RATES_SIZE 18
2204 #endif
2205 
2206 /** Type definition of mlan_rate_cfg_t for MLAN_OID_RATE_CFG */
2207 typedef struct _mlan_rate_cfg_t
2208 {
2209     /** Fixed rate: 0, auto rate: 1 */
2210     bool is_rate_auto;
2211     /** Rate type. 0: index; 1: value; 2: bitmap */
2212     t_u32 rate_type;
2213     /** Rate/MCS index or rate value if fixed rate */
2214     t_u32 rate;
2215     /** Rate Bitmap */
2216     t_u16 bitmap_rates[MAX_BITMAP_RATES_SIZE];
2217 #if (CONFIG_11AC) || (CONFIG_11AX)
2218     /** NSS */
2219     t_u32 nss;
2220 #endif
2221     /* LG rate: 0, HT rate: 1, VHT rate: 2 */
2222     mlan_rate_format rate_format;
2223     /** Rate Setting */
2224     t_u16 rate_setting;
2225 } mlan_rate_cfg_t;
2226 
2227 /** HT channel bandwidth */
2228 typedef enum _mlan_ht_bw
2229 {
2230     MLAN_HT_BW20,
2231     MLAN_HT_BW40,
2232 #if CONFIG_11AC
2233     MLAN_VHT_BW80,
2234     MLAN_VHT_BW160,
2235 #endif
2236 } mlan_ht_bw;
2237 
2238 /** HT guard interval */
2239 typedef enum _mlan_ht_gi
2240 {
2241     MLAN_HT_LGI,
2242     MLAN_HT_SGI,
2243 } mlan_ht_gi;
2244 
2245 #if CONFIG_11AC
2246 typedef enum _mlan_vht_stbc
2247 {
2248     MLAN_VHT_STBC,
2249     MLAN_VHT_NO_STBC,
2250 } mlan_vht_stbc;
2251 
2252 typedef enum _mlan_vht_ldpc
2253 {
2254     MLAN_VHT_LDPC,
2255     MLAN_VHT_NO_LDPC,
2256 } mlan_vht_ldpc;
2257 #endif
2258 
2259 /** Band and BSS mode */
2260 typedef struct _mlan_band_data_rate
2261 {
2262     /** Band configuration */
2263     t_u16 config_bands;
2264     /** BSS mode (Infra or IBSS) */
2265     mlan_bss_mode bss_mode;
2266 } mlan_band_data_rate;
2267 
2268 /** Type definition of mlan_data_rate for MLAN_OID_GET_DATA_RATE */
2269 typedef struct _mlan_data_rate
2270 {
2271     /** Tx data rate */
2272     t_u32 tx_data_rate;
2273     /** Rx data rate */
2274     t_u32 rx_data_rate;
2275 
2276     /** Tx channel bandwidth */
2277     t_u32 tx_ht_bw;
2278     /** Tx guard interval */
2279     t_u32 tx_ht_gi;
2280     /** Rx channel bandwidth */
2281     t_u32 rx_ht_bw;
2282     /** Rx guard interval */
2283     t_u32 rx_ht_gi;
2284 
2285 #ifndef SD8801
2286     /** MCS index */
2287     t_u32 tx_mcs_index;
2288     t_u32 rx_mcs_index;
2289 
2290 #if (CONFIG_11AC) || (CONFIG_11AX)
2291     /** NSS */
2292     t_u32 tx_nss;
2293     t_u32 rx_nss;
2294 #endif
2295 
2296     /* LG rate: 0, HT rate: 1, VHT rate: 2 */
2297     mlan_rate_format tx_rate_format;
2298     mlan_rate_format rx_rate_format;
2299 #endif
2300 } mlan_data_rate;
2301 
2302 /** Type definition of mlan_ds_rate for MLAN_IOCTL_RATE */
2303 typedef struct _mlan_ds_rate
2304 {
2305     /** Sub-command */
2306     mlan_ioctl_req_id sub_command;
2307 #if CONFIG_AUTO_NULL_TX
2308     /** Only set auto tx fix rate */
2309     t_u16 auto_null_fixrate_enable;
2310 #endif
2311     /** Rate configuration parameter */
2312     union
2313     {
2314         /** Rate configuration for MLAN_OID_RATE_CFG */
2315         mlan_rate_cfg_t rate_cfg;
2316         /** Data rate for MLAN_OID_GET_DATA_RATE */
2317         mlan_data_rate data_rate;
2318         /** Supported rates for MLAN_OID_SUPPORTED_RATES */
2319         t_u8 rates[MLAN_SUPPORTED_RATES];
2320         /** Band/BSS mode for getting supported rates */
2321         mlan_band_data_rate rate_band_cfg;
2322     } param;
2323 } mlan_ds_rate, *pmlan_ds_rate;
2324 
2325 /*-----------------------------------------------------------------*/
2326 /** Power Configuration Group */
2327 /*-----------------------------------------------------------------*/
2328 
2329 /** Type definition of mlan_power_cfg_t for MLAN_OID_POWER_CFG */
2330 typedef struct _mlan_power_cfg_t
2331 {
2332     /** Is power auto */
2333     bool is_power_auto;
2334     /** Power level in dBm */
2335     t_u32 power_level;
2336 } mlan_power_cfg_t;
2337 
2338 /** max power table size */
2339 #define MAX_POWER_TABLE_SIZE 128
2340 
2341 /** The HT BW40 bit in Tx rate index */
2342 #define TX_RATE_HT_BW40_BIT MBIT(7)
2343 
2344 /** Type definition of mlan_power_cfg_ext for MLAN_OID_POWER_CFG_EXT */
2345 typedef struct _mlan_power_cfg_ext
2346 {
2347     /** Length of power_data */
2348     t_u32 len;
2349     /** Buffer of power configuration data */
2350     t_u32 power_data[MAX_POWER_TABLE_SIZE];
2351 } mlan_power_cfg_ext;
2352 
2353 /** Type definition of mlan_ds_power_cfg for MLAN_IOCTL_POWER_CFG */
2354 typedef struct _mlan_ds_power_cfg
2355 {
2356     /** Sub-command */
2357     mlan_ioctl_req_id sub_command;
2358     /** Power configuration parameter */
2359     union
2360     {
2361         /** Power configuration for MLAN_OID_POWER_CFG */
2362         mlan_power_cfg_t power_cfg;
2363         /** Extended power configuration for MLAN_OID_POWER_CFG_EXT */
2364         mlan_power_cfg_ext power_ext;
2365     } param;
2366 } mlan_ds_power_cfg, *pmlan_ds_power_cfg;
2367 
2368 /*-----------------------------------------------------------------*/
2369 /** Power Management Configuration Group */
2370 /*-----------------------------------------------------------------*/
2371 #if CONFIG_HOST_SLEEP
2372 /** Host sleep config conditions : Cancel */
2373 #define HOST_SLEEP_CFG_CANCEL 0xffffffffU
2374 /** Host sleep config conditions : NULL (used for offload features) */
2375 #define HOST_SLEEP_NO_COND 0
2376 
2377 /** Host sleep config condition: broadcast data */
2378 #define HOST_SLEEP_COND_BROADCAST_DATA MBIT(0)
2379 /** Host sleep config condition: unicast data */
2380 #define HOST_SLEEP_COND_UNICAST_DATA MBIT(1)
2381 /** Host sleep config condition: mac event */
2382 #define HOST_SLEEP_COND_MAC_EVENT MBIT(2)
2383 /** Host sleep config condition: multicast data */
2384 #define HOST_SLEEP_COND_MULTICAST_DATA MBIT(3)
2385 
2386 /** Host sleep config conditions: Default */
2387 #define HOST_SLEEP_DEF_COND (HOST_SLEEP_COND_BROADCAST_DATA | HOST_SLEEP_COND_UNICAST_DATA | HOST_SLEEP_COND_MAC_EVENT)
2388 /** Host sleep config GPIO : Default */
2389 #define HOST_SLEEP_DEF_GPIO 0xff
2390 /** Host sleep config gap : Default */
2391 #define HOST_SLEEP_DEF_GAP 200
2392 
2393 /** Type definition of mlan_ds_hs_cfg for MLAN_OID_PM_CFG_HS_CFG */
2394 typedef struct _mlan_ds_hs_cfg
2395 {
2396     /** MTRUE to invoke the HostCmd, MFALSE otherwise */
2397     t_u32 is_invoke_hostcmd;
2398     /** Host sleep config condition */
2399     /** Bit0: broadcast data
2400      *  Bit1: unicast data
2401      *  Bit2: mac event
2402      *  Bit3: multicast data
2403      */
2404     t_u32 conditions;
2405     /** GPIO pin or 0xff for interface */
2406     t_u32 gpio;
2407     /** Gap in milliseconds or or 0xff for special setting when GPIO is used to wakeup host */
2408     t_u32 gap;
2409 } mlan_ds_hs_cfg, *pmlan_ds_hs_cfg;
2410 #endif
2411 
2412 /** Enable deep sleep mode */
2413 #define DEEP_SLEEP_ON 1
2414 /** Disable deep sleep mode */
2415 #define DEEP_SLEEP_OFF 0
2416 
2417 /** Default idle time in milliseconds for auto deep sleep */
2418 #define DEEP_SLEEP_IDLE_TIME 100
2419 
2420 typedef struct _mlan_ds_auto_ds
2421 {
2422     /** auto ds mode, 0 - disable, 1 - enable */
2423     t_u16 auto_ds;
2424     /** auto ds idle time in milliseconds */
2425     t_u16 idletime;
2426 } mlan_ds_auto_ds;
2427 
2428 /** Type definition of mlan_ds_inactivity_to for MLAN_OID_PM_CFG_INACTIVITY_TO */
2429 typedef struct _mlan_ds_inactivity_to
2430 {
2431     /** Timeout unit in microsecond, 0 means 1000us (1ms) */
2432     t_u32 timeout_unit;
2433     /** Inactivity timeout for unicast data */
2434     t_u32 unicast_timeout;
2435     /** Inactivity timeout for multicast data */
2436     t_u32 mcast_timeout;
2437     /** Timeout for additional Rx traffic after Null PM1 packet exchange */
2438     t_u32 ps_entry_timeout;
2439 } mlan_ds_inactivity_to, *pmlan_ds_inactivity_to;
2440 
2441 /** Minimum sleep period in milliseconds */
2442 #define MIN_SLEEP_PERIOD 10
2443 /** Maximum sleep period in milliseconds */
2444 #define MAX_SLEEP_PERIOD 60
2445 /** Special setting for UPSD certification tests */
2446 #define SLEEP_PERIOD_RESERVED_FF 0xFF
2447 
2448 /** PS null interval disable */
2449 #define PS_NULL_DISABLE (-1)
2450 
2451 /** Local listen interval disable */
2452 #define MRVDRV_LISTEN_INTERVAL_DISABLE (-1)
2453 /** Minimum listen interval */
2454 #define MRVDRV_MIN_LISTEN_INTERVAL 0
2455 
2456 /** Minimum multiple DTIM */
2457 #define MRVDRV_MIN_MULTIPLE_DTIM 0
2458 /** Maximum multiple DTIM */
2459 #define MRVDRV_MAX_MULTIPLE_DTIM 5
2460 /** Ignore multiple DTIM */
2461 #define MRVDRV_IGNORE_MULTIPLE_DTIM 0xfffe
2462 /** Match listen interval to closest DTIM */
2463 #define MRVDRV_MATCH_CLOSEST_DTIM 0xfffd
2464 
2465 /** Minimum adhoc awake period */
2466 #define MIN_ADHOC_AWAKE_PD 0
2467 /** Maximum adhoc awake period */
2468 #define MAX_ADHOC_AWAKE_PD 31
2469 /** Special adhoc awake period */
2470 #define SPECIAL_ADHOC_AWAKE_PD 255
2471 
2472 /** Minimum beacon miss timeout in milliseconds */
2473 #define MIN_BCN_MISS_TO 0
2474 /** Maximum beacon miss timeout in milliseconds */
2475 #define MAX_BCN_MISS_TO 50
2476 /** Disable beacon miss timeout */
2477 #define DISABLE_BCN_MISS_TO 65535
2478 
2479 /** Minimum delay to PS in milliseconds */
2480 #define MIN_DELAY_TO_PS 0
2481 /** Maximum delay to PS in milliseconds */
2482 #define MAX_DELAY_TO_PS 65535
2483 /** Delay to PS unchanged */
2484 #define DELAY_TO_PS_UNCHANGED (-1)
2485 /** Default delay to PS in milliseconds */
2486 #define DELAY_TO_PS_DEFAULT 1000
2487 /** Delay for WNM retry request in milliseconds */
2488 #define DELAY_TO_PS_WNM 500
2489 
2490 /** PS mode: Unchanged */
2491 #define PS_MODE_UNCHANGED 0
2492 /** PS mode: Auto */
2493 #define PS_MODE_AUTO 1
2494 /** PS mode: Poll */
2495 #define PS_MODE_POLL 2
2496 /** PS mode: Null */
2497 #define PS_MODE_NULL 3
2498 
2499 /** Type definition of mlan_ds_ps_cfg for MLAN_OID_PM_CFG_PS_CFG */
2500 typedef struct _mlan_ds_ps_cfg
2501 {
2502     /** PS null interval in seconds */
2503     t_u32 ps_null_interval;
2504     /** Multiple DTIM interval */
2505     t_u32 multiple_dtim_interval;
2506     /** Listen interval */
2507     t_u32 listen_interval;
2508     /** Adhoc awake period */
2509     t_u32 adhoc_awake_period;
2510     /** Beacon miss timeout in milliseconds */
2511     t_u32 bcn_miss_timeout;
2512     /** Delay to PS in milliseconds */
2513     t_s32 delay_to_ps;
2514     /** PS mode */
2515     t_u32 ps_mode;
2516 } mlan_ds_ps_cfg, *pmlan_ds_ps_cfg;
2517 
2518 /** Type definition of mlan_ds_sleep_params for MLAN_OID_PM_CFG_SLEEP_PARAMS */
2519 typedef struct _mlan_ds_sleep_params
2520 {
2521     /** Error */
2522     t_u32 error;
2523     /** Offset in microseconds */
2524     t_u32 offset;
2525     /** Stable time in microseconds */
2526     t_u32 stable_time;
2527     /** Calibration control */
2528     t_u32 cal_control;
2529     /** External sleep clock */
2530     t_u32 ext_sleep_clk;
2531     /** Reserved */
2532     t_u32 reserved;
2533 } mlan_ds_sleep_params, *pmlan_ds_sleep_params;
2534 
2535 /** sleep_param */
2536 typedef struct _ps_sleep_param
2537 {
2538     /** control bitmap */
2539     t_u32 ctrl_bitmap;
2540     /** minimum sleep period (micro second) */
2541     t_u32 min_sleep;
2542     /** maximum sleep period (micro second) */
2543     t_u32 max_sleep;
2544 } ps_sleep_param;
2545 
2546 /** inactivity sleep_param */
2547 typedef struct _inact_sleep_param
2548 {
2549     /** inactivity timeout (micro second) */
2550     t_u32 inactivity_to;
2551     /** miniumu awake period (micro second) */
2552     t_u32 min_awake;
2553     /** maximum awake period (micro second) */
2554     t_u32 max_awake;
2555 } inact_sleep_param;
2556 
2557 /** flag for ps mode */
2558 #define PS_FLAG_PS_MODE 1U
2559 /** flag for sleep param */
2560 #define PS_FLAG_SLEEP_PARAM 2U
2561 /** flag for inactivity sleep param */
2562 #define PS_FLAG_INACT_SLEEP_PARAM 4U
2563 
2564 /** Disable power mode */
2565 #define PS_MODE_DISABLE 0
2566 /** Enable periodic dtim ps */
2567 #define PS_MODE_PERIODIC_DTIM 1
2568 /** Enable inactivity ps */
2569 #define PS_MODE_INACTIVITY 2
2570 
2571 /** mlan_ds_ps_mgmt */
2572 typedef struct _mlan_ds_ps_mgmt
2573 {
2574     /** flags for valid field */
2575     t_u16 flags;
2576     /** power mode */
2577     t_u16 ps_mode;
2578     /** sleep param */
2579     ps_sleep_param sleep_param;
2580     /** inactivity sleep param */
2581     inact_sleep_param inact_param;
2582 } mlan_ds_ps_mgmt;
2583 
2584 /** mlan_ds_ps_info */
2585 typedef struct _mlan_ds_ps_info
2586 {
2587     /** suspend allowed flag */
2588     t_u32 is_suspend_allowed;
2589 } mlan_ds_ps_info;
2590 
2591 /** Type definition of mlan_ds_wakeup_reason for MLAN_OID_PM_HS_WAKEUP_REASON */
2592 typedef struct _mlan_ds_hs_wakeup_reason
2593 {
2594     t_u16 hs_wakeup_reason;
2595 } mlan_ds_hs_wakeup_reason;
2596 
2597 /** Type definition of mlan_ds_pm_cfg for MLAN_IOCTL_PM_CFG */
2598 typedef struct _mlan_ds_pm_cfg
2599 {
2600     /** Sub-command */
2601     t_u32 sub_command;
2602     /** Power management parameter */
2603     union
2604     {
2605         /** Power saving mode for MLAN_OID_PM_CFG_IEEE_PS */
2606         t_u32 ps_mode;
2607 #if CONFIG_HOST_SLEEP
2608         /** Host Sleep configuration for MLAN_OID_PM_CFG_HS_CFG */
2609         mlan_ds_hs_cfg hs_cfg;
2610 #endif
2611         /** Deep sleep mode for MLAN_OID_PM_CFG_DEEP_SLEEP */
2612         mlan_ds_auto_ds auto_deep_sleep;
2613         /** Inactivity timeout for MLAN_OID_PM_CFG_INACTIVITY_TO */
2614         mlan_ds_inactivity_to inactivity_to;
2615         /** Sleep period for MLAN_OID_PM_CFG_SLEEP_PD */
2616         t_u32 sleep_period;
2617         /** PS configuration parameters for MLAN_OID_PM_CFG_PS_CFG */
2618         mlan_ds_ps_cfg ps_cfg;
2619         /** PS configuration parameters for MLAN_OID_PM_CFG_SLEEP_PARAMS */
2620         mlan_ds_sleep_params sleep_params;
2621         /** PS configuration parameters for MLAN_OID_PM_CFG_PS_MODE */
2622         mlan_ds_ps_mgmt ps_mgmt;
2623         /** power info for MLAN_OID_PM_INFO */
2624         mlan_ds_ps_info ps_info;
2625         /** hs wakeup reason for MLAN_OID_PM_HS_WAKEUP_REASON */
2626         mlan_ds_hs_wakeup_reason wakeup_reason;
2627     } param;
2628 } mlan_ds_pm_cfg, *pmlan_ds_pm_cfg;
2629 
2630 /*-----------------------------------------------------------------*/
2631 /** WMM Configuration Group */
2632 /*-----------------------------------------------------------------*/
2633 
2634 /** WMM TSpec size */
2635 #define MLAN_WMM_TSPEC_SIZE 63
2636 /** WMM Add TS extra IE bytes */
2637 #define MLAN_WMM_ADDTS_EXTRA_IE_BYTES 256
2638 /** WMM statistics for packets hist bins */
2639 #define MLAN_WMM_STATS_PKTS_HIST_BINS 7
2640 /** Maximum number of AC QOS queues available */
2641 #define MLAN_WMM_MAX_AC_QUEUES 4
2642 
2643 /**
2644  *  @brief IOCTL structure to send an ADDTS request and retrieve the response.
2645  *
2646  *  IOCTL structure from the application layer relayed to firmware to
2647  *    instigate an ADDTS management frame with an appropriate TSPEC IE as well
2648  *    as any additional IEs appended in the ADDTS Action frame.
2649  *
2650  *  @sa woal_wmm_addts_req_ioctl
2651  */
2652 typedef struct
2653 {
2654     mlan_cmd_result_e cmd_result;                  /**< Firmware execution result */
2655 
2656     t_u32 timeout_ms;                              /**< Timeout value in milliseconds */
2657     t_u8 ieee_status_code;                         /**< IEEE status code */
2658 
2659     t_u32 ie_data_len;                             /**< Length of ie block in ie_data */
2660     t_u8 ie_data[MLAN_WMM_TSPEC_SIZE               /**< TSPEC to send in the ADDTS */
2661                  + MLAN_WMM_ADDTS_EXTRA_IE_BYTES]; /**< Extra IE buf*/
2662 } wlan_ioctl_wmm_addts_req_t;
2663 
2664 /**
2665  *  @brief IOCTL structure to send a DELTS request.
2666  *
2667  *  IOCTL structure from the application layer relayed to firmware to
2668  *    instigate an DELTS management frame with an appropriate TSPEC IE.
2669  *
2670  *  @sa woal_wmm_delts_req_ioctl
2671  */
2672 typedef struct
2673 {
2674     mlan_cmd_result_e cmd_result;      /**< Firmware execution result */
2675     t_u8 ieee_reason_code;             /**< IEEE reason code sent, unused for WMM */
2676     t_u32 ie_data_len;                 /**< Length of ie block in ie_data */
2677     t_u8 ie_data[MLAN_WMM_TSPEC_SIZE]; /**< TSPEC to send in the DELTS */
2678 } wlan_ioctl_wmm_delts_req_t;
2679 
2680 /**
2681  *  @brief IOCTL structure to configure a specific AC Queue's parameters
2682  *
2683  *  IOCTL structure from the application layer relayed to firmware to
2684  *    get, set, or default the WMM AC queue parameters.
2685  *
2686  *  - msdu_lifetime_expiry is ignored if set to 0 on a set command
2687  *
2688  *  @sa woal_wmm_queue_config_ioctl
2689  */
2690 typedef struct
2691 {
2692     mlan_wmm_queue_config_action_e action; /**< Set, Get, or Default */
2693     mlan_wmm_ac_e access_category;         /**< WMM_AC_BK(0) to WMM_AC_VO(3) */
2694     t_u16 msdu_lifetime_expiry;            /**< lifetime expiry in TUs */
2695     t_u8 supported_rates[10];              /**< Not supported yet */
2696 } wlan_ioctl_wmm_queue_config_t;
2697 
2698 /**
2699  *  @brief IOCTL structure to start, stop, and get statistics for a WMM AC
2700  *
2701  *  IOCTL structure from the application layer relayed to firmware to
2702  *    start or stop statistical collection for a given AC.  Also used to
2703  *    retrieve and clear the collected stats on a given AC.
2704  *
2705  *  @sa woal_wmm_queue_stats_ioctl
2706  */
2707 typedef struct
2708 {
2709     /** Action of Queue Config : Start, Stop, or Get */
2710     mlan_wmm_queue_stats_action_e action;
2711     /** User Priority */
2712     t_u8 user_priority;
2713     /** Number of successful packets transmitted */
2714     t_u16 pkt_count;
2715     /** Packets lost; not included in pkt_count */
2716     t_u16 pkt_loss;
2717     /** Average Queue delay in microseconds */
2718     t_u32 avg_queue_delay;
2719     /** Average Transmission delay in microseconds */
2720     t_u32 avg_tx_delay;
2721     /** Calculated used time in units of 32 microseconds */
2722     t_u16 used_time;
2723     /** Calculated policed time in units of 32 microseconds */
2724     t_u16 policed_time;
2725     /** Queue Delay Histogram; number of packets per queue delay range
2726      *
2727      *  [0] -  0ms <= delay < 5ms
2728      *  [1] -  5ms <= delay < 10ms
2729      *  [2] - 10ms <= delay < 20ms
2730      *  [3] - 20ms <= delay < 30ms
2731      *  [4] - 30ms <= delay < 40ms
2732      *  [5] - 40ms <= delay < 50ms
2733      *  [6] - 50ms <= delay < msduLifetime (TUs)
2734      */
2735     t_u16 delay_histogram[MLAN_WMM_STATS_PKTS_HIST_BINS];
2736 } wlan_ioctl_wmm_queue_stats_t,
2737     /** Type definition of mlan_ds_wmm_queue_stats for MLAN_OID_WMM_CFG_QUEUE_STATS */
2738     mlan_ds_wmm_queue_stats, *pmlan_ds_wmm_queue_stats;
2739 
2740 /**
2741  *  @brief IOCTL sub structure for a specific WMM AC Status
2742  */
2743 typedef struct
2744 {
2745     /** WMM Acm */
2746     t_u8 wmm_acm;
2747     /** Flow required flag */
2748     t_u8 flow_required;
2749     /** Flow created flag */
2750     t_u8 flow_created;
2751     /** Disabled flag */
2752     t_u8 disabled;
2753 } wlan_ioctl_wmm_queue_status_ac_t;
2754 
2755 /**
2756  *  @brief IOCTL structure to retrieve the WMM AC Queue status
2757  *
2758  *  IOCTL structure from the application layer to retrieve:
2759  *     - ACM bit setting for the AC
2760  *     - Firmware status (flow required, flow created, flow disabled)
2761  *
2762  *  @sa woal_wmm_queue_status_ioctl
2763  */
2764 typedef struct
2765 {
2766     /** WMM AC queue status */
2767     wlan_ioctl_wmm_queue_status_ac_t ac_status[MLAN_WMM_MAX_AC_QUEUES];
2768 } wlan_ioctl_wmm_queue_status_t,
2769     /** Type definition of mlan_ds_wmm_queue_status for MLAN_OID_WMM_CFG_QUEUE_STATUS */
2770     mlan_ds_wmm_queue_status, *pmlan_ds_wmm_queue_status;
2771 
2772 /** Type definition of mlan_ds_wmm_addts for MLAN_OID_WMM_CFG_ADDTS */
2773 typedef struct _mlan_ds_wmm_addts
2774 {
2775     /** Result of ADDTS request */
2776     mlan_cmd_result_e result;
2777     /** Timeout value in milliseconds */
2778     t_u32 timeout;
2779     /** IEEE status code */
2780     t_u32 status_code;
2781     /** Dialog token */
2782     t_u8 dialog_tok;
2783     /** TSPEC data length */
2784     t_u8 ie_data_len;
2785     /** TSPEC to send in the ADDTS + buffering for any extra IEs */
2786     t_u8 ie_data[MLAN_WMM_TSPEC_SIZE + MLAN_WMM_ADDTS_EXTRA_IE_BYTES];
2787 } mlan_ds_wmm_addts, *pmlan_ds_wmm_addts;
2788 
2789 /** Type definition of mlan_ds_wmm_delts for MLAN_OID_WMM_CFG_DELTS */
2790 typedef struct _mlan_ds_wmm_delts
2791 {
2792     /** Result of DELTS request */
2793     mlan_cmd_result_e result;
2794     /** IEEE status code */
2795     t_u32 status_code;
2796     /** TSPEC data length */
2797     t_u8 ie_data_len;
2798     /** TSPEC to send in the DELTS */
2799     t_u8 ie_data[MLAN_WMM_TSPEC_SIZE];
2800 } mlan_ds_wmm_delts, *pmlan_ds_wmm_delts;
2801 
2802 /** Type definition of mlan_ds_wmm_queue_config for MLAN_OID_WMM_CFG_QUEUE_CONFIG */
2803 typedef struct _mlan_ds_wmm_queue_config
2804 {
2805     /** Action of Queue Config : Set, Get, or Default */
2806     mlan_wmm_queue_config_action_e action;
2807     /** WMM Access Category: WMM_AC_BK(0) to WMM_AC_VO(3) */
2808     mlan_wmm_ac_e access_category;
2809     /** Lifetime expiry in TUs */
2810     t_u16 msdu_lifetime_expiry;
2811     /** Reserve for future use */
2812     t_u8 reserved[10];
2813 } mlan_ds_wmm_queue_config, *pmlan_ds_wmm_queue_config;
2814 
2815 /** Type definition of mlan_ds_wmm_cfg for MLAN_IOCTL_WMM_CFG */
2816 typedef struct _mlan_ds_wmm_cfg
2817 {
2818     /** Sub-command */
2819     t_u32 sub_command;
2820     /** WMM configuration parameter */
2821     union
2822     {
2823         /** WMM enable for MLAN_OID_WMM_CFG_ENABLE */
2824         t_u32 wmm_enable;
2825         /** QoS configuration for MLAN_OID_WMM_CFG_QOS */
2826         t_u8 qos_cfg;
2827         /** WMM add TS for MLAN_OID_WMM_CFG_ADDTS */
2828         mlan_ds_wmm_addts addts;
2829         /** WMM delete TS for MLAN_OID_WMM_CFG_DELTS */
2830         mlan_ds_wmm_delts delts;
2831         /** WMM queue configuration for MLAN_OID_WMM_CFG_QUEUE_CONFIG */
2832         mlan_ds_wmm_queue_config q_cfg;
2833         /** AC Parameters Record WMM_AC_BE, WMM_AC_BK, WMM_AC_VI,
2834          * WMM_AC_VO */
2835         wmm_ac_parameters_t ac_params[MAX_AC_QUEUES];
2836         /** WMM queue status for MLAN_OID_WMM_CFG_QUEUE_STATS */
2837         mlan_ds_wmm_queue_stats q_stats;
2838         /** WMM queue status for MLAN_OID_WMM_CFG_QUEUE_STATUS */
2839         mlan_ds_wmm_queue_status q_status;
2840         /** WMM TS status for MLAN_OID_WMM_CFG_TS_STATUS */
2841         mlan_ds_wmm_ts_status ts_status;
2842     } param;
2843 } mlan_ds_wmm_cfg, *pmlan_ds_wmm_cfg;
2844 
2845 /*-----------------------------------------------------------------*/
2846 /** WPS Configuration Group */
2847 /*-----------------------------------------------------------------*/
2848 /** Enumeration for WPS session */
2849 enum _mlan_wps_status
2850 {
2851     MLAN_WPS_CFG_SESSION_START = 1,
2852     MLAN_WPS_CFG_SESSION_END   = 0
2853 };
2854 
2855 /** Type definition of mlan_ds_wps_cfg for MLAN_IOCTL_WPS_CFG */
2856 typedef struct _mlan_ds_wps_cfg
2857 {
2858     /** Sub-command */
2859     t_u32 sub_command;
2860     /** WPS configuration parameter */
2861     union
2862     {
2863         /** WPS session for MLAN_OID_WPS_CFG_SESSION */
2864         t_u32 wps_session;
2865     } param;
2866 } mlan_ds_wps_cfg, *pmlan_ds_wps_cfg;
2867 
2868 /*-----------------------------------------------------------------*/
2869 /** 802.11n Configuration Group */
2870 /*-----------------------------------------------------------------*/
2871 /** Maximum MCS */
2872 #define NUM_MCS_FIELD 16
2873 
2874 /* Both 2.4G and 5G band selected */
2875 #define BAND_SELECT_BOTH 0U
2876 /* Band 2.4G selected */
2877 #define BAND_SELECT_BG 1U
2878 /* Band 5G selected */
2879 #define BAND_SELECT_A 2U
2880 
2881 /** Type definition of mlan_ds_11n_htcap_cfg for MLAN_OID_11N_HTCAP_CFG */
2882 typedef struct _mlan_ds_11n_htcap_cfg
2883 {
2884     /** HT Capability information */
2885     t_u32 htcap;
2886     /** Band selection */
2887     t_u32 misc_cfg;
2888     /** Hardware HT cap information required */
2889     t_u32 hw_cap_req;
2890 } mlan_ds_11n_htcap_cfg, *pmlan_ds_11n_htcap_cfg;
2891 
2892 /** Type definition of mlan_ds_11n_addba_param for MLAN_OID_11N_CFG_ADDBA_PARAM */
2893 typedef struct _mlan_ds_11n_addba_param
2894 {
2895     /** Timeout */
2896     t_u32 timeout;
2897     /** Buffer size for ADDBA request */
2898     t_u32 txwinsize;
2899     /** Buffer size for ADDBA response */
2900     t_u32 rxwinsize;
2901     /** amsdu for ADDBA request */
2902     t_u8 txamsdu;
2903     /** amsdu for ADDBA response */
2904     t_u8 rxamsdu;
2905 } mlan_ds_11n_addba_param, *pmlan_ds_11n_addba_param;
2906 
2907 /** Type definition of mlan_ds_11n_tx_cfg for MLAN_OID_11N_CFG_TX */
2908 typedef struct _mlan_ds_11n_tx_cfg
2909 {
2910     /** HTTxCap */
2911     t_u16 httxcap;
2912     /** HTTxInfo */
2913     t_u16 httxinfo;
2914     /** Band selection */
2915     t_u32 misc_cfg;
2916 } mlan_ds_11n_tx_cfg, *pmlan_ds_11n_tx_cfg;
2917 
2918 /** Tx */
2919 #define MLAN_RADIO_TX MBIT(0)
2920 /** Rx */
2921 #define MLAN_RADIO_RX MBIT(1)
2922 /** Tx & Rx */
2923 #define MLAN_RADIO_TXRX (MLAN_RADIO_TX | MLAN_RADIO_RX)
2924 
2925 /** Type definition of mlan_ds_11ac_tx_cfg for MLAN_OID_11AC_CFG */
2926 typedef struct _mlan_ds_11ac_vht_cfg
2927 {
2928     /** Band selection (1: 2.4G, 2: 5 G, 3: both 2.4G and 5G) */
2929     t_u32 band;
2930     /** TxRx (1: Tx, 2: Rx, 3: both Tx and Rx) */
2931     t_u32 txrx;
2932     /** BW CFG (0: 11N CFG, 1: vhtcap) */
2933     t_u32 bwcfg;
2934     /** VHT capabilities. */
2935     t_u32 vht_cap_info;
2936     /** VHT Tx mcs */
2937     t_u32 vht_tx_mcs;
2938     /** VHT Rx mcs */
2939     t_u32 vht_rx_mcs;
2940     /** VHT rx max rate */
2941     t_u16 vht_rx_max_rate;
2942     /** VHT max tx rate */
2943     t_u16 vht_tx_max_rate;
2944     /** Skip usr 11ac mcs cfg */
2945     t_bool skip_usr_11ac_mcs_cfg;
2946 } mlan_ds_11ac_vht_cfg, *pmlan_ds_11ac_vht_cfg;
2947 
2948 #if CONFIG_11AX
2949 #define MAX_RU_COUNT    6
2950 #define MAX_RUTXPWR_NUM 140
2951 typedef MLAN_PACK_START struct _mlan_rupwrlimit_config_t
2952 {
2953     /** start freq */
2954     t_u16 start_freq;
2955     /* channel width */
2956     t_u8 width;
2957     /** channel number */
2958     t_u8 chan_num;
2959     /** chan ru Power */
2960     t_s8 ruPower[MAX_RU_COUNT];
2961 } MLAN_PACK_END mlan_rupwrlimit_config_t;
2962 
2963 typedef MLAN_PACK_START struct _mlan_11axcmdcfg_obss_pd_offset
2964 {
2965     /** <NON_SRG_OffSET, SRG_OFFSET> */
2966     t_u8 offset[2];
2967 } MLAN_PACK_END mlan_11axcmdcfg_obss_pd_offset;
2968 
2969 /** Type definition of mlan_11axcmdcfg_sr_control for MLAN_OID_11AX_CMD_CFG */
2970 typedef MLAN_PACK_START struct _mlan_11axcmdcfg_sr_control
2971 {
2972     /** 1 enable, 0 disable */
2973     t_u8 control;
2974 } MLAN_PACK_END mlan_11axcmdcfg_sr_control;
2975 
2976 /** Type definition of mlan_ds_11ax_he_capa for MLAN_OID_11AX_HE_CFG */
2977 typedef MLAN_PACK_START struct _mlan_ds_11ax_he_capa
2978 {
2979     /** tlv id of he capability */
2980     t_u16 id;
2981     /** length of the payload */
2982     t_u16 len;
2983     /** extension id */
2984     t_u8 ext_id;
2985     /** he mac capability info */
2986     t_u8 he_mac_cap[6];
2987     /** he phy capability info */
2988     t_u8 he_phy_cap[11];
2989     /** he txrx mcs support for 80MHz */
2990     t_u8 he_txrx_mcs_support[4];
2991     /** val for txrx mcs 160Mhz or 80+80, and PPE thresholds */
2992     t_u8 val[28];
2993 } MLAN_PACK_END mlan_ds_11ax_he_capa, *pmlan_ds_11ax_he_capa;
2994 
2995 /** Type definition of mlan_ds_11ax_he_cfg for MLAN_OID_11AX_HE_CFG */
2996 typedef struct _mlan_ds_11ax_he_cfg
2997 {
2998     /** band, BIT0:2.4G, BIT1:5G*/
2999     t_u8 band;
3000     /** mlan_ds_11ax_he_capa */
3001     mlan_ds_11ax_he_capa he_cap;
3002 } mlan_ds_11ax_he_cfg, *pmlan_ds_11ax_he_cfg;
3003 
3004 /** Type definition of mlan_ds_11ax_sr_cmd for MLAN_OID_11AX_CMD_CFG */
3005 typedef MLAN_PACK_START struct _mlan_ds_11ax_sr_cmd
3006 {
3007     /** type*/
3008     t_u16 type;
3009     /** length of TLV */
3010     t_u16 len;
3011     /** value */
3012     union
3013     {
3014         mlan_11axcmdcfg_obss_pd_offset obss_pd_offset;
3015         mlan_11axcmdcfg_sr_control sr_control;
3016     } param;
3017 } MLAN_PACK_END mlan_ds_11ax_sr_cmd, *pmlan_ds_11ax_sr_cmd;
3018 
3019 /** Type definition of mlan_ds_11ax_beam_cmd for MLAN_OID_11AX_CMD_CFG */
3020 typedef struct _mlan_ds_11ax_beam_cmd
3021 {
3022     /** command value: 1 is disable, 0 is enable*/
3023     t_u8 value;
3024 } mlan_ds_11ax_beam_cmd, *pmlan_ds_11ax_beam_cmd;
3025 
3026 /** Type definition of mlan_ds_11ax_htc_cmd for MLAN_OID_11AX_CMD_CFG */
3027 typedef struct _mlan_ds_11ax_htc_cmd
3028 {
3029     /** command value: 1 is enable, 0 is disable*/
3030     t_u8 value;
3031 } mlan_ds_11ax_htc_cmd, *pmlan_ds_11ax_htc_cmd;
3032 
3033 /** Type definition of mlan_ds_11ax_htc_cmd for MLAN_OID_11AX_CMD_CFG */
3034 typedef struct _mlan_ds_11ax_txop_cmd
3035 {
3036     /** Two byte rts threshold value of which only 10 bits, bit 0 to bit 9
3037      * are valid */
3038     t_u16 rts_thres;
3039 } mlan_ds_11ax_txop_cmd, *pmlan_ds_11ax_txop_cmd;
3040 
3041 /** Type definition of mlan_ds_11ax_htc_cmd for MLAN_OID_11AX_CMD_CFG */
3042 typedef MLAN_PACK_START struct _mlan_ds_11ax_txomi_cmd
3043 {
3044     /* 11ax spec 9.2.4.6a.2 OM Control 12 bits. Bit 0 to bit 11 */
3045     t_u16 omi;
3046     /* tx option
3047      * 0: send OMI in QoS NULL; 1: send OMI in QoS data;
3048      * 0xFF: OMI is transmitted in both QoS NULL and QoS data frame.
3049      */
3050     t_u8 tx_option;
3051     /* num_data_pkts is applied only if OMI is sent in QoS data frame.
3052      * It specifies the number of consecutive data frames containing the OMI.
3053      * Minimum number of data packets should be 1 and maximum should be 16.
3054      */
3055     t_u8 num_data_pkts;
3056 } MLAN_PACK_END mlan_ds_11ax_txomi_cmd, *pmlan_ds_11ax_txomi_cmd;
3057 
3058 /** Type definition of mlan_ds_11ax_toltime_cmd for MLAN_OID_11AX_CMD_CFG */
3059 typedef struct _mlan_ds_11ax_toltime_cmd
3060 {
3061     /* OBSS Narrow Bandwidth RU Tolerance Time */
3062     t_u32 tol_time;
3063 } mlan_ds_11ax_toltime_cmd, *pmlan_ds_11ax_toltime_cmd;
3064 
3065 /** Type definition of mlan_ds_11ax_chanlrupwrcft_cmd for MLAN_OID_11AX_CMD_CFG */
3066 typedef struct _mlan_ds_11ax_chanlrupwrcft_cmd
3067 {
3068     /** type*/
3069     t_u16 type;
3070     /** length of TLV */
3071     t_u16 len;
3072     /* Channel RU TX power limit Config */
3073     mlan_rupwrlimit_config_t rupwrlimit_config;
3074 } mlan_ds_11ax_chanlrupwrcft_cmd, *pmlan_ds_11ax_chanlrupwrcft_cmd;
3075 
3076 /** Type definition of mlan_ds_11ax_cmd_cfg for MLAN_OID_11AX_CMD_CFG */
3077 typedef struct _mlan_ds_11ax_cmd_cfg
3078 {
3079     /** Sub-command */
3080     t_u32 sub_command;
3081     /** Sub-id */
3082     t_u32 sub_id;
3083     /** 802.11n configuration parameter */
3084     union
3085     {
3086         /** SR configuration for MLAN_11AXCMD_SR_SUBID */
3087         mlan_ds_11ax_sr_cmd sr_cfg;
3088         /** Beam configuration for MLAN_11AXCMD_BEAM_SUBID */
3089         mlan_ds_11ax_beam_cmd beam_cfg;
3090         /** HTC configuration for MLAN_11AXCMD_HTC_SUBID */
3091         mlan_ds_11ax_htc_cmd htc_cfg;
3092         /** txop RTS configuration for MLAN_11AXCMD_TXOPRTS_SUBID */
3093         mlan_ds_11ax_txop_cmd txop_cfg;
3094         /** tx omi configuration for MLAN_11AXCMD_TXOMI_SUBID */
3095         mlan_ds_11ax_txomi_cmd txomi_cfg;
3096         /** OBSS tolerance time configuration for
3097          * MLAN_11AXCMD_TOLTIME_SUBID */
3098         mlan_ds_11ax_toltime_cmd toltime_cfg;
3099         /** Channel RU TX power limit Config for
3100          * MLAN_11AXCMD_RUPOWER_SUBID */
3101         mlan_ds_11ax_chanlrupwrcft_cmd rupwr_cfg;
3102     } param;
3103 } mlan_ds_11ax_cmd_cfg, *pmlan_ds_11ax_cmd_cfg;
3104 
3105 #if CONFIG_11AX_TWT
3106 /** Type definition of mlan_ds_twt_setup for MLAN_OID_11AX_TWT_CFG */
3107 typedef MLAN_PACK_START struct _mlan_ds_twt_setup
3108 {
3109     /** Implicit, 0: TWT session is explicit, 1: Session is implicit */
3110     t_u8 implicit;
3111     /** Announced, 0: Unannounced, 1: Announced TWT */
3112     t_u8 announced;
3113     /** Trigger Enabled, 0: Non-Trigger enabled, 1: Trigger enabled TWT */
3114     t_u8 trigger_enabled;
3115     /** TWT Information Disabled, 0: TWT info enabled, 1: TWT info disabled */
3116     t_u8 twt_info_disabled;
3117     /** Negotiation Type, 0: Future Individual TWT SP start time, 1: Next
3118      * Wake TBTT time */
3119     t_u8 negotiation_type;
3120     /** TWT Wakeup Duration, time after which the TWT requesting STA can
3121      * transition to doze state */
3122     t_u8 twt_wakeup_duration;
3123     /** Flow Identifier. Range: [0-7]*/
3124     t_u8 flow_identifier;
3125     /** Hard Constraint, 0: FW can tweak the TWT setup parameters if it is
3126      *rejected by AP.
3127      ** 1: Firmware should not tweak any parameters. */
3128     t_u8 hard_constraint;
3129     /** TWT Exponent, Range: [0-63] */
3130     t_u8 twt_exponent;
3131     /** TWT Mantissa Range: [0-sizeof(UINT16)] */
3132     t_u16 twt_mantissa;
3133     /** TWT Request Type, 0: REQUEST_TWT, 1: SUGGEST_TWT*/
3134     t_u8 twt_request;
3135     /** TWT Setup State. Set to 0 by driver, filled by FW in response*/
3136     t_u8 twt_setup_state;
3137     /** TWT link lost timeout threshold */
3138     t_u16 bcnMiss_threshold;
3139 } MLAN_PACK_END mlan_ds_twt_setup, *pmlan_ds_twt_setup;
3140 
3141 /** Type definition of mlan_ds_twt_teardown for MLAN_OID_11AX_TWT_CFG */
3142 typedef MLAN_PACK_START struct _mlan_ds_twt_teardown
3143 {
3144     /** TWT Flow Identifier. Range: [0-7] */
3145     t_u8 flow_identifier;
3146     /** Negotiation Type. 0: Future Individual TWT SP start time, 1: Next
3147      * Wake TBTT time */
3148     t_u8 negotiation_type;
3149     /** Tear down all TWT. 1: To teardown all TWT, 0 otherwise */
3150     t_u8 teardown_all_twt;
3151 } MLAN_PACK_END mlan_ds_twt_teardown, *pmlan_ds_twt_teardown;
3152 
3153 /** Type definition of mlan_ds_twt_report for MLAN_OID_11AX_TWT_CFG */
3154 typedef MLAN_PACK_START struct _mlan_ds_twt_report
3155 {
3156     /** TWT report type, 0: BTWT id */
3157     t_u8 type;
3158     /** TWT report length of value in data */
3159     t_u8 length;
3160     t_u8 reserve[2];
3161     /** TWT report payload for FW response to fill, 4 * 9bytes */
3162     t_u8 data[36];
3163 } MLAN_PACK_END mlan_ds_twt_report, *pmlan_ds_twt_report;
3164 
3165 /** Type definition of mlan_ds_twt_report for MLAN_OID_11AX_TWT_CFG */
3166 typedef MLAN_PACK_START struct _mlan_ds_twt_information
3167 {
3168     /** TWT Flow Identifier. Range: [0-7] */
3169     t_u8 flow_identifier;
3170     /** TWT operation suspend duration in milli seconds. */
3171     t_u32 suspend_duration;
3172     /** TWT information state from FW. */
3173     t_u8 information_state;
3174 } MLAN_PACK_END mlan_ds_twt_information, *pmlan_ds_twt_information;
3175 
3176 /** Type definition of mlan_ds_twtcfg for MLAN_OID_11AX_TWT_CFG */
3177 typedef MLAN_PACK_START struct _mlan_ds_twtcfg
3178 {
3179     /** Sub-command */
3180     t_u32 sub_command;
3181     /** Sub-id */
3182     t_u32 sub_id;
3183     /** TWT Setup/Teardown configuration parameter */
3184     union
3185     {
3186         /** TWT Setup config for Sub ID: MLAN_11AX_TWT_SETUP_SUBID */
3187         mlan_ds_twt_setup twt_setup;
3188         /** TWT Teardown config for Sub ID: MLAN_11AX_TWT_TEARDOWN_SUBID */
3189         mlan_ds_twt_teardown twt_teardown;
3190         /** TWT report for Sub ID: MLAN_11AX_TWT_REPORT_SUBID */
3191         mlan_ds_twt_report twt_report;
3192         /** TWT report for Sub ID: MLAN_11AX_TWT_INFORMATION_SUBID */
3193         mlan_ds_twt_information twt_information;
3194     } param;
3195 } MLAN_PACK_END mlan_ds_twtcfg, *pmlan_ds_twtcfg;
3196 #endif /* CONFIG_11AX_TWT */
3197 
3198 /** Type definition of mlan_ds_11as_cfg for MLAN_IOCTL_11AX_CFG */
3199 typedef struct _mlan_ds_11ax_cfg
3200 {
3201     /** Sub-command */
3202     t_u32 sub_command;
3203     /** 802.11n configuration parameter */
3204     union
3205     {
3206         /** HE configuration for MLAN_OID_11AX_HE_CFG */
3207         mlan_ds_11ax_he_cfg he_cfg;
3208     } param;
3209 } mlan_ds_11ax_cfg, *pmlan_ds_11ax_cfg;
3210 #endif
3211 
3212 #if CONFIG_WIFI_CLOCKSYNC
3213 /** Type definition of mlan_ds_gpio_tsf_latch */
3214 typedef MLAN_PACK_START struct _mlan_ds_gpio_tsf_latch
3215 {
3216     /**clock sync Mode */
3217     t_u8 clock_sync_mode;
3218     /**clock sync Role */
3219     t_u8 clock_sync_Role;
3220     /**clock sync GPIO Pin Number */
3221     t_u8 clock_sync_gpio_pin_number;
3222     /**clock sync GPIO Level or Toggle */
3223     t_u8 clock_sync_gpio_level_toggle;
3224     /**clock sync GPIO Pulse Width */
3225     t_u16 clock_sync_gpio_pulse_width;
3226 } MLAN_PACK_END mlan_ds_gpio_tsf_latch, *pmlan_ds_gpio_tsf_latch;
3227 
3228 /** Type definition of mlan_ds_tsf_info */
3229 typedef MLAN_PACK_START struct _mlan_ds_tsf_info
3230 {
3231     /**get tsf info format */
3232     t_u16 tsf_format;
3233     /**tsf info */
3234     t_u16 tsf_info;
3235     /**tsf */
3236     t_u64 tsf;
3237     /**Positive or negative offset in microsecond from Beacon TSF to GPIO toggle TSF  */
3238     t_s32 tsf_offset;
3239 } MLAN_PACK_END mlan_ds_tsf_info, *pmlan_ds_tsf_info;
3240 #endif /* CONFIG_WIFI_CLOCKSYNC */
3241 
3242 /** Type definition of mlan_ds_11n_amsdu_aggr_ctrl for
3243  * MLAN_OID_11N_AMSDU_AGGR_CTRL*/
3244 typedef struct _mlan_ds_11n_amsdu_aggr_ctrl
3245 {
3246     /** Enable/Disable */
3247     t_u16 enable;
3248     /** Current AMSDU size valid */
3249     t_u16 curr_buf_size;
3250 } mlan_ds_11n_amsdu_aggr_ctrl, *pmlan_ds_11n_amsdu_aggr_ctrl;
3251 
3252 /** Type definition of mlan_ds_11n_aggr_prio_tbl for MLAN_OID_11N_CFG_AGGR_PRIO_TBL */
3253 typedef struct _mlan_ds_11n_aggr_prio_tbl
3254 {
3255     /** ampdu priority table */
3256     t_u8 ampdu[MAX_NUM_TID];
3257     /** amsdu priority table */
3258     t_u8 amsdu[MAX_NUM_TID];
3259 } mlan_ds_11n_aggr_prio_tbl, *pmlan_ds_11n_aggr_prio_tbl;
3260 
3261 /** DelBA All TIDs */
3262 #define DELBA_ALL_TIDS 0xff
3263 /** DelBA Tx */
3264 #define DELBA_TX MBIT(0)
3265 /** DelBA Rx */
3266 #define DELBA_RX MBIT(1)
3267 
3268 /** Type definition of mlan_ds_11n_delba for MLAN_OID_11N_CFG_DELBA */
3269 typedef struct _mlan_ds_11n_delba
3270 {
3271     /** TID */
3272     t_u8 tid;
3273     /** Peer MAC address */
3274     t_u8 peer_mac_addr[MLAN_MAC_ADDR_LENGTH];
3275     /** Direction (Tx: bit 0, Rx: bit 1) */
3276     t_u8 direction;
3277 } mlan_ds_11n_delba, *pmlan_ds_11n_delba;
3278 
3279 /** Type definition of mlan_ds_11n_cfg for MLAN_IOCTL_11N_CFG */
3280 typedef struct _mlan_ds_11n_cfg
3281 {
3282     /** Sub-command */
3283     t_u32 sub_command;
3284     /** 802.11n configuration parameter */
3285     union
3286     {
3287         /** Tx param for 11n for MLAN_OID_11N_CFG_TX */
3288         mlan_ds_11n_tx_cfg tx_cfg;
3289         /** Aggr priority table for MLAN_OID_11N_CFG_AGGR_PRIO_TBL */
3290         mlan_ds_11n_aggr_prio_tbl aggr_prio_tbl;
3291         /** Add BA param for MLAN_OID_11N_CFG_ADDBA_PARAM */
3292         mlan_ds_11n_addba_param addba_param;
3293         /** Add BA Reject paramters for MLAN_OID_11N_CFG_ADDBA_REJECT */
3294         t_u8 addba_reject[MAX_NUM_TID];
3295         /** Tx buf size for MLAN_OID_11N_CFG_MAX_TX_BUF_SIZE */
3296         t_u32 tx_buf_size;
3297         /** HT cap info configuration for MLAN_OID_11N_HTCAP_CFG */
3298         mlan_ds_11n_htcap_cfg htcap_cfg;
3299         /** Tx param for 11n for MLAN_OID_11N_AMSDU_AGGR_CTRL */
3300         mlan_ds_11n_amsdu_aggr_ctrl amsdu_aggr_ctrl;
3301         /** Supported MCS Set field */
3302         t_u8 supported_mcs_set[NUM_MCS_FIELD];
3303         /** Transmit Beamforming Capabilities field */
3304         t_u32 tx_bf_cap;
3305         /** DelBA for MLAN_OID_11N_CFG_DELBA */
3306         mlan_ds_11n_delba del_ba;
3307     } param;
3308 } mlan_ds_11n_cfg, *pmlan_ds_11n_cfg;
3309 
3310 /** Country code length */
3311 #define COUNTRY_CODE_LEN 3U
3312 
3313 /*-----------------------------------------------------------------*/
3314 /** 802.11d Configuration Group */
3315 /*-----------------------------------------------------------------*/
3316 /** Maximum subbands for 11d */
3317 #if CONFIG_5GHz_SUPPORT
3318 #define MRVDRV_MAX_SUBBAND_802_11D 83U
3319 #else
3320 #define MRVDRV_MAX_SUBBAND_802_11D 14
3321 #endif /* CONFIG_5GHz_SUPPORT */
3322 
3323 #ifdef STA_SUPPORT
3324 /** Data structure for subband set */
3325 typedef struct _mlan_ds_subband_set_t
3326 {
3327     /** First channel */
3328     t_u8 first_chan;
3329     /** Number of channels */
3330     t_u8 no_of_chan;
3331     /** Maximum Tx power in dBm */
3332     t_u8 max_tx_pwr;
3333 } mlan_ds_subband_set_t;
3334 
3335 /** Domain regulatory information */
3336 typedef struct _mlan_ds_11d_domain_info
3337 {
3338     /** Country Code */
3339     t_u8 country_code[COUNTRY_CODE_LEN];
3340     /** Band that channels in sub_band belong to */
3341     t_u16 band;
3342     /** No. of subband in below */
3343     t_u8 no_of_sub_band;
3344     /** Subband data to send/last sent */
3345     mlan_ds_subband_set_t sub_band[MRVDRV_MAX_SUBBAND_802_11D];
3346 } mlan_ds_11d_domain_info;
3347 #endif
3348 
3349 /** Type definition of mlan_ds_11d_cfg for MLAN_IOCTL_11D_CFG */
3350 typedef struct _mlan_ds_11d_cfg
3351 {
3352     /** Sub-command */
3353     t_u32 sub_command;
3354     /** 802.11d configuration parameter */
3355     union
3356     {
3357 #ifdef STA_SUPPORT
3358         /** Enable for MLAN_OID_11D_CFG_ENABLE */
3359         t_u32 enable_11d;
3360         /** Domain info for MLAN_OID_11D_DOMAIN_INFO */
3361         mlan_ds_11d_domain_info domain_info;
3362 #endif /* STA_SUPPORT */
3363 #ifdef UAP_SUPPORT
3364         /** tlv data for MLAN_OID_11D_DOMAIN_INFO */
3365         t_u8 domain_tlv[MAX_IE_SIZE];
3366 #endif /* UAP_SUPPORT */
3367     } param;
3368 } mlan_ds_11d_cfg, *pmlan_ds_11d_cfg;
3369 
3370 /*-----------------------------------------------------------------*/
3371 /** Register Memory Access Group */
3372 /*-----------------------------------------------------------------*/
3373 /** Enumeration for register type */
3374 enum _mlan_reg_type
3375 {
3376     MLAN_REG_MAC = 1,
3377     MLAN_REG_BBP,
3378     MLAN_REG_RF,
3379     MLAN_REG_CAU = 5,
3380 };
3381 
3382 /** Type definition of mlan_ds_reg_rw for MLAN_OID_REG_RW */
3383 typedef struct _mlan_ds_reg_rw
3384 {
3385     /** Register type */
3386     t_u32 type;
3387     /** Offset */
3388     t_u32 offset;
3389     /** Value */
3390     t_u32 value;
3391 } mlan_ds_reg_rw;
3392 
3393 /** Maximum EEPROM data */
3394 /* wmsdk: The value of MAX_EEPROM_DATA has been changed from 256 to 1. This is
3395  * done as this structure is used to set only the offset and byte_count. The
3396  * command (iwpriv mlan rdeeprom <offset> <length>) being GET command, its value
3397  * parameter is always sent as 0 */
3398 #define MAX_EEPROM_DATA 1
3399 
3400 /** Type definition of mlan_ds_read_eeprom for MLAN_OID_EEPROM_RD */
3401 typedef struct _mlan_ds_read_eeprom
3402 {
3403     /** Multiples of 4 */
3404     t_u16 offset;
3405     /** Number of bytes */
3406     t_u16 byte_count;
3407     /** Value */
3408     t_u8 value[MAX_EEPROM_DATA];
3409 } mlan_ds_read_eeprom;
3410 
3411 /** Type definition of mlan_ds_mem_rw for MLAN_OID_MEM_RW */
3412 typedef struct _mlan_ds_mem_rw
3413 {
3414     /** Address */
3415     t_u32 addr;
3416     /** Value */
3417     t_u32 value;
3418 } mlan_ds_mem_rw;
3419 
3420 /** Type definition of mlan_ds_reg_mem for MLAN_IOCTL_REG_MEM */
3421 typedef struct _mlan_ds_reg_mem
3422 {
3423     /** Sub-command */
3424     t_u32 sub_command;
3425     /** Register memory access parameter */
3426     union
3427     {
3428         /** Register access for MLAN_OID_REG_RW */
3429         mlan_ds_reg_rw reg_rw;
3430         /** EEPROM access for MLAN_OID_EEPROM_RD */
3431         mlan_ds_read_eeprom rd_eeprom;
3432         /** Memory access for MLAN_OID_MEM_RW */
3433         mlan_ds_mem_rw mem_rw;
3434     } param;
3435 } mlan_ds_reg_mem, *pmlan_ds_reg_mem;
3436 
3437 /** Type definition of mlan_ds_auto_reconnect */
3438 typedef struct _mlan_ds_auto_reconnect
3439 {
3440     /** Reconnect Counter */
3441     t_u8 reconnect_counter;
3442     /** Reconnect Interval */
3443     t_u8 reconnect_interval;
3444     /** Flags */
3445     t_u16 flags;
3446 } mlan_ds_auto_reconnect;
3447 
3448 /** Type definition of mlan_ds_rx_mgmt_indication */
3449 typedef struct _mlan_ds_rx_mgmt_indication
3450 {
3451     /** Mgmt subtype mask for MLAN_OID_MISC_RX_MGMT_IND */
3452     t_u32 mgmt_subtype_mask;
3453 } mlan_ds_rx_mgmt_indication;
3454 
3455 /** Type definition of mlan_bridge_mode */
3456 typedef struct _mlan_bridge_mode
3457 {
3458     /** Value */
3459     t_u8 enable;
3460 } mlan_bridge_mode;
3461 
3462 /*-----------------------------------------------------------------*/
3463 /** Multi-Radio Configuration Group */
3464 /*-----------------------------------------------------------------*/
3465 
3466 /*-----------------------------------------------------------------*/
3467 /** 802.11h Configuration Group */
3468 /*-----------------------------------------------------------------*/
3469 #if defined(DFS_TESTING_SUPPORT)
3470 /** Type definition of mlan_ds_11h_dfs_testing for MLAN_OID_11H_DFS_TESTING */
3471 typedef struct _mlan_ds_11h_dfs_testing
3472 {
3473     /** User-configured CAC period in milliseconds, 0 to use default */
3474     t_u16 usr_cac_period_msec;
3475     /** User-configured NOP period in seconds, 0 to use default */
3476     t_u16 usr_nop_period_sec;
3477     /** User-configured skip channel change, 0 to disable */
3478     t_u8 usr_no_chan_change;
3479     /** User-configured fixed channel to change to, 0 to use random channel */
3480     t_u8 usr_fixed_new_chan;
3481 } mlan_ds_11h_dfs_testing, *pmlan_ds_11h_dfs_testing;
3482 #endif
3483 
3484 /** Type definition of mlan_ds_11h_cfg for MLAN_IOCTL_11H_CFG */
3485 typedef struct _mlan_ds_11h_cfg
3486 {
3487     /** Sub-command */
3488     t_u32 sub_command;
3489     union
3490     {
3491         /** Local power constraint for MLAN_OID_11H_LOCAL_POWER_CONSTRAINT */
3492         t_s8 usr_local_power_constraint;
3493 #if defined(DFS_TESTING_SUPPORT)
3494         /** User-configuation for MLAN_OID_11H_DFS_TESTING */
3495         mlan_ds_11h_dfs_testing dfs_testing;
3496 #endif
3497     } param;
3498 } mlan_ds_11h_cfg, *pmlan_ds_11h_cfg;
3499 
3500 /*-----------------------------------------------------------------*/
3501 /** Miscellaneous Configuration Group */
3502 /*-----------------------------------------------------------------*/
3503 
3504 /** CMD buffer size */
3505 #define MLAN_SIZE_OF_CMD_BUFFER 2048
3506 
3507 /** LDO Internal */
3508 #define LDO_INTERNAL 0
3509 /** LDO External */
3510 #define LDO_EXTERNAL 1
3511 
3512 /** Enumeration for IE type */
3513 enum _mlan_ie_type
3514 {
3515     MLAN_IE_TYPE_GEN_IE = 0,
3516 #ifdef STA_SUPPORT
3517     MLAN_IE_TYPE_ARP_FILTER,
3518 #endif /* STA_SUPPORT */
3519 };
3520 
3521 /** Type definition of mlan_ds_misc_gen_ie for MLAN_OID_MISC_GEN_IE */
3522 typedef struct _mlan_ds_misc_gen_ie
3523 {
3524     /** IE type */
3525     t_u32 type;
3526     /** IE length */
3527     t_u32 len;
3528     /** IE buffer */
3529     t_u8 ie_data[MAX_IE_SIZE];
3530 } mlan_ds_misc_gen_ie;
3531 
3532 #if defined(SDIO_MULTI_PORT_TX_AGGR) || defined(SDIO_MULTI_PORT_RX_AGGR)
3533 /** Type definition of mlan_ds_misc_sdio_mpa_ctrl for MLAN_OID_MISC_SDIO_MPA_CTRL */
3534 typedef struct _mlan_ds_misc_sdio_mpa_ctrl
3535 {
3536     /** SDIO MP-A TX enable/disable */
3537     t_u16 tx_enable;
3538     /** SDIO MP-A RX enable/disable */
3539     t_u16 rx_enable;
3540     /** SDIO MP-A TX buf size */
3541     t_u16 tx_buf_size;
3542     /** SDIO MP-A RX buf size */
3543     t_u16 rx_buf_size;
3544     /** SDIO MP-A TX Max Ports */
3545     t_u16 tx_max_ports;
3546     /** SDIO MP-A RX Max Ports */
3547     t_u16 rx_max_ports;
3548 } mlan_ds_misc_sdio_mpa_ctrl;
3549 #endif
3550 
3551 /** Type definition of mlan_ds_misc_cmd for MLAN_OID_MISC_HOST_CMD */
3552 typedef struct _mlan_ds_misc_cmd
3553 {
3554     /** Command length */
3555     t_u32 len;
3556     /** Command buffer */
3557     t_u8 cmd[MLAN_SIZE_OF_CMD_BUFFER];
3558 } mlan_ds_misc_cmd;
3559 
3560 /** Maximum number of system clocks */
3561 #define MLAN_MAX_CLK_NUM 16
3562 
3563 /** Clock type : Configurable */
3564 #define MLAN_CLK_CONFIGURABLE 0
3565 /** Clock type : Supported */
3566 #define MLAN_CLK_SUPPORTED 1
3567 
3568 /** Type definition of mlan_ds_misc_sys_clock for MLAN_OID_MISC_SYS_CLOCK */
3569 typedef struct _mlan_ds_misc_sys_clock
3570 {
3571     /** Current system clock */
3572     t_u16 cur_sys_clk;
3573     /** Clock type */
3574     t_u16 sys_clk_type;
3575     /** Number of clocks */
3576     t_u16 sys_clk_num;
3577     /** System clocks */
3578     t_u16 sys_clk[MLAN_MAX_CLK_NUM];
3579 } mlan_ds_misc_sys_clock;
3580 
3581 /** Enumeration for function init/shutdown */
3582 enum _mlan_func_cmd
3583 {
3584     MLAN_FUNC_INIT = 1,
3585     MLAN_FUNC_SHUTDOWN,
3586 };
3587 
3588 /** Type definition of mlan_ds_misc_tx_datapause for MLAN_OID_MISC_TX_DATAPAUSE */
3589 typedef struct _mlan_ds_misc_tx_datapause
3590 {
3591     /** Tx data pause flag */
3592     t_u16 tx_pause;
3593     /** Max number of Tx buffers for all PS clients */
3594     t_u16 tx_buf_cnt;
3595 } mlan_ds_misc_tx_datapause;
3596 
3597 /** IP address length */
3598 #define IPADDR_LEN (16)
3599 /** Max number of ip */
3600 #define MAX_IPADDR (4)
3601 /** IP address type - IPv4*/
3602 #define IPADDR_TYPE_IPV4 (1)
3603 /** IP operation remove */
3604 #define MLAN_IPADDR_OP_IP_REMOVE (0)
3605 /** IP operation ARP filter */
3606 #define MLAN_IPADDR_OP_ARP_FILTER MBIT(0)
3607 /** IP operation ARP response */
3608 #define MLAN_IPADDR_OP_AUTO_ARP_RESP MBIT(1)
3609 
3610 /** Type definition of mlan_ds_misc_ipaddr_cfg for MLAN_OID_MISC_IP_ADDR */
3611 typedef struct _mlan_ds_misc_ipaddr_cfg
3612 {
3613     /** Operation code */
3614     t_u32 op_code;
3615     /** IP address type */
3616     t_u32 ip_addr_type;
3617     /** Number of IP */
3618     t_u32 ip_addr_num;
3619     /** IP address */
3620     t_u8 ip_addr[MAX_IPADDR][IPADDR_LEN];
3621 } mlan_ds_misc_ipaddr_cfg;
3622 
3623 /* MEF configuration disable */
3624 #define MEF_CFG_DISABLE 0
3625 /* MEF configuration Rx filter enable */
3626 #define MEF_CFG_RX_FILTER_ENABLE 1
3627 /* MEF configuration auto ARP response */
3628 #define MEF_CFG_AUTO_ARP_RESP 2
3629 /* MEF configuration host command */
3630 #define MEF_CFG_HOSTCMD 0xFFFF
3631 
3632 /** Type definition of mlan_ds_misc_mef_cfg for MLAN_OID_MISC_MEF_CFG */
3633 typedef struct _mlan_ds_misc_mef_cfg
3634 {
3635     /** Sub-ID for operation */
3636     t_u32 sub_id;
3637     /** Parameter according to sub-ID */
3638     union
3639     {
3640         /** MEF command buffer for MEF_CFG_HOSTCMD */
3641         mlan_ds_misc_cmd cmd_buf;
3642     } param;
3643 } mlan_ds_misc_mef_cfg;
3644 
3645 /** Type definition of mlan_ds_misc_cfp_code for MLAN_OID_MISC_CFP_CODE */
3646 typedef struct _mlan_ds_misc_cfp_code
3647 {
3648     /** CFP table code for 2.4GHz */
3649     t_u32 cfp_code_bg;
3650     /** CFP table code for 5GHz */
3651     t_u32 cfp_code_a;
3652 } mlan_ds_misc_cfp_code;
3653 
3654 /** Type definition of mlan_ds_misc_country_code for MLAN_OID_MISC_COUNTRY_CODE */
3655 typedef struct _mlan_ds_misc_country_code
3656 {
3657     /** Country Code */
3658     t_u8 country_code[COUNTRY_CODE_LEN];
3659 } mlan_ds_misc_country_code;
3660 
3661 /** action for set */
3662 #define SUBSCRIBE_EVT_ACT_BITWISE_SET 0x0002
3663 /** action for clear */
3664 #define SUBSCRIBE_EVT_ACT_BITWISE_CLR 0x0003
3665 /** BITMAP for subscribe event rssi low */
3666 #define SUBSCRIBE_EVT_RSSI_LOW MBIT(0)
3667 /** BITMAP for subscribe event snr low */
3668 #define SUBSCRIBE_EVT_SNR_LOW MBIT(1)
3669 /** BITMAP for subscribe event max fail */
3670 #define SUBSCRIBE_EVT_MAX_FAIL MBIT(2)
3671 /** BITMAP for subscribe event beacon missed */
3672 #define SUBSCRIBE_EVT_BEACON_MISSED MBIT(3)
3673 /** BITMAP for subscribe event rssi high */
3674 #define SUBSCRIBE_EVT_RSSI_HIGH MBIT(4)
3675 /** BITMAP for subscribe event snr high */
3676 #define SUBSCRIBE_EVT_SNR_HIGH MBIT(5)
3677 /** BITMAP for subscribe event data rssi low */
3678 #define SUBSCRIBE_EVT_DATA_RSSI_LOW MBIT(6)
3679 /** BITMAP for subscribe event data snr low */
3680 #define SUBSCRIBE_EVT_DATA_SNR_LOW MBIT(7)
3681 /** BITMAP for subscribe event data rssi high */
3682 #define SUBSCRIBE_EVT_DATA_RSSI_HIGH MBIT(8)
3683 /** BITMAP for subscribe event data snr high */
3684 #define SUBSCRIBE_EVT_DATA_SNR_HIGH MBIT(9)
3685 /** BITMAP for subscribe event link quality */
3686 #define SUBSCRIBE_EVT_LINK_QUALITY MBIT(10)
3687 /** BITMAP for subscribe event pre_beacon_lost */
3688 #define SUBSCRIBE_EVT_PRE_BEACON_LOST MBIT(11)
3689 /** default PRE_BEACON_MISS_COUNT */
3690 #define DEFAULT_PRE_BEACON_MISS 30
3691 
3692 /** Type definition of mlan_ds_subscribe_evt for MLAN_OID_MISC_CFP_CODE */
3693 typedef struct _mlan_ds_subscribe_evt
3694 {
3695     /** evt action */
3696     t_u16 evt_action;
3697     /** bitmap for subscribe event */
3698     t_u16 evt_bitmap;
3699     /** Absolute value of RSSI threshold value (dBm) */
3700     t_u8 low_rssi;
3701     /** 0--report once, 1--report everytime happen, N -- report only happend > N consecutive times */
3702     t_u8 low_rssi_freq;
3703     /** SNR threshold value (dB) */
3704     t_u8 low_snr;
3705     /** 0--report once, 1--report everytime happen, N -- report only happend > N consecutive times */
3706     t_u8 low_snr_freq;
3707     /** Failure count threshold */
3708     t_u8 failure_count;
3709     /** 0--report once, 1--report everytime happen, N -- report only happend > N consecutive times */
3710     t_u8 failure_count_freq;
3711     /** num of missed beacons */
3712     t_u8 beacon_miss;
3713     /** 0--report once, 1--report everytime happen, N -- report only happend > N consecutive times */
3714     t_u8 beacon_miss_freq;
3715     /** Absolute value of RSSI threshold value (dBm) */
3716     t_u8 high_rssi;
3717     /** 0--report once, 1--report everytime happen, N -- report only happend > N consecutive times */
3718     t_u8 high_rssi_freq;
3719     /** SNR threshold value (dB) */
3720     t_u8 high_snr;
3721     /** 0--report once, 1--report everytime happen, N -- report only happend > N consecutive times */
3722     t_u8 high_snr_freq;
3723     /** Absolute value of data RSSI threshold value (dBm) */
3724     t_u8 data_low_rssi;
3725     /** 0--report once, 1--report everytime happen, N -- report only happend > N consecutive times */
3726     t_u8 data_low_rssi_freq;
3727     /** Absolute value of data SNR threshold value (dBm) */
3728     t_u8 data_low_snr;
3729     /** 0--report once, 1--report everytime happen, N -- report only happend > N consecutive times */
3730     t_u8 data_low_snr_freq;
3731     /** Absolute value of data RSSI threshold value (dBm) */
3732     t_u8 data_high_rssi;
3733     /** 0--report once, 1--report everytime happen, N -- report only happend > N consecutive times */
3734     t_u8 data_high_rssi_freq;
3735     /** Absolute value of data SNR threshold value (dBm) */
3736     t_u8 data_high_snr;
3737     /** 0--report once, 1--report everytime happen, N -- report only happend > N consecutive times */
3738     t_u8 data_high_snr_freq;
3739     /* Link SNR threshold (dB) */
3740     t_u16 link_snr;
3741     /* Link SNR frequency */
3742     t_u16 link_snr_freq;
3743     /* Second minimum rate value as per the rate table below */
3744     t_u16 link_rate;
3745     /* Second minimum rate frequency */
3746     t_u16 link_rate_freq;
3747     /* Tx latency value (us) */
3748     t_u16 link_tx_latency;
3749     /* Tx latency frequency */
3750     t_u16 link_tx_lantency_freq;
3751     /* Number of pre missed beacons */
3752     t_u8 pre_beacon_miss;
3753 } mlan_ds_subscribe_evt;
3754 /** Max OTP user data length */
3755 #define MAX_OTP_USER_DATA_LEN 252U
3756 
3757 /** Type definition of mlan_ds_misc_otp_user_data for MLAN_OID_MISC_OTP_USER_DATA */
3758 typedef struct _mlan_ds_misc_otp_user_data
3759 {
3760     /** Reserved */
3761     t_u16 reserved;
3762     /** OTP user data length */
3763     t_u16 user_data_length;
3764     /** User data buffer */
3765     t_u8 user_data[MAX_OTP_USER_DATA_LEN];
3766 } mlan_ds_misc_otp_user_data;
3767 
3768 /** mlan_ds_misc_pmfcfg structure */
3769 typedef struct _mlan_ds_misc_pmfcfg
3770 {
3771     /** Management Frame Protection Capable */
3772     t_u8 mfpc;
3773     /** Management Frame Protection Required */
3774     t_u8 mfpr;
3775 } mlan_ds_misc_pmfcfg;
3776 
3777 /** mlan_ds_misc_ed_mac_mode structure */
3778 typedef struct _mlan_ds_ed_mac_mode
3779 {
3780     /** ED CTRL 2G */
3781     t_u16 ed_ctrl_2g;
3782     /** ED Offset 2G */
3783     t_s16 ed_offset_2g;
3784 #if CONFIG_5GHz_SUPPORT
3785     /** ED CTRL 5G */
3786     t_u16 ed_ctrl_5g;
3787     /** ED Offset 5G */
3788     t_s16 ed_offset_5g;
3789 #endif
3790 } mlan_ds_misc_ed_mac_mode;
3791 
3792 #ifdef OTP_CHANINFO
3793 typedef struct _mlan_ds_misc_chnrgpwr_cfg
3794 {
3795     /** length */
3796     t_u16 length;
3797     /** chnrgpwr buf */
3798     t_u8 chnrgpwr_buf[2048];
3799 } mlan_ds_misc_chnrgpwr_cfg;
3800 #endif
3801 
3802 #if CONFIG_RF_TEST_MODE
3803 
3804 typedef enum _mlan_rf_test_mode
3805 {
3806     MLAN_OID_MISC_RF_TEST_GENERIC              = 0x00200075,
3807     MLAN_OID_MISC_RF_TEST_TX_CONT              = 0x00200076,
3808     MLAN_OID_MISC_RF_TEST_TX_FRAME             = 0x00200077,
3809     MLAN_OID_MISC_RF_TEST_HE_POWER             = 0X0020007F,
3810     MLAN_OID_MISC_RF_TEST_CONFIG_TRIGGER_FRAME = 0x0020008C,
3811 } mlan_rf_test_mode;
3812 
3813 #define MFG_CMD_SET_TEST_MODE        1
3814 #define MFG_CMD_UNSET_TEST_MODE      0
3815 #define MFG_CMD_TX_ANT               0x1004
3816 #define MFG_CMD_RX_ANT               0x1005
3817 #define MFG_CMD_TX_CONT              0x1009
3818 #define MFG_CMD_RF_CHAN              0x100A
3819 #define MFG_CMD_CLR_RX_ERR           0x1010
3820 #define MFG_CMD_TX_FRAME             0x1021
3821 #define MFG_CMD_RFPWR                0x1033
3822 #define MFG_CMD_RF_BAND_AG           0x1034
3823 #define MFG_CMD_RF_CHANNELBW         0x1044
3824 #define MFG_CMD_RADIO_MODE_CFG       0x1211
3825 #define MFG_CMD_CONFIG_MAC_HE_TB_TX  0x110A
3826 #define MFG_CMD_CONFIG_TRIGGER_FRAME 0x110C
3827 #define MFG_CMD_OTP_MAC_ADD          0x108C
3828 #define MFG_CMD_OTP_CAL_DATA         0x121A
3829 
3830 /** Configuration for Manufacturing generic command */
3831 typedef MLAN_PACK_START struct _mlan_ds_mfg_cmd_generic_cfg
3832 {
3833     /** MFG command code */
3834     t_u32 mfg_cmd;
3835     /** Action */
3836     t_u16 action;
3837     /** Device ID */
3838     t_u16 device_id;
3839     /** MFG Error code */
3840     t_u32 error;
3841     /** value 1 */
3842     t_u32 data1;
3843     /** value 2 */
3844     t_u32 data2;
3845     /** value 3 */
3846     t_u32 data3;
3847 } MLAN_PACK_END mlan_ds_mfg_cmd_generic_cfg;
3848 
3849 /** Configuration for Manufacturing command Tx Frame */
3850 typedef MLAN_PACK_START struct _mlan_ds_mfg_cmd_tx_frame2
3851 {
3852     /** MFG command code */
3853     t_u32 mfg_cmd;
3854     /** Action */
3855     t_u16 action;
3856     /** Device ID */
3857     t_u16 device_id;
3858     /** MFG Error code */
3859     t_u32 error;
3860     /** enable */
3861     t_u32 enable;
3862     /** data_rate */
3863     t_u32 data_rate;
3864     /** frame pattern */
3865     t_u32 frame_pattern;
3866     /** frame length */
3867     t_u32 frame_length;
3868     /** BSSID */
3869     t_u8 bssid[MLAN_MAC_ADDR_LENGTH];
3870     /** Adjust burst sifs */
3871     t_u16 adjust_burst_sifs;
3872     /** Burst sifs in us*/
3873     t_u32 burst_sifs_in_us;
3874     /** short preamble */
3875     t_u32 short_preamble;
3876     /** active sub channel */
3877     t_u32 act_sub_ch;
3878     /** short GI */
3879     t_u32 short_gi;
3880     /** Adv coding */
3881     t_u32 adv_coding;
3882     /** Tx beamforming */
3883     t_u32 tx_bf;
3884     /** HT Greenfield Mode*/
3885     t_u32 gf_mode;
3886     /** STBC */
3887     t_u32 stbc;
3888     /** power id */
3889     t_u32 rsvd[2];
3890 } MLAN_PACK_END mlan_ds_mfg_cmd_tx_frame2;
3891 
3892 /** Configuration for Manufacturing command Tx Continuous */
3893 typedef MLAN_PACK_START struct _mlan_ds_mfg_cmd_tx_cont
3894 {
3895     /** MFG command code */
3896     t_u32 mfg_cmd;
3897     /** Action */
3898     t_u16 action;
3899     /** Device ID */
3900     t_u16 device_id;
3901     /** MFG Error code */
3902     t_u32 error;
3903     /** enable Tx*/
3904     t_u32 enable_tx;
3905     /** Continuous Wave mode */
3906     t_u32 cw_mode;
3907     /** payload pattern */
3908     t_u32 payload_pattern;
3909     /** CS Mode */
3910     t_u32 cs_mode;
3911     /** active sub channel */
3912     t_u32 act_sub_ch;
3913     /** Tx rate */
3914     t_u32 tx_rate;
3915     /** power id */
3916     t_u32 rsvd;
3917 } MLAN_PACK_END mlan_ds_mfg_cmd_tx_cont;
3918 
3919 typedef PACK_START struct _mlan_ds_mfg_Cmd_HE_TBTx_t
3920 {
3921     /** MFG command code */
3922     t_u32 mfg_cmd;
3923     /** Action */
3924     t_u16 action;
3925     /** Device ID */
3926     t_u16 device_id;
3927     /** MFG Error code */
3928     t_u32 error;
3929     /** Enable Tx */
3930     t_u16 enable;
3931     /** Q num */
3932     t_u16 qnum;
3933     /** AID */
3934     t_u16 aid;
3935     /** AXQ Mu Timer */
3936     t_u16 axq_mu_timer;
3937     /** Tx Power */
3938     t_s16 tx_power;
3939 } PACK_END mlan_ds_mfg_Cmd_HE_TBTx_t;
3940 
3941 typedef MLAN_PACK_START struct _mlan_ds_mfg_cmd_otp_mac_addr_rd_wr_t
3942 {
3943     /** MFG command code */
3944     t_u32 mfg_cmd;
3945     /** Action */
3946     t_u16 action;
3947     /** Device ID */
3948     t_u16 device_id;
3949     /** MFG Error code */
3950     t_u32 error;
3951     /** Destination MAC Address */
3952     t_u8 mac_addr[MLAN_MAC_ADDR_LENGTH];
3953 } MLAN_PACK_END mlan_ds_mfg_cmd_otp_mac_addr_rd_wr_t;
3954 
3955 #define CAL_DATA_LEN 2800
3956 typedef MLAN_PACK_START struct _mlan_ds_mfg_cmd_otp_cal_data_rd_wr_t
3957 {
3958     /** MFG command code */
3959     t_u32 mfg_cmd;
3960     /** Action */
3961     t_u16 action;
3962     /** Device ID */
3963     t_u16 device_id;
3964     /** MFG Error code */
3965     t_u32 error;
3966     /** CAL Data write status */
3967     t_u32 cal_data_status;
3968     /** CAL Data Length*/
3969     t_u32 cal_data_len;
3970     /** Destination MAC Address */
3971     t_u8 cal_data[CAL_DATA_LEN];
3972 } MLAN_PACK_END mlan_ds_mfg_cmd_otp_cal_data_rd_wr_t;
3973 
3974 #ifdef BIG_ENDIAN_SUPPORT
3975 typedef MLAN_PACK_START struct _mfg_cmd_IEEEtypes_HETrigComInfo_t
3976 {
3977     t_u64 reserved : 1;
3978     t_u64 he_sig2 : 9;
3979     t_u64 doppler : 1;
3980     t_u64 spatial_reuse : 16;
3981     t_u64 pe_disambig : 1;
3982     t_u64 pre_fec_pad_fct : 2;
3983     t_u64 ap_tx_pwr : 6;
3984 
3985     t_u64 ldpc_ess : 1;
3986     t_u64 ul_stbc : 1;
3987     t_u64 ltf_symbol : 3;
3988     t_u64 ltf_mode : 1;
3989     t_u64 ltf_type : 2;
3990 
3991     t_u64 ul_bw : 2;
3992     t_u64 cs_required : 1;
3993     t_u64 more_tf : 1;
3994     t_u64 ul_len : 12;
3995     t_u64 trigger_type : 4;
3996 
3997 } MLAN_PACK_END mfg_cmd_IEEEtypes_HETrigComInfo_t;
3998 #else
3999 typedef MLAN_PACK_START struct _mfg_cmd_IEEEtypes_HETrigComInfo_t
4000 {
4001     t_u64 trigger_type : 4;
4002     t_u64 ul_len : 12;
4003     t_u64 more_tf : 1;
4004     t_u64 cs_required : 1;
4005     t_u64 ul_bw : 2;
4006 
4007     t_u64 ltf_type : 2;
4008     t_u64 ltf_mode : 1;
4009     t_u64 ltf_symbol : 3;
4010     t_u64 ul_stbc : 1;
4011     t_u64 ldpc_ess : 1;
4012 
4013     t_u64 ap_tx_pwr : 6;
4014     t_u64 pre_fec_pad_fct : 2;
4015     t_u64 pe_disambig : 1;
4016     t_u64 spatial_reuse : 16;
4017     t_u64 doppler : 1;
4018     t_u64 he_sig2 : 9;
4019     t_u64 reserved : 1;
4020 
4021 } MLAN_PACK_END mfg_cmd_IEEEtypes_HETrigComInfo_t;
4022 #endif
4023 
4024 #ifdef BIG_ENDIAN_SUPPORT
4025 typedef MLAN_PACK_START struct _mfg_cmd_IEEEtypes_HETrigUserInfo_t
4026 {
4027     t_u8 reserved : 1;
4028     t_u8 ul_target_rssi : 7;
4029     t_u32 ss_alloc : 6;
4030     t_u32 ul_dcm : 1;
4031     t_u32 ul_mcs : 4;
4032     t_u32 ul_coding_type : 1;
4033     t_u32 ru_alloc : 7;
4034     t_u32 ru_alloc_reg : 1;
4035     t_u32 aid12 : 12;
4036 
4037 } MLAN_PACK_END mfg_cmd_IEEEtypes_HETrigUserInfo_t;
4038 #else
4039 typedef MLAN_PACK_START struct _mfg_cmd_IEEEtypes_HETrigUserInfo_t
4040 {
4041     t_u32 aid12 : 12;
4042     t_u32 ru_alloc_reg : 1;
4043     t_u32 ru_alloc : 7;
4044     t_u32 ul_coding_type : 1;
4045     t_u32 ul_mcs : 4;
4046     t_u32 ul_dcm : 1;
4047     t_u32 ss_alloc : 6;
4048     t_u8 ul_target_rssi : 7;
4049     t_u8 reserved : 1;
4050 } MLAN_PACK_END mfg_cmd_IEEEtypes_HETrigUserInfo_t;
4051 #endif
4052 
4053 #ifdef BIG_ENDIAN_SUPPORT
4054 typedef MLAN_PACK_START struct _mfg_cmd_IEEETypes_BasicHETrigUserInfo_t
4055 {
4056     t_u8 pref_ac : 2;
4057     t_u8 ac_pl : 1;
4058     t_u8 tid_al : 3;
4059     t_u8 mpdu_mu_sf : 2;
4060 } MLAN_PACK_END mfg_cmd_IEEETypes_BasicHETrigUserInfo_t;
4061 #else
4062 typedef MLAN_PACK_START struct _mfg_cmd_IEEETypes_BasicHETrigUserInfo_t
4063 {
4064     t_u8 mpdu_mu_sf : 2;
4065     t_u8 tid_al : 3;
4066     t_u8 ac_pl : 1;
4067     t_u8 pref_ac : 2;
4068 } MLAN_PACK_END mfg_cmd_IEEETypes_BasicHETrigUserInfo_t;
4069 #endif
4070 
4071 #ifdef BIG_ENDIAN_SUPPORT
4072 typedef MLAN_PACK_START struct _mfg_cmd_IEEEtypes_FrameCtrl_t
4073 {
4074     /** Order */
4075     t_u8 order : 1;
4076     /** Wep */
4077     t_u8 wep : 1;
4078     /** More Data */
4079     t_u8 more_data : 1;
4080     /** Power Mgmt */
4081     t_u8 pwr_mgmt : 1;
4082     /** Retry */
4083     t_u8 retry : 1;
4084     /** More Frag */
4085     t_u8 more_frag : 1;
4086     /** From DS */
4087     t_u8 from_ds : 1;
4088     /** To DS */
4089     t_u8 to_ds : 1;
4090     /** Sub Type */
4091     t_u8 sub_type : 4;
4092     /** Type */
4093     t_u8 type : 2;
4094     /** Protocol Version */
4095     t_u8 protocol_version : 2;
4096 } MLAN_PACK_END mfg_cmd_IEEEtypes_FrameCtrl_t;
4097 #else
4098 typedef MLAN_PACK_START struct _mfg_cmd_IEEEtypes_FrameCtrl_t
4099 {
4100     /** Protocol Version */
4101     t_u8 protocol_version : 2;
4102     /** Type */
4103     t_u8 type : 2;
4104     /** Sub Type */
4105     t_u8 sub_type : 4;
4106     /** To DS */
4107     t_u8 to_ds : 1;
4108     /** From DS */
4109     t_u8 from_ds : 1;
4110     /** More Frag */
4111     t_u8 more_frag : 1;
4112     /** Retry */
4113     t_u8 retry : 1;
4114     /** Power Mgmt */
4115     t_u8 pwr_mgmt : 1;
4116     /** More Data */
4117     t_u8 more_data : 1;
4118     /** Wep */
4119     t_u8 wep : 1;
4120     /** Order */
4121     t_u8 order : 1;
4122 } MLAN_PACK_END mfg_cmd_IEEEtypes_FrameCtrl_t;
4123 #endif
4124 
4125 typedef MLAN_PACK_START struct _mfg_Cmd_IEEEtypes_CtlBasicTrigHdr_t
4126 {
4127     /** MFG command code */
4128     t_u32 mfg_cmd;
4129     /** Action */
4130     t_u16 action;
4131     /** Device ID */
4132     t_u16 device_id;
4133     /** MFG Error code */
4134     t_u32 error;
4135     /** enable Tx*/
4136     t_u32 enable_tx;
4137     /** enable Stand Alone HE TB */
4138     t_u32 standalone_hetb;
4139     /** Frame Control */
4140     mfg_cmd_IEEEtypes_FrameCtrl_t frmCtl;
4141     /** Duration */
4142     t_u16 duration;
4143     /** Destination MAC Address */
4144     t_u8 dest_addr[MLAN_MAC_ADDR_LENGTH];
4145     /** Source MAC Address */
4146     t_u8 src_addr[MLAN_MAC_ADDR_LENGTH];
4147     /** Common Info Field **/
4148     mfg_cmd_IEEEtypes_HETrigComInfo_t trig_common_field;
4149     /** User Info Field **/
4150     mfg_cmd_IEEEtypes_HETrigUserInfo_t trig_user_info_field;
4151     /** Trigger Dependent User Info Field **/
4152     mfg_cmd_IEEETypes_BasicHETrigUserInfo_t basic_trig_user_info;
4153 } MLAN_PACK_END mfg_Cmd_IEEEtypes_CtlBasicTrigHdr_t;
4154 #endif
4155 
4156 #if CONFIG_MULTI_CHAN
4157 typedef MLAN_PACK_START struct _mlan_ds_multi_chan_cfg
4158 {
4159     /** Channel Time */
4160     t_u32 channel_time;
4161     /** Buffer Weight */
4162     t_u8 buffer_weight;
4163     /** tlv len */
4164     t_u16 tlv_len;
4165     /** TLV buffer */
4166     t_u8 tlv_buf[];
4167 } MLAN_PACK_END mlan_ds_multi_chan_cfg;
4168 
4169 typedef MLAN_PACK_START struct _mlan_ds_drcs_cfg
4170 {
4171     /** Channel Index*/
4172     t_u16 chan_idx;
4173     /** Channel time (in TU) for chan_idx */
4174     t_u8 chantime;
4175     /** Channel swith time (in TU) for chan_idx */
4176     t_u8 switchtime;
4177     /** Undoze time (in TU) for chan_idx */
4178     t_u8 undozetime;
4179     /** Rx traffic control scheme when channel switch*/
4180     /** only valid for GC/STA interface*/
4181     t_u8 mode;
4182 } MLAN_PACK_END mlan_ds_drcs_cfg;
4183 #endif
4184 
4185 #if CONFIG_1AS
4186 /** Type definition of mlan_ds_host_clock  */
4187 typedef struct _mlan_ds_host_clock
4188 {
4189     /** host time in secs */
4190     t_u64 time;
4191     /** fw time */
4192     t_u64 fw_time;
4193     /** host-bbu clock delta */
4194     t_u64 host_bbu_clk_delta;
4195 } mlan_ds_host_clock;
4196 #endif
4197 
4198 #if (CONFIG_GTK_REKEY_OFFLOAD)
4199 #define MLAN_KCK_LEN        16
4200 #define MLAN_KEK_LEN        16
4201 #define MLAN_REPLAY_CTR_LEN 8
4202 /** mlan_ds_misc_gtk_rekey_data */
4203 typedef struct _mlan_ds_misc_gtk_rekey_data
4204 {
4205     /** key encryption key */
4206     t_u8 kek[MLAN_KEK_LEN];
4207     /** key confirmation key */
4208     t_u8 kck[MLAN_KCK_LEN];
4209     /** replay counter */
4210     t_u8 replay_ctr[MLAN_REPLAY_CTR_LEN];
4211 } mlan_ds_misc_gtk_rekey_data;
4212 #endif
4213 
4214 #if (CONFIG_WIFI_IND_RESET) && (CONFIG_WIFI_IND_DNLD)
4215 typedef struct _mlan_ds_ind_rst_cfg
4216 {
4217     /** Set or Get */
4218     t_u16 action;
4219     /** oob mode enable/ disable */
4220     t_u8 ir_mode;
4221     /** gpio pin */
4222     t_u8 gpio_pin;
4223 } mlan_ds_ind_rst_cfg;
4224 #endif
4225 
4226 /** Type definition of mlan_ds_misc_cfg for MLAN_IOCTL_MISC_CFG */
4227 typedef struct _mlan_ds_misc_cfg
4228 {
4229     /** Sub-command */
4230     t_u32 sub_command;
4231     /** Miscellaneous configuration parameter */
4232     union
4233     {
4234         /** Generic IE for MLAN_OID_MISC_GEN_IE */
4235         mlan_ds_misc_gen_ie gen_ie;
4236         /** Region code for MLAN_OID_MISC_REGION */
4237         t_u32 region_code;
4238 #if defined(SDIO_MULTI_PORT_TX_AGGR) || defined(SDIO_MULTI_PORT_RX_AGGR)
4239         /** SDIO MP-A Ctrl command for MLAN_OID_MISC_SDIO_MPA_CTRL */
4240         mlan_ds_misc_sdio_mpa_ctrl mpa_ctrl;
4241 #endif
4242         /** Hostcmd for MLAN_OID_MISC_HOST_CMD */
4243         mlan_ds_misc_cmd hostcmd;
4244         /** System clock for MLAN_OID_MISC_SYS_CLOCK */
4245         mlan_ds_misc_sys_clock sys_clock;
4246 #if CONFIG_WIFI_CLOCKSYNC
4247         mlan_ds_gpio_tsf_latch gpio_tsf_latch_config;
4248         mlan_ds_tsf_info tsf_info;
4249 #endif /* CONFIG_WIFI_CLOCKSYNC */
4250         /** WWS set/get for MLAN_OID_MISC_WWS */
4251         t_u32 wws_cfg;
4252         /** Function init/shutdown for MLAN_OID_MISC_INIT_SHUTDOWN */
4253         t_u32 func_init_shutdown;
4254         /** Custom IE for MLAN_OID_MISC_CUSTOM_IE */
4255         mlan_ds_misc_custom_ie cust_ie;
4256         /** Tx data pause for MLAN_OID_MISC_TX_DATAPAUSE */
4257         mlan_ds_misc_tx_datapause tx_datapause;
4258         /** IP address configuration */
4259         mlan_ds_misc_ipaddr_cfg ipaddr_cfg;
4260         /** MAC control for MLAN_OID_MISC_MAC_CONTROL */
4261         t_u32 mac_ctrl;
4262         /** MEF configuration for MLAN_OID_MISC_MEF_CFG */
4263         mlan_ds_misc_mef_cfg mef_cfg;
4264         /** CFP code for MLAN_OID_MISC_CFP_CODE */
4265         mlan_ds_misc_cfp_code cfp_code;
4266         /** Country code for MLAN_OID_MISC_COUNTRY_CODE */
4267         mlan_ds_misc_country_code country_code;
4268         /** Thermal reading for MLAN_OID_MISC_THERMAL */
4269         t_u32 thermal;
4270         /** Mgmt subtype mask for MLAN_OID_MISC_RX_MGMT_IND */
4271         t_u32 mgmt_subtype_mask;
4272         /** subscribe event for MLAN_OID_MISC_SUBSCRIBE_EVENT */
4273         mlan_ds_subscribe_evt subscribe_event;
4274 #ifdef DEBUG_LEVEL1
4275         /** Driver debug bit masks */
4276         t_u32 drvdbg;
4277 #endif
4278 
4279         /** boot sleep enable or disable */
4280         t_u16 boot_sleep;
4281 
4282         /** Hotspot config param set */
4283         t_u32 hotspot_cfg;
4284         mlan_ds_misc_otp_user_data otp_user_data;
4285 #ifdef WLAN_LOW_POWER_ENABLE
4286         t_u8 low_pwr_mode;
4287 #endif // WLAN_LOW_POWER_ENABLE
4288 #ifdef OTP_CHANINFO
4289         /** Custom regulatory domain */
4290         mlan_ds_custom_reg_domain custom_reg_domain;
4291         mlan_ds_misc_chnrgpwr_cfg rgchnpwr_cfg;
4292 #endif
4293 #if CONFIG_RF_TEST_MODE
4294         mlan_ds_mfg_cmd_generic_cfg mfg_generic_cfg;
4295         mlan_ds_mfg_cmd_tx_frame2 mfg_tx_frame2;
4296         mlan_ds_mfg_cmd_tx_cont mfg_tx_cont;
4297         mlan_ds_mfg_Cmd_HE_TBTx_t mfg_he_power;
4298         mfg_Cmd_IEEEtypes_CtlBasicTrigHdr_t mfg_tx_trigger_config;
4299         mlan_ds_mfg_cmd_otp_mac_addr_rd_wr_t mfg_otp_mac_addr_rd_wr;
4300         mlan_ds_mfg_cmd_otp_cal_data_rd_wr_t mfg_otp_cal_data_rd_wr;
4301 #endif
4302 #if CONFIG_MULTI_CHAN
4303         /** Multi-channel config for MLAN_OID_MISC_MULTI_CHAN_CFG */
4304         mlan_ds_multi_chan_cfg multi_chan_cfg;
4305         /** Multi-channel policy for MLAN_OID_MISC_MULTI_CHAN_POLICY */
4306         t_u16 multi_chan_policy;
4307         /** channel drcs time slicing config for MLAN_OID_MISC_DRCS_CFG
4308          */
4309         mlan_ds_drcs_cfg drcs_cfg[2];
4310 #endif
4311 #if CONFIG_1AS
4312         mlan_ds_host_clock host_clock;
4313 #endif
4314 #if CONFIG_ECSA
4315         mlan_ds_bw_chan_oper bw_chan_oper;
4316 #endif
4317         mlan_embedded_dhcp_config embedded_dhcp_config;
4318 #if CONFIG_GTK_REKEY_OFFLOAD
4319         /** GTK rekey data */
4320         mlan_ds_misc_gtk_rekey_data gtk_rekey;
4321 #endif
4322 #if (CONFIG_WIFI_IND_RESET) && (CONFIG_WIFI_IND_DNLD)
4323         mlan_ds_ind_rst_cfg ind_rst_cfg;
4324 #endif
4325     } param;
4326 } mlan_ds_misc_cfg, *pmlan_ds_misc_cfg;
4327 
4328 /** mlan ioctl */
4329 MLAN_API mlan_status mlan_ioctl(IN t_void *pmlan_adapter, IN pmlan_ioctl_req pioctl_req);
4330 
4331 #endif /* !_MLAN_IOCTL_H_ */
4332