xref: /openbmc/linux/drivers/net/wireless/ath/ath6kl/wmi.h (revision 240d279940ef496e9456db2287b7989f6521e2e2)
1 /*
2  * Copyright (c) 2010-2011 Atheros Communications Inc.
3  *
4  * Permission to use, copy, modify, and/or distribute this software for any
5  * purpose with or without fee is hereby granted, provided that the above
6  * copyright notice and this permission notice appear in all copies.
7  *
8  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15  */
16 
17 /*
18  * This file contains the definitions of the WMI protocol specified in the
19  * Wireless Module Interface (WMI).  It includes definitions of all the
20  * commands and events. Commands are messages from the host to the WM.
21  * Events and Replies are messages from the WM to the host.
22  */
23 
24 #ifndef WMI_H
25 #define WMI_H
26 
27 #include <linux/ieee80211.h>
28 
29 #include "htc.h"
30 
31 #define HTC_PROTOCOL_VERSION		0x0002
32 #define WMI_PROTOCOL_VERSION		0x0002
33 #define WMI_CONTROL_MSG_MAX_LEN		256
34 #define is_ethertype(type_or_len)	((type_or_len) >= 0x0600)
35 
36 #define IP_ETHERTYPE		0x0800
37 
38 #define WMI_IMPLICIT_PSTREAM	0xFF
39 #define WMI_MAX_THINSTREAM	15
40 
41 #define SSID_IE_LEN_INDEX	13
42 
43 /* Host side link management data structures */
44 #define SIG_QUALITY_THRESH_LVLS		6
45 #define SIG_QUALITY_UPPER_THRESH_LVLS	SIG_QUALITY_THRESH_LVLS
46 #define SIG_QUALITY_LOWER_THRESH_LVLS	SIG_QUALITY_THRESH_LVLS
47 
48 #define A_BAND_24GHZ           0
49 #define A_BAND_5GHZ            1
50 #define A_NUM_BANDS            2
51 
52 /* in ms */
53 #define WMI_IMPLICIT_PSTREAM_INACTIVITY_INT 5000
54 
55 /*
56  * There are no signed versions of __le16 and __le32, so for a temporary
57  * solution come up with our own version. The idea is from fs/ntfs/types.h.
58  *
59  * Use a_ prefix so that it doesn't conflict if we get proper support to
60  * linux/types.h.
61  */
62 typedef __s16 __bitwise a_sle16;
63 typedef __s32 __bitwise a_sle32;
64 
65 static inline a_sle32 a_cpu_to_sle32(s32 val)
66 {
67 	return (__force a_sle32) cpu_to_le32(val);
68 }
69 
70 static inline s32 a_sle32_to_cpu(a_sle32 val)
71 {
72 	return le32_to_cpu((__force __le32) val);
73 }
74 
75 static inline a_sle16 a_cpu_to_sle16(s16 val)
76 {
77 	return (__force a_sle16) cpu_to_le16(val);
78 }
79 
80 static inline s16 a_sle16_to_cpu(a_sle16 val)
81 {
82 	return le16_to_cpu((__force __le16) val);
83 }
84 
85 struct sq_threshold_params {
86 	s16 upper_threshold[SIG_QUALITY_UPPER_THRESH_LVLS];
87 	s16 lower_threshold[SIG_QUALITY_LOWER_THRESH_LVLS];
88 	u32 upper_threshold_valid_count;
89 	u32 lower_threshold_valid_count;
90 	u32 polling_interval;
91 	u8 weight;
92 	u8 last_rssi;
93 	u8 last_rssi_poll_event;
94 };
95 
96 struct wmi_data_sync_bufs {
97 	u8 traffic_class;
98 	struct sk_buff *skb;
99 };
100 
101 /* WMM stream classes */
102 #define WMM_NUM_AC  4
103 #define WMM_AC_BE   0		/* best effort */
104 #define WMM_AC_BK   1		/* background */
105 #define WMM_AC_VI   2		/* video */
106 #define WMM_AC_VO   3		/* voice */
107 
108 struct wmi {
109 	u16 stream_exist_for_ac[WMM_NUM_AC];
110 	u8 fat_pipe_exist;
111 	struct ath6kl *parent_dev;
112 	u8 pwr_mode;
113 	spinlock_t lock;
114 	enum htc_endpoint_id ep_id;
115 	struct sq_threshold_params
116 	    sq_threshld[SIGNAL_QUALITY_METRICS_NUM_MAX];
117 	bool is_wmm_enabled;
118 	u8 traffic_class;
119 	bool is_probe_ssid;
120 
121 	u8 *last_mgmt_tx_frame;
122 	size_t last_mgmt_tx_frame_len;
123 	u8 saved_pwr_mode;
124 };
125 
126 struct host_app_area {
127 	__le32 wmi_protocol_ver;
128 } __packed;
129 
130 enum wmi_msg_type {
131 	DATA_MSGTYPE = 0x0,
132 	CNTL_MSGTYPE,
133 	SYNC_MSGTYPE,
134 	OPT_MSGTYPE,
135 };
136 
137 /*
138  * Macros for operating on WMI_DATA_HDR (info) field
139  */
140 
141 #define WMI_DATA_HDR_MSG_TYPE_MASK  0x03
142 #define WMI_DATA_HDR_MSG_TYPE_SHIFT 0
143 #define WMI_DATA_HDR_UP_MASK        0x07
144 #define WMI_DATA_HDR_UP_SHIFT       2
145 
146 /* In AP mode, the same bit (b5) is used to indicate Power save state in
147  * the Rx dir and More data bit state in the tx direction.
148  */
149 #define WMI_DATA_HDR_PS_MASK        0x1
150 #define WMI_DATA_HDR_PS_SHIFT       5
151 
152 #define WMI_DATA_HDR_MORE_MASK      0x1
153 #define WMI_DATA_HDR_MORE_SHIFT     5
154 
155 enum wmi_data_hdr_data_type {
156 	WMI_DATA_HDR_DATA_TYPE_802_3 = 0,
157 	WMI_DATA_HDR_DATA_TYPE_802_11,
158 
159 	/* used to be used for the PAL */
160 	WMI_DATA_HDR_DATA_TYPE_ACL,
161 };
162 
163 #define WMI_DATA_HDR_DATA_TYPE_MASK     0x3
164 #define WMI_DATA_HDR_DATA_TYPE_SHIFT    6
165 
166 /* Macros for operating on WMI_DATA_HDR (info2) field */
167 #define WMI_DATA_HDR_SEQNO_MASK     0xFFF
168 #define WMI_DATA_HDR_SEQNO_SHIFT    0
169 
170 #define WMI_DATA_HDR_AMSDU_MASK     0x1
171 #define WMI_DATA_HDR_AMSDU_SHIFT    12
172 
173 #define WMI_DATA_HDR_META_MASK      0x7
174 #define WMI_DATA_HDR_META_SHIFT     13
175 
176 struct wmi_data_hdr {
177 	s8 rssi;
178 
179 	/*
180 	 * usage of 'info' field(8-bit):
181 	 *
182 	 *  b1:b0       - WMI_MSG_TYPE
183 	 *  b4:b3:b2    - UP(tid)
184 	 *  b5          - Used in AP mode.
185 	 *  More-data in tx dir, PS in rx.
186 	 *  b7:b6       - Dot3 header(0),
187 	 *                Dot11 Header(1),
188 	 *                ACL data(2)
189 	 */
190 	u8 info;
191 
192 	/*
193 	 * usage of 'info2' field(16-bit):
194 	 *
195 	 * b11:b0       - seq_no
196 	 * b12          - A-MSDU?
197 	 * b15:b13      - META_DATA_VERSION 0 - 7
198 	 */
199 	__le16 info2;
200 	__le16 info3;
201 } __packed;
202 
203 static inline u8 wmi_data_hdr_get_up(struct wmi_data_hdr *dhdr)
204 {
205 	return (dhdr->info >> WMI_DATA_HDR_UP_SHIFT) & WMI_DATA_HDR_UP_MASK;
206 }
207 
208 static inline void wmi_data_hdr_set_up(struct wmi_data_hdr *dhdr,
209 				       u8 usr_pri)
210 {
211 	dhdr->info &= ~(WMI_DATA_HDR_UP_MASK << WMI_DATA_HDR_UP_SHIFT);
212 	dhdr->info |= usr_pri << WMI_DATA_HDR_UP_SHIFT;
213 }
214 
215 static inline u8 wmi_data_hdr_get_dot11(struct wmi_data_hdr *dhdr)
216 {
217 	u8 data_type;
218 
219 	data_type = (dhdr->info >> WMI_DATA_HDR_DATA_TYPE_SHIFT) &
220 				   WMI_DATA_HDR_DATA_TYPE_MASK;
221 	return (data_type == WMI_DATA_HDR_DATA_TYPE_802_11);
222 }
223 
224 static inline u16 wmi_data_hdr_get_seqno(struct wmi_data_hdr *dhdr)
225 {
226 	return (le16_to_cpu(dhdr->info2) >> WMI_DATA_HDR_SEQNO_SHIFT) &
227 				WMI_DATA_HDR_SEQNO_MASK;
228 }
229 
230 static inline u8 wmi_data_hdr_is_amsdu(struct wmi_data_hdr *dhdr)
231 {
232 	return (le16_to_cpu(dhdr->info2) >> WMI_DATA_HDR_AMSDU_SHIFT) &
233 			       WMI_DATA_HDR_AMSDU_MASK;
234 }
235 
236 static inline u8 wmi_data_hdr_get_meta(struct wmi_data_hdr *dhdr)
237 {
238 	return (le16_to_cpu(dhdr->info2) >> WMI_DATA_HDR_META_SHIFT) &
239 			       WMI_DATA_HDR_META_MASK;
240 }
241 
242 /* Tx meta version definitions */
243 #define WMI_MAX_TX_META_SZ	12
244 #define WMI_META_VERSION_1	0x01
245 #define WMI_META_VERSION_2	0x02
246 
247 struct wmi_tx_meta_v1 {
248 	/* packet ID to identify the tx request */
249 	u8 pkt_id;
250 
251 	/* rate policy to be used for the tx of this frame */
252 	u8 rate_plcy_id;
253 } __packed;
254 
255 struct wmi_tx_meta_v2 {
256 	/*
257 	 * Offset from start of the WMI header for csum calculation to
258 	 * begin.
259 	 */
260 	u8 csum_start;
261 
262 	/* offset from start of WMI header where final csum goes */
263 	u8 csum_dest;
264 
265 	/* no of bytes over which csum is calculated */
266 	u8 csum_flags;
267 } __packed;
268 
269 struct wmi_rx_meta_v1 {
270 	u8 status;
271 
272 	/* rate index mapped to rate at which this packet was received. */
273 	u8 rix;
274 
275 	/* rssi of packet */
276 	u8 rssi;
277 
278 	/* rf channel during packet reception */
279 	u8 channel;
280 
281 	__le16 flags;
282 } __packed;
283 
284 struct wmi_rx_meta_v2 {
285 	__le16 csum;
286 
287 	/* bit 0 set -partial csum valid bit 1 set -test mode */
288 	u8 csum_flags;
289 } __packed;
290 
291 #define WMI_CMD_HDR_IF_ID_MASK 0xF
292 
293 /* Control Path */
294 struct wmi_cmd_hdr {
295 	__le16 cmd_id;
296 
297 	/* info1 - 16 bits
298 	 * b03:b00 - id
299 	 * b15:b04 - unused */
300 	__le16 info1;
301 
302 	/* for alignment */
303 	__le16 reserved;
304 } __packed;
305 
306 /* List of WMI commands */
307 enum wmi_cmd_id {
308 	WMI_CONNECT_CMDID = 0x0001,
309 	WMI_RECONNECT_CMDID,
310 	WMI_DISCONNECT_CMDID,
311 	WMI_SYNCHRONIZE_CMDID,
312 	WMI_CREATE_PSTREAM_CMDID,
313 	WMI_DELETE_PSTREAM_CMDID,
314 	WMI_START_SCAN_CMDID,
315 	WMI_SET_SCAN_PARAMS_CMDID,
316 	WMI_SET_BSS_FILTER_CMDID,
317 	WMI_SET_PROBED_SSID_CMDID,	/* 10 */
318 	WMI_SET_LISTEN_INT_CMDID,
319 	WMI_SET_BMISS_TIME_CMDID,
320 	WMI_SET_DISC_TIMEOUT_CMDID,
321 	WMI_GET_CHANNEL_LIST_CMDID,
322 	WMI_SET_BEACON_INT_CMDID,
323 	WMI_GET_STATISTICS_CMDID,
324 	WMI_SET_CHANNEL_PARAMS_CMDID,
325 	WMI_SET_POWER_MODE_CMDID,
326 	WMI_SET_IBSS_PM_CAPS_CMDID,
327 	WMI_SET_POWER_PARAMS_CMDID,	/* 20 */
328 	WMI_SET_POWERSAVE_TIMERS_POLICY_CMDID,
329 	WMI_ADD_CIPHER_KEY_CMDID,
330 	WMI_DELETE_CIPHER_KEY_CMDID,
331 	WMI_ADD_KRK_CMDID,
332 	WMI_DELETE_KRK_CMDID,
333 	WMI_SET_PMKID_CMDID,
334 	WMI_SET_TX_PWR_CMDID,
335 	WMI_GET_TX_PWR_CMDID,
336 	WMI_SET_ASSOC_INFO_CMDID,
337 	WMI_ADD_BAD_AP_CMDID,		/* 30 */
338 	WMI_DELETE_BAD_AP_CMDID,
339 	WMI_SET_TKIP_COUNTERMEASURES_CMDID,
340 	WMI_RSSI_THRESHOLD_PARAMS_CMDID,
341 	WMI_TARGET_ERROR_REPORT_BITMASK_CMDID,
342 	WMI_SET_ACCESS_PARAMS_CMDID,
343 	WMI_SET_RETRY_LIMITS_CMDID,
344 	WMI_SET_OPT_MODE_CMDID,
345 	WMI_OPT_TX_FRAME_CMDID,
346 	WMI_SET_VOICE_PKT_SIZE_CMDID,
347 	WMI_SET_MAX_SP_LEN_CMDID,	/* 40 */
348 	WMI_SET_ROAM_CTRL_CMDID,
349 	WMI_GET_ROAM_TBL_CMDID,
350 	WMI_GET_ROAM_DATA_CMDID,
351 	WMI_ENABLE_RM_CMDID,
352 	WMI_SET_MAX_OFFHOME_DURATION_CMDID,
353 	WMI_EXTENSION_CMDID,	/* Non-wireless extensions */
354 	WMI_SNR_THRESHOLD_PARAMS_CMDID,
355 	WMI_LQ_THRESHOLD_PARAMS_CMDID,
356 	WMI_SET_LPREAMBLE_CMDID,
357 	WMI_SET_RTS_CMDID,		/* 50 */
358 	WMI_CLR_RSSI_SNR_CMDID,
359 	WMI_SET_FIXRATES_CMDID,
360 	WMI_GET_FIXRATES_CMDID,
361 	WMI_SET_AUTH_MODE_CMDID,
362 	WMI_SET_REASSOC_MODE_CMDID,
363 	WMI_SET_WMM_CMDID,
364 	WMI_SET_WMM_TXOP_CMDID,
365 	WMI_TEST_CMDID,
366 
367 	/* COEX AR6002 only */
368 	WMI_SET_BT_STATUS_CMDID,
369 	WMI_SET_BT_PARAMS_CMDID,	/* 60 */
370 
371 	WMI_SET_KEEPALIVE_CMDID,
372 	WMI_GET_KEEPALIVE_CMDID,
373 	WMI_SET_APPIE_CMDID,
374 	WMI_GET_APPIE_CMDID,
375 	WMI_SET_WSC_STATUS_CMDID,
376 
377 	/* Wake on Wireless */
378 	WMI_SET_HOST_SLEEP_MODE_CMDID,
379 	WMI_SET_WOW_MODE_CMDID,
380 	WMI_GET_WOW_LIST_CMDID,
381 	WMI_ADD_WOW_PATTERN_CMDID,
382 	WMI_DEL_WOW_PATTERN_CMDID,	/* 70 */
383 
384 	WMI_SET_FRAMERATES_CMDID,
385 	WMI_SET_AP_PS_CMDID,
386 	WMI_SET_QOS_SUPP_CMDID,
387 
388 	/* WMI_THIN_RESERVED_... mark the start and end
389 	 * values for WMI_THIN_RESERVED command IDs. These
390 	 * command IDs can be found in wmi_thin.h */
391 	WMI_THIN_RESERVED_START = 0x8000,
392 	WMI_THIN_RESERVED_END = 0x8fff,
393 
394 	/* Developer commands starts at 0xF000 */
395 	WMI_SET_BITRATE_CMDID = 0xF000,
396 	WMI_GET_BITRATE_CMDID,
397 	WMI_SET_WHALPARAM_CMDID,
398 	WMI_SET_MAC_ADDRESS_CMDID,
399 	WMI_SET_AKMP_PARAMS_CMDID,
400 	WMI_SET_PMKID_LIST_CMDID,
401 	WMI_GET_PMKID_LIST_CMDID,
402 	WMI_ABORT_SCAN_CMDID,
403 	WMI_SET_TARGET_EVENT_REPORT_CMDID,
404 
405 	/* Unused */
406 	WMI_UNUSED1,
407 	WMI_UNUSED2,
408 
409 	/* AP mode commands */
410 	WMI_AP_HIDDEN_SSID_CMDID,
411 	WMI_AP_SET_NUM_STA_CMDID,
412 	WMI_AP_ACL_POLICY_CMDID,
413 	WMI_AP_ACL_MAC_LIST_CMDID,
414 	WMI_AP_CONFIG_COMMIT_CMDID,
415 	WMI_AP_SET_MLME_CMDID,
416 	WMI_AP_SET_PVB_CMDID,
417 	WMI_AP_CONN_INACT_CMDID,
418 	WMI_AP_PROT_SCAN_TIME_CMDID,
419 	WMI_AP_SET_COUNTRY_CMDID,
420 	WMI_AP_SET_DTIM_CMDID,
421 	WMI_AP_MODE_STAT_CMDID,
422 
423 	WMI_SET_IP_CMDID,
424 	WMI_SET_PARAMS_CMDID,
425 	WMI_SET_MCAST_FILTER_CMDID,
426 	WMI_DEL_MCAST_FILTER_CMDID,
427 
428 	WMI_ALLOW_AGGR_CMDID,
429 	WMI_ADDBA_REQ_CMDID,
430 	WMI_DELBA_REQ_CMDID,
431 	WMI_SET_HT_CAP_CMDID,
432 	WMI_SET_HT_OP_CMDID,
433 	WMI_SET_TX_SELECT_RATES_CMDID,
434 	WMI_SET_TX_SGI_PARAM_CMDID,
435 	WMI_SET_RATE_POLICY_CMDID,
436 
437 	WMI_HCI_CMD_CMDID,
438 	WMI_RX_FRAME_FORMAT_CMDID,
439 	WMI_SET_THIN_MODE_CMDID,
440 	WMI_SET_BT_WLAN_CONN_PRECEDENCE_CMDID,
441 
442 	WMI_AP_SET_11BG_RATESET_CMDID,
443 	WMI_SET_PMK_CMDID,
444 	WMI_MCAST_FILTER_CMDID,
445 
446 	/* COEX CMDID AR6003 */
447 	WMI_SET_BTCOEX_FE_ANT_CMDID,
448 	WMI_SET_BTCOEX_COLOCATED_BT_DEV_CMDID,
449 	WMI_SET_BTCOEX_SCO_CONFIG_CMDID,
450 	WMI_SET_BTCOEX_A2DP_CONFIG_CMDID,
451 	WMI_SET_BTCOEX_ACLCOEX_CONFIG_CMDID,
452 	WMI_SET_BTCOEX_BTINQUIRY_PAGE_CONFIG_CMDID,
453 	WMI_SET_BTCOEX_DEBUG_CMDID,
454 	WMI_SET_BTCOEX_BT_OPERATING_STATUS_CMDID,
455 	WMI_GET_BTCOEX_STATS_CMDID,
456 	WMI_GET_BTCOEX_CONFIG_CMDID,
457 
458 	WMI_SET_DFS_ENABLE_CMDID,	/* F034 */
459 	WMI_SET_DFS_MINRSSITHRESH_CMDID,
460 	WMI_SET_DFS_MAXPULSEDUR_CMDID,
461 	WMI_DFS_RADAR_DETECTED_CMDID,
462 
463 	/* P2P commands */
464 	WMI_P2P_SET_CONFIG_CMDID,	/* F038 */
465 	WMI_WPS_SET_CONFIG_CMDID,
466 	WMI_SET_REQ_DEV_ATTR_CMDID,
467 	WMI_P2P_FIND_CMDID,
468 	WMI_P2P_STOP_FIND_CMDID,
469 	WMI_P2P_GO_NEG_START_CMDID,
470 	WMI_P2P_LISTEN_CMDID,
471 
472 	WMI_CONFIG_TX_MAC_RULES_CMDID,	/* F040 */
473 	WMI_SET_PROMISCUOUS_MODE_CMDID,
474 	WMI_RX_FRAME_FILTER_CMDID,
475 	WMI_SET_CHANNEL_CMDID,
476 
477 	/* WAC commands */
478 	WMI_ENABLE_WAC_CMDID,
479 	WMI_WAC_SCAN_REPLY_CMDID,
480 	WMI_WAC_CTRL_REQ_CMDID,
481 	WMI_SET_DIV_PARAMS_CMDID,
482 
483 	WMI_GET_PMK_CMDID,
484 	WMI_SET_PASSPHRASE_CMDID,
485 	WMI_SEND_ASSOC_RES_CMDID,
486 	WMI_SET_ASSOC_REQ_RELAY_CMDID,
487 
488 	/* ACS command, consists of sub-commands */
489 	WMI_ACS_CTRL_CMDID,
490 	WMI_SET_EXCESS_TX_RETRY_THRES_CMDID,
491 	WMI_SET_TBD_TIME_CMDID, /*added for wmiconfig command for TBD */
492 
493 	/* Pktlog cmds */
494 	WMI_PKTLOG_ENABLE_CMDID,
495 	WMI_PKTLOG_DISABLE_CMDID,
496 
497 	/* More P2P Cmds */
498 	WMI_P2P_GO_NEG_REQ_RSP_CMDID,
499 	WMI_P2P_GRP_INIT_CMDID,
500 	WMI_P2P_GRP_FORMATION_DONE_CMDID,
501 	WMI_P2P_INVITE_CMDID,
502 	WMI_P2P_INVITE_REQ_RSP_CMDID,
503 	WMI_P2P_PROV_DISC_REQ_CMDID,
504 	WMI_P2P_SET_CMDID,
505 
506 	WMI_GET_RFKILL_MODE_CMDID,
507 	WMI_SET_RFKILL_MODE_CMDID,
508 	WMI_AP_SET_APSD_CMDID,
509 	WMI_AP_APSD_BUFFERED_TRAFFIC_CMDID,
510 
511 	WMI_P2P_SDPD_TX_CMDID, /* F05C */
512 	WMI_P2P_STOP_SDPD_CMDID,
513 	WMI_P2P_CANCEL_CMDID,
514 	/* Ultra low power store / recall commands */
515 	WMI_STORERECALL_CONFIGURE_CMDID,
516 	WMI_STORERECALL_RECALL_CMDID,
517 	WMI_STORERECALL_HOST_READY_CMDID,
518 	WMI_FORCE_TARGET_ASSERT_CMDID,
519 
520 	WMI_SET_PROBED_SSID_EX_CMDID,
521 	WMI_SET_NETWORK_LIST_OFFLOAD_CMDID,
522 	WMI_SET_ARP_NS_OFFLOAD_CMDID,
523 	WMI_ADD_WOW_EXT_PATTERN_CMDID,
524 	WMI_GTK_OFFLOAD_OP_CMDID,
525 	WMI_REMAIN_ON_CHNL_CMDID,
526 	WMI_CANCEL_REMAIN_ON_CHNL_CMDID,
527 	WMI_SEND_ACTION_CMDID,
528 	WMI_PROBE_REQ_REPORT_CMDID,
529 	WMI_DISABLE_11B_RATES_CMDID,
530 	WMI_SEND_PROBE_RESPONSE_CMDID,
531 	WMI_GET_P2P_INFO_CMDID,
532 	WMI_AP_JOIN_BSS_CMDID,
533 };
534 
535 enum wmi_mgmt_frame_type {
536 	WMI_FRAME_BEACON = 0,
537 	WMI_FRAME_PROBE_REQ,
538 	WMI_FRAME_PROBE_RESP,
539 	WMI_FRAME_ASSOC_REQ,
540 	WMI_FRAME_ASSOC_RESP,
541 	WMI_NUM_MGMT_FRAME
542 };
543 
544 /* WMI_CONNECT_CMDID  */
545 enum network_type {
546 	INFRA_NETWORK = 0x01,
547 	ADHOC_NETWORK = 0x02,
548 	ADHOC_CREATOR = 0x04,
549 	AP_NETWORK = 0x10,
550 };
551 
552 enum dot11_auth_mode {
553 	OPEN_AUTH = 0x01,
554 	SHARED_AUTH = 0x02,
555 
556 	/* different from IEEE_AUTH_MODE definitions */
557 	LEAP_AUTH = 0x04,
558 };
559 
560 enum auth_mode {
561 	NONE_AUTH = 0x01,
562 	WPA_AUTH = 0x02,
563 	WPA2_AUTH = 0x04,
564 	WPA_PSK_AUTH = 0x08,
565 	WPA2_PSK_AUTH = 0x10,
566 	WPA_AUTH_CCKM = 0x20,
567 	WPA2_AUTH_CCKM = 0x40,
568 };
569 
570 #define WMI_MIN_CRYPTO_TYPE NONE_CRYPT
571 #define WMI_MAX_CRYPTO_TYPE (AES_CRYPT + 1)
572 
573 #define WMI_MIN_KEY_INDEX   0
574 #define WMI_MAX_KEY_INDEX   3
575 
576 #define WMI_MAX_KEY_LEN     32
577 
578 /*
579  * NB: these values are ordered carefully; there are lots of
580  * of implications in any reordering.  In particular beware
581  * that 4 is not used to avoid conflicting with IEEE80211_F_PRIVACY.
582  */
583 #define ATH6KL_CIPHER_WEP            0
584 #define ATH6KL_CIPHER_TKIP           1
585 #define ATH6KL_CIPHER_AES_OCB        2
586 #define ATH6KL_CIPHER_AES_CCM        3
587 #define ATH6KL_CIPHER_CKIP           5
588 #define ATH6KL_CIPHER_CCKM_KRK       6
589 #define ATH6KL_CIPHER_NONE           7 /* pseudo value */
590 
591 /*
592  * 802.11 rate set.
593  */
594 #define ATH6KL_RATE_MAXSIZE  15	/* max rates we'll handle */
595 
596 #define ATH_OUI_TYPE            0x01
597 #define WPA_OUI_TYPE            0x01
598 #define WMM_PARAM_OUI_SUBTYPE   0x01
599 #define WMM_OUI_TYPE            0x02
600 #define WSC_OUT_TYPE            0x04
601 
602 enum wmi_connect_ctrl_flags_bits {
603 	CONNECT_ASSOC_POLICY_USER = 0x0001,
604 	CONNECT_SEND_REASSOC = 0x0002,
605 	CONNECT_IGNORE_WPAx_GROUP_CIPHER = 0x0004,
606 	CONNECT_PROFILE_MATCH_DONE = 0x0008,
607 	CONNECT_IGNORE_AAC_BEACON = 0x0010,
608 	CONNECT_CSA_FOLLOW_BSS = 0x0020,
609 	CONNECT_DO_WPA_OFFLOAD = 0x0040,
610 	CONNECT_DO_NOT_DEAUTH = 0x0080,
611 };
612 
613 struct wmi_connect_cmd {
614 	u8 nw_type;
615 	u8 dot11_auth_mode;
616 	u8 auth_mode;
617 	u8 prwise_crypto_type;
618 	u8 prwise_crypto_len;
619 	u8 grp_crypto_type;
620 	u8 grp_crypto_len;
621 	u8 ssid_len;
622 	u8 ssid[IEEE80211_MAX_SSID_LEN];
623 	__le16 ch;
624 	u8 bssid[ETH_ALEN];
625 	__le32 ctrl_flags;
626 } __packed;
627 
628 /* WMI_RECONNECT_CMDID */
629 struct wmi_reconnect_cmd {
630 	/* channel hint */
631 	__le16 channel;
632 
633 	/* mandatory if set */
634 	u8 bssid[ETH_ALEN];
635 } __packed;
636 
637 /* WMI_ADD_CIPHER_KEY_CMDID */
638 enum key_usage {
639 	PAIRWISE_USAGE = 0x00,
640 	GROUP_USAGE = 0x01,
641 
642 	/* default Tx Key - static WEP only */
643 	TX_USAGE = 0x02,
644 };
645 
646 /*
647  * Bit Flag
648  * Bit 0 - Initialise TSC - default is Initialize
649  */
650 #define KEY_OP_INIT_TSC     0x01
651 #define KEY_OP_INIT_RSC     0x02
652 
653 /* default initialise the TSC & RSC */
654 #define KEY_OP_INIT_VAL     0x03
655 #define KEY_OP_VALID_MASK   0x03
656 
657 struct wmi_add_cipher_key_cmd {
658 	u8 key_index;
659 	u8 key_type;
660 
661 	/* enum key_usage */
662 	u8 key_usage;
663 
664 	u8 key_len;
665 
666 	/* key replay sequence counter */
667 	u8 key_rsc[8];
668 
669 	u8 key[WLAN_MAX_KEY_LEN];
670 
671 	/* additional key control info */
672 	u8 key_op_ctrl;
673 
674 	u8 key_mac_addr[ETH_ALEN];
675 } __packed;
676 
677 /* WMI_DELETE_CIPHER_KEY_CMDID */
678 struct wmi_delete_cipher_key_cmd {
679 	u8 key_index;
680 } __packed;
681 
682 #define WMI_KRK_LEN     16
683 
684 /* WMI_ADD_KRK_CMDID */
685 struct wmi_add_krk_cmd {
686 	u8 krk[WMI_KRK_LEN];
687 } __packed;
688 
689 /* WMI_SETPMKID_CMDID */
690 
691 #define WMI_PMKID_LEN 16
692 
693 enum pmkid_enable_flg {
694 	PMKID_DISABLE = 0,
695 	PMKID_ENABLE = 1,
696 };
697 
698 struct wmi_setpmkid_cmd {
699 	u8 bssid[ETH_ALEN];
700 
701 	/* enum pmkid_enable_flg */
702 	u8 enable;
703 
704 	u8 pmkid[WMI_PMKID_LEN];
705 } __packed;
706 
707 /* WMI_START_SCAN_CMD */
708 enum wmi_scan_type {
709 	WMI_LONG_SCAN = 0,
710 	WMI_SHORT_SCAN = 1,
711 };
712 
713 struct wmi_start_scan_cmd {
714 	__le32 force_fg_scan;
715 
716 	/* for legacy cisco AP compatibility */
717 	__le32 is_legacy;
718 
719 	/* max duration in the home channel(msec) */
720 	__le32 home_dwell_time;
721 
722 	/* time interval between scans (msec) */
723 	__le32 force_scan_intvl;
724 
725 	/* enum wmi_scan_type */
726 	u8 scan_type;
727 
728 	/* how many channels follow */
729 	u8 num_ch;
730 
731 	/* channels in Mhz */
732 	__le16 ch_list[1];
733 } __packed;
734 
735 /* WMI_SET_SCAN_PARAMS_CMDID */
736 #define WMI_SHORTSCANRATIO_DEFAULT      3
737 
738 /*
739  *  Warning: scan control flag value of 0xFF is used to disable
740  *  all flags in WMI_SCAN_PARAMS_CMD. Do not add any more
741  *  flags here
742  */
743 enum wmi_scan_ctrl_flags_bits {
744 
745 	/* set if can scan in the connect cmd */
746 	CONNECT_SCAN_CTRL_FLAGS = 0x01,
747 
748 	/* set if scan for the SSID it is already connected to */
749 	SCAN_CONNECTED_CTRL_FLAGS = 0x02,
750 
751 	/* set if enable active scan */
752 	ACTIVE_SCAN_CTRL_FLAGS = 0x04,
753 
754 	/* set if enable roam scan when bmiss and lowrssi */
755 	ROAM_SCAN_CTRL_FLAGS = 0x08,
756 
757 	/* set if follows customer BSSINFO reporting rule */
758 	REPORT_BSSINFO_CTRL_FLAGS = 0x10,
759 
760 	/* if disabled, target doesn't scan after a disconnect event  */
761 	ENABLE_AUTO_CTRL_FLAGS = 0x20,
762 
763 	/*
764 	 * Scan complete event with canceled status will be generated when
765 	 * a scan is prempted before it gets completed.
766 	 */
767 	ENABLE_SCAN_ABORT_EVENT = 0x40
768 };
769 
770 #define DEFAULT_SCAN_CTRL_FLAGS			\
771 	(CONNECT_SCAN_CTRL_FLAGS |		\
772 	 SCAN_CONNECTED_CTRL_FLAGS |		\
773 	 ACTIVE_SCAN_CTRL_FLAGS |		\
774 	 ROAM_SCAN_CTRL_FLAGS |			\
775 	 ENABLE_AUTO_CTRL_FLAGS)
776 
777 struct wmi_scan_params_cmd {
778 	  /* sec */
779 	__le16 fg_start_period;
780 
781 	/* sec */
782 	__le16 fg_end_period;
783 
784 	/* sec */
785 	__le16 bg_period;
786 
787 	/* msec */
788 	__le16 maxact_chdwell_time;
789 
790 	/* msec */
791 	__le16 pas_chdwell_time;
792 
793 	  /* how many shorts scan for one long */
794 	u8 short_scan_ratio;
795 
796 	u8 scan_ctrl_flags;
797 
798 	/* msec */
799 	__le16 minact_chdwell_time;
800 
801 	/* max active scans per ssid */
802 	__le16 maxact_scan_per_ssid;
803 
804 	/* msecs */
805 	__le32 max_dfsch_act_time;
806 } __packed;
807 
808 /* WMI_SET_BSS_FILTER_CMDID */
809 enum wmi_bss_filter {
810 	/* no beacons forwarded */
811 	NONE_BSS_FILTER = 0x0,
812 
813 	/* all beacons forwarded */
814 	ALL_BSS_FILTER,
815 
816 	/* only beacons matching profile */
817 	PROFILE_FILTER,
818 
819 	/* all but beacons matching profile */
820 	ALL_BUT_PROFILE_FILTER,
821 
822 	/* only beacons matching current BSS */
823 	CURRENT_BSS_FILTER,
824 
825 	/* all but beacons matching BSS */
826 	ALL_BUT_BSS_FILTER,
827 
828 	/* beacons matching probed ssid */
829 	PROBED_SSID_FILTER,
830 
831 	/* marker only */
832 	LAST_BSS_FILTER,
833 };
834 
835 struct wmi_bss_filter_cmd {
836 	/* see, enum wmi_bss_filter */
837 	u8 bss_filter;
838 
839 	/* for alignment */
840 	u8 reserved1;
841 
842 	/* for alignment */
843 	__le16 reserved2;
844 
845 	__le32 ie_mask;
846 } __packed;
847 
848 /* WMI_SET_PROBED_SSID_CMDID */
849 #define MAX_PROBED_SSID_INDEX   9
850 
851 enum wmi_ssid_flag {
852 	/* disables entry */
853 	DISABLE_SSID_FLAG = 0,
854 
855 	/* probes specified ssid */
856 	SPECIFIC_SSID_FLAG = 0x01,
857 
858 	/* probes for any ssid */
859 	ANY_SSID_FLAG = 0x02,
860 };
861 
862 struct wmi_probed_ssid_cmd {
863 	/* 0 to MAX_PROBED_SSID_INDEX */
864 	u8 entry_index;
865 
866 	/* see, enum wmi_ssid_flg */
867 	u8 flag;
868 
869 	u8 ssid_len;
870 	u8 ssid[IEEE80211_MAX_SSID_LEN];
871 } __packed;
872 
873 /*
874  * WMI_SET_LISTEN_INT_CMDID
875  * The Listen interval is between 15 and 3000 TUs
876  */
877 struct wmi_listen_int_cmd {
878 	__le16 listen_intvl;
879 	__le16 num_beacons;
880 } __packed;
881 
882 /* WMI_SET_POWER_MODE_CMDID */
883 enum wmi_power_mode {
884 	REC_POWER = 0x01,
885 	MAX_PERF_POWER,
886 };
887 
888 struct wmi_power_mode_cmd {
889 	/* see, enum wmi_power_mode */
890 	u8 pwr_mode;
891 } __packed;
892 
893 /*
894  * Policy to determnine whether power save failure event should be sent to
895  * host during scanning
896  */
897 enum power_save_fail_event_policy {
898 	SEND_POWER_SAVE_FAIL_EVENT_ALWAYS = 1,
899 	IGNORE_POWER_SAVE_FAIL_EVENT_DURING_SCAN = 2,
900 };
901 
902 struct wmi_power_params_cmd {
903 	/* msec */
904 	__le16 idle_period;
905 
906 	__le16 pspoll_number;
907 	__le16 dtim_policy;
908 	__le16 tx_wakeup_policy;
909 	__le16 num_tx_to_wakeup;
910 	__le16 ps_fail_event_policy;
911 } __packed;
912 
913 /* WMI_SET_DISC_TIMEOUT_CMDID */
914 struct wmi_disc_timeout_cmd {
915 	/* seconds */
916 	u8 discon_timeout;
917 } __packed;
918 
919 enum dir_type {
920 	UPLINK_TRAFFIC = 0,
921 	DNLINK_TRAFFIC = 1,
922 	BIDIR_TRAFFIC = 2,
923 };
924 
925 enum voiceps_cap_type {
926 	DISABLE_FOR_THIS_AC = 0,
927 	ENABLE_FOR_THIS_AC = 1,
928 	ENABLE_FOR_ALL_AC = 2,
929 };
930 
931 enum traffic_type {
932 	TRAFFIC_TYPE_APERIODIC = 0,
933 	TRAFFIC_TYPE_PERIODIC = 1,
934 };
935 
936 /* WMI_SYNCHRONIZE_CMDID */
937 struct wmi_sync_cmd {
938 	u8 data_sync_map;
939 } __packed;
940 
941 /* WMI_CREATE_PSTREAM_CMDID */
942 struct wmi_create_pstream_cmd {
943 	/* msec */
944 	__le32 min_service_int;
945 
946 	/* msec */
947 	__le32 max_service_int;
948 
949 	/* msec */
950 	__le32 inactivity_int;
951 
952 	/* msec */
953 	__le32 suspension_int;
954 
955 	__le32 service_start_time;
956 
957 	/* in bps */
958 	__le32 min_data_rate;
959 
960 	/* in bps */
961 	__le32 mean_data_rate;
962 
963 	/* in bps */
964 	__le32 peak_data_rate;
965 
966 	__le32 max_burst_size;
967 	__le32 delay_bound;
968 
969 	/* in bps */
970 	__le32 min_phy_rate;
971 
972 	__le32 sba;
973 	__le32 medium_time;
974 
975 	/* in octects */
976 	__le16 nominal_msdu;
977 
978 	/* in octects */
979 	__le16 max_msdu;
980 
981 	u8 traffic_class;
982 
983 	/* see, enum dir_type */
984 	u8 traffic_direc;
985 
986 	u8 rx_queue_num;
987 
988 	/* see, enum traffic_type */
989 	u8 traffic_type;
990 
991 	/* see, enum voiceps_cap_type */
992 	u8 voice_psc_cap;
993 	u8 tsid;
994 
995 	/* 802.1D user priority */
996 	u8 user_pri;
997 
998 	/* nominal phy rate */
999 	u8 nominal_phy;
1000 } __packed;
1001 
1002 /* WMI_DELETE_PSTREAM_CMDID */
1003 struct wmi_delete_pstream_cmd {
1004 	u8 tx_queue_num;
1005 	u8 rx_queue_num;
1006 	u8 traffic_direc;
1007 	u8 traffic_class;
1008 	u8 tsid;
1009 } __packed;
1010 
1011 /* WMI_SET_CHANNEL_PARAMS_CMDID */
1012 enum wmi_phy_mode {
1013 	WMI_11A_MODE = 0x1,
1014 	WMI_11G_MODE = 0x2,
1015 	WMI_11AG_MODE = 0x3,
1016 	WMI_11B_MODE = 0x4,
1017 	WMI_11GONLY_MODE = 0x5,
1018 };
1019 
1020 #define WMI_MAX_CHANNELS        32
1021 
1022 /*
1023  *  WMI_RSSI_THRESHOLD_PARAMS_CMDID
1024  *  Setting the polltime to 0 would disable polling. Threshold values are
1025  *  in the ascending order, and should agree to:
1026  *  (lowThreshold_lowerVal < lowThreshold_upperVal < highThreshold_lowerVal
1027  *   < highThreshold_upperVal)
1028  */
1029 
1030 struct wmi_rssi_threshold_params_cmd {
1031 	/* polling time as a factor of LI */
1032 	__le32 poll_time;
1033 
1034 	/* lowest of upper */
1035 	a_sle16 thresh_above1_val;
1036 
1037 	a_sle16 thresh_above2_val;
1038 	a_sle16 thresh_above3_val;
1039 	a_sle16 thresh_above4_val;
1040 	a_sle16 thresh_above5_val;
1041 
1042 	/* highest of upper */
1043 	a_sle16 thresh_above6_val;
1044 
1045 	/* lowest of bellow */
1046 	a_sle16 thresh_below1_val;
1047 
1048 	a_sle16 thresh_below2_val;
1049 	a_sle16 thresh_below3_val;
1050 	a_sle16 thresh_below4_val;
1051 	a_sle16 thresh_below5_val;
1052 
1053 	/* highest of bellow */
1054 	a_sle16 thresh_below6_val;
1055 
1056 	/* "alpha" */
1057 	u8 weight;
1058 
1059 	u8 reserved[3];
1060 } __packed;
1061 
1062 /*
1063  *  WMI_SNR_THRESHOLD_PARAMS_CMDID
1064  *  Setting the polltime to 0 would disable polling.
1065  */
1066 
1067 struct wmi_snr_threshold_params_cmd {
1068 	/* polling time as a factor of LI */
1069 	__le32 poll_time;
1070 
1071 	/* "alpha" */
1072 	u8 weight;
1073 
1074 	/* lowest of uppper */
1075 	u8 thresh_above1_val;
1076 
1077 	u8 thresh_above2_val;
1078 	u8 thresh_above3_val;
1079 
1080 	/* highest of upper */
1081 	u8 thresh_above4_val;
1082 
1083 	/* lowest of bellow */
1084 	u8 thresh_below1_val;
1085 
1086 	u8 thresh_below2_val;
1087 	u8 thresh_below3_val;
1088 
1089 	/* highest of bellow */
1090 	u8 thresh_below4_val;
1091 
1092 	u8 reserved[3];
1093 } __packed;
1094 
1095 enum wmi_preamble_policy {
1096 	WMI_IGNORE_BARKER_IN_ERP = 0,
1097 	WMI_DONOT_IGNORE_BARKER_IN_ERP
1098 };
1099 
1100 struct wmi_set_lpreamble_cmd {
1101 	u8 status;
1102 	u8 preamble_policy;
1103 } __packed;
1104 
1105 struct wmi_set_rts_cmd {
1106 	__le16 threshold;
1107 } __packed;
1108 
1109 /* WMI_SET_TX_PWR_CMDID */
1110 struct wmi_set_tx_pwr_cmd {
1111 	/* in dbM units */
1112 	u8 dbM;
1113 } __packed;
1114 
1115 struct wmi_tx_pwr_reply {
1116 	/* in dbM units */
1117 	u8 dbM;
1118 } __packed;
1119 
1120 struct wmi_report_sleep_state_event {
1121 	__le32 sleep_state;
1122 };
1123 
1124 enum wmi_report_sleep_status {
1125 	WMI_REPORT_SLEEP_STATUS_IS_DEEP_SLEEP = 0,
1126 	WMI_REPORT_SLEEP_STATUS_IS_AWAKE
1127 };
1128 enum target_event_report_config {
1129 	/* default */
1130 	DISCONN_EVT_IN_RECONN = 0,
1131 
1132 	NO_DISCONN_EVT_IN_RECONN
1133 };
1134 
1135 /* Command Replies */
1136 
1137 /* WMI_GET_CHANNEL_LIST_CMDID reply */
1138 struct wmi_channel_list_reply {
1139 	u8 reserved;
1140 
1141 	/* number of channels in reply */
1142 	u8 num_ch;
1143 
1144 	/* channel in Mhz */
1145 	__le16 ch_list[1];
1146 } __packed;
1147 
1148 /* List of Events (target to host) */
1149 enum wmi_event_id {
1150 	WMI_READY_EVENTID = 0x1001,
1151 	WMI_CONNECT_EVENTID,
1152 	WMI_DISCONNECT_EVENTID,
1153 	WMI_BSSINFO_EVENTID,
1154 	WMI_CMDERROR_EVENTID,
1155 	WMI_REGDOMAIN_EVENTID,
1156 	WMI_PSTREAM_TIMEOUT_EVENTID,
1157 	WMI_NEIGHBOR_REPORT_EVENTID,
1158 	WMI_TKIP_MICERR_EVENTID,
1159 	WMI_SCAN_COMPLETE_EVENTID,	/* 0x100a */
1160 	WMI_REPORT_STATISTICS_EVENTID,
1161 	WMI_RSSI_THRESHOLD_EVENTID,
1162 	WMI_ERROR_REPORT_EVENTID,
1163 	WMI_OPT_RX_FRAME_EVENTID,
1164 	WMI_REPORT_ROAM_TBL_EVENTID,
1165 	WMI_EXTENSION_EVENTID,
1166 	WMI_CAC_EVENTID,
1167 	WMI_SNR_THRESHOLD_EVENTID,
1168 	WMI_LQ_THRESHOLD_EVENTID,
1169 	WMI_TX_RETRY_ERR_EVENTID,	/* 0x1014 */
1170 	WMI_REPORT_ROAM_DATA_EVENTID,
1171 	WMI_TEST_EVENTID,
1172 	WMI_APLIST_EVENTID,
1173 	WMI_GET_WOW_LIST_EVENTID,
1174 	WMI_GET_PMKID_LIST_EVENTID,
1175 	WMI_CHANNEL_CHANGE_EVENTID,
1176 	WMI_PEER_NODE_EVENTID,
1177 	WMI_PSPOLL_EVENTID,
1178 	WMI_DTIMEXPIRY_EVENTID,
1179 	WMI_WLAN_VERSION_EVENTID,
1180 	WMI_SET_PARAMS_REPLY_EVENTID,
1181 	WMI_ADDBA_REQ_EVENTID,		/*0x1020 */
1182 	WMI_ADDBA_RESP_EVENTID,
1183 	WMI_DELBA_REQ_EVENTID,
1184 	WMI_TX_COMPLETE_EVENTID,
1185 	WMI_HCI_EVENT_EVENTID,
1186 	WMI_ACL_DATA_EVENTID,
1187 	WMI_REPORT_SLEEP_STATE_EVENTID,
1188 	WMI_REPORT_BTCOEX_STATS_EVENTID,
1189 	WMI_REPORT_BTCOEX_CONFIG_EVENTID,
1190 	WMI_GET_PMK_EVENTID,
1191 
1192 	/* DFS Events */
1193 	WMI_DFS_HOST_ATTACH_EVENTID,
1194 	WMI_DFS_HOST_INIT_EVENTID,
1195 	WMI_DFS_RESET_DELAYLINES_EVENTID,
1196 	WMI_DFS_RESET_RADARQ_EVENTID,
1197 	WMI_DFS_RESET_AR_EVENTID,
1198 	WMI_DFS_RESET_ARQ_EVENTID,
1199 	WMI_DFS_SET_DUR_MULTIPLIER_EVENTID,
1200 	WMI_DFS_SET_BANGRADAR_EVENTID,
1201 	WMI_DFS_SET_DEBUGLEVEL_EVENTID,
1202 	WMI_DFS_PHYERR_EVENTID,
1203 
1204 	/* CCX Evants */
1205 	WMI_CCX_RM_STATUS_EVENTID,
1206 
1207 	/* P2P Events */
1208 	WMI_P2P_GO_NEG_RESULT_EVENTID,
1209 
1210 	WMI_WAC_SCAN_DONE_EVENTID,
1211 	WMI_WAC_REPORT_BSS_EVENTID,
1212 	WMI_WAC_START_WPS_EVENTID,
1213 	WMI_WAC_CTRL_REQ_REPLY_EVENTID,
1214 
1215 	WMI_REPORT_WMM_PARAMS_EVENTID,
1216 	WMI_WAC_REJECT_WPS_EVENTID,
1217 
1218 	/* More P2P Events */
1219 	WMI_P2P_GO_NEG_REQ_EVENTID,
1220 	WMI_P2P_INVITE_REQ_EVENTID,
1221 	WMI_P2P_INVITE_RCVD_RESULT_EVENTID,
1222 	WMI_P2P_INVITE_SENT_RESULT_EVENTID,
1223 	WMI_P2P_PROV_DISC_RESP_EVENTID,
1224 	WMI_P2P_PROV_DISC_REQ_EVENTID,
1225 
1226 	/* RFKILL Events */
1227 	WMI_RFKILL_STATE_CHANGE_EVENTID,
1228 	WMI_RFKILL_GET_MODE_CMD_EVENTID,
1229 
1230 	WMI_P2P_START_SDPD_EVENTID,
1231 	WMI_P2P_SDPD_RX_EVENTID,
1232 
1233 	WMI_THIN_RESERVED_START_EVENTID = 0x8000,
1234 	/* Events in this range are reserved for thinmode */
1235 	WMI_THIN_RESERVED_END_EVENTID = 0x8fff,
1236 
1237 	WMI_SET_CHANNEL_EVENTID,
1238 	WMI_ASSOC_REQ_EVENTID,
1239 
1240 	/* Generic ACS event */
1241 	WMI_ACS_EVENTID,
1242 	WMI_STORERECALL_STORE_EVENTID,
1243 	WMI_WOW_EXT_WAKE_EVENTID,
1244 	WMI_GTK_OFFLOAD_STATUS_EVENTID,
1245 	WMI_NETWORK_LIST_OFFLOAD_EVENTID,
1246 	WMI_REMAIN_ON_CHNL_EVENTID,
1247 	WMI_CANCEL_REMAIN_ON_CHNL_EVENTID,
1248 	WMI_TX_STATUS_EVENTID,
1249 	WMI_RX_PROBE_REQ_EVENTID,
1250 	WMI_P2P_CAPABILITIES_EVENTID,
1251 	WMI_RX_ACTION_EVENTID,
1252 	WMI_P2P_INFO_EVENTID,
1253 };
1254 
1255 struct wmi_ready_event_2 {
1256 	__le32 sw_version;
1257 	__le32 abi_version;
1258 	u8 mac_addr[ETH_ALEN];
1259 	u8 phy_cap;
1260 } __packed;
1261 
1262 /* Connect Event */
1263 struct wmi_connect_event {
1264 	union {
1265 		struct {
1266 			__le16 ch;
1267 			u8 bssid[ETH_ALEN];
1268 			__le16 listen_intvl;
1269 			__le16 beacon_intvl;
1270 			__le32 nw_type;
1271 		} sta;
1272 		struct {
1273 			u8 phymode;
1274 			u8 aid;
1275 			u8 mac_addr[ETH_ALEN];
1276 			u8 auth;
1277 			u8 keymgmt;
1278 			__le16 cipher;
1279 			u8 apsd_info;
1280 			u8 unused[3];
1281 		} ap_sta;
1282 		struct {
1283 			__le16 ch;
1284 			u8 bssid[ETH_ALEN];
1285 			u8 unused[8];
1286 		} ap_bss;
1287 	} u;
1288 	u8 beacon_ie_len;
1289 	u8 assoc_req_len;
1290 	u8 assoc_resp_len;
1291 	u8 assoc_info[1];
1292 } __packed;
1293 
1294 /* Disconnect Event */
1295 enum wmi_disconnect_reason {
1296 	NO_NETWORK_AVAIL = 0x01,
1297 
1298 	/* bmiss */
1299 	LOST_LINK = 0x02,
1300 
1301 	DISCONNECT_CMD = 0x03,
1302 	BSS_DISCONNECTED = 0x04,
1303 	AUTH_FAILED = 0x05,
1304 	ASSOC_FAILED = 0x06,
1305 	NO_RESOURCES_AVAIL = 0x07,
1306 	CSERV_DISCONNECT = 0x08,
1307 	INVALID_PROFILE = 0x0a,
1308 	DOT11H_CHANNEL_SWITCH = 0x0b,
1309 	PROFILE_MISMATCH = 0x0c,
1310 	CONNECTION_EVICTED = 0x0d,
1311 	IBSS_MERGE = 0xe,
1312 };
1313 
1314 #define ATH6KL_COUNTRY_RD_SHIFT        16
1315 
1316 struct ath6kl_wmi_regdomain {
1317 	__le32 reg_code;
1318 };
1319 
1320 struct wmi_disconnect_event {
1321 	/* reason code, see 802.11 spec. */
1322 	__le16 proto_reason_status;
1323 
1324 	/* set if known */
1325 	u8 bssid[ETH_ALEN];
1326 
1327 	/* see WMI_DISCONNECT_REASON */
1328 	u8 disconn_reason;
1329 
1330 	u8 assoc_resp_len;
1331 	u8 assoc_info[1];
1332 } __packed;
1333 
1334 /*
1335  * BSS Info Event.
1336  * Mechanism used to inform host of the presence and characteristic of
1337  * wireless networks present.  Consists of bss info header followed by
1338  * the beacon or probe-response frame body.  The 802.11 header is no included.
1339  */
1340 enum wmi_bi_ftype {
1341 	BEACON_FTYPE = 0x1,
1342 	PROBERESP_FTYPE,
1343 	ACTION_MGMT_FTYPE,
1344 	PROBEREQ_FTYPE,
1345 };
1346 
1347 #define DEF_LRSSI_SCAN_PERIOD		 5
1348 #define DEF_LRSSI_ROAM_THRESHOLD	20
1349 #define DEF_LRSSI_ROAM_FLOOR		60
1350 #define DEF_SCAN_FOR_ROAM_INTVL		 2
1351 
1352 enum wmi_roam_ctrl {
1353 	WMI_FORCE_ROAM = 1,
1354 	WMI_SET_ROAM_MODE,
1355 	WMI_SET_HOST_BIAS,
1356 	WMI_SET_LRSSI_SCAN_PARAMS,
1357 };
1358 
1359 enum wmi_roam_mode {
1360 	WMI_DEFAULT_ROAM_MODE = 1, /* RSSI based roam */
1361 	WMI_HOST_BIAS_ROAM_MODE = 2, /* Host bias based roam */
1362 	WMI_LOCK_BSS_MODE = 3, /* Lock to the current BSS */
1363 };
1364 
1365 struct bss_bias {
1366 	u8 bssid[ETH_ALEN];
1367 	s8 bias;
1368 } __packed;
1369 
1370 struct bss_bias_info {
1371 	u8 num_bss;
1372 	struct bss_bias bss_bias[0];
1373 } __packed;
1374 
1375 struct low_rssi_scan_params {
1376 	__le16 lrssi_scan_period;
1377 	a_sle16 lrssi_scan_threshold;
1378 	a_sle16 lrssi_roam_threshold;
1379 	u8 roam_rssi_floor;
1380 	u8 reserved[1];
1381 } __packed;
1382 
1383 struct roam_ctrl_cmd {
1384 	union {
1385 		u8 bssid[ETH_ALEN]; /* WMI_FORCE_ROAM */
1386 		u8 roam_mode; /* WMI_SET_ROAM_MODE */
1387 		struct bss_bias_info bss; /* WMI_SET_HOST_BIAS */
1388 		struct low_rssi_scan_params params; /* WMI_SET_LRSSI_SCAN_PARAMS
1389 						     */
1390 	} __packed info;
1391 	u8 roam_ctrl;
1392 } __packed;
1393 
1394 /* BSS INFO HDR version 2.0 */
1395 struct wmi_bss_info_hdr2 {
1396 	__le16 ch; /* frequency in MHz */
1397 
1398 	/* see, enum wmi_bi_ftype */
1399 	u8 frame_type;
1400 
1401 	u8 snr; /* note: rssi = snr - 95 dBm */
1402 	u8 bssid[ETH_ALEN];
1403 	__le16 ie_mask;
1404 } __packed;
1405 
1406 /* Command Error Event */
1407 enum wmi_error_code {
1408 	INVALID_PARAM = 0x01,
1409 	ILLEGAL_STATE = 0x02,
1410 	INTERNAL_ERROR = 0x03,
1411 };
1412 
1413 struct wmi_cmd_error_event {
1414 	__le16 cmd_id;
1415 	u8 err_code;
1416 } __packed;
1417 
1418 struct wmi_pstream_timeout_event {
1419 	u8 tx_queue_num;
1420 	u8 rx_queue_num;
1421 	u8 traffic_direc;
1422 	u8 traffic_class;
1423 } __packed;
1424 
1425 /*
1426  * The WMI_NEIGHBOR_REPORT Event is generated by the target to inform
1427  * the host of BSS's it has found that matches the current profile.
1428  * It can be used by the host to cache PMKs and/to initiate pre-authentication
1429  * if the BSS supports it.  The first bssid is always the current associated
1430  * BSS.
1431  * The bssid and bssFlags information repeats according to the number
1432  * or APs reported.
1433  */
1434 enum wmi_bss_flags {
1435 	WMI_DEFAULT_BSS_FLAGS = 0x00,
1436 	WMI_PREAUTH_CAPABLE_BSS = 0x01,
1437 	WMI_PMKID_VALID_BSS = 0x02,
1438 };
1439 
1440 struct wmi_neighbor_info {
1441 	u8 bssid[ETH_ALEN];
1442 	u8 bss_flags; /* enum wmi_bss_flags */
1443 } __packed;
1444 
1445 struct wmi_neighbor_report_event {
1446 	u8 num_neighbors;
1447 	struct wmi_neighbor_info neighbor[0];
1448 } __packed;
1449 
1450 /* TKIP MIC Error Event */
1451 struct wmi_tkip_micerr_event {
1452 	u8 key_id;
1453 	u8 is_mcast;
1454 } __packed;
1455 
1456 /* WMI_SCAN_COMPLETE_EVENTID */
1457 struct wmi_scan_complete_event {
1458 	a_sle32 status;
1459 } __packed;
1460 
1461 #define MAX_OPT_DATA_LEN 1400
1462 
1463 /*
1464  * Special frame receive Event.
1465  * Mechanism used to inform host of the receiption of the special frames.
1466  * Consists of special frame info header followed by special frame body.
1467  * The 802.11 header is not included.
1468  */
1469 struct wmi_opt_rx_info_hdr {
1470 	__le16 ch;
1471 	u8 frame_type;
1472 	s8 snr;
1473 	u8 src_addr[ETH_ALEN];
1474 	u8 bssid[ETH_ALEN];
1475 } __packed;
1476 
1477 /* Reporting statistic */
1478 struct tx_stats {
1479 	__le32 pkt;
1480 	__le32 byte;
1481 	__le32 ucast_pkt;
1482 	__le32 ucast_byte;
1483 	__le32 mcast_pkt;
1484 	__le32 mcast_byte;
1485 	__le32 bcast_pkt;
1486 	__le32 bcast_byte;
1487 	__le32 rts_success_cnt;
1488 	__le32 pkt_per_ac[4];
1489 	__le32 err_per_ac[4];
1490 
1491 	__le32 err;
1492 	__le32 fail_cnt;
1493 	__le32 retry_cnt;
1494 	__le32 mult_retry_cnt;
1495 	__le32 rts_fail_cnt;
1496 	a_sle32 ucast_rate;
1497 } __packed;
1498 
1499 struct rx_stats {
1500 	__le32 pkt;
1501 	__le32 byte;
1502 	__le32 ucast_pkt;
1503 	__le32 ucast_byte;
1504 	__le32 mcast_pkt;
1505 	__le32 mcast_byte;
1506 	__le32 bcast_pkt;
1507 	__le32 bcast_byte;
1508 	__le32 frgment_pkt;
1509 
1510 	__le32 err;
1511 	__le32 crc_err;
1512 	__le32 key_cache_miss;
1513 	__le32 decrypt_err;
1514 	__le32 dupl_frame;
1515 	a_sle32 ucast_rate;
1516 } __packed;
1517 
1518 struct tkip_ccmp_stats {
1519 	__le32 tkip_local_mic_fail;
1520 	__le32 tkip_cnter_measures_invoked;
1521 	__le32 tkip_replays;
1522 	__le32 tkip_fmt_err;
1523 	__le32 ccmp_fmt_err;
1524 	__le32 ccmp_replays;
1525 } __packed;
1526 
1527 struct pm_stats {
1528 	__le32 pwr_save_failure_cnt;
1529 	__le16 stop_tx_failure_cnt;
1530 	__le16 atim_tx_failure_cnt;
1531 	__le16 atim_rx_failure_cnt;
1532 	__le16 bcn_rx_failure_cnt;
1533 } __packed;
1534 
1535 struct cserv_stats {
1536 	__le32 cs_bmiss_cnt;
1537 	__le32 cs_low_rssi_cnt;
1538 	__le16 cs_connect_cnt;
1539 	__le16 cs_discon_cnt;
1540 	a_sle16 cs_ave_beacon_rssi;
1541 	__le16 cs_roam_count;
1542 	a_sle16 cs_rssi;
1543 	u8 cs_snr;
1544 	u8 cs_ave_beacon_snr;
1545 	u8 cs_last_roam_msec;
1546 } __packed;
1547 
1548 struct wlan_net_stats {
1549 	struct tx_stats tx;
1550 	struct rx_stats rx;
1551 	struct tkip_ccmp_stats tkip_ccmp_stats;
1552 } __packed;
1553 
1554 struct arp_stats {
1555 	__le32 arp_received;
1556 	__le32 arp_matched;
1557 	__le32 arp_replied;
1558 } __packed;
1559 
1560 struct wlan_wow_stats {
1561 	__le32 wow_pkt_dropped;
1562 	__le16 wow_evt_discarded;
1563 	u8 wow_host_pkt_wakeups;
1564 	u8 wow_host_evt_wakeups;
1565 } __packed;
1566 
1567 struct wmi_target_stats {
1568 	__le32 lq_val;
1569 	a_sle32 noise_floor_calib;
1570 	struct pm_stats pm_stats;
1571 	struct wlan_net_stats stats;
1572 	struct wlan_wow_stats wow_stats;
1573 	struct arp_stats arp_stats;
1574 	struct cserv_stats cserv_stats;
1575 } __packed;
1576 
1577 /*
1578  * WMI_RSSI_THRESHOLD_EVENTID.
1579  * Indicate the RSSI events to host. Events are indicated when we breach a
1580  * thresold value.
1581  */
1582 enum wmi_rssi_threshold_val {
1583 	WMI_RSSI_THRESHOLD1_ABOVE = 0,
1584 	WMI_RSSI_THRESHOLD2_ABOVE,
1585 	WMI_RSSI_THRESHOLD3_ABOVE,
1586 	WMI_RSSI_THRESHOLD4_ABOVE,
1587 	WMI_RSSI_THRESHOLD5_ABOVE,
1588 	WMI_RSSI_THRESHOLD6_ABOVE,
1589 	WMI_RSSI_THRESHOLD1_BELOW,
1590 	WMI_RSSI_THRESHOLD2_BELOW,
1591 	WMI_RSSI_THRESHOLD3_BELOW,
1592 	WMI_RSSI_THRESHOLD4_BELOW,
1593 	WMI_RSSI_THRESHOLD5_BELOW,
1594 	WMI_RSSI_THRESHOLD6_BELOW
1595 };
1596 
1597 struct wmi_rssi_threshold_event {
1598 	a_sle16 rssi;
1599 	u8 range;
1600 } __packed;
1601 
1602 enum wmi_snr_threshold_val {
1603 	WMI_SNR_THRESHOLD1_ABOVE = 1,
1604 	WMI_SNR_THRESHOLD1_BELOW,
1605 	WMI_SNR_THRESHOLD2_ABOVE,
1606 	WMI_SNR_THRESHOLD2_BELOW,
1607 	WMI_SNR_THRESHOLD3_ABOVE,
1608 	WMI_SNR_THRESHOLD3_BELOW,
1609 	WMI_SNR_THRESHOLD4_ABOVE,
1610 	WMI_SNR_THRESHOLD4_BELOW
1611 };
1612 
1613 struct wmi_snr_threshold_event {
1614 	/* see, enum wmi_snr_threshold_val */
1615 	u8 range;
1616 
1617 	u8 snr;
1618 } __packed;
1619 
1620 /* WMI_REPORT_ROAM_TBL_EVENTID */
1621 #define MAX_ROAM_TBL_CAND   5
1622 
1623 struct wmi_bss_roam_info {
1624 	a_sle32 roam_util;
1625 	u8 bssid[ETH_ALEN];
1626 	s8 rssi;
1627 	s8 rssidt;
1628 	s8 last_rssi;
1629 	s8 util;
1630 	s8 bias;
1631 
1632 	/* for alignment */
1633 	u8 reserved;
1634 } __packed;
1635 
1636 struct wmi_target_roam_tbl {
1637 	__le16 roam_mode;
1638 	__le16 num_entries;
1639 	struct wmi_bss_roam_info info[];
1640 } __packed;
1641 
1642 /* WMI_CAC_EVENTID */
1643 enum cac_indication {
1644 	CAC_INDICATION_ADMISSION = 0x00,
1645 	CAC_INDICATION_ADMISSION_RESP = 0x01,
1646 	CAC_INDICATION_DELETE = 0x02,
1647 	CAC_INDICATION_NO_RESP = 0x03,
1648 };
1649 
1650 #define WMM_TSPEC_IE_LEN   63
1651 
1652 struct wmi_cac_event {
1653 	u8 ac;
1654 	u8 cac_indication;
1655 	u8 status_code;
1656 	u8 tspec_suggestion[WMM_TSPEC_IE_LEN];
1657 } __packed;
1658 
1659 /* WMI_APLIST_EVENTID */
1660 
1661 enum aplist_ver {
1662 	APLIST_VER1 = 1,
1663 };
1664 
1665 struct wmi_ap_info_v1 {
1666 	u8 bssid[ETH_ALEN];
1667 	__le16 channel;
1668 } __packed;
1669 
1670 union wmi_ap_info {
1671 	struct wmi_ap_info_v1 ap_info_v1;
1672 } __packed;
1673 
1674 struct wmi_aplist_event {
1675 	u8 ap_list_ver;
1676 	u8 num_ap;
1677 	union wmi_ap_info ap_list[1];
1678 } __packed;
1679 
1680 /* Developer Commands */
1681 
1682 /*
1683  * WMI_SET_BITRATE_CMDID
1684  *
1685  * Get bit rate cmd uses same definition as set bit rate cmd
1686  */
1687 enum wmi_bit_rate {
1688 	RATE_AUTO = -1,
1689 	RATE_1Mb = 0,
1690 	RATE_2Mb = 1,
1691 	RATE_5_5Mb = 2,
1692 	RATE_11Mb = 3,
1693 	RATE_6Mb = 4,
1694 	RATE_9Mb = 5,
1695 	RATE_12Mb = 6,
1696 	RATE_18Mb = 7,
1697 	RATE_24Mb = 8,
1698 	RATE_36Mb = 9,
1699 	RATE_48Mb = 10,
1700 	RATE_54Mb = 11,
1701 	RATE_MCS_0_20 = 12,
1702 	RATE_MCS_1_20 = 13,
1703 	RATE_MCS_2_20 = 14,
1704 	RATE_MCS_3_20 = 15,
1705 	RATE_MCS_4_20 = 16,
1706 	RATE_MCS_5_20 = 17,
1707 	RATE_MCS_6_20 = 18,
1708 	RATE_MCS_7_20 = 19,
1709 	RATE_MCS_0_40 = 20,
1710 	RATE_MCS_1_40 = 21,
1711 	RATE_MCS_2_40 = 22,
1712 	RATE_MCS_3_40 = 23,
1713 	RATE_MCS_4_40 = 24,
1714 	RATE_MCS_5_40 = 25,
1715 	RATE_MCS_6_40 = 26,
1716 	RATE_MCS_7_40 = 27,
1717 };
1718 
1719 struct wmi_bit_rate_reply {
1720 	/* see, enum wmi_bit_rate */
1721 	s8 rate_index;
1722 } __packed;
1723 
1724 /*
1725  * WMI_SET_FIXRATES_CMDID
1726  *
1727  * Get fix rates cmd uses same definition as set fix rates cmd
1728  */
1729 struct wmi_fix_rates_reply {
1730 	/* see wmi_bit_rate */
1731 	__le32 fix_rate_mask;
1732 } __packed;
1733 
1734 enum roam_data_type {
1735 	/* get the roam time data */
1736 	ROAM_DATA_TIME = 1,
1737 };
1738 
1739 struct wmi_target_roam_time {
1740 	__le32 disassoc_time;
1741 	__le32 no_txrx_time;
1742 	__le32 assoc_time;
1743 	__le32 allow_txrx_time;
1744 	u8 disassoc_bssid[ETH_ALEN];
1745 	s8 disassoc_bss_rssi;
1746 	u8 assoc_bssid[ETH_ALEN];
1747 	s8 assoc_bss_rssi;
1748 } __packed;
1749 
1750 enum wmi_txop_cfg {
1751 	WMI_TXOP_DISABLED = 0,
1752 	WMI_TXOP_ENABLED
1753 };
1754 
1755 struct wmi_set_wmm_txop_cmd {
1756 	u8 txop_enable;
1757 } __packed;
1758 
1759 struct wmi_set_keepalive_cmd {
1760 	u8 keep_alive_intvl;
1761 } __packed;
1762 
1763 struct wmi_get_keepalive_cmd {
1764 	__le32 configured;
1765 	u8 keep_alive_intvl;
1766 } __packed;
1767 
1768 struct wmi_set_appie_cmd {
1769 	u8 mgmt_frm_type; /* enum wmi_mgmt_frame_type */
1770 	u8 ie_len;
1771 	u8 ie_info[0];
1772 } __packed;
1773 
1774 /* Notify the WSC registration status to the target */
1775 #define WSC_REG_ACTIVE     1
1776 #define WSC_REG_INACTIVE   0
1777 
1778 #define WOW_MAX_FILTER_LISTS	 1
1779 #define WOW_MAX_FILTERS_PER_LIST 4
1780 #define WOW_PATTERN_SIZE	 64
1781 #define WOW_MASK_SIZE		 64
1782 
1783 #define MAC_MAX_FILTERS_PER_LIST 4
1784 
1785 struct wow_filter {
1786 	u8 wow_valid_filter;
1787 	u8 wow_filter_id;
1788 	u8 wow_filter_size;
1789 	u8 wow_filter_offset;
1790 	u8 wow_filter_mask[WOW_MASK_SIZE];
1791 	u8 wow_filter_pattern[WOW_PATTERN_SIZE];
1792 } __packed;
1793 
1794 #define MAX_IP_ADDRS  2
1795 
1796 struct wmi_set_ip_cmd {
1797 	/* IP in network byte order */
1798 	__le32 ips[MAX_IP_ADDRS];
1799 } __packed;
1800 
1801 /* WMI_GET_WOW_LIST_CMD reply  */
1802 struct wmi_get_wow_list_reply {
1803 	/* number of patterns in reply */
1804 	u8 num_filters;
1805 
1806 	/* this is filter # x of total num_filters */
1807 	u8 this_filter_num;
1808 
1809 	u8 wow_mode;
1810 	u8 host_mode;
1811 	struct wow_filter wow_filters[1];
1812 } __packed;
1813 
1814 /* WMI_SET_AKMP_PARAMS_CMD */
1815 
1816 struct wmi_pmkid {
1817 	u8 pmkid[WMI_PMKID_LEN];
1818 } __packed;
1819 
1820 /* WMI_GET_PMKID_LIST_CMD  Reply */
1821 struct wmi_pmkid_list_reply {
1822 	__le32 num_pmkid;
1823 	u8 bssid_list[ETH_ALEN][1];
1824 	struct wmi_pmkid pmkid_list[1];
1825 } __packed;
1826 
1827 /* WMI_ADDBA_REQ_EVENTID */
1828 struct wmi_addba_req_event {
1829 	u8 tid;
1830 	u8 win_sz;
1831 	__le16 st_seq_no;
1832 
1833 	/* f/w response for ADDBA Req; OK (0) or failure (!=0) */
1834 	u8 status;
1835 } __packed;
1836 
1837 /* WMI_ADDBA_RESP_EVENTID */
1838 struct wmi_addba_resp_event {
1839 	u8 tid;
1840 
1841 	/* OK (0), failure (!=0) */
1842 	u8 status;
1843 
1844 	/* three values: not supported(0), 3839, 8k */
1845 	__le16 amsdu_sz;
1846 } __packed;
1847 
1848 /* WMI_DELBA_EVENTID
1849  * f/w received a DELBA for peer and processed it.
1850  * Host is notified of this
1851  */
1852 struct wmi_delba_event {
1853 	u8 tid;
1854 	u8 is_peer_initiator;
1855 	__le16 reason_code;
1856 } __packed;
1857 
1858 #define PEER_NODE_JOIN_EVENT		0x00
1859 #define PEER_NODE_LEAVE_EVENT		0x01
1860 #define PEER_FIRST_NODE_JOIN_EVENT	0x10
1861 #define PEER_LAST_NODE_LEAVE_EVENT	0x11
1862 
1863 struct wmi_peer_node_event {
1864 	u8 event_code;
1865 	u8 peer_mac_addr[ETH_ALEN];
1866 } __packed;
1867 
1868 /* Transmit complete event data structure(s) */
1869 
1870 /* version 1 of tx complete msg */
1871 struct tx_complete_msg_v1 {
1872 #define TX_COMPLETE_STATUS_SUCCESS 0
1873 #define TX_COMPLETE_STATUS_RETRIES 1
1874 #define TX_COMPLETE_STATUS_NOLINK  2
1875 #define TX_COMPLETE_STATUS_TIMEOUT 3
1876 #define TX_COMPLETE_STATUS_OTHER   4
1877 
1878 	u8 status;
1879 
1880 	/* packet ID to identify parent packet */
1881 	u8 pkt_id;
1882 
1883 	/* rate index on successful transmission */
1884 	u8 rate_idx;
1885 
1886 	/* number of ACK failures in tx attempt */
1887 	u8 ack_failures;
1888 } __packed;
1889 
1890 struct wmi_tx_complete_event {
1891 	/* no of tx comp msgs following this struct */
1892 	u8 num_msg;
1893 
1894 	/* length in bytes for each individual msg following this struct */
1895 	u8 msg_len;
1896 
1897 	/* version of tx complete msg data following this struct */
1898 	u8 msg_type;
1899 
1900 	/* individual messages follow this header */
1901 	u8 reserved;
1902 } __packed;
1903 
1904 /*
1905  * ------- AP Mode definitions --------------
1906  */
1907 
1908 /*
1909  * !!! Warning !!!
1910  * -Changing the following values needs compilation of both driver and firmware
1911  */
1912 #define AP_MAX_NUM_STA          8
1913 
1914 /* Spl. AID used to set DTIM flag in the beacons */
1915 #define MCAST_AID               0xFF
1916 
1917 #define DEF_AP_COUNTRY_CODE     "US "
1918 
1919 /* Used with WMI_AP_SET_NUM_STA_CMDID */
1920 
1921 /*
1922  * Used with WMI_AP_SET_MLME_CMDID
1923  */
1924 
1925 /* MLME Commands */
1926 #define WMI_AP_MLME_ASSOC       1   /* associate station */
1927 #define WMI_AP_DISASSOC         2   /* disassociate station */
1928 #define WMI_AP_DEAUTH           3   /* deauthenticate station */
1929 #define WMI_AP_MLME_AUTHORIZE   4   /* authorize station */
1930 #define WMI_AP_MLME_UNAUTHORIZE 5   /* unauthorize station */
1931 
1932 struct wmi_ap_set_mlme_cmd {
1933 	u8 mac[ETH_ALEN];
1934 	__le16 reason;		/* 802.11 reason code */
1935 	u8 cmd;			/* operation to perform (WMI_AP_*) */
1936 } __packed;
1937 
1938 struct wmi_ap_set_pvb_cmd {
1939 	__le32 flag;
1940 	__le16 rsvd;
1941 	__le16 aid;
1942 } __packed;
1943 
1944 struct wmi_rx_frame_format_cmd {
1945 	/* version of meta data for rx packets <0 = default> (0-7 = valid) */
1946 	u8 meta_ver;
1947 
1948 	/*
1949 	 * 1 == leave .11 header intact,
1950 	 * 0 == replace .11 header with .3 <default>
1951 	 */
1952 	u8 dot11_hdr;
1953 
1954 	/*
1955 	 * 1 == defragmentation is performed by host,
1956 	 * 0 == performed by target <default>
1957 	 */
1958 	u8 defrag_on_host;
1959 
1960 	/* for alignment */
1961 	u8 reserved[1];
1962 } __packed;
1963 
1964 /* AP mode events */
1965 
1966 /* WMI_PS_POLL_EVENT */
1967 struct wmi_pspoll_event {
1968 	__le16 aid;
1969 } __packed;
1970 
1971 struct wmi_per_sta_stat {
1972 	__le32 tx_bytes;
1973 	__le32 tx_pkts;
1974 	__le32 tx_error;
1975 	__le32 tx_discard;
1976 	__le32 rx_bytes;
1977 	__le32 rx_pkts;
1978 	__le32 rx_error;
1979 	__le32 rx_discard;
1980 	__le32 aid;
1981 } __packed;
1982 
1983 struct wmi_ap_mode_stat {
1984 	__le32 action;
1985 	struct wmi_per_sta_stat sta[AP_MAX_NUM_STA + 1];
1986 } __packed;
1987 
1988 /* End of AP mode definitions */
1989 
1990 struct wmi_remain_on_chnl_cmd {
1991 	__le32 freq;
1992 	__le32 duration;
1993 } __packed;
1994 
1995 struct wmi_send_action_cmd {
1996 	__le32 id;
1997 	__le32 freq;
1998 	__le32 wait;
1999 	__le16 len;
2000 	u8 data[0];
2001 } __packed;
2002 
2003 struct wmi_tx_status_event {
2004 	__le32 id;
2005 	u8 ack_status;
2006 } __packed;
2007 
2008 struct wmi_probe_req_report_cmd {
2009 	u8 enable;
2010 } __packed;
2011 
2012 struct wmi_disable_11b_rates_cmd {
2013 	u8 disable;
2014 } __packed;
2015 
2016 struct wmi_set_appie_extended_cmd {
2017 	u8 role_id;
2018 	u8 mgmt_frm_type;
2019 	u8 ie_len;
2020 	u8 ie_info[0];
2021 } __packed;
2022 
2023 struct wmi_remain_on_chnl_event {
2024 	__le32 freq;
2025 	__le32 duration;
2026 } __packed;
2027 
2028 struct wmi_cancel_remain_on_chnl_event {
2029 	__le32 freq;
2030 	__le32 duration;
2031 	u8 status;
2032 } __packed;
2033 
2034 struct wmi_rx_action_event {
2035 	__le32 freq;
2036 	__le16 len;
2037 	u8 data[0];
2038 } __packed;
2039 
2040 struct wmi_p2p_capabilities_event {
2041 	__le16 len;
2042 	u8 data[0];
2043 } __packed;
2044 
2045 struct wmi_p2p_rx_probe_req_event {
2046 	__le32 freq;
2047 	__le16 len;
2048 	u8 data[0];
2049 } __packed;
2050 
2051 #define P2P_FLAG_CAPABILITIES_REQ   (0x00000001)
2052 #define P2P_FLAG_MACADDR_REQ        (0x00000002)
2053 #define P2P_FLAG_HMODEL_REQ         (0x00000002)
2054 
2055 struct wmi_get_p2p_info {
2056 	__le32 info_req_flags;
2057 } __packed;
2058 
2059 struct wmi_p2p_info_event {
2060 	__le32 info_req_flags;
2061 	__le16 len;
2062 	u8 data[0];
2063 } __packed;
2064 
2065 struct wmi_p2p_capabilities {
2066 	u8 go_power_save;
2067 } __packed;
2068 
2069 struct wmi_p2p_macaddr {
2070 	u8 mac_addr[ETH_ALEN];
2071 } __packed;
2072 
2073 struct wmi_p2p_hmodel {
2074 	u8 p2p_model;
2075 } __packed;
2076 
2077 struct wmi_p2p_probe_response_cmd {
2078 	__le32 freq;
2079 	u8 destination_addr[ETH_ALEN];
2080 	__le16 len;
2081 	u8 data[0];
2082 } __packed;
2083 
2084 /* Extended WMI (WMIX)
2085  *
2086  * Extended WMIX commands are encapsulated in a WMI message with
2087  * cmd=WMI_EXTENSION_CMD.
2088  *
2089  * Extended WMI commands are those that are needed during wireless
2090  * operation, but which are not really wireless commands.  This allows,
2091  * for instance, platform-specific commands.  Extended WMI commands are
2092  * embedded in a WMI command message with WMI_COMMAND_ID=WMI_EXTENSION_CMDID.
2093  * Extended WMI events are similarly embedded in a WMI event message with
2094  * WMI_EVENT_ID=WMI_EXTENSION_EVENTID.
2095  */
2096 struct wmix_cmd_hdr {
2097 	__le32 cmd_id;
2098 } __packed;
2099 
2100 enum wmix_command_id {
2101 	WMIX_DSETOPEN_REPLY_CMDID = 0x2001,
2102 	WMIX_DSETDATA_REPLY_CMDID,
2103 	WMIX_GPIO_OUTPUT_SET_CMDID,
2104 	WMIX_GPIO_INPUT_GET_CMDID,
2105 	WMIX_GPIO_REGISTER_SET_CMDID,
2106 	WMIX_GPIO_REGISTER_GET_CMDID,
2107 	WMIX_GPIO_INTR_ACK_CMDID,
2108 	WMIX_HB_CHALLENGE_RESP_CMDID,
2109 	WMIX_DBGLOG_CFG_MODULE_CMDID,
2110 	WMIX_PROF_CFG_CMDID,	/* 0x200a */
2111 	WMIX_PROF_ADDR_SET_CMDID,
2112 	WMIX_PROF_START_CMDID,
2113 	WMIX_PROF_STOP_CMDID,
2114 	WMIX_PROF_COUNT_GET_CMDID,
2115 };
2116 
2117 enum wmix_event_id {
2118 	WMIX_DSETOPENREQ_EVENTID = 0x3001,
2119 	WMIX_DSETCLOSE_EVENTID,
2120 	WMIX_DSETDATAREQ_EVENTID,
2121 	WMIX_GPIO_INTR_EVENTID,
2122 	WMIX_GPIO_DATA_EVENTID,
2123 	WMIX_GPIO_ACK_EVENTID,
2124 	WMIX_HB_CHALLENGE_RESP_EVENTID,
2125 	WMIX_DBGLOG_EVENTID,
2126 	WMIX_PROF_COUNT_EVENTID,
2127 };
2128 
2129 /*
2130  * ------Error Detection support-------
2131  */
2132 
2133 /*
2134  * WMIX_HB_CHALLENGE_RESP_CMDID
2135  * Heartbeat Challenge Response command
2136  */
2137 struct wmix_hb_challenge_resp_cmd {
2138 	__le32 cookie;
2139 	__le32 source;
2140 } __packed;
2141 
2142 struct ath6kl_wmix_dbglog_cfg_module_cmd {
2143 	__le32 valid;
2144 	__le32 config;
2145 } __packed;
2146 
2147 /* End of Extended WMI (WMIX) */
2148 
2149 enum wmi_sync_flag {
2150 	NO_SYNC_WMIFLAG = 0,
2151 
2152 	/* transmit all queued data before cmd */
2153 	SYNC_BEFORE_WMIFLAG,
2154 
2155 	/* any new data waits until cmd execs */
2156 	SYNC_AFTER_WMIFLAG,
2157 
2158 	SYNC_BOTH_WMIFLAG,
2159 
2160 	/* end marker */
2161 	END_WMIFLAG
2162 };
2163 
2164 enum htc_endpoint_id ath6kl_wmi_get_control_ep(struct wmi *wmi);
2165 void ath6kl_wmi_set_control_ep(struct wmi *wmi, enum htc_endpoint_id ep_id);
2166 int ath6kl_wmi_dix_2_dot3(struct wmi *wmi, struct sk_buff *skb);
2167 int ath6kl_wmi_data_hdr_add(struct wmi *wmi, struct sk_buff *skb,
2168 			    u8 msg_type, bool more_data,
2169 			    enum wmi_data_hdr_data_type data_type,
2170 			    u8 meta_ver, void *tx_meta_info);
2171 
2172 int ath6kl_wmi_dot11_hdr_remove(struct wmi *wmi, struct sk_buff *skb);
2173 int ath6kl_wmi_dot3_2_dix(struct sk_buff *skb);
2174 int ath6kl_wmi_implicit_create_pstream(struct wmi *wmi, u8 if_idx,
2175 				       struct sk_buff *skb, u32 layer2_priority,
2176 				       bool wmm_enabled, u8 *ac);
2177 
2178 int ath6kl_wmi_control_rx(struct wmi *wmi, struct sk_buff *skb);
2179 
2180 int ath6kl_wmi_cmd_send(struct wmi *wmi, u8 if_idx, struct sk_buff *skb,
2181 			enum wmi_cmd_id cmd_id, enum wmi_sync_flag sync_flag);
2182 
2183 int ath6kl_wmi_connect_cmd(struct wmi *wmi, u8 if_idx,
2184 			   enum network_type nw_type,
2185 			   enum dot11_auth_mode dot11_auth_mode,
2186 			   enum auth_mode auth_mode,
2187 			   enum crypto_type pairwise_crypto,
2188 			   u8 pairwise_crypto_len,
2189 			   enum crypto_type group_crypto,
2190 			   u8 group_crypto_len, int ssid_len, u8 *ssid,
2191 			   u8 *bssid, u16 channel, u32 ctrl_flags);
2192 
2193 int ath6kl_wmi_reconnect_cmd(struct wmi *wmi, u8 if_idx, u8 *bssid,
2194 			     u16 channel);
2195 int ath6kl_wmi_disconnect_cmd(struct wmi *wmi, u8 if_idx);
2196 int ath6kl_wmi_startscan_cmd(struct wmi *wmi, u8 if_idx,
2197 			     enum wmi_scan_type scan_type,
2198 			     u32 force_fgscan, u32 is_legacy,
2199 			     u32 home_dwell_time, u32 force_scan_interval,
2200 			     s8 num_chan, u16 *ch_list);
2201 int ath6kl_wmi_scanparams_cmd(struct wmi *wmi, u8 if_idx, u16 fg_start_sec,
2202 			      u16 fg_end_sec, u16 bg_sec,
2203 			      u16 minact_chdw_msec, u16 maxact_chdw_msec,
2204 			      u16 pas_chdw_msec, u8 short_scan_ratio,
2205 			      u8 scan_ctrl_flag, u32 max_dfsch_act_time,
2206 			      u16 maxact_scan_per_ssid);
2207 int ath6kl_wmi_bssfilter_cmd(struct wmi *wmi, u8 if_idx, u8 filter,
2208 			     u32 ie_mask);
2209 int ath6kl_wmi_probedssid_cmd(struct wmi *wmi, u8 if_idx, u8 index, u8 flag,
2210 			      u8 ssid_len, u8 *ssid);
2211 int ath6kl_wmi_listeninterval_cmd(struct wmi *wmi, u8 if_idx,
2212 				  u16 listen_interval,
2213 				  u16 listen_beacons);
2214 int ath6kl_wmi_powermode_cmd(struct wmi *wmi, u8 if_idx, u8 pwr_mode);
2215 int ath6kl_wmi_pmparams_cmd(struct wmi *wmi, u16 idle_period,
2216 			    u16 ps_poll_num, u16 dtim_policy,
2217 			    u16 tx_wakup_policy, u16 num_tx_to_wakeup,
2218 			    u16 ps_fail_event_policy);
2219 int ath6kl_wmi_disctimeout_cmd(struct wmi *wmi, u8 timeout);
2220 int ath6kl_wmi_create_pstream_cmd(struct wmi *wmi, u8 if_idx,
2221 				  struct wmi_create_pstream_cmd *pstream);
2222 int ath6kl_wmi_delete_pstream_cmd(struct wmi *wmi, u8 if_idx, u8 traffic_class,
2223 				  u8 tsid);
2224 
2225 int ath6kl_wmi_set_rts_cmd(struct wmi *wmi, u16 threshold);
2226 int ath6kl_wmi_set_lpreamble_cmd(struct wmi *wmi, u8 status,
2227 				 u8 preamble_policy);
2228 
2229 int ath6kl_wmi_get_challenge_resp_cmd(struct wmi *wmi, u32 cookie, u32 source);
2230 int ath6kl_wmi_config_debug_module_cmd(struct wmi *wmi, u32 valid, u32 config);
2231 
2232 int ath6kl_wmi_get_stats_cmd(struct wmi *wmi, u8 if_idx);
2233 int ath6kl_wmi_addkey_cmd(struct wmi *wmi, u8 if_idx, u8 key_index,
2234 			  enum crypto_type key_type,
2235 			  u8 key_usage, u8 key_len,
2236 			  u8 *key_rsc, u8 *key_material,
2237 			  u8 key_op_ctrl, u8 *mac_addr,
2238 			  enum wmi_sync_flag sync_flag);
2239 int ath6kl_wmi_add_krk_cmd(struct wmi *wmi, u8 if_idx, u8 *krk);
2240 int ath6kl_wmi_deletekey_cmd(struct wmi *wmi, u8 if_idx, u8 key_index);
2241 int ath6kl_wmi_setpmkid_cmd(struct wmi *wmi, u8 if_idx, const u8 *bssid,
2242 			    const u8 *pmkid, bool set);
2243 int ath6kl_wmi_set_tx_pwr_cmd(struct wmi *wmi, u8 dbM);
2244 int ath6kl_wmi_get_tx_pwr_cmd(struct wmi *wmi);
2245 int ath6kl_wmi_get_roam_tbl_cmd(struct wmi *wmi);
2246 
2247 int ath6kl_wmi_set_wmm_txop(struct wmi *wmi, enum wmi_txop_cfg cfg);
2248 int ath6kl_wmi_set_keepalive_cmd(struct wmi *wmi, u8 keep_alive_intvl);
2249 int ath6kl_wmi_test_cmd(struct wmi *wmi, void *buf, size_t len);
2250 
2251 s32 ath6kl_wmi_get_rate(s8 rate_index);
2252 
2253 int ath6kl_wmi_set_ip_cmd(struct wmi *wmi, struct wmi_set_ip_cmd *ip_cmd);
2254 int ath6kl_wmi_set_roam_lrssi_cmd(struct wmi *wmi, u8 lrssi);
2255 int ath6kl_wmi_force_roam_cmd(struct wmi *wmi, const u8 *bssid);
2256 int ath6kl_wmi_set_roam_mode_cmd(struct wmi *wmi, enum wmi_roam_mode mode);
2257 
2258 /* AP mode */
2259 int ath6kl_wmi_ap_profile_commit(struct wmi *wmip, u8 if_idx,
2260 				 struct wmi_connect_cmd *p);
2261 
2262 int ath6kl_wmi_ap_set_mlme(struct wmi *wmip, u8 if_idx, u8 cmd,
2263 			   const u8 *mac, u16 reason);
2264 
2265 int ath6kl_wmi_set_pvb_cmd(struct wmi *wmi, u8 if_idx, u16 aid, bool flag);
2266 
2267 int ath6kl_wmi_set_rx_frame_format_cmd(struct wmi *wmi, u8 rx_meta_version,
2268 				       bool rx_dot11_hdr, bool defrag_on_host);
2269 
2270 int ath6kl_wmi_set_appie_cmd(struct wmi *wmi, u8 if_idx, u8 mgmt_frm_type,
2271 			     const u8 *ie, u8 ie_len);
2272 
2273 /* P2P */
2274 int ath6kl_wmi_disable_11b_rates_cmd(struct wmi *wmi, bool disable);
2275 
2276 int ath6kl_wmi_remain_on_chnl_cmd(struct wmi *wmi, u8 if_idx, u32 freq,
2277 				  u32 dur);
2278 
2279 int ath6kl_wmi_send_action_cmd(struct wmi *wmi, u8 if_idx, u32 id, u32 freq,
2280 			       u32 wait, const u8 *data, u16 data_len);
2281 
2282 int ath6kl_wmi_send_probe_response_cmd(struct wmi *wmi, u8 if_idx, u32 freq,
2283 				       const u8 *dst, const u8 *data,
2284 				       u16 data_len);
2285 
2286 int ath6kl_wmi_probe_report_req_cmd(struct wmi *wmi, bool enable);
2287 
2288 int ath6kl_wmi_info_req_cmd(struct wmi *wmi, u32 info_req_flags);
2289 
2290 int ath6kl_wmi_cancel_remain_on_chnl_cmd(struct wmi *wmi, u8 if_idx);
2291 
2292 int ath6kl_wmi_set_appie_cmd(struct wmi *wmi, u8 if_idx, u8 mgmt_frm_type,
2293 			     const u8 *ie, u8 ie_len);
2294 
2295 void *ath6kl_wmi_init(struct ath6kl *devt);
2296 void ath6kl_wmi_shutdown(struct wmi *wmi);
2297 
2298 #endif /* WMI_H */
2299