xref: /OK3568_Linux_fs/kernel/drivers/net/wireless/rockchip_wlan/mvl88w8977/mlan/esa/hostsa_ext_def.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1 /** @file hostsa_ext_def.h
2  *
3  *  @brief This file declares the generic data structures and APIs.
4  *
5  *  Copyright (C) 2014-2017, Marvell International Ltd.
6  *
7  *  This software file (the "File") is distributed by Marvell International
8  *  Ltd. under the terms of the GNU General Public License Version 2, June 1991
9  *  (the "License").  You may use, redistribute and/or modify this File in
10  *  accordance with the terms and conditions of the License, a copy of which
11  *  is available by writing to the Free Software Foundation, Inc.,
12  *  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or on the
13  *  worldwide web at http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
14  *
15  *  THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE
16  *  IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE
17  *  ARE EXPRESSLY DISCLAIMED.  The License provides additional details about
18  *  this warranty disclaimer.
19  */
20 
21 /******************************************************
22 Change log:
23     03/07/2014: initial version
24 ******************************************************/
25 
26 #ifndef _HOSTSA_EXT_DEF_H_
27 #define _HOSTSA_EXT_DEF_H_
28 
29 #include "common/IEEE_types.h"
30 /* ####################
31      From mlan_decl.h
32    #################### */
33 
34 /** Re-define generic data types for MLAN/MOAL */
35 /** Signed char (1-byte) */
36 typedef signed char t_s8;
37 /** Unsigned char (1-byte) */
38 typedef unsigned char t_u8;
39 /** Signed short (2-bytes) */
40 typedef short t_s16;
41 /** Unsigned short (2-bytes) */
42 typedef unsigned short t_u16;
43 /** Signed long (4-bytes) */
44 typedef int t_s32;
45 /** Unsigned long (4-bytes) */
46 typedef unsigned int t_u32;
47 /** Signed long long 8-bytes) */
48 typedef long long t_s64;
49 /** Unsigned long long 8-bytes) */
50 typedef unsigned long long t_u64;
51 /** Void pointer (4-bytes) */
52 typedef void t_void;
53 /** Size type */
54 typedef t_u32 t_size;
55 /** Boolean type */
56 typedef t_u8 t_bool;
57 
58 #ifdef MLAN_64BIT
59 /** Pointer type (64-bit) */
60 typedef t_u64 t_ptr;
61 /** Signed value (64-bit) */
62 typedef t_s64 t_sval;
63 #else
64 /** Pointer type (32-bit) */
65 typedef t_u32 t_ptr;
66 /** Signed value (32-bit) */
67 typedef t_s32 t_sval;
68 #endif
69 
70 /** MLAN MNULL pointer */
71 #define MNULL                    (0)
72 
73 /** MLAN TRUE */
74 #define MTRUE                    (1)
75 /** MLAN FALSE */
76 #define MFALSE                   (0)
77 
78 /** MLAN MAC Address Length */
79 #define MLAN_MAC_ADDR_LENGTH     (6)
80 
81 /** MLAN_MEM_DEF */
82 #define MLAN_MEM_DEF             (0)
83 
84 /** MLAN BSS type */
85 typedef enum _mlan_bss_type {
86 	MLAN_BSS_TYPE_STA = 0,
87 	MLAN_BSS_TYPE_UAP = 1,
88 #ifdef WIFI_DIRECT_SUPPORT
89 	MLAN_BSS_TYPE_WIFIDIRECT = 2,
90 #endif
91 	MLAN_BSS_TYPE_NAN = 4,
92 	MLAN_BSS_TYPE_ANY = 0xff,
93 } mlan_bss_type;
94 
95 /** MLAN BSS role */
96 typedef enum _mlan_bss_role {
97 	MLAN_BSS_ROLE_STA = 0,
98 	MLAN_BSS_ROLE_UAP = 1,
99 	MLAN_BSS_ROLE_ANY = 0xff,
100 } mlan_bss_role;
101 
102 /** mlan_status */
103 typedef enum _mlan_status {
104 	MLAN_STATUS_FAILURE = 0xffffffff,
105 	MLAN_STATUS_SUCCESS = 0,
106 	MLAN_STATUS_PENDING,
107 	MLAN_STATUS_RESOURCE,
108 	MLAN_STATUS_COMPLETE,
109 } mlan_status;
110 
111 /** mlan_buf_type */
112 typedef enum _mlan_buf_type {
113 	MLAN_BUF_TYPE_CMD = 1,
114 	MLAN_BUF_TYPE_DATA,
115 	MLAN_BUF_TYPE_EVENT,
116 	MLAN_BUF_TYPE_RAW_DATA,
117 	MLAN_BUF_TYPE_SPA_DATA,
118 } mlan_buf_type;
119 
120 typedef MLAN_PACK_START struct {
121 #ifdef BIG_ENDIAN_SUPPORT
122        /** Host tx power ctrl:
123             0x0: use fw setting for TX power
124             0x1: value specified in bit[6] and bit[5:0] are valid */
125 	t_u8 hostctl:1;
126        /** Sign of the power specified in bit[5:0] */
127 	t_u8 sign:1;
128        /** Power to be used for transmission(in dBm) */
129 	t_u8 abs_val:6;
130 #else
131        /** Power to be used for transmission(in dBm) */
132 	t_u8 abs_val:6;
133        /** Sign of the power specified in bit[5:0] */
134 	t_u8 sign:1;
135        /** Host tx power ctrl:
136             0x0: use fw setting for TX power
137             0x1: value specified in bit[6] and bit[5:0] are valid */
138 	t_u8 hostctl:1;
139 #endif
140 } MLAN_PACK_END tx_power_t;
141 
142 /* pkt_txctrl */
143 typedef MLAN_PACK_START struct _pkt_txctrl {
144     /**Data rate in unit of 0.5Mbps */
145 	t_u16 data_rate;
146 	/*Channel number to transmit the frame */
147 	t_u8 channel;
148     /** Bandwidth to transmit the frame*/
149 	t_u8 bw;
150     /** Power to be used for transmission*/
151 	union {
152 		tx_power_t tp;
153 		t_u8 val;
154 	} tx_power;
155     /** Retry time of tx transmission*/
156 	t_u8 retry_limit;
157 } MLAN_PACK_END pkt_txctrl, *ppkt_txctrl;
158 
159 /** pkt_rxinfo */
160 typedef MLAN_PACK_START struct _pkt_rxinfo {
161     /** Data rate of received paccket*/
162 	t_u16 data_rate;
163     /** Channel on which packet was received*/
164 	t_u8 channel;
165     /** Rx antenna*/
166 	t_u8 antenna;
167     /** Rx Rssi*/
168 	t_u8 rssi;
169 } MLAN_PACK_END pkt_rxinfo, *ppkt_rxinfo;
170 
171 /** mlan_buffer data structure */
172 typedef struct _mlan_buffer {
173     /** Pointer to previous mlan_buffer */
174 	struct _mlan_buffer *pprev;
175     /** Pointer to next mlan_buffer */
176 	struct _mlan_buffer *pnext;
177     /** Status code from firmware/driver */
178 	t_u32 status_code;
179     /** Flags for this buffer */
180 	t_u32 flags;
181     /** BSS index number for multiple BSS support */
182 	t_u32 bss_index;
183     /** Buffer descriptor, e.g. skb in Linux */
184 	t_void *pdesc;
185     /** Pointer to buffer */
186 	t_u8 *pbuf;
187     /** Offset to data */
188 	t_u32 data_offset;
189     /** Data length */
190 	t_u32 data_len;
191     /** Buffer type: data, cmd, event etc. */
192 	mlan_buf_type buf_type;
193 
194     /** Fields below are valid for data packet only */
195     /** QoS priority */
196 	t_u32 priority;
197     /** Time stamp when packet is received (seconds) */
198 	t_u32 in_ts_sec;
199     /** Time stamp when packet is received (micro seconds) */
200 	t_u32 in_ts_usec;
201     /** Time stamp when packet is processed (seconds) */
202 	t_u32 out_ts_sec;
203     /** Time stamp when packet is processed (micro seconds) */
204 	t_u32 out_ts_usec;
205     /** tx_seq_num */
206 	t_u32 tx_seq_num;
207 
208     /** Fields below are valid for MLAN module only */
209     /** Pointer to parent mlan_buffer */
210 	struct _mlan_buffer *pparent;
211     /** Use count for this buffer */
212 	t_u32 use_count;
213 	union {
214 		pkt_txctrl tx_info;
215 		pkt_rxinfo rx_info;
216 	} u;
217 } mlan_buffer, *pmlan_buffer;
218 
219 /** Maximum data rates */
220 #define MAX_DATA_RATES          14
221 /** Maximum key length */
222 #define MLAN_MAX_KEY_LENGTH             32
223 /** Maximum data rates */
224 #define MAX_DATA_RATES          14
225 /** Maximum number of AC QOS queues available in the driver/firmware */
226 #define MAX_AC_QUEUES 4
227 
228 /** MLAN Maximum SSID Length */
229 #define MLAN_MAX_SSID_LENGTH     (32)
230 
231 /** Max Ie length */
232 #define MAX_IE_SIZE             256
233 
234 /** Max channel */
235 #define MLAN_MAX_CHANNEL    165
236 
237 #ifdef UAP_SUPPORT
238 /** Maximum packet forward control value */
239 #define MAX_PKT_FWD_CTRL 15
240 /** Maximum BEACON period */
241 #define MAX_BEACON_PERIOD 4000
242 /** Minimum BEACON period */
243 #define MIN_BEACON_PERIOD 50
244 /** Maximum DTIM period */
245 #define MAX_DTIM_PERIOD 100
246 /** Minimum DTIM period */
247 #define MIN_DTIM_PERIOD 1
248 /** Maximum TX Power Limit */
249 #define MAX_TX_POWER    20
250 /** Minimum TX Power Limit */
251 #define MIN_TX_POWER    0
252 /** MAX station count */
253 #define MAX_STA_COUNT   10
254 /** Maximum RTS threshold */
255 #define MAX_RTS_THRESHOLD   2347
256 /** Maximum fragmentation threshold */
257 #define MAX_FRAG_THRESHOLD 2346
258 /** Minimum fragmentation threshold */
259 #define MIN_FRAG_THRESHOLD 256
260 /** data rate 54 M */
261 #define DATA_RATE_54M   108
262 /** antenna A */
263 #define ANTENNA_MODE_A      0
264 /** antenna B */
265 #define ANTENNA_MODE_B      1
266 /** transmit antenna */
267 #define TX_ANTENNA          1
268 /** receive antenna */
269 #define RX_ANTENNA          0
270 /** Maximum stage out time */
271 #define MAX_STAGE_OUT_TIME  864000
272 /** Minimum stage out time */
273 #define MIN_STAGE_OUT_TIME  300
274 /** Maximum Retry Limit */
275 #define MAX_RETRY_LIMIT         14
276 
277 /** Maximum group key timer in seconds */
278 #define MAX_GRP_TIMER           86400
279 /**Default ssid for micro AP*/
280 #define AP_DEFAULT_SSID                 "Marvell Micro AP"
281 /**Default pairwise key handshake retry times*/
282 #define PWS_HSK_RETRIES                 3
283 /**Default group key handshake retry times*/
284 #define GRP_HSK_RETRIES                 3
285 /**Default pairwise key handshake timeout*/
286 #define PWS_HSK_TIMEOUT                 100	//100 ms
287 /**Default group key handshake timeout*/
288 #define GRP_HSK_TIMEOUT                 100	//100 ms
289 /**Default Group key rekey time*/
290 #define GRP_REKEY_TIME                  86400	//86400 sec
291 
292 /** Maximum value of 4 byte configuration */
293 #define MAX_VALID_DWORD         0x7FFFFFFF	/*  (1 << 31) - 1 */
294 
295 /** Band config ACS mode */
296 #define BAND_CONFIG_ACS_MODE    0x40
297 /** Band config manual */
298 #define BAND_CONFIG_MANUAL      0x00
299 
300 /** Maximum data rates */
301 #define MAX_DATA_RATES          14
302 
303 /** auto data rate */
304 #define DATA_RATE_AUTO       0
305 
306 /**filter mode: disable */
307 #define MAC_FILTER_MODE_DISABLE         0
308 /**filter mode: block mac address */
309 #define MAC_FILTER_MODE_ALLOW_MAC       1
310 /**filter mode: block mac address */
311 #define MAC_FILTER_MODE_BLOCK_MAC       2
312 /** Maximum mac filter num */
313 #define MAX_MAC_FILTER_NUM           16
314 
315 /* Bitmap for protocol to use */
316 /** No security */
317 #define PROTOCOL_NO_SECURITY        0x01
318 /** Static WEP */
319 #define PROTOCOL_STATIC_WEP         0x02
320 /** WPA */
321 #define PROTOCOL_WPA                0x08
322 /** WPA2 */
323 #define PROTOCOL_WPA2               0x20
324 /** WP2 Mixed */
325 #define PROTOCOL_WPA2_MIXED         0x28
326 /** EAP */
327 #define PROTOCOL_EAP                0x40
328 /** WAPI */
329 #define PROTOCOL_WAPI               0x80
330 
331 /** Key_mgmt_psk */
332 #define KEY_MGMT_NONE   0x04
333 /** Key_mgmt_none */
334 #define KEY_MGMT_PSK    0x02
335 /** Key_mgmt_eap  */
336 #define KEY_MGMT_EAP    0x01
337 /** Key_mgmt_psk_sha256 */
338 #define KEY_MGMT_PSK_SHA256     0x100
339 
340 /** TKIP */
341 #define CIPHER_TKIP                 0x04
342 /** AES CCMP */
343 #define CIPHER_AES_CCMP             0x08
344 
345 /** Valid cipher bitmap */
346 #define VALID_CIPHER_BITMAP         0x0c
347 /** 60 seconds */
348 #define MRVDRV_TIMER_60S                60000
349 /** 10 seconds */
350 #define MRVDRV_TIMER_10S                10000
351 /** 5 seconds */
352 #define MRVDRV_TIMER_5S                 5000
353 /** 1 second */
354 #define MRVDRV_TIMER_1S                 1000
355 /** DMA alignment */
356 #define DMA_ALIGNMENT            32
357 /** max size of TxPD */
358 #define MAX_TXPD_SIZE            32
359 
360 typedef t_u8 mlan_802_11_mac_addr[MLAN_MAC_ADDR_LENGTH];
361 
362 /** mlan_802_11_ssid data structure */
363 typedef struct _mlan_802_11_ssid {
364     /** SSID Length */
365 	t_u32 ssid_len;
366     /** SSID information field */
367 	t_u8 ssid[MLAN_MAX_SSID_LENGTH];
368 } mlan_802_11_ssid, *pmlan_802_11_ssid;
369 
370 /** mac_filter data structure */
371 typedef struct _mac_filter {
372     /** mac filter mode */
373 	t_u16 filter_mode;
374     /** mac adress count */
375 	t_u16 mac_count;
376     /** mac address list */
377 	mlan_802_11_mac_addr mac_list[MAX_MAC_FILTER_NUM];
378 } mac_filter;
379 
380 /** wpa parameter */
381 typedef struct _wpa_param {
382     /** Pairwise cipher WPA */
383 	t_u8 pairwise_cipher_wpa;
384     /** Pairwise cipher WPA2 */
385 	t_u8 pairwise_cipher_wpa2;
386     /** group cipher */
387 	t_u8 group_cipher;
388     /** RSN replay protection */
389 	t_u8 rsn_protection;
390     /** passphrase length */
391 	t_u32 length;
392     /** passphrase */
393 	t_u8 passphrase[64];
394     /**group key rekey time in seconds */
395 	t_u32 gk_rekey_time;
396 } wpa_param;
397 
398 /** wep key */
399 typedef struct _wep_key {
400     /** key index 0-3 */
401 	t_u8 key_index;
402     /** is default */
403 	t_u8 is_default;
404     /** length */
405 	t_u16 length;
406     /** key data */
407 	t_u8 key[26];
408 } wep_key;
409 
410 /** wep param */
411 typedef struct _wep_param {
412     /** key 0 */
413 	wep_key key0;
414     /** key 1 */
415 	wep_key key1;
416     /** key 2 */
417 	wep_key key2;
418     /** key 3 */
419 	wep_key key3;
420 } wep_param;
421 
422 /** Data structure of WMM QoS information */
423 typedef struct _wmm_qos_info_t {
424 #ifdef BIG_ENDIAN_SUPPORT
425     /** QoS UAPSD */
426 	t_u8 qos_uapsd:1;
427     /** Reserved */
428 	t_u8 reserved:3;
429     /** Parameter set count */
430 	t_u8 para_set_count:4;
431 #else
432     /** Parameter set count */
433 	t_u8 para_set_count:4;
434     /** Reserved */
435 	t_u8 reserved:3;
436     /** QoS UAPSD */
437 	t_u8 qos_uapsd:1;
438 #endif				/* BIG_ENDIAN_SUPPORT */
439 } wmm_qos_info_t, *pwmm_qos_info_t;
440 
441 /** Data structure of WMM ECW */
442 typedef struct _wmm_ecw_t {
443 #ifdef BIG_ENDIAN_SUPPORT
444     /** Maximum Ecw */
445 	t_u8 ecw_max:4;
446     /** Minimum Ecw */
447 	t_u8 ecw_min:4;
448 #else
449     /** Minimum Ecw */
450 	t_u8 ecw_min:4;
451     /** Maximum Ecw */
452 	t_u8 ecw_max:4;
453 #endif				/* BIG_ENDIAN_SUPPORT */
454 } wmm_ecw_t, *pwmm_ecw_t;
455 
456 /** 5G band */
457 #define BAND_CONFIG_5G        0x01
458 /** 2.4 G band */
459 #define BAND_CONFIG_2G		  0x00
460 /** MAX BG channel */
461 #define MAX_BG_CHANNEL 14
462 /** mlan_bss_param
463  * Note: For each entry you must enter an invalid value
464  * in the MOAL function woal_set_sys_config_invalid_data().
465  * Otherwise for a valid data an unwanted TLV will be
466  * added to that command.
467  */
468 
469 /**ethernet II header len*/
470 #define ETHII_HEADER_LEN  (14)
471 
472 /** The bit to indicate the key is for unicast */
473 #define MLAN_KEY_INDEX_UNICAST        0x40000000
474 /** The key index to indicate default key */
475 #define MLAN_KEY_INDEX_DEFAULT        0x000000ff
476 /** Maximum key length */
477 /* #define MLAN_MAX_KEY_LENGTH        32 */
478 /** Minimum passphrase length */
479 #define MLAN_MIN_PASSPHRASE_LENGTH    8
480 /** Maximum passphrase length */
481 #define MLAN_MAX_PASSPHRASE_LENGTH    63
482 /** PMK length */
483 #define MLAN_PMK_HEXSTR_LENGTH        64
484 /* A few details needed for WEP (Wireless Equivalent Privacy) */
485 /** 104 bits */
486 #define MAX_WEP_KEY_SIZE	13
487 /** 40 bits RC4 - WEP */
488 #define MIN_WEP_KEY_SIZE	5
489 /** packet number size */
490 #define PN_SIZE			16
491 /** max seq size of wpa/wpa2 key */
492 #define SEQ_MAX_SIZE        8
493 
494 /** key flag for tx_seq */
495 #define KEY_FLAG_TX_SEQ_VALID	0x00000001
496 /** key flag for rx_seq */
497 #define KEY_FLAG_RX_SEQ_VALID	0x00000002
498 /** key flag for group key */
499 #define KEY_FLAG_GROUP_KEY      0x00000004
500 /** key flag for tx */
501 #define KEY_FLAG_SET_TX_KEY     0x00000008
502 /** key flag for mcast IGTK */
503 #define KEY_FLAG_AES_MCAST_IGTK 0x00000010
504 /** key flag for remove key */
505 #define KEY_FLAG_REMOVE_KEY     0x80000000
506 /** Type definition of mlan_ds_encrypt_key for MLAN_OID_SEC_CFG_ENCRYPT_KEY */
507 typedef struct _mlan_ds_encrypt_key {
508     /** Key disabled, all other fields will be
509      *  ignore when this flag set to MTRUE
510      */
511 	t_u32 key_disable;
512     /** key removed flag, when this flag is set
513      *  to MTRUE, only key_index will be check
514      */
515 	t_u32 key_remove;
516     /** Key index, used as current tx key index
517      *  when is_current_wep_key is set to MTRUE
518      */
519 	t_u32 key_index;
520     /** Current Tx key flag */
521 	t_u32 is_current_wep_key;
522     /** Key length */
523 	t_u32 key_len;
524     /** Key */
525 	t_u8 key_material[MLAN_MAX_KEY_LENGTH];
526     /** mac address */
527 	t_u8 mac_addr[MLAN_MAC_ADDR_LENGTH];
528     /** wapi key flag */
529 	t_u32 is_wapi_key;
530     /** Initial packet number */
531 	t_u8 pn[PN_SIZE];
532     /** key flags */
533 	t_u32 key_flags;
534 } mlan_ds_encrypt_key, *pmlan_ds_encrypt_key;
535 
536 /** mlan_deauth_param */
537 typedef struct _mlan_deauth_param {
538     /** STA mac addr */
539 	t_u8 mac_addr[MLAN_MAC_ADDR_LENGTH];
540     /** deauth reason */
541 	t_u16 reason_code;
542 } mlan_deauth_param;
543 
544 /** Enumeration for PSK */
545 enum _mlan_psk_type {
546 	MLAN_PSK_PASSPHRASE = 1,
547 	MLAN_PSK_PMK,
548 	MLAN_PSK_CLEAR,
549 	MLAN_PSK_QUERY,
550 };
551 /** Type definition of mlan_passphrase_t */
552 typedef struct _mlan_passphrase_t {
553     /** Length of passphrase */
554 	t_u32 passphrase_len;
555     /** Passphrase */
556 	t_u8 passphrase[MLAN_MAX_PASSPHRASE_LENGTH];
557 } mlan_passphrase_t;
558 
559 /** Maximum PMK R0 NAME key length */
560 #define MLAN_MAX_PMKR0_NAME_LENGTH      16
561 
562 /** Type defnition of mlan_pmk_t */
563 typedef struct _mlan_pmk_t {
564     /** PMK */
565 	t_u8 pmk[MLAN_MAX_KEY_LENGTH];
566 	t_u8 pmk_r0[MLAN_MAX_KEY_LENGTH];
567 	t_u8 pmk_r0_name[MLAN_MAX_PMKR0_NAME_LENGTH];
568 } mlan_pmk_t;
569 
570 /** Type definition of mlan_ds_passphrase for MLAN_OID_SEC_CFG_PASSPHRASE */
571 typedef struct _mlan_ds_passphrase {
572     /** SSID may be used */
573 	mlan_802_11_ssid ssid;
574     /** BSSID may be used */
575 	mlan_802_11_mac_addr bssid;
576     /** Flag for passphrase or pmk used */
577 	t_u16 psk_type;
578     /** Passphrase or PMK */
579 	union {
580 	/** Passphrase */
581 		mlan_passphrase_t passphrase;
582 	/** PMK */
583 		mlan_pmk_t pmk;
584 	} psk;
585 } mlan_ds_passphrase, *pmlan_ds_passphrase;
586 
587 /** mlan_ssid_bssid  data structure for
588  *  MLAN_OID_BSS_START and MLAN_OID_BSS_FIND_BSS
589  */
590 typedef struct _mlan_ssid_bssid {
591     /** SSID */
592 	mlan_802_11_ssid ssid;
593     /** BSSID */
594 	mlan_802_11_mac_addr bssid;
595     /** index in BSSID list, start from 1 */
596 	t_u32 idx;
597     /** Receive signal strength in dBm */
598 	t_s32 rssi;
599     /**channel*/
600 	t_u16 channel;
601     /**mobility domain value*/
602 	t_u16 ft_md;
603     /**ft capability*/
604 	t_u8 ft_cap;
605     /**band*/
606 	t_u16 bss_band;
607 	t_u32 channel_flags;
608 } mlan_ssid_bssid;
609 
610 /** Channel List Entry */
611 typedef struct _channel_list {
612     /** Channel Number */
613 	t_u8 chan_number;
614     /** Band Config */
615 	BandConfig_t bandcfg;
616 } scan_chan_list;
617 
618 /** Data structure of WMM Aci/Aifsn */
619 typedef struct _wmm_aci_aifsn_t {
620 #ifdef BIG_ENDIAN_SUPPORT
621     /** Reserved */
622 	t_u8 reserved:1;
623     /** Aci */
624 	t_u8 aci:2;
625     /** Acm */
626 	t_u8 acm:1;
627     /** Aifsn */
628 	t_u8 aifsn:4;
629 #else
630     /** Aifsn */
631 	t_u8 aifsn:4;
632     /** Acm */
633 	t_u8 acm:1;
634     /** Aci */
635 	t_u8 aci:2;
636     /** Reserved */
637 	t_u8 reserved:1;
638 #endif				/* BIG_ENDIAN_SUPPORT */
639 } wmm_aci_aifsn_t, *pwmm_aci_aifsn_t;
640 
641 /** Data structure of WMM AC parameters  */
642 typedef struct _wmm_ac_parameters_t {
643 	wmm_aci_aifsn_t aci_aifsn;   /**< AciAifSn */
644 	wmm_ecw_t ecw;		   /**< Ecw */
645 	t_u16 tx_op_limit;		      /**< Tx op limit */
646 } wmm_ac_parameters_t, *pwmm_ac_parameters_t;
647 
648 /** Data structure of WMM parameter IE  */
649 typedef struct _wmm_parameter_t {
650     /** OuiType:  00:50:f2:02 */
651 	t_u8 ouitype[4];
652     /** Oui subtype: 01 */
653 	t_u8 ouisubtype;
654     /** version: 01 */
655 	t_u8 version;
656     /** QoS information */
657 	t_u8 qos_info;
658     /** Reserved */
659 	t_u8 reserved;
660     /** AC Parameters Record WMM_AC_BE, WMM_AC_BK, WMM_AC_VI, WMM_AC_VO */
661 	wmm_ac_parameters_t ac_params[MAX_AC_QUEUES];
662 } wmm_parameter_t, *pwmm_parameter_t;
663 
664 typedef struct _mlan_uap_bss_param {
665     /** AP mac addr */
666 	mlan_802_11_mac_addr mac_addr;
667     /** SSID */
668 	mlan_802_11_ssid ssid;
669     /** Broadcast ssid control */
670 	t_u8 bcast_ssid_ctl;
671     /** Radio control: on/off */
672 	t_u8 radio_ctl;
673     /** dtim period */
674 	t_u8 dtim_period;
675     /** beacon period */
676 	t_u16 beacon_period;
677     /** rates */
678 	t_u8 rates[MAX_DATA_RATES];
679     /** Tx data rate */
680 	t_u16 tx_data_rate;
681     /** Tx beacon rate */
682 	t_u16 tx_beacon_rate;
683     /** multicast/broadcast data rate */
684 	t_u16 mcbc_data_rate;
685     /** Tx power level in dBm */
686 	t_u8 tx_power_level;
687     /** Tx antenna */
688 	t_u8 tx_antenna;
689     /** Rx antenna */
690 	t_u8 rx_antenna;
691     /** packet forward control */
692 	t_u8 pkt_forward_ctl;
693     /** max station count */
694 	t_u16 max_sta_count;
695     /** mac filter */
696 	mac_filter filter;
697     /** station ageout timer in unit of 100ms  */
698 	t_u32 sta_ageout_timer;
699     /** PS station ageout timer in unit of 100ms  */
700 	t_u32 ps_sta_ageout_timer;
701     /** RTS threshold */
702 	t_u16 rts_threshold;
703     /** fragmentation threshold */
704 	t_u16 frag_threshold;
705     /**  retry_limit */
706 	t_u16 retry_limit;
707     /**  pairwise update timeout in milliseconds */
708 	t_u32 pairwise_update_timeout;
709     /** pairwise handshake retries */
710 	t_u32 pwk_retries;
711     /**  groupwise update timeout in milliseconds */
712 	t_u32 groupwise_update_timeout;
713     /** groupwise handshake retries */
714 	t_u32 gwk_retries;
715     /** preamble type */
716 	t_u8 preamble_type;
717     /** band cfg */
718 	BandConfig_t band_cfg;
719     /** channel */
720 	t_u8 channel;
721     /** auth mode */
722 	t_u16 auth_mode;
723     /** encryption protocol */
724 	t_u16 protocol;
725     /** key managment type */
726 	t_u16 key_mgmt;
727     /** wep param */
728 	wep_param wep_cfg;
729     /** wpa param */
730 	wpa_param wpa_cfg;
731     /** Mgmt IE passthru mask */
732 	t_u32 mgmt_ie_passthru_mask;
733 	/*
734 	 * 11n HT Cap  HTCap_t  ht_cap
735 	 */
736     /** HT Capabilities Info field */
737 	t_u16 ht_cap_info;
738     /** A-MPDU Parameters field */
739 	t_u8 ampdu_param;
740     /** Supported MCS Set field */
741 	t_u8 supported_mcs_set[16];
742     /** HT Extended Capabilities field */
743 	t_u16 ht_ext_cap;
744     /** Transmit Beamforming Capabilities field */
745 	t_u32 tx_bf_cap;
746     /** Antenna Selection Capability field */
747 	t_u8 asel;
748     /** Enable 2040 Coex */
749 	t_u8 enable_2040coex;
750     /** key management operation */
751 	t_u16 key_mgmt_operation;
752     /** BSS status */
753 	t_u16 bss_status;
754 #ifdef WIFI_DIRECT_SUPPORT
755 	/* pre shared key */
756 	t_u8 psk[MLAN_MAX_KEY_LENGTH];
757 #endif				/* WIFI_DIRECT_SUPPORT */
758     /** Number of channels in scan_channel_list */
759 	t_u32 num_of_chan;
760     /** scan channel list in ACS mode */
761 	scan_chan_list chan_list[MLAN_MAX_CHANNEL];
762     /** Wmm parameters */
763 	wmm_parameter_t wmm_para;
764 
765 } mlan_uap_bss_param;
766 #endif
767 
768 /** Enumeration for authentication mode */
769 enum _mlan_auth_mode {
770 	MLAN_AUTH_MODE_OPEN = 0x00,
771 	MLAN_AUTH_MODE_SHARED = 0x01,
772 	MLAN_AUTH_MODE_FT = 0x02,
773 	MLAN_AUTH_MODE_NETWORKEAP = 0x80,
774 	MLAN_AUTH_MODE_AUTO = 0xFF,
775 };
776 
777 #ifdef UAP_SUPPORT
778 /** TxPD descriptor */
779 typedef MLAN_PACK_START struct _UapTxPD {
780 	/** BSS type */
781 	t_u8 bss_type;
782 	/** BSS number */
783 	t_u8 bss_num;
784 	/** Tx packet length */
785 	t_u16 tx_pkt_length;
786 	/** Tx packet offset */
787 	t_u16 tx_pkt_offset;
788 	/** Tx packet type */
789 	t_u16 tx_pkt_type;
790 	/** Tx Control */
791 	t_u32 tx_control;
792 	/** Pkt Priority */
793 	t_u8 priority;
794 	/** Transmit Pkt Flags*/
795 	t_u8 flags;
796     /** Amount of time the packet has been queued
797       * in the driver (units = 2ms)*/
798 	t_u8 pkt_delay_2ms;
799     /** reserved */
800 	t_u8 reserved;
801     /** Tx Control */
802 	t_u32 tx_control_1;
803 } MLAN_PACK_END UapTxPD, *PUapTxPD;
804 
805 /** RxPD Descriptor */
806 typedef MLAN_PACK_START struct _UapRxPD {
807     /** BSS Type */
808 	t_u8 bss_type;
809     /** BSS number*/
810 	t_u8 bss_num;
811     /** Rx packet length */
812 	t_u16 rx_pkt_length;
813     /** Rx packet offset */
814 	t_u16 rx_pkt_offset;
815     /** Rx packet type */
816 	t_u16 rx_pkt_type;
817     /** Sequence nunmber */
818 	t_u16 seq_num;
819     /** Packet Priority */
820 	t_u8 priority;
821     /** Rx Packet Rate */
822 	t_u8 rx_rate;
823     /** SNR */
824 	t_s8 snr;
825     /** Noise Floor */
826 	t_s8 nf;
827     /** [Bit 1] [Bit 0] RxRate format: legacy rate = 00 HT = 01 VHT = 10
828      *  [Bit 3] [Bit 2] HT/VHT Bandwidth BW20 = 00 BW40 = 01 BW80 = 10 BW160 = 11
829      *  [Bit 4] HT/VHT Guard interval LGI = 0 SGI = 1
830      *  [Bit 5] STBC support Enabled = 1
831      *  [Bit 6] LDPC support Enabled = 1
832      *  [Bit 7] Reserved */
833 	t_u8 rate_info;
834     /** Reserved */
835 	t_u8 reserved1[3];
836     /** TDLS flags, bit 0: 0=InfraLink, 1=DirectLink */
837 	t_u8 flags;
838     /** For SD8887 ntenna info: 0 = 2.4G antenna a; 1 = 2.4G antenna b; 3 = 5G antenna; 0xff = invalid value */
839 	t_u8 antenna;
840 	/* [31:0] ToA of the rx packet, [63:32] ToD of the ack for the rx packet Both ToA and ToD are in nanoseconds */
841 	t_u64 toa_tod_tstamps;
842     /** rx info */
843 	t_u32 rx_info;
844 } MLAN_PACK_END UapRxPD, *PUapRxPD;
845 #endif /* UAP_SUPPORT */
846 
847 /* ####################
848      From mlan_main.h
849    #################### */
850 
851 /** 16 bits byte swap */
852 #define swap_byte_16(x) \
853 ((t_u16)((((t_u16)(x) & 0x00ffU) << 8) | \
854 		 (((t_u16)(x) & 0xff00U) >> 8)))
855 
856 /** 32 bits byte swap */
857 #define swap_byte_32(x) \
858 ((t_u32)((((t_u32)(x) & 0x000000ffUL) << 24) | \
859 	 (((t_u32)(x) & 0x0000ff00UL) <<  8) | \
860 	 (((t_u32)(x) & 0x00ff0000UL) >>  8) | \
861 	 (((t_u32)(x) & 0xff000000UL) >> 24)))
862 
863 /** 64 bits byte swap */
864 #define swap_byte_64(x) \
865 ((t_u64)((t_u64)(((t_u64)(x) & 0x00000000000000ffULL) << 56) | \
866 	     (t_u64)(((t_u64)(x) & 0x000000000000ff00ULL) << 40) | \
867 	     (t_u64)(((t_u64)(x) & 0x0000000000ff0000ULL) << 24) | \
868 	     (t_u64)(((t_u64)(x) & 0x00000000ff000000ULL) <<  8) | \
869 	     (t_u64)(((t_u64)(x) & 0x000000ff00000000ULL) >>  8) | \
870 	     (t_u64)(((t_u64)(x) & 0x0000ff0000000000ULL) >> 24) | \
871 	     (t_u64)(((t_u64)(x) & 0x00ff000000000000ULL) >> 40) | \
872 	     (t_u64)(((t_u64)(x) & 0xff00000000000000ULL) >> 56)))
873 
874 #ifdef BIG_ENDIAN_SUPPORT
875 /** Convert ulong n/w to host */
876 #define mlan_ntohl(x) x
877 /** Convert host ulong to n/w */
878 #define mlan_htonl(x) x
879 /** Convert n/w to host */
880 #define mlan_ntohs(x)  x
881 /** Convert host to n/w */
882 #define mlan_htons(x)  x
883 /** Convert from 16 bit little endian format to CPU format */
884 #define wlan_le16_to_cpu(x) swap_byte_16(x)
885 /** Convert from 32 bit little endian format to CPU format */
886 #define wlan_le32_to_cpu(x) swap_byte_32(x)
887 /** Convert from 64 bit little endian format to CPU format */
888 #define wlan_le64_to_cpu(x) swap_byte_64(x)
889 /** Convert to 16 bit little endian format from CPU format */
890 #define wlan_cpu_to_le16(x) swap_byte_16(x)
891 /** Convert to 32 bit little endian format from CPU format */
892 #define wlan_cpu_to_le32(x) swap_byte_32(x)
893 /** Convert to 64 bit little endian format from CPU format */
894 #define wlan_cpu_to_le64(x) swap_byte_64(x)
895 
896 /** Convert TxPD to little endian format from CPU format */
897 #define endian_convert_TxPD(x)                                          \
898 	{                                                                   \
899 	    (x)->tx_pkt_length = wlan_cpu_to_le16((x)->tx_pkt_length);      \
900 	    (x)->tx_pkt_offset = wlan_cpu_to_le16((x)->tx_pkt_offset);      \
901 	    (x)->tx_pkt_type   = wlan_cpu_to_le16((x)->tx_pkt_type);        \
902 	    (x)->tx_control    = wlan_cpu_to_le32((x)->tx_control);         \
903         (x)->tx_control_1  = wlan_cpu_to_le32((x)->tx_control_1);         \
904 	}
905 /** Convert RxPD from little endian format to CPU format */
906 #define endian_convert_RxPD(x)                                          \
907 	{                                                                   \
908 	    (x)->rx_pkt_length = wlan_le16_to_cpu((x)->rx_pkt_length);      \
909 	    (x)->rx_pkt_offset = wlan_le16_to_cpu((x)->rx_pkt_offset);      \
910 	    (x)->rx_pkt_type   = wlan_le16_to_cpu((x)->rx_pkt_type);        \
911 	    (x)->seq_num       = wlan_le16_to_cpu((x)->seq_num);            \
912         (x)->rx_info       = wlan_le32_to_cpu((x)->rx_info);            \
913 	}
914 /** Convert RxPD extra header from little endian format to CPU format */
915 #define endian_convert_RxPD_extra_header(x)                                          \
916 	{                                                                   \
917 	    (x)->channel_flags = wlan_le16_to_cpu((x)->channel_flags);      \
918 	}
919 #else
920 /** Convert ulong n/w to host */
921 #define mlan_ntohl(x) swap_byte_32(x)
922 /** Convert host ulong to n/w */
923 #define mlan_htonl(x) swap_byte_32(x)
924 /** Convert n/w to host */
925 #define mlan_ntohs(x) swap_byte_16(x)
926 /** Convert host to n/w */
927 #define mlan_htons(x) swap_byte_16(x)
928 /** Do nothing */
929 #define wlan_le16_to_cpu(x) x
930 /** Do nothing */
931 #define wlan_le32_to_cpu(x) x
932 /** Do nothing */
933 #define wlan_le64_to_cpu(x) x
934 /** Do nothing */
935 #define wlan_cpu_to_le16(x) x
936 /** Do nothing */
937 #define wlan_cpu_to_le32(x) x
938 /** Do nothing */
939 #define wlan_cpu_to_le64(x) x
940 
941 /** Convert TxPD to little endian format from CPU format */
942 #define endian_convert_TxPD(x)  do {} while (0)
943 /** Convert RxPD from little endian format to CPU format */
944 #define endian_convert_RxPD(x)  do {} while (0)
945 /** Convert RxPD extra header from little endian format to CPU format */
946 #define endian_convert_RxPD_extra_header(x)  do {} while (0)
947 #endif /* BIG_ENDIAN_SUPPORT */
948 
949 /** Find minimum */
950 #ifndef MIN
951 #define MIN(a, b)    ((a) < (b) ? (a) : (b))
952 #endif
953 
954 /** Find maximum */
955 #ifndef MAX
956 #define MAX(a, b)    ((a) > (b) ? (a) : (b))
957 #endif
958 
959 #ifdef memset
960 #undef memset
961 #endif
962 /** Memset routine */
963 #define memset(mpl_utils, s, c, len) \
964 	(mpl_utils->moal_memset(mpl_utils->pmoal_handle, s, c, len))
965 
966 #ifdef memmove
967 #undef memmove
968 #endif
969 /** Memmove routine */
970 #define memmove(mpl_utils, dest, src, len) \
971 	(mpl_utils->moal_memmove(mpl_utils->pmoal_handle, dest, src, len))
972 
973 #ifdef memcpy
974 #undef memcpy
975 #endif
976 /** Memcpy routine */
977 #define memcpy(mpl_utils, to, from, len) \
978 	(mpl_utils->moal_memcpy(mpl_utils->pmoal_handle, to, from, len))
979 
980 #ifdef memcmp
981 #undef memcmp
982 #endif
983 /** Memcmp routine */
984 #define memcmp(mpl_utils, s1, s2, len) \
985 	(mpl_utils->moal_memcmp(mpl_utils->pmoal_handle, s1, s2, len))
986 
987 /** Find number of elements */
988 #ifndef NELEMENTS
989 #define NELEMENTS(x)    (sizeof(x)/sizeof(x[0]))
990 #endif
991 
992 #define MOAL_ALLOC_MLAN_BUFFER  (0)
993 #define MOAL_MALLOC_BUFFER      (1)
994 
995 /* ##################
996      From mlan_fw.h
997    ################## */
998 /** TxPD descriptor */
999 typedef MLAN_PACK_START struct _TxPD {
1000     /** BSS type */
1001 	t_u8 bss_type;
1002     /** BSS number */
1003 	t_u8 bss_num;
1004     /** Tx packet length */
1005 	t_u16 tx_pkt_length;
1006     /** Tx packet offset */
1007 	t_u16 tx_pkt_offset;
1008     /** Tx packet type */
1009 	t_u16 tx_pkt_type;
1010     /** Tx Control */
1011 	t_u32 tx_control;
1012     /** Pkt Priority */
1013 	t_u8 priority;
1014     /** Transmit Pkt Flags*/
1015 	t_u8 flags;
1016     /** Amount of time the packet has been queued
1017       * in the driver (units = 2ms)*/
1018 	t_u8 pkt_delay_2ms;
1019     /** reserved */
1020 	t_u8 reserved;
1021     /** Tx Control */
1022 	t_u32 tx_control_1;
1023 } MLAN_PACK_END TxPD, *PTxPD;
1024 
1025 /** 2K buf size */
1026 #define MLAN_TX_DATA_BUF_SIZE_2K        2048
1027 
1028 /* ####################
1029      From mlan_decl.h
1030    #################### */
1031 
1032 /** IN parameter */
1033 #define IN
1034 /** OUT parameter */
1035 #define OUT
1036 
1037 /** BIT value */
1038 #define MBIT(x)    (((t_u32)1) << (x))
1039 
1040 #ifdef DEBUG_LEVEL1
1041 /** Debug level bit definition */
1042 #define	MMSG        MBIT(0)
1043 #define MFATAL      MBIT(1)
1044 #define MERROR      MBIT(2)
1045 #define MDATA       MBIT(3)
1046 #define MCMND       MBIT(4)
1047 #define MEVENT      MBIT(5)
1048 #define MINTR       MBIT(6)
1049 #define MIOCTL      MBIT(7)
1050 
1051 #define MMPA_D      MBIT(15)
1052 #define MDAT_D      MBIT(16)
1053 #define MCMD_D      MBIT(17)
1054 #define MEVT_D      MBIT(18)
1055 #define MFW_D       MBIT(19)
1056 #define MIF_D       MBIT(20)
1057 
1058 #define MENTRY      MBIT(28)
1059 #define MWARN       MBIT(29)
1060 #define MINFO       MBIT(30)
1061 #define MHEX_DUMP   MBIT(31)
1062 #endif /* DEBUG_LEVEL1 */
1063 
1064 /** Wait until a condition becomes true */
1065 #define MASSERT(cond)                   \
1066 do {                                    \
1067 	if (!(cond)) {                      \
1068 		PRINTM(MFATAL, "ASSERT: %s: %i\n", __FUNCTION__, __LINE__); \
1069 	}                                   \
1070 } while (0)
1071 
1072 /** Log entry point for debugging */
1073 #define ENTER()      PRINTM(MENTRY, "Enter: %s\n", __FUNCTION__)
1074 /** Log exit point for debugging */
1075 #define LEAVE()      PRINTM(MENTRY, "Leave: %s\n", __FUNCTION__)
1076 
1077 /* ####################
1078      From mlan_main.h
1079    #################### */
1080 
1081 #ifdef DEBUG_LEVEL1
1082 extern t_void (*print_callback) (IN t_void *pmoal_handle,
1083 				 IN t_u32 level, IN char *pformat, IN ...
1084 	);
1085 
1086 extern mlan_status (*get_sys_time_callback) (IN t_void *pmoal_handle,
1087 					     OUT t_u32 *psec, OUT t_u32 *pusec);
1088 
1089 extern t_u32 mlan_drvdbg;
1090 
1091 #ifdef DEBUG_LEVEL2
1092 #define PRINTM_MINFO(msg...)  do {if ((mlan_drvdbg & MINFO) && (print_callback)) \
1093 									print_callback(MNULL, MINFO, msg); } while (0)
1094 #define PRINTM_MWARN(msg...)  do {if ((mlan_drvdbg & MWARN) && (print_callback)) \
1095 									print_callback(MNULL, MWARN, msg); } while (0)
1096 #define PRINTM_MENTRY(msg...) do {if ((mlan_drvdbg & MENTRY) && (print_callback)) \
1097 									print_callback(MNULL, MENTRY, msg); } while (0)
1098 #define PRINTM_GET_SYS_TIME(level, psec, pusec)             \
1099 do {                                                        \
1100 	if ((level & mlan_drvdbg) && (get_sys_time_callback))        \
1101 		get_sys_time_callback(MNULL, psec, pusec);          \
1102 } while (0)
1103 
1104 /** Hexdump for level-2 debugging */
1105 #define HEXDUMP(x, y, z)   \
1106 do {                \
1107 	if ((mlan_drvdbg & (MHEX_DUMP | MINFO)) && (print_callback))  \
1108 		print_callback(MNULL, MHEX_DUMP | MINFO, x, y, z); \
1109 } while (0)
1110 
1111 #else
1112 
1113 #define PRINTM_MINFO(msg...)  do {} while (0)
1114 #define PRINTM_MWARN(msg...)  do {} while (0)
1115 #define PRINTM_MENTRY(msg...) do {} while (0)
1116 
1117 #define PRINTM_GET_SYS_TIME(level, psec, pusec)         \
1118 do {                                                    \
1119 	if ((level & mlan_drvdbg) && (get_sys_time_callback)     \
1120 			&& (level != MINFO) && (level != MWARN))    \
1121 		get_sys_time_callback(MNULL, psec, pusec);      \
1122 } while (0)
1123 
1124 /** Hexdump for debugging */
1125 #define HEXDUMP(x, y, z) do {} while (0)
1126 
1127 #endif /* DEBUG_LEVEL2 */
1128 
1129 #define PRINTM_MFW_D(msg...)  do {if ((mlan_drvdbg & MFW_D) && (print_callback)) \
1130 									print_callback(MNULL, MFW_D, msg); } while (0)
1131 #define PRINTM_MCMD_D(msg...) do {if ((mlan_drvdbg & MCMD_D) && (print_callback)) \
1132 									print_callback(MNULL, MCMD_D, msg); } while (0)
1133 #define PRINTM_MDAT_D(msg...) do {if ((mlan_drvdbg & MDAT_D) && (print_callback)) \
1134 									print_callback(MNULL, MDAT_D, msg); } while (0)
1135 #define PRINTM_MIF_D(msg...) do {if ((mlan_drvdbg & MIF_D) && (print_callback)) \
1136 									print_callback(MNULL, MIF_D, msg); } while (0)
1137 
1138 #define PRINTM_MIOCTL(msg...) do {if ((mlan_drvdbg & MIOCTL) && (print_callback)) \
1139 									print_callback(MNULL, MIOCTL, msg); } while (0)
1140 #define PRINTM_MINTR(msg...)  do {if ((mlan_drvdbg & MINTR) && (print_callback)) \
1141 									print_callback(MNULL, MINTR, msg); } while (0)
1142 #define PRINTM_MEVENT(msg...) do {if ((mlan_drvdbg & MEVENT) && (print_callback)) \
1143 									print_callback(MNULL, MEVENT, msg); } while (0)
1144 #define PRINTM_MCMND(msg...)  do {if ((mlan_drvdbg & MCMND) && (print_callback)) \
1145 									print_callback(MNULL, MCMND, msg); } while (0)
1146 #define PRINTM_MDATA(msg...)  do {if ((mlan_drvdbg & MDATA) && (print_callback)) \
1147 									print_callback(MNULL, MDATA, msg); } while (0)
1148 #define PRINTM_MERROR(msg...) do {if ((mlan_drvdbg & MERROR) && (print_callback)) \
1149 									print_callback(MNULL, MERROR, msg); } while (0)
1150 #define PRINTM_MFATAL(msg...) do {if ((mlan_drvdbg & MFATAL) && (print_callback)) \
1151 									print_callback(MNULL, MFATAL, msg); } while (0)
1152 #define PRINTM_MMSG(msg...)   do {if ((mlan_drvdbg & MMSG) && (print_callback)) \
1153 									print_callback(MNULL, MMSG, msg); } while (0)
1154 
1155 #define PRINTM(level, msg...) PRINTM_##level((char *)msg)
1156 
1157 /** Log debug message */
1158 #ifdef __GNUC__
1159 #define PRINTM_NETINTF(level, pmu, pml)   \
1160 do {                                    \
1161 	if ((mlan_drvdbg & level) && pmu && pml      \
1162 			&& pmu->moal_print_netintf) \
1163 		pmu->moal_print_netintf( \
1164 			pmu->pmoal_handle, \
1165 			pml->bss_index, level); \
1166 } while (0)
1167 #endif /* __GNUC__ */
1168 
1169 /** Max hex dump data length */
1170 #define MAX_DATA_DUMP_LEN     64
1171 
1172 /** Debug hexdump for level-1 debugging */
1173 #define DBG_HEXDUMP(level, x, y, z)   \
1174 do {                \
1175 	if ((mlan_drvdbg & level) && print_callback)  \
1176 		print_callback(MNULL, MHEX_DUMP | level, x, y, z); \
1177 } while (0)
1178 
1179 #else /* DEBUG_LEVEL1 */
1180 
1181 #define PRINTM(level, msg...) do {} while (0)
1182 
1183 #define PRINTM_NETINTF(level, pmpriv) do {} while (0)
1184 
1185 /** Debug hexdump for level-1 debugging */
1186 #define DBG_HEXDUMP(level, x, y, z) do {} while (0)
1187 
1188 /** Hexdump for debugging */
1189 #define HEXDUMP(x, y, z) do {} while (0)
1190 
1191 #define PRINTM_GET_SYS_TIME(level, psec, pusec) do { } while (0)
1192 
1193 #endif /* DEBUG_LEVEL1 */
1194 
1195 /* #######################################################
1196      embedded authenticator and supplicant specific
1197    ################ ########################################*/
1198 
1199 /** Get_system_time routine */
1200 #define get_system_time(mpl_utils, psec, pusec) \
1201 	(mpl_utils->moal_get_system_time(mpl_utils->pmoal_handle, psec, pusec))
1202 
1203 /** malloc routine */
1204 #ifdef malloc
1205 #undef malloc
1206 #endif
1207 #define malloc(mpl_utils, len, pptr) \
1208 	(mpl_utils->moal_malloc(mpl_utils->pmoal_handle, len, MLAN_MEM_DEF, pptr))
1209 
1210 /** free routine */
1211 #ifdef free
1212 #undef free
1213 #endif
1214 #define free(mpl_utils, ptr) \
1215 	(mpl_utils->moal_mfree(mpl_utils->pmoal_handle, ptr))
1216 
1217 #endif /* _HOSTSA_EXT_DEF_H_ */
1218