3 * @brief Header file for uaputl application
5 * Copyright (C) 2008-2009, Marvell International Ltd.
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 along with the File in the gpl.txt file or by writing to
12 * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
13 * 02111-1307 or on the worldwide web at http://www.gnu.org/licenses/gpl.txt.
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.
21 /************************************************************************
23 03/01/08: Initial creation
24 ************************************************************************/
29 #if (BYTE_ORDER == LITTLE_ENDIAN)
33 /** 16 bits byte swap */
34 #define swap_byte_16(x) \
35 ((u16)((((u16)(x) & 0x00ffU) << 8) | \
36 (((u16)(x) & 0xff00U) >> 8)))
38 /** 32 bits byte swap */
39 #define swap_byte_32(x) \
40 ((u32)((((u32)(x) & 0x000000ffUL) << 24) | \
41 (((u32)(x) & 0x0000ff00UL) << 8) | \
42 (((u32)(x) & 0x00ff0000UL) >> 8) | \
43 (((u32)(x) & 0xff000000UL) >> 24)))
45 /** 64 bits byte swap */
46 #define swap_byte_64(x) \
47 ((u64)((u64)(((u64)(x) & 0x00000000000000ffULL) << 56) | \
48 (u64)(((u64)(x) & 0x000000000000ff00ULL) << 40) | \
49 (u64)(((u64)(x) & 0x0000000000ff0000ULL) << 24) | \
50 (u64)(((u64)(x) & 0x00000000ff000000ULL) << 8) | \
51 (u64)(((u64)(x) & 0x000000ff00000000ULL) >> 8) | \
52 (u64)(((u64)(x) & 0x0000ff0000000000ULL) >> 24) | \
53 (u64)(((u64)(x) & 0x00ff000000000000ULL) >> 40) | \
54 (u64)(((u64)(x) & 0xff00000000000000ULL) >> 56) ))
57 /** Convert from 16 bit little endian format to CPU format */
58 #define uap_le16_to_cpu(x) swap_byte_16(x)
59 /** Convert from 32 bit little endian format to CPU format */
60 #define uap_le32_to_cpu(x) swap_byte_32(x)
61 /** Convert from 64 bit little endian format to CPU format */
62 #define uap_le64_to_cpu(x) swap_byte_64(x)
63 /** Convert to 16 bit little endian format from CPU format */
64 #define uap_cpu_to_le16(x) swap_byte_16(x)
65 /** Convert to 32 bit little endian format from CPU format */
66 #define uap_cpu_to_le32(x) swap_byte_32(x)
67 /** Convert to 64 bit little endian format from CPU format */
68 #define uap_cpu_to_le64(x) swap_byte_64(x)
70 /** Convert APCMD header to little endian format from CPU format */
71 #define endian_convert_request_header(x); \
73 (x)->CmdCode = uap_cpu_to_le16((x)->CmdCode); \
74 (x)->Size = uap_cpu_to_le16((x)->Size); \
75 (x)->SeqNum = uap_cpu_to_le16((x)->SeqNum); \
76 (x)->Result = uap_cpu_to_le16((x)->Result); \
79 /** Convert APCMD header from little endian format to CPU format */
80 #define endian_convert_response_header(x); \
82 (x)->CmdCode = uap_le16_to_cpu((x)->CmdCode); \
83 (x)->Size = uap_le16_to_cpu((x)->Size); \
84 (x)->SeqNum = uap_le16_to_cpu((x)->SeqNum); \
85 (x)->Result = uap_le16_to_cpu((x)->Result); \
88 /** Convert TLV header to little endian format from CPU format */
89 #define endian_convert_tlv_header_out(x); \
91 (x)->Tag = uap_cpu_to_le16((x)->Tag); \
92 (x)->Length = uap_cpu_to_le16((x)->Length); \
95 /** Convert TLV header from little endian format to CPU format */
96 #define endian_convert_tlv_header_in(x); \
98 (x)->Tag = uap_le16_to_cpu((x)->Tag); \
99 (x)->Length = uap_le16_to_cpu((x)->Length); \
102 #else /* BIG_ENDIAN */
104 #define uap_le16_to_cpu(x) x
106 #define uap_le32_to_cpu(x) x
108 #define uap_le64_to_cpu(x) x
110 #define uap_cpu_to_le16(x) x
112 #define uap_cpu_to_le32(x) x
114 #define uap_cpu_to_le64(x) x
117 #define endian_convert_request_header(x)
119 #define endian_convert_response_header(x)
121 #define endian_convert_tlv_header_out(x)
123 #define endian_convert_tlv_header_in(x)
124 #endif /* BIG_ENDIAN */
126 /** uAP application version string */
127 #define UAP_VERSION "1.12"
128 /** Host Command ioctl number */
129 #define UAPHOSTCMD (SIOCDEVPRIVATE + 1)
130 /** Private command ID to Power Mode */
131 #define UAP_POWER_MODE (SIOCDEVPRIVATE + 3)
133 /** Default device name */
134 #define DEFAULT_DEV_NAME "uap0"
137 #define UAP_SUCCESS 1
139 #define UAP_FAILURE 0
141 #define UAP_RET_MAC_BROADCAST 0x1FF
143 #define UAP_RET_MAC_MULTICAST 0x1FE
145 /** Command is successful */
146 #define CMD_SUCCESS 0
148 #define CMD_FAILURE -1
150 /** BSS start error : Invalid parameters */
151 #define BSS_FAILURE_START_INVAL -2
152 /** BSS start error : BSS already started */
153 #define BSS_FAILURE_START_REDUNDANT -3
155 /** BSS stop error : BSS already stopped */
156 #define BSS_FAILURE_STOP_REDUNDANT -2
157 /** BSS stop error : No active BSS */
158 #define BSS_FAILURE_STOP_INVAL -3
160 /** Maximum line length for config file */
161 #define MAX_LINE_LENGTH 240
162 /** Maximum command length */
163 #define MAX_CMD_LENGTH 100
164 /** Size of command buffer */
165 #define MRVDRV_SIZE_OF_CMD_BUFFER (2 * 1024)
166 /** Maximum number of clients supported by AP */
167 #define MAX_NUM_CLIENTS 16
168 /** Maximum number of MAC addresses for one-shot filter modifications */
169 #define MAX_MAC_ONESHOT_FILTER 16
170 /** Maximum SSID length */
171 #define MAX_SSID_LENGTH 32
172 /** Maximum SSID length */
173 #define MIN_SSID_LENGTH 1
174 /** Maximum WPA passphrase length */
175 #define MAX_WPA_PASSPHRASE_LENGTH 64
176 /** Minimum WPA passphrase length */
177 #define MIN_WPA_PASSPHRASE_LENGTH 8
178 /** Maximum data rates */
179 #define MAX_DATA_RATES 14
180 /** Maximum length of lines in configuration file */
181 #define MAX_CONFIG_LINE 240
182 /** MSB bit is set if its a basic rate */
183 #define BASIC_RATE_SET_BIT 0x80
184 /** Maximum group key timer */
185 #define MAX_GRP_TIMER 86400
186 /** Maximum Retry Limit */
187 #define MAX_RETRY_LIMIT 14
189 /** Maximum TX Power Limit */
190 #define MAX_TX_POWER 20
191 /** Minimum TX Power Limit */
192 #define MIN_TX_POWER 0
194 /** Maximum channels */
195 #define MAX_CHANNELS 14
196 /** Maximum RTS threshold */
197 #define MAX_RTS_THRESHOLD 2347
199 /** Maximum fragmentation threshold */
200 #define MAX_FRAG_THRESHOLD 2346
201 /** Minimum fragmentation threshold */
202 #define MIN_FRAG_THRESHOLD 256
204 /** Maximum stage out time */
205 #define MAX_STAGE_OUT_TIME 864000
206 /** Minimum stage out time */
207 #define MIN_STAGE_OUT_TIME 300
209 /** Maximum DTIM period */
210 #define MAX_DTIM_PERIOD 100
212 /** Maximum BEACON period */
213 #define MAX_BEACON_PERIOD 4000
215 /** Minimum BEACON period */
216 #define MIN_BEACON_PERIOD 50
218 /** Maximum IE buffer length */
219 #define MAX_IE_BUFFER_LEN 256
221 /** Maximum custom IE count */
222 #define MAX_CUSTOM_IE_COUNT 4
224 /** Maximum number of rates allowed at a time */
227 /** Default wait period in seconds */
228 #define DEFAULT_WAIT_TIME 3
231 /** Structure packing begins */
233 /** Structure packeing end */
234 #define PACK_END __attribute__ ((packed))
236 /** Structure packing begins */
237 #define PACK_START __packed
238 /** Structure packeing end */
243 /** MAC address length */
247 /** Action field value : get */
249 /** Action field value : set */
252 * Hex or Decimal to Integer
253 * @param num string to convert into decimal or hex
255 #define A2HEXDECIMAL(num) \
256 (strncasecmp("0x", (num), 2)?(unsigned int) strtoll((num),NULL,0):a2hex((num)))\
259 * Check of decimal or hex string
262 #define IS_HEX_OR_DIGIT(num) \
263 (strncasecmp("0x", (num), 2)?ISDIGIT((num)):ishexstring((num)))\
265 /** Find minimum value */
267 #define MIN(a, b) ((a) < (b) ? (a) : (b))
270 /** Character, 1 byte */
272 /** Unsigned character, 1 byte */
273 typedef unsigned char u8;
276 typedef signed short s16;
277 /** Unsigned short integer */
278 typedef unsigned short u16;
281 typedef signed long s32;
282 /** Unsigned long integer */
283 typedef unsigned long u32;
285 /** Valid Input Commands */
317 /** Message verbosity level */
319 { MSG_NONE, MSG_DEBUG, MSG_ALL };
332 /** 4 byte header to store buf len*/
333 #define BUF_HEADER_SIZE 4
336 #define APCMDHEADER /** Buf Size */ \
348 #define TLVHEADER /** Tag */ \
353 /* TLV Definitions */
355 /** TLV buffer header*/
356 typedef PACK_START struct _TLVBUF_HEADER
364 } PACK_END TLVBUF_HEADER;
366 /** Band config ACS mode */
367 #define BAND_CONFIG_ACS_MODE 0x40
369 /** TLV buffer : Channel Config */
370 typedef PACK_START struct _TLVBUF_CHANNEL_CONFIG
374 /** Band Configuration
376 * [7-6] Channel Selection Mode; 00 manual, 01 ACS
377 * [3-2] Channel Width; 00 20 MHz
378 * [1-0] Band Info; 00 2.4 GHz
381 /** Channel number */
383 } PACK_END TLVBUF_CHANNEL_CONFIG;
385 /** Channel List Entry */
386 typedef PACK_START struct _CHANNEL_LIST
390 /** Channel Number */
398 } PACK_END CHANNEL_LIST;
400 /** TLV buffer : Channel List */
401 typedef PACK_START struct _TLVBUF_CHANNEL_LIST
406 CHANNEL_LIST ChanList[0];
407 } PACK_END TLVBUF_CHANNEL_LIST;
409 /** TLV buffer : AP MAC address */
410 typedef PACK_START struct _TLVBUF_AP_MAC_ADDRESS
414 /** AP MAC address */
415 u8 ApMacAddr[ETH_ALEN];
416 } PACK_END TLVBUF_AP_MAC_ADDRESS;
418 /** TLV buffer : SSID */
419 typedef PACK_START struct _TLVBUF_SSID
425 } PACK_END TLVBUF_SSID;
427 /** TLV buffer : Beacon period */
428 typedef PACK_START struct _TLVBUF_BEACON_PERIOD
434 } PACK_END TLVBUF_BEACON_PERIOD;
436 /** TLV buffer : DTIM period */
437 typedef PACK_START struct _TLVBUF_DTIM_PERIOD
443 } PACK_END TLVBUF_DTIM_PERIOD;
445 /** TLV buffer : Channel */
446 typedef PACK_START struct _TLVBUF_PHYPARAMDSSET
452 } PACK_END TLVBUF_PHYPARAMDSSET;
454 /** TLV buffer : Operational rates */
455 typedef PACK_START struct _TLVBUF_RATES
459 /** Operational rates */
460 u8 OperationalRates[0];
461 } PACK_END TLVBUF_RATES;
463 /** TLV buffer : Tx power */
464 typedef PACK_START struct _TLVBUF_TX_POWER
468 /** Tx power in dBm */
470 } PACK_END TLVBUF_TX_POWER;
472 /** TLV buffer : SSID broadcast control */
473 typedef PACK_START struct _TLVBUF_BCAST_SSID_CTL
477 /** SSID broadcast control flag */
479 } PACK_END TLVBUF_BCAST_SSID_CTL;
481 /** TLV buffer : RSN replay protection */
482 typedef PACK_START struct _tlvbuf_rsn_replay_prot
486 /** RSN replay protection control flag */
488 } PACK_END tlvbuf_rsn_replay_prot;
490 /** TLV buffer : Preamble control */
491 typedef PACK_START struct _TLVBUF_PREAMBLE_CTL
497 } PACK_END TLVBUF_PREAMBLE_CTL;
499 /** TLV buffer : Antenna control */
500 typedef PACK_START struct _TLVBUF_ANTENNA_CTL
508 } PACK_END TLVBUF_ANTENNA_CTL;
510 /** TLV buffer : RTS threshold */
511 typedef PACK_START struct _TLVBUF_RTS_THRESHOLD
517 } PACK_END TLVBUF_RTS_THRESHOLD;
519 /** TLV buffer : Radio control */
520 typedef PACK_START struct _TLVBUF_RADIO_CTL
524 /** Radio control flag */
526 } PACK_END TLVBUF_RADIO_CTL;
528 /** TLV buffer : Tx data rate */
529 typedef PACK_START struct _TLVBUF_TX_DATA_RATE
535 } PACK_END TLVBUF_TX_DATA_RATE;
537 /** TLV buffer : MCBC Data Rate */
538 typedef PACK_START struct _TLVBUF_MCBC_DATA_RATE
542 /** MCBC data rate */
544 } PACK_END TLVBUF_MCBC_DATA_RATE;
546 /** TLV buffer : Packet forward control */
547 typedef PACK_START struct _TLVBUF_PKT_FWD_CTL
551 /** Packet forwarding control flag */
553 } PACK_END TLVBUF_PKT_FWD_CTL;
555 /** TLV buffer : STA information */
556 typedef PACK_START struct _TLVBUF_STA_INFO
560 /** STA MAC address */
561 u8 MacAddress[ETH_ALEN];
562 /** Power mfg status */
566 } PACK_END TLVBUF_STA_INFO;
568 /** TLV buffer : STA MAC address filtering control */
569 typedef PACK_START struct _TLVBUF_STA_MAC_ADDR_FILTER
575 /** Number of STA MACs */
577 /** STA MAC addresses buffer */
579 } PACK_END TLVBUF_STA_MAC_ADDR_FILTER;
581 /** TLV buffer : STA ageout timer */
582 typedef PACK_START struct _TLVBUF_STA_AGEOUT_TIMER
586 /** STA ageout timer in ms */
587 u32 StaAgeoutTimer_ms;
588 } PACK_END TLVBUF_STA_AGEOUT_TIMER;
590 /** TLV buffer : max station number */
591 typedef PACK_START struct _TLVBUF_MAX_STA_NUM
595 /** max station number */
597 } PACK_END TLVBUF_MAX_STA_NUM;
599 /** TLV buffer : retry limit */
600 typedef PACK_START struct _TLVBUF_RETRY_LIMIT
606 } PACK_END TLVBUF_RETRY_LIMIT;
608 /* Bitmap for protocol to use */
610 #define PROTOCOL_NO_SECURITY 1
612 #define PROTOCOL_STATIC_WEP 2
614 #define PROTOCOL_WPA 8
616 #define PROTOCOL_WPA2 32
618 #define PROTOCOL_WPA2_MIXED 40
620 /* Bitmap for unicast/bcast cipher type */
622 #define CIPHER_NONE 0
624 #define CIPHER_WEP_40 1
626 #define CIPHER_WEP_104 2
628 #define CIPHER_TKIP 4
630 #define CIPHER_AES_CCMP 8
631 /** valid cipher bitmap */
632 #define CIPHER_BITMAP 0x0c
634 /** TLV buffer : Authentication Mode */
635 typedef PACK_START struct _TLVBUF_AUTH_MODE
639 /** Authentication Mode */
641 } PACK_END TLVBUF_AUTH_MODE;
643 /** TLV buffer : Security Protocol */
644 typedef PACK_START struct _TLVBUF_PROTOCOL
648 /** Security protocol */
650 } PACK_END TLVBUF_PROTOCOL;
652 /** TLV buffer : cipher */
653 typedef PACK_START struct _TLVBUF_CIPHER
657 /** Pairwise cipher */
661 } PACK_END TLVBUF_CIPHER;
663 /** TLV buffer : Group re-key time */
664 typedef PACK_START struct _TLVBUF_GROUP_REKEY_TIMER
668 /** Group rekey time in seconds */
669 u32 GroupRekeyTime_sec;
670 } PACK_END TLVBUF_GROUP_REKEY_TIMER;
673 #define KEY_MGMT_NONE 0x04
675 #define KEY_MGMT_PSK 0x02
677 /** TLV buffer : KeyMgmt */
678 typedef PACK_START struct _TLVBUF_AKMP
684 } PACK_END TLVBUF_AKMP;
686 /** TLV buffer : Single WEP key */
687 typedef PACK_START struct _TLVBUF_WEP_KEY
693 /** Default key flag */
697 } PACK_END TLVBUF_WEP_KEY;
700 typedef PACK_START struct _custom_ie
704 /** Mgmt Subtype Mask */
705 u16 mgmt_subtype_mask;
710 } PACK_END custom_ie;
712 /** TLV buffer : custom IE */
713 typedef PACK_START struct _tlvbuf_custom_ie
717 /** custom IE data */
718 custom_ie ie_data[0];
719 } PACK_END tlvbuf_custom_ie;
721 /** TLV buffer : WPA passphrase */
722 typedef PACK_START struct _TLVBUF_WPA_PASSPHRASE
726 /** WPA passphrase */
728 } PACK_END TLVBUF_WPA_PASSPHRASE;
730 /** TLV buffer : Fragmentation threshold */
731 typedef PACK_START struct _TLVBUF_FRAG_THRESHOLD
735 /** Fragmentation threshold */
737 } PACK_END TLVBUF_FRAG_THRESHOLD;
739 /* APCMD definitions */
741 typedef PACK_START struct _APCMDBUF
748 /** APCMD header length */
749 #define APCMDHEADERLEN (sizeof(APCMDBUF))
751 /** APCMD buffer : sys_info request */
752 typedef PACK_START struct _APCMDBUF_SYS_INFO_REQUEST
756 } PACK_END APCMDBUF_SYS_INFO_REQUEST;
758 /** APCMD buffer : sys_info response */
759 typedef PACK_START struct _APCMDBUF_SYS_INFO_RESPONSE
763 /** System information buffer */
765 } PACK_END APCMDBUF_SYS_INFO_RESPONSE;
767 /** APCMD buffer : sys_reset */
768 typedef PACK_START struct _APCMDBUF_SYS_RESET
772 } PACK_END APCMDBUF_SYS_RESET;
774 /** APCMD buffer : sys_configure */
775 typedef PACK_START struct _APCMDBUF_SYS_CONFIGURE
779 /** Action : GET or SET */
781 } PACK_END APCMDBUF_SYS_CONFIGURE;
783 /** APCMD buffer : SNMP MIB */
784 typedef PACK_START struct _APCMDBUF_SNMP_MIB
788 /** Action : GET or SET */
790 } PACK_END APCMDBUF_SNMP_MIB;
791 /** APCMD buffer : bss_start */
792 typedef PACK_START struct _APCMDBUF_BSS_START
796 } PACK_END APCMDBUF_BSS_START;
798 /** APCMD buffer : bss_stop */
799 typedef PACK_START struct _APCMDBUF_BSS_STOP
803 } PACK_END APCMDBUF_BSS_STOP;
805 /** APCMD buffer : sta_list request */
806 typedef PACK_START struct _APCMDBUF_STA_LIST_REQUEST
810 } PACK_END APCMDBUF_STA_LIST_REQUEST;
812 /** APCMD buffer : sta_list response */
813 typedef PACK_START struct _APCMDBUF_STA_LIST_RESPONSE
817 /** Number of STAs */
819 /** STA information TLVs */
820 TLVBUF_STA_INFO StaList[0];
821 } PACK_END APCMDBUF_STA_LIST_RESPONSE;
823 /** APCMD buffer : sta_deauth */
824 typedef PACK_START struct _APCMDBUF_STA_DEAUTH
828 /** STA MAC address to deauthenticate */
829 u8 StaMacAddress[ETH_ALEN];
832 } PACK_END APCMDBUF_STA_DEAUTH;
834 /** TLV : BT Coex common configuration */
835 typedef PACK_START struct _tlvbuf_coex_common_cfg
839 /** Configuration bitmap */
843 } PACK_END tlvbuf_coex_common_cfg;
845 /** TLV : BT Coex SCO configuration */
846 typedef PACK_START struct _tlvbuf_coex_sco_cfg
850 /** Qtime protection */
851 u16 protection_qtime[4];
852 /** Rate protection */
858 } PACK_END tlvbuf_coex_sco_cfg;
860 /** TLV : BT Coex ACL configuration */
861 typedef PACK_START struct _tlvbuf_coex_acl_cfg
865 /** Enabled or not */
871 /** Rate protection */
875 } PACK_END tlvbuf_coex_acl_cfg;
877 /** TLV : BT Coex statistics */
878 typedef PACK_START struct _tlvbuf_coex_stats
886 /** Null not queued */
890 /** CF end not queued */
891 u32 cf_end_not_queued;
892 /** Null allocation failures */
894 /** CF end allocation failures */
895 u32 cf_end_alloc_fail;
898 } PACK_END tlvbuf_coex_stats;
900 /** APCMD buffer : BT Coex API extension */
901 typedef PACK_START struct _apcmdbuf_coex_config
905 /** Action : GET or SET */
907 /** Reserved for alignment */
911 } PACK_END apcmdbuf_coex_config;
921 /** APCMD buffer: Regrdwr */
922 typedef PACK_START struct _APCMDBUF_REG_RDWR
928 /** Register offset */
932 } PACK_END APCMDBUF_REG_RDWR;
935 typedef PACK_START struct _IEEEtypes_SubbandSet
937 u8 FirstChan; /**< First channel */
938 u8 NoOfChan; /**< Number of channels */
939 u8 MaxTxPwr; /**< Maximum Tx power */
940 } PACK_END IEEEtypes_SubbandSet_t;
942 /** country code length used for 802.11D */
943 #define COUNTRY_CODE_LEN 3
945 /** MAX domain SUB-BAND*/
946 #define MAX_SUB_BANDS 40
948 /** Max Multi Domain Entries for G */
949 #define MaxMultiDomainCapabilityEntryG 1
951 /** Max Multi Domain Entries for A */
952 #define MaxMultiDomainCapabilityEntryA 31
954 /** Country code and Sub-band */
955 typedef PACK_START struct domain_param
958 u8 CountryCode[COUNTRY_CODE_LEN]; /**< Country code */
959 IEEEtypes_SubbandSet_t Subband[0]; /**< Set of subbands */
960 } PACK_END domain_param_t;
962 /** HostCmd_CFG_80211D */
963 typedef PACK_START struct _APCMDBUF_CFG_80211D
968 u16 Action; /* 0 = ACT_GET; 1 = ACT_SET; */
969 /** Domain parameters */
970 domain_param_t Domain;
971 } PACK_END APCMDBUF_CFG_80211D;
973 /** HostCmd_MEM_ACCESS */
974 typedef PACK_START struct _APCMDBUF_MEM_ACCESS
979 u16 Action; /* 0 = ACT_GET; 1 = ACT_SET; */
980 /** Reserved field */
986 } PACK_END APCMDBUF_MEM_ACCESS;
988 /** HostCmd_EEPROM_ACCESS */
989 typedef PACK_START struct _APCMDBUF_EEPROM_ACCESS
994 u16 Action; /* 0 = ACT_GET; */
995 /** Reserved field */
996 u16 Offset; /* Multiples of 4 */
998 u16 ByteCount; /* Multiples of 4 */
1001 } PACK_END APCMDBUF_EEPROM_ACCESS;
1003 /** Max EEPROM length */
1004 #define MAX_EEPROM_LEN 20
1006 /**subcmd id for glbal flag */
1007 #define DEBUG_SUBCOMMAND_GMODE 1
1008 /**subcmd id for Majorid mask */
1009 #define DEBUG_SUBCOMMAND_MAJOREVTMASK 2
1010 /**subcmd id to trigger a scan */
1011 #define DEBUG_SUBCOMMAND_CHANNEL_SCAN 3
1013 /** Channel scan entry for each channel */
1014 typedef PACK_START struct _CHANNEL_SCAN_ENTRY_T
1016 /** Channel Number */
1018 /** Number of APs */
1024 /** Channel weight */
1026 } PACK_END CHANNEL_SCAN_ENTRY_T;
1028 /** Channel scan entry */
1029 typedef PACK_START struct _CHANNEL_SCAN_ENTRY
1031 /** Number of channels */
1033 /** Channel scan entry */
1034 CHANNEL_SCAN_ENTRY_T cst[0];
1035 } PACK_END CHANNEL_SCAN_ENTRY;
1037 /** debugConfig_t */
1038 typedef PACK_START union
1040 /** used in all new debug commands */
1042 /** used in DEBUG_SUBCOMMAND_GMODE */
1044 /** used in DEBUG_SUBCOMMAND_MAJOREVTMASK */
1045 u32 debugMajorIdMask;
1046 /** used in DEBUG_SUBCOMMAND_CHANNEL_SCAN */
1047 CHANNEL_SCAN_ENTRY cs_entry;
1048 } PACK_END debugConfig_t;
1050 /** HostCmd_SYS_DEBUG */
1051 typedef PACK_START struct _APCMDBUF_SYS_DEBUG
1056 u16 Action; /* 0 = ACT_GET; 1 = ACT_SET; */
1059 /** debug parameter */
1060 debugConfig_t debugConfig;
1061 } PACK_END APCMDBUF_SYS_DEBUG;
1063 /** HostCmd_CFG_DATA */
1064 typedef PACK_START struct _APCMDBUF_CFG_DATA
1076 } PACK_END APCMDBUF_CFG_DATA;
1078 /** Maximum size of set/get configurations */
1079 #define MAX_CFG_DATA_SIZE 2000 /* less than
1080 MRVDRV_SIZE_OF_CMD_BUFFER */
1082 /** Host Command ID bit mask (bit 11:0) */
1083 #define HostCmd_CMD_ID_MASK 0x0fff
1084 /** APCMD response check */
1085 #define APCMD_RESP_CHECK 0x8000
1088 /** APCMD : sys_info */
1089 #define APCMD_SYS_INFO 0x00ae
1090 /** APCMD : sys_reset */
1091 #define APCMD_SYS_RESET 0x00af
1092 /** APCMD : sys_configure */
1093 #define APCMD_SYS_CONFIGURE 0x00b0
1094 /** APCMD : bss_start */
1095 #define APCMD_BSS_START 0x00b1
1096 /** APCMD : bss_stop */
1097 #define APCMD_BSS_STOP 0x00b2
1098 /** APCMD : sta_list */
1099 #define APCMD_STA_LIST 0x00b3
1100 /** APCMD : sta_deauth */
1101 #define APCMD_STA_DEAUTH 0x00b5
1102 /** SNMP MIB SET/GET */
1103 #define HostCmd_SNMP_MIB 0x0016
1104 /** Read/Write Mac register */
1105 #define HostCmd_CMD_MAC_REG_ACCESS 0x0019
1106 /** Read/Write BBP register */
1107 #define HostCmd_CMD_BBP_REG_ACCESS 0x001a
1108 /** Read/Write RF register */
1109 #define HostCmd_CMD_RF_REG_ACCESS 0x001b
1110 /** Host Command ID : EEPROM access */
1111 #define HostCmd_EEPROM_ACCESS 0x0059
1112 /** Host Command ID : Memory access */
1113 #define HostCmd_CMD_MEM_ACCESS 0x0086
1114 /** Host Command ID : 802.11D configuration */
1115 #define HostCmd_CMD_802_11D_DOMAIN_INFO 0x005b
1116 /** Host Command ID : Configuration data */
1117 #define HostCmd_CMD_CFG_DATA 0x008f
1118 /** Host Command ID: SYS_DEBUG */
1119 #define APCMD_SYS_DEBUG 0x00db
1121 /** Host Command ID: ROBUST_COEX */
1122 #define HostCmd_ROBUST_COEX 0x00e0
1124 /** Oid for 802.11D enable/disable */
1125 #define OID_80211D_ENABLE 0x0009
1129 #define PROPRIETARY_TLV_BASE_ID 0x0100
1131 /**TLV: Domain type */
1132 #define TLV_TYPE_DOMAIN 0x0007
1135 #define MRVL_SSID_TLV_ID 0x0000
1136 /** TLV : Operational rates */
1137 #define MRVL_RATES_TLV_ID 0x0001
1138 /** TLV : Channel */
1139 #define MRVL_PHYPARAMDSSET_TLV_ID 0x0003
1140 /** TLV type : Scan Channels list */
1141 #define MRVL_CHANNELLIST_TLV_ID (PROPRIETARY_TLV_BASE_ID + 1)
1142 /** TLV type : Authentication type */
1143 #define MRVL_AUTH_TLV_ID (PROPRIETARY_TLV_BASE_ID + 31)
1144 /** TLV Id : Channel Config */
1145 #define MRVL_CHANNELCONFIG_TLV_ID (PROPRIETARY_TLV_BASE_ID + 42)
1146 /** TLV : AP MAC address */
1147 #define MRVL_AP_MAC_ADDRESS_TLV_ID (PROPRIETARY_TLV_BASE_ID + 43)
1148 /** TLV : Beacon period */
1149 #define MRVL_BEACON_PERIOD_TLV_ID (PROPRIETARY_TLV_BASE_ID + 44)
1150 /** TLV : DTIM period */
1151 #define MRVL_DTIM_PERIOD_TLV_ID (PROPRIETARY_TLV_BASE_ID + 45)
1152 /** TLV : Tx power */
1153 #define MRVL_TX_POWER_TLV_ID (PROPRIETARY_TLV_BASE_ID + 47)
1154 /** TLV : SSID broadcast control */
1155 #define MRVL_BCAST_SSID_CTL_TLV_ID (PROPRIETARY_TLV_BASE_ID + 48)
1156 /** TLV : Preamble control */
1157 #define MRVL_PREAMBLE_CTL_TLV_ID (PROPRIETARY_TLV_BASE_ID + 49)
1158 /** TLV : Antenna control */
1159 #define MRVL_ANTENNA_CTL_TLV_ID (PROPRIETARY_TLV_BASE_ID + 50)
1160 /** TLV : RTS threshold */
1161 #define MRVL_RTS_THRESHOLD_TLV_ID (PROPRIETARY_TLV_BASE_ID + 51)
1162 /** TLV : Radio control */
1163 #define MRVL_RADIO_CTL_TLV_ID (PROPRIETARY_TLV_BASE_ID + 52)
1164 /** TLV : Tx data rate */
1165 #define MRVL_TX_DATA_RATE_TLV_ID (PROPRIETARY_TLV_BASE_ID + 53)
1166 /** TLV : Packet forwarding control */
1167 #define MRVL_PKT_FWD_CTL_TLV_ID (PROPRIETARY_TLV_BASE_ID + 54)
1168 /** TLV : STA information */
1169 #define MRVL_STA_INFO_TLV_ID (PROPRIETARY_TLV_BASE_ID + 55)
1170 /** TLV : STA MAC address filter */
1171 #define MRVL_STA_MAC_ADDR_FILTER_TLV_ID (PROPRIETARY_TLV_BASE_ID + 56)
1172 /** TLV : STA ageout timer */
1173 #define MRVL_STA_AGEOUT_TIMER_TLV_ID (PROPRIETARY_TLV_BASE_ID + 57)
1174 /** TLV : WEP keys */
1175 #define MRVL_WEP_KEY_TLV_ID (PROPRIETARY_TLV_BASE_ID + 59)
1176 /** TLV : WPA passphrase */
1177 #define MRVL_WPA_PASSPHRASE_TLV_ID (PROPRIETARY_TLV_BASE_ID + 60)
1178 /** TLV type : protocol TLV */
1179 #define MRVL_PROTOCOL_TLV_ID (PROPRIETARY_TLV_BASE_ID + 64)
1180 /** TLV type : AKMP TLV */
1181 #define MRVL_AKMP_TLV_ID (PROPRIETARY_TLV_BASE_ID + 65)
1182 /** TLV type : Cipher TLV */
1183 #define MRVL_CIPHER_TLV_ID (PROPRIETARY_TLV_BASE_ID + 66)
1184 /** TLV : Fragment threshold */
1185 #define MRVL_FRAG_THRESHOLD_TLV_ID (PROPRIETARY_TLV_BASE_ID + 70)
1186 /** TLV : Group rekey timer */
1187 #define MRVL_GRP_REKEY_TIME_TLV_ID (PROPRIETARY_TLV_BASE_ID + 71)
1188 /**TLV: Max Station number */
1189 #define MRVL_MAX_STA_CNT_TLV_ID (PROPRIETARY_TLV_BASE_ID + 85)
1190 /**TLV: Retry limit */
1191 #define MRVL_RETRY_LIMIT_TLV_ID (PROPRIETARY_TLV_BASE_ID + 93)
1192 /**TLV: MCBC data rate */
1193 #define MRVL_MCBC_DATA_RATE_TLV_ID (PROPRIETARY_TLV_BASE_ID + 98)
1194 /**TLV: RSN replay protection */
1195 #define MRVL_RSN_REPLAY_PROT_TLV_ID (PROPRIETARY_TLV_BASE_ID + 100)
1196 /** TLV: Management IE list */
1197 #define MRVL_MGMT_IE_LIST_TLV_ID (PROPRIETARY_TLV_BASE_ID + 105)
1198 /** TLV : Coex common configuration */
1199 #define MRVL_BT_COEX_COMMON_CFG_TLV_ID (PROPRIETARY_TLV_BASE_ID + 108)
1200 /** TLV : Coex SCO configuration */
1201 #define MRVL_BT_COEX_SCO_CFG_TLV_ID (PROPRIETARY_TLV_BASE_ID + 109)
1202 /** TLV : Coex ACL configuration */
1203 #define MRVL_BT_COEX_ACL_CFG_TLV_ID (PROPRIETARY_TLV_BASE_ID + 110)
1204 /** TLV : Coex stats configuration */
1205 #define MRVL_BT_COEX_STATS_TLV_ID (PROPRIETARY_TLV_BASE_ID + 111)
1208 typedef struct _ps_sleep_param
1210 /** control bitmap */
1212 /** minimum sleep period (micro second) */
1214 /** maximum sleep period (micro second) */
1218 /** inactivity sleep_param */
1219 typedef struct _inact_sleep_param
1221 /** inactivity timeout (micro second) */
1223 /** miniumu awake period (micro second) */
1225 /** maximum awake period (micro second) */
1227 } inact_sleep_param;
1229 /** flag for ps mode */
1230 #define PS_FLAG_PS_MODE 1
1231 /** flag for sleep param */
1232 #define PS_FLAG_SLEEP_PARAM 2
1233 /** flag for inactivity sleep param */
1234 #define PS_FLAG_INACT_SLEEP_PARAM 4
1236 /** Disable power mode */
1237 #define PS_MODE_DISABLE 0
1238 /** Enable periodic dtim ps */
1239 #define PS_MODE_PERIODIC_DTIM 1
1240 /** Enable inactivity ps */
1241 #define PS_MODE_INACTIVITY 2
1243 /** sleep parameter */
1244 #define SLEEP_PARAMETER 1
1245 /** inactivity sleep parameter */
1246 #define INACTIVITY_SLEEP_PARAMETER 2
1248 /** sleep parameter : lower limit in micro-sec */
1249 #define PS_SLEEP_PARAM_MIN 5000
1250 /** sleep parameter : upper limit in micro-sec */
1251 #define PS_SLEEP_PARAM_MAX 32000
1252 /** power save awake period minimum value in micro-sec */
1253 #define PS_AWAKE_PERIOD_MIN 10
1256 typedef struct _ps_mgmt
1258 /** flags for valid field */
1263 ps_sleep_param sleep_param;
1264 /** inactivity sleep param */
1265 inact_sleep_param inact_param;
1268 /** Function Prototype Declaration */
1269 int mac2raw(char *mac, u8 * raw);
1270 void print_mac(u8 * raw);
1271 int uap_ioctl(u8 * cmd, u16 * size, u16 buf_size);
1272 void print_auth(TLVBUF_AUTH_MODE * tlv);
1273 void print_tlv(u8 * buf, u16 len);
1274 void print_cipher(TLVBUF_CIPHER * tlv);
1275 void print_rate(TLVBUF_RATES * tlv);
1276 int string2raw(char *str, unsigned char *raw);
1277 void print_mac_filter(TLVBUF_STA_MAC_ADDR_FILTER * tlv);
1278 int ishexstring(void *hex);
1279 inline int ISDIGIT(char *x);
1280 unsigned int a2hex(char *s);
1281 int fparse_for_hex(FILE * fp, u8 * dst);
1282 int is_input_valid(valid_inputs cmd, int argc, char *argv[]);
1283 int is_cipher_valid(int pairwisecipher, int groupcipher);
1284 int get_sys_cfg_rates(u8 * rates);
1285 int is_tx_rate_valid(u8 rate);
1286 int is_mcbc_rate_valid(u8 rate);
1287 void hexdump_data(char *prompt, void *p, int len, char delim);
1288 unsigned char hexc2bin(char chr);