2 * Copyright (c) 2004-2007 Atheros Communications Inc.
5 * This module implements the hardware independent layer of the
6 * Wireless Module Interface (WMI) protocol.
8 * $Id: //depot/sw/releases/olca2.0-GPL/host/wmi/wmi.c#3 $
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License version 2 as
13 * published by the Free Software Foundation;
15 * Software distributed under the License is distributed on an "AS
16 * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
17 * implied. See the License for the specific language governing
18 * rights and limitations under the License.
31 #include <ieee80211.h>
32 #include <ieee80211_node.h>
39 #include "a_drv_api.h"
41 #include "dbglog_api.h"
43 static A_STATUS
wmi_ready_event_rx(struct wmi_t
*wmip
, A_UINT8
*datap
, int len
);
45 static A_STATUS
wmi_connect_event_rx(struct wmi_t
*wmip
, A_UINT8
*datap
,
47 static A_STATUS
wmi_disconnect_event_rx(struct wmi_t
*wmip
, A_UINT8
*datap
,
49 static A_STATUS
wmi_tkip_micerr_event_rx(struct wmi_t
*wmip
, A_UINT8
*datap
,
51 static A_STATUS
wmi_bssInfo_event_rx(struct wmi_t
*wmip
, A_UINT8
*datap
,
53 static A_STATUS
wmi_opt_frame_event_rx(struct wmi_t
*wmip
, A_UINT8
*datap
,
55 static A_STATUS
wmi_pstream_timeout_event_rx(struct wmi_t
*wmip
, A_UINT8
*datap
,
57 static A_STATUS
wmi_sync_point(struct wmi_t
*wmip
);
59 static A_STATUS
wmi_bitrate_reply_rx(struct wmi_t
*wmip
, A_UINT8
*datap
,
61 static A_STATUS
wmi_ratemask_reply_rx(struct wmi_t
*wmip
, A_UINT8
*datap
,
63 static A_STATUS
wmi_channelList_reply_rx(struct wmi_t
*wmip
, A_UINT8
*datap
,
65 static A_STATUS
wmi_regDomain_event_rx(struct wmi_t
*wmip
, A_UINT8
*datap
,
67 static A_STATUS
wmi_txPwr_reply_rx(struct wmi_t
*wmip
, A_UINT8
*datap
, int len
);
68 static A_STATUS
wmi_neighborReport_event_rx(struct wmi_t
*wmip
, A_UINT8
*datap
,
71 static A_STATUS
wmi_dset_open_req_rx(struct wmi_t
*wmip
, A_UINT8
*datap
,
73 #ifdef CONFIG_HOST_DSET_SUPPORT
74 static A_STATUS
wmi_dset_close_rx(struct wmi_t
*wmip
, A_UINT8
*datap
, int len
);
75 static A_STATUS
wmi_dset_data_req_rx(struct wmi_t
*wmip
, A_UINT8
*datap
,
77 #endif /* CONFIG_HOST_DSET_SUPPORT */
80 static A_STATUS
wmi_scanComplete_rx(struct wmi_t
*wmip
, A_UINT8
*datap
,
82 static A_STATUS
wmi_errorEvent_rx(struct wmi_t
*wmip
, A_UINT8
*datap
, int len
);
83 static A_STATUS
wmi_statsEvent_rx(struct wmi_t
*wmip
, A_UINT8
*datap
, int len
);
84 static A_STATUS
wmi_rssiThresholdEvent_rx(struct wmi_t
*wmip
, A_UINT8
*datap
, int len
);
85 static A_STATUS
wmi_hbChallengeResp_rx(struct wmi_t
*wmip
, A_UINT8
*datap
, int len
);
86 static A_STATUS
wmi_reportErrorEvent_rx(struct wmi_t
*wmip
, A_UINT8
*datap
, int len
);
87 static A_STATUS
wmi_cac_event_rx(struct wmi_t
*wmip
, A_UINT8
*datap
, int len
);
88 static A_STATUS
wmi_roam_tbl_event_rx(struct wmi_t
*wmip
, A_UINT8
*datap
,
90 static A_STATUS
wmi_roam_data_event_rx(struct wmi_t
*wmip
, A_UINT8
*datap
,
92 static A_STATUS
wmi_get_wow_list_event_rx(struct wmi_t
*wmip
, A_UINT8
*datap
,
95 wmi_get_pmkid_list_event_rx(struct wmi_t
*wmip
, A_UINT8
*datap
, A_UINT32 len
);
97 #ifdef CONFIG_HOST_GPIO_SUPPORT
98 static A_STATUS
wmi_gpio_intr_rx(struct wmi_t
*wmip
, A_UINT8
*datap
, int len
);
99 static A_STATUS
wmi_gpio_data_rx(struct wmi_t
*wmip
, A_UINT8
*datap
, int len
);
100 static A_STATUS
wmi_gpio_ack_rx(struct wmi_t
*wmip
, A_UINT8
*datap
, int len
);
101 #endif /* CONFIG_HOST_GPIO_SUPPORT */
103 #ifdef CONFIG_HOST_TCMD_SUPPORT
105 wmi_tcmd_test_report_rx(struct wmi_t
*wmip
, A_UINT8
*datap
, int len
);
109 wmi_txRetryErrEvent_rx(struct wmi_t
*wmip
, A_UINT8
*datap
, int len
);
112 wmi_snrThresholdEvent_rx(struct wmi_t
*wmip
, A_UINT8
*datap
, int len
);
115 wmi_lqThresholdEvent_rx(struct wmi_t
*wmip
, A_UINT8
*datap
, int len
);
118 wmi_is_bitrate_index_valid(struct wmi_t
*wmip
, A_UINT32 rateIndex
);
121 wmi_aplistEvent_rx(struct wmi_t
*wmip
, A_UINT8
*datap
, int len
);
124 wmi_dbglog_event_rx(struct wmi_t
*wmip
, A_UINT8
*datap
, int len
);
126 static A_STATUS
wmi_keepalive_reply_rx(struct wmi_t
*wmip
, A_UINT8
*datap
, int len
);
129 static const A_INT32 wmi_rateTable
[] = {
144 #define MODE_A_SUPPORT_RATE_START 4
145 #define MODE_A_SUPPORT_RATE_STOP 11
147 #define MODE_GONLY_SUPPORT_RATE_START MODE_A_SUPPORT_RATE_START
148 #define MODE_GONLY_SUPPORT_RATE_STOP MODE_A_SUPPORT_RATE_STOP
150 #define MODE_B_SUPPORT_RATE_START 0
151 #define MODE_B_SUPPORT_RATE_STOP 3
153 #define MODE_G_SUPPORT_RATE_START 0
154 #define MODE_G_SUPPORT_RATE_STOP 11
156 #define MAX_NUMBER_OF_SUPPORT_RATES (MODE_G_SUPPORT_RATE_STOP + 1)
158 /* 802.1d to AC mapping. Refer pg 57 of WMM-test-plan-v1.2 */
159 const A_UINT8 up_to_ac
[]= {
175 wmip
= A_MALLOC(sizeof(struct wmi_t
));
179 A_MEMZERO(wmip
, sizeof(*wmip
));
180 A_MUTEX_INIT(&wmip
->wmi_lock
);
181 wmip
->wmi_devt
= devt
;
182 wlan_node_table_init(wmip
, &wmip
->wmi_scan_table
);
183 wmi_qos_state_init(wmip
);
184 wmip
->wmi_powerMode
= REC_POWER
;
185 wmip
->wmi_phyMode
= WMI_11G_MODE
;
191 wmi_qos_state_init(struct wmi_t
*wmip
)
200 /* Initialize QoS States */
201 wmip
->wmi_numQoSStream
= 0;
203 wmip
->wmi_fatPipeExists
= 0;
205 for (i
=0; i
< WMM_NUM_AC
; i
++) {
206 wmip
->wmi_streamExistsForAC
[i
]=0;
209 /* Initialize the static Wmi stream Pri to WMM AC mappings Arrays */
210 WMI_INIT_WMISTREAM_AC_MAP(wmip
);
214 A_WMI_SET_NUMDATAENDPTS(wmip
->wmi_devt
, 1);
218 wmi_shutdown(struct wmi_t
*wmip
)
221 wlan_node_table_cleanup(&wmip
->wmi_scan_table
);
222 if (A_IS_MUTEX_VALID(&wmip
->wmi_lock
)) {
223 A_MUTEX_DELETE(&wmip
->wmi_lock
);
230 * performs DIX to 802.3 encapsulation for transmit packets.
231 * uses passed in buffer. Returns buffer or NULL if failed.
232 * Assumes the entire DIX header is contigous and that there is
233 * enough room in the buffer for a 802.3 mac header and LLC+SNAP headers.
236 wmi_dix_2_dot3(struct wmi_t
*wmip
, void *osbuf
)
241 ATH_LLC_SNAP_HDR
*llcHdr
;
243 A_ASSERT(osbuf
!= NULL
);
245 if (A_NETBUF_HEADROOM(osbuf
) <
246 (sizeof(ATH_LLC_SNAP_HDR
) + sizeof(WMI_DATA_HDR
)))
251 datap
= A_NETBUF_DATA(osbuf
);
253 typeorlen
= *(A_UINT16
*)(datap
+ ATH_MAC_LEN
+ ATH_MAC_LEN
);
255 if (!IS_ETHERTYPE(A_BE2CPU16(typeorlen
))) {
257 * packet is already in 802.3 format - return success
259 A_DPRINTF(DBG_WMI
, (DBGFMT
"packet already 802.3\n", DBGARG
));
264 * Save mac fields and length to be inserted later
266 A_MEMCPY(macHdr
.dstMac
, datap
, ATH_MAC_LEN
);
267 A_MEMCPY(macHdr
.srcMac
, datap
+ ATH_MAC_LEN
, ATH_MAC_LEN
);
268 macHdr
.typeOrLen
= A_CPU2BE16(A_NETBUF_LEN(osbuf
) - sizeof(ATH_MAC_HDR
) +
269 sizeof(ATH_LLC_SNAP_HDR
));
272 * Make room for LLC+SNAP headers
274 if (A_NETBUF_PUSH(osbuf
, sizeof(ATH_LLC_SNAP_HDR
)) != A_OK
) {
278 datap
= A_NETBUF_DATA(osbuf
);
280 A_MEMCPY(datap
, &macHdr
, sizeof (ATH_MAC_HDR
));
282 llcHdr
= (ATH_LLC_SNAP_HDR
*)(datap
+ sizeof(ATH_MAC_HDR
));
286 llcHdr
->orgCode
[0] = 0x0;
287 llcHdr
->orgCode
[1] = 0x0;
288 llcHdr
->orgCode
[2] = 0x0;
289 llcHdr
->etherType
= typeorlen
;
295 * Adds a WMI data header
296 * Assumes there is enough room in the buffer to add header.
299 wmi_data_hdr_add(struct wmi_t
*wmip
, void *osbuf
, A_UINT8 msgType
)
303 A_ASSERT(osbuf
!= NULL
);
305 if (A_NETBUF_PUSH(osbuf
, sizeof(WMI_DATA_HDR
)) != A_OK
) {
309 dtHdr
= (WMI_DATA_HDR
*)A_NETBUF_DATA(osbuf
);
310 dtHdr
->info
= msgType
;
316 A_UINT8
wmi_implicit_create_pstream(struct wmi_t
*wmip
, void *osbuf
, A_UINT8 dir
, A_UINT8 up
)
319 A_UINT8 trafficClass
= WMM_AC_BE
, userPriority
= up
;
320 ATH_LLC_SNAP_HDR
*llcHdr
;
321 A_UINT16 ipType
= IP_ETHERTYPE
;
323 WMI_CREATE_PSTREAM_CMD cmd
;
324 A_BOOL streamExists
= FALSE
;
326 A_ASSERT(osbuf
!= NULL
);
328 datap
= A_NETBUF_DATA(osbuf
);
330 if (up
== UNDEFINED_PRI
) {
331 llcHdr
= (ATH_LLC_SNAP_HDR
*)(datap
+ sizeof(WMI_DATA_HDR
) +
332 sizeof(ATH_MAC_HDR
));
334 if (llcHdr
->etherType
== A_CPU2BE16(ipType
)) {
335 /* Extract the endpoint info from the TOS field in the IP header */
336 userPriority
= A_WMI_IPTOS_TO_USERPRIORITY(((A_UINT8
*)llcHdr
) + sizeof(ATH_LLC_SNAP_HDR
));
340 if (userPriority
< MAX_NUM_PRI
) {
341 trafficClass
= convert_userPriority_to_trafficClass(userPriority
);
344 dtHdr
= (WMI_DATA_HDR
*)datap
;
345 if(dir
==UPLINK_TRAFFIC
)
346 dtHdr
->info
|= (userPriority
& WMI_DATA_HDR_UP_MASK
) << WMI_DATA_HDR_UP_SHIFT
; /* lower 3-bits are 802.1d priority */
349 streamExists
= wmip
->wmi_fatPipeExists
;
352 if (!(streamExists
& (1 << trafficClass
))) {
354 A_MEMZERO(&cmd
, sizeof(cmd
));
355 cmd
.trafficClass
= trafficClass
;
356 cmd
.userPriority
= userPriority
;
357 cmd
.inactivityInt
= WMI_IMPLICIT_PSTREAM_INACTIVITY_INT
;
358 /* Implicit streams are created with TSID 0xFF */
359 cmd
.tsid
= WMI_IMPLICIT_PSTREAM
;
360 wmi_create_pstream_cmd(wmip
, &cmd
);
367 wmi_get_stream_id(struct wmi_t
*wmip
, A_UINT8 trafficClass
)
369 return WMI_ACCESSCATEGORY_WMISTREAM(wmip
, trafficClass
);
373 * performs 802.3 to DIX encapsulation for received packets.
374 * Assumes the entire 802.3 header is contigous.
377 wmi_dot3_2_dix(struct wmi_t
*wmip
, void *osbuf
)
381 ATH_LLC_SNAP_HDR
*llcHdr
;
383 A_ASSERT(osbuf
!= NULL
);
384 datap
= A_NETBUF_DATA(osbuf
);
386 A_MEMCPY(&macHdr
, datap
, sizeof(ATH_MAC_HDR
));
387 llcHdr
= (ATH_LLC_SNAP_HDR
*)(datap
+ sizeof(ATH_MAC_HDR
));
388 macHdr
.typeOrLen
= llcHdr
->etherType
;
390 if (A_NETBUF_PULL(osbuf
, sizeof(ATH_LLC_SNAP_HDR
)) != A_OK
) {
394 datap
= A_NETBUF_DATA(osbuf
);
396 A_MEMCPY(datap
, &macHdr
, sizeof (ATH_MAC_HDR
));
402 * Removes a WMI data header
405 wmi_data_hdr_remove(struct wmi_t
*wmip
, void *osbuf
)
407 A_ASSERT(osbuf
!= NULL
);
409 return (A_NETBUF_PULL(osbuf
, sizeof(WMI_DATA_HDR
)));
413 wmi_iterate_nodes(struct wmi_t
*wmip
, wlan_node_iter_func
*f
, void *arg
)
415 wlan_iterate_nodes(&wmip
->wmi_scan_table
, f
, arg
);
419 * WMI Extended Event received from Target.
422 wmi_control_rx_xtnd(struct wmi_t
*wmip
, void *osbuf
)
428 A_STATUS status
= A_OK
;
430 if (A_NETBUF_LEN(osbuf
) < sizeof(WMIX_CMD_HDR
)) {
431 A_DPRINTF(DBG_WMI
, (DBGFMT
"bad packet 1\n", DBGARG
));
432 wmip
->wmi_stats
.cmd_len_err
++;
433 A_NETBUF_FREE(osbuf
);
437 cmd
= (WMIX_CMD_HDR
*)A_NETBUF_DATA(osbuf
);
440 if (A_NETBUF_PULL(osbuf
, sizeof(WMIX_CMD_HDR
)) != A_OK
) {
441 A_DPRINTF(DBG_WMI
, (DBGFMT
"bad packet 2\n", DBGARG
));
442 wmip
->wmi_stats
.cmd_len_err
++;
443 A_NETBUF_FREE(osbuf
);
447 datap
= A_NETBUF_DATA(osbuf
);
448 len
= A_NETBUF_LEN(osbuf
);
451 case (WMIX_DSETOPENREQ_EVENTID
):
452 status
= wmi_dset_open_req_rx(wmip
, datap
, len
);
454 #ifdef CONFIG_HOST_DSET_SUPPORT
455 case (WMIX_DSETCLOSE_EVENTID
):
456 status
= wmi_dset_close_rx(wmip
, datap
, len
);
458 case (WMIX_DSETDATAREQ_EVENTID
):
459 status
= wmi_dset_data_req_rx(wmip
, datap
, len
);
461 #endif /* CONFIG_HOST_DSET_SUPPORT */
462 #ifdef CONFIG_HOST_GPIO_SUPPORT
463 case (WMIX_GPIO_INTR_EVENTID
):
464 wmi_gpio_intr_rx(wmip
, datap
, len
);
466 case (WMIX_GPIO_DATA_EVENTID
):
467 wmi_gpio_data_rx(wmip
, datap
, len
);
469 case (WMIX_GPIO_ACK_EVENTID
):
470 wmi_gpio_ack_rx(wmip
, datap
, len
);
472 #endif /* CONFIG_HOST_GPIO_SUPPORT */
473 case (WMIX_HB_CHALLENGE_RESP_EVENTID
):
474 wmi_hbChallengeResp_rx(wmip
, datap
, len
);
476 case (WMIX_DBGLOG_EVENTID
):
477 wmi_dbglog_event_rx(wmip
, datap
, len
);
480 A_DPRINTF(DBG_WMI
|DBG_ERROR
,
481 (DBGFMT
"Unknown id 0x%x\n", DBGARG
, id
));
482 wmip
->wmi_stats
.cmd_id_err
++;
496 wmi_control_rx(struct wmi_t
*wmip
, void *osbuf
)
501 A_UINT32 len
, i
, loggingReq
;
502 A_STATUS status
= A_OK
;
504 A_ASSERT(osbuf
!= NULL
);
505 if (A_NETBUF_LEN(osbuf
) < sizeof(WMI_CMD_HDR
)) {
506 A_DPRINTF(DBG_WMI
, (DBGFMT
"bad packet 1\n", DBGARG
));
507 wmip
->wmi_stats
.cmd_len_err
++;
508 A_NETBUF_FREE(osbuf
);
512 cmd
= (WMI_CMD_HDR
*)A_NETBUF_DATA(osbuf
);
515 if (A_NETBUF_PULL(osbuf
, sizeof(WMI_CMD_HDR
)) != A_OK
) {
516 A_DPRINTF(DBG_WMI
, (DBGFMT
"bad packet 2\n", DBGARG
));
517 wmip
->wmi_stats
.cmd_len_err
++;
518 A_NETBUF_FREE(osbuf
);
522 datap
= A_NETBUF_DATA(osbuf
);
523 len
= A_NETBUF_LEN(osbuf
);
525 ar6000_get_driver_cfg(wmip
->wmi_devt
,
526 AR6000_DRIVER_CFG_LOG_RAW_WMI_MSGS
,
530 AR_DEBUG_PRINTF(ATH_DEBUG_WMI
, ("WMI %d \n",id
));
531 AR_DEBUG_PRINTF(ATH_DEBUG_WMI
, ("WMI recv, MsgNo %d : ", cmdRecvNum
));
532 for(i
= 0; i
< len
; i
++)
533 AR_DEBUG_PRINTF(ATH_DEBUG_WMI
, ("%x ", datap
[i
]));
534 AR_DEBUG_PRINTF(ATH_DEBUG_WMI
, ("\n"));
542 case (WMI_GET_BITRATE_CMDID
):
543 A_DPRINTF(DBG_WMI
, (DBGFMT
"WMI_GET_BITRATE_CMDID\n", DBGARG
));
544 status
= wmi_bitrate_reply_rx(wmip
, datap
, len
);
546 case (WMI_GET_CHANNEL_LIST_CMDID
):
547 A_DPRINTF(DBG_WMI
, (DBGFMT
"WMI_GET_CHANNEL_LIST_CMDID\n", DBGARG
));
548 status
= wmi_channelList_reply_rx(wmip
, datap
, len
);
550 case (WMI_GET_TX_PWR_CMDID
):
551 A_DPRINTF(DBG_WMI
, (DBGFMT
"WMI_GET_TX_PWR_CMDID\n", DBGARG
));
552 status
= wmi_txPwr_reply_rx(wmip
, datap
, len
);
554 case (WMI_READY_EVENTID
):
555 A_DPRINTF(DBG_WMI
, (DBGFMT
"WMI_READY_EVENTID\n", DBGARG
));
556 status
= wmi_ready_event_rx(wmip
, datap
, len
);
557 A_WMI_SEND_EVENT_TO_APP(wmip
->wmi_devt
, id
, datap
, len
);
558 A_WMI_DBGLOG_INIT_DONE(wmip
->wmi_devt
);
560 case (WMI_CONNECT_EVENTID
):
561 A_DPRINTF(DBG_WMI
, (DBGFMT
"WMI_CONNECT_EVENTID\n", DBGARG
));
562 status
= wmi_connect_event_rx(wmip
, datap
, len
);
563 A_WMI_SEND_EVENT_TO_APP(wmip
->wmi_devt
, id
, datap
, len
);
565 case (WMI_DISCONNECT_EVENTID
):
566 A_DPRINTF(DBG_WMI
, (DBGFMT
"WMI_DISCONNECT_EVENTID\n", DBGARG
));
567 status
= wmi_disconnect_event_rx(wmip
, datap
, len
);
568 A_WMI_SEND_EVENT_TO_APP(wmip
->wmi_devt
, id
, datap
, len
);
570 case (WMI_TKIP_MICERR_EVENTID
):
571 A_DPRINTF(DBG_WMI
, (DBGFMT
"WMI_TKIP_MICERR_EVENTID\n", DBGARG
));
572 status
= wmi_tkip_micerr_event_rx(wmip
, datap
, len
);
574 case (WMI_BSSINFO_EVENTID
):
575 A_DPRINTF(DBG_WMI
, (DBGFMT
"WMI_BSSINFO_EVENTID\n", DBGARG
));
576 status
= wmi_bssInfo_event_rx(wmip
, datap
, len
);
577 A_WMI_SEND_EVENT_TO_APP(wmip
->wmi_devt
, id
, datap
, len
);
579 case (WMI_REGDOMAIN_EVENTID
):
580 A_DPRINTF(DBG_WMI
, (DBGFMT
"WMI_REGDOMAIN_EVENTID\n", DBGARG
));
581 status
= wmi_regDomain_event_rx(wmip
, datap
, len
);
583 case (WMI_PSTREAM_TIMEOUT_EVENTID
):
584 A_DPRINTF(DBG_WMI
, (DBGFMT
"WMI_PSTREAM_TIMEOUT_EVENTID\n", DBGARG
));
585 status
= wmi_pstream_timeout_event_rx(wmip
, datap
, len
);
586 /* pstreams are fatpipe abstractions that get implicitly created.
587 * User apps only deal with thinstreams. creation of a thinstream
588 * by the user or data traffic flow in an AC triggers implicit
589 * pstream creation. Do we need to send this event to App..?
590 * no harm in sending it.
592 A_WMI_SEND_EVENT_TO_APP(wmip
->wmi_devt
, id
, datap
, len
);
594 case (WMI_NEIGHBOR_REPORT_EVENTID
):
595 A_DPRINTF(DBG_WMI
, (DBGFMT
"WMI_NEIGHBOR_REPORT_EVENTID\n", DBGARG
));
596 status
= wmi_neighborReport_event_rx(wmip
, datap
, len
);
598 case (WMI_SCAN_COMPLETE_EVENTID
):
599 A_DPRINTF(DBG_WMI
, (DBGFMT
"WMI_SCAN_COMPLETE_EVENTID\n", DBGARG
));
600 status
= wmi_scanComplete_rx(wmip
, datap
, len
);
601 A_WMI_SEND_EVENT_TO_APP(wmip
->wmi_devt
, id
, datap
, len
);
603 case (WMI_CMDERROR_EVENTID
):
604 A_DPRINTF(DBG_WMI
, (DBGFMT
"WMI_CMDERROR_EVENTID\n", DBGARG
));
605 status
= wmi_errorEvent_rx(wmip
, datap
, len
);
607 case (WMI_REPORT_STATISTICS_EVENTID
):
608 A_DPRINTF(DBG_WMI
, (DBGFMT
"WMI_REPORT_STATISTICS_EVENTID\n", DBGARG
));
609 status
= wmi_statsEvent_rx(wmip
, datap
, len
);
611 case (WMI_RSSI_THRESHOLD_EVENTID
):
612 A_DPRINTF(DBG_WMI
, (DBGFMT
"WMI_RSSI_THRESHOLD_EVENTID\n", DBGARG
));
613 status
= wmi_rssiThresholdEvent_rx(wmip
, datap
, len
);
615 case (WMI_ERROR_REPORT_EVENTID
):
616 A_DPRINTF(DBG_WMI
, (DBGFMT
"WMI_ERROR_REPORT_EVENTID\n", DBGARG
));
617 status
= wmi_reportErrorEvent_rx(wmip
, datap
, len
);
618 A_WMI_SEND_EVENT_TO_APP(wmip
->wmi_devt
, id
, datap
, len
);
620 case (WMI_OPT_RX_FRAME_EVENTID
):
621 A_DPRINTF(DBG_WMI
, (DBGFMT
"WMI_OPT_RX_FRAME_EVENTID\n", DBGARG
));
622 status
= wmi_opt_frame_event_rx(wmip
, datap
, len
);
624 case (WMI_REPORT_ROAM_TBL_EVENTID
):
625 A_DPRINTF(DBG_WMI
, (DBGFMT
"WMI_REPORT_ROAM_TBL_EVENTID\n", DBGARG
));
626 status
= wmi_roam_tbl_event_rx(wmip
, datap
, len
);
628 case (WMI_EXTENSION_EVENTID
):
629 A_DPRINTF(DBG_WMI
, (DBGFMT
"WMI_EXTENSION_EVENTID\n", DBGARG
));
630 status
= wmi_control_rx_xtnd(wmip
, osbuf
);
632 case (WMI_CAC_EVENTID
):
633 A_DPRINTF(DBG_WMI
, (DBGFMT
"WMI_CAC_EVENTID\n", DBGARG
));
634 status
= wmi_cac_event_rx(wmip
, datap
, len
);
636 case (WMI_REPORT_ROAM_DATA_EVENTID
):
637 A_DPRINTF(DBG_WMI
, (DBGFMT
"WMI_REPORT_ROAM_DATA_EVENTID\n", DBGARG
));
638 status
= wmi_roam_data_event_rx(wmip
, datap
, len
);
640 #ifdef CONFIG_HOST_TCMD_SUPPORT
641 case (WMI_TEST_EVENTID
):
642 A_DPRINTF(DBG_WMI
, (DBGFMT
"WMI_TEST_EVENTID\n", DBGARG
));
643 status
= wmi_tcmd_test_report_rx(wmip
, datap
, len
);
646 case (WMI_GET_FIXRATES_CMDID
):
647 A_DPRINTF(DBG_WMI
, (DBGFMT
"WMI_GET_FIXRATES_CMDID\n", DBGARG
));
648 status
= wmi_ratemask_reply_rx(wmip
, datap
, len
);
650 case (WMI_TX_RETRY_ERR_EVENTID
):
651 A_DPRINTF(DBG_WMI
, (DBGFMT
"WMI_TX_RETRY_ERR_EVENTID\n", DBGARG
));
652 status
= wmi_txRetryErrEvent_rx(wmip
, datap
, len
);
653 A_WMI_SEND_EVENT_TO_APP(wmip
->wmi_devt
, id
, datap
, len
);
655 case (WMI_SNR_THRESHOLD_EVENTID
):
656 A_DPRINTF(DBG_WMI
, (DBGFMT
"WMI_SNR_THRESHOLD_EVENTID\n", DBGARG
));
657 status
= wmi_snrThresholdEvent_rx(wmip
, datap
, len
);
658 A_WMI_SEND_EVENT_TO_APP(wmip
->wmi_devt
, id
, datap
, len
);
660 case (WMI_LQ_THRESHOLD_EVENTID
):
661 A_DPRINTF(DBG_WMI
, (DBGFMT
"WMI_LQ_THRESHOLD_EVENTID\n", DBGARG
));
662 status
= wmi_lqThresholdEvent_rx(wmip
, datap
, len
);
663 A_WMI_SEND_EVENT_TO_APP(wmip
->wmi_devt
, id
, datap
, len
);
665 case (WMI_APLIST_EVENTID
):
666 AR_DEBUG_PRINTF(ATH_DEBUG_WMI
, ("Received APLIST Event\n"));
667 status
= wmi_aplistEvent_rx(wmip
, datap
, len
);
669 case (WMI_GET_KEEPALIVE_CMDID
):
670 A_DPRINTF(DBG_WMI
, (DBGFMT
"WMI_GET_KEEPALIVE_CMDID\n", DBGARG
));
671 status
= wmi_keepalive_reply_rx(wmip
, datap
, len
);
673 case (WMI_GET_WOW_LIST_EVENTID
):
674 status
= wmi_get_wow_list_event_rx(wmip
, datap
, len
);
676 case (WMI_GET_PMKID_LIST_EVENTID
):
677 A_DPRINTF(DBG_WMI
, (DBGFMT
"WMI_GET_PMKID_LIST Event\n", DBGARG
));
678 status
= wmi_get_pmkid_list_event_rx(wmip
, datap
, len
);
681 A_DPRINTF(DBG_WMI
|DBG_ERROR
,
682 (DBGFMT
"Unknown id 0x%x\n", DBGARG
, id
));
683 wmip
->wmi_stats
.cmd_id_err
++;
688 A_NETBUF_FREE(osbuf
);
694 wmi_ready_event_rx(struct wmi_t
*wmip
, A_UINT8
*datap
, int len
)
696 WMI_READY_EVENT
*ev
= (WMI_READY_EVENT
*)datap
;
698 if (len
< sizeof(WMI_READY_EVENT
)) {
701 A_DPRINTF(DBG_WMI
, (DBGFMT
"Enter\n", DBGARG
));
702 wmip
->wmi_ready
= TRUE
;
703 A_WMI_READY_EVENT(wmip
->wmi_devt
, ev
->macaddr
, ev
->phyCapability
);
709 wmi_connect_event_rx(struct wmi_t
*wmip
, A_UINT8
*datap
, int len
)
711 WMI_CONNECT_EVENT
*ev
;
713 if (len
< sizeof(WMI_CONNECT_EVENT
)) {
716 ev
= (WMI_CONNECT_EVENT
*)datap
;
718 (DBGFMT
"freq %d bssid %2.2x:%2.2x:%2.2x:%2.2x:%2.2x:%2.2x\n",
720 ev
->bssid
[0], ev
->bssid
[1], ev
->bssid
[2],
721 ev
->bssid
[3], ev
->bssid
[4], ev
->bssid
[5]));
723 A_MEMCPY(wmip
->wmi_bssid
, ev
->bssid
, ATH_MAC_LEN
);
725 A_WMI_CONNECT_EVENT(wmip
->wmi_devt
, ev
->channel
, ev
->bssid
,
726 ev
->listenInterval
, ev
->beaconInterval
,
727 ev
->networkType
, ev
->beaconIeLen
,
728 ev
->assocReqLen
, ev
->assocRespLen
,
735 wmi_regDomain_event_rx(struct wmi_t
*wmip
, A_UINT8
*datap
, int len
)
737 WMI_REG_DOMAIN_EVENT
*ev
;
739 if (len
< sizeof(*ev
)) {
742 ev
= (WMI_REG_DOMAIN_EVENT
*)datap
;
744 A_WMI_REGDOMAIN_EVENT(wmip
->wmi_devt
, ev
->regDomain
);
750 wmi_neighborReport_event_rx(struct wmi_t
*wmip
, A_UINT8
*datap
, int len
)
752 WMI_NEIGHBOR_REPORT_EVENT
*ev
;
755 if (len
< sizeof(*ev
)) {
758 ev
= (WMI_NEIGHBOR_REPORT_EVENT
*)datap
;
759 numAps
= ev
->numberOfAps
;
761 if (len
< (int)(sizeof(*ev
) + ((numAps
- 1) * sizeof(WMI_NEIGHBOR_INFO
)))) {
765 A_WMI_NEIGHBORREPORT_EVENT(wmip
->wmi_devt
, numAps
, ev
->neighbor
);
771 wmi_disconnect_event_rx(struct wmi_t
*wmip
, A_UINT8
*datap
, int len
)
773 WMI_DISCONNECT_EVENT
*ev
;
775 if (len
< sizeof(WMI_DISCONNECT_EVENT
)) {
778 A_DPRINTF(DBG_WMI
, (DBGFMT
"Enter\n", DBGARG
));
780 ev
= (WMI_DISCONNECT_EVENT
*)datap
;
782 A_MEMZERO(wmip
->wmi_bssid
, sizeof(wmip
->wmi_bssid
));
784 A_WMI_DISCONNECT_EVENT(wmip
->wmi_devt
, ev
->disconnectReason
, ev
->bssid
,
785 ev
->assocRespLen
, ev
->assocInfo
, ev
->protocolReasonStatus
);
791 wmi_tkip_micerr_event_rx(struct wmi_t
*wmip
, A_UINT8
*datap
, int len
)
793 WMI_TKIP_MICERR_EVENT
*ev
;
795 if (len
< sizeof(*ev
)) {
798 A_DPRINTF(DBG_WMI
, (DBGFMT
"Enter\n", DBGARG
));
800 ev
= (WMI_TKIP_MICERR_EVENT
*)datap
;
801 A_WMI_TKIP_MICERR_EVENT(wmip
->wmi_devt
, ev
->keyid
, ev
->ismcast
);
807 wmi_bssInfo_event_rx(struct wmi_t
*wmip
, A_UINT8
*datap
, int len
)
810 WMI_BSS_INFO_HDR
*bih
;
812 A_UINT32 nodeCachingAllowed
;
814 if (len
<= sizeof(WMI_BSS_INFO_HDR
)) {
818 A_WMI_BSSINFO_EVENT_RX(wmip
->wmi_devt
, datap
, len
);
819 /* What is driver config for wlan node caching? */
820 if(ar6000_get_driver_cfg(wmip
->wmi_devt
,
821 AR6000_DRIVER_CFG_GET_WLANNODECACHING
,
822 &nodeCachingAllowed
) != A_OK
) {
826 if(!nodeCachingAllowed
) {
831 bih
= (WMI_BSS_INFO_HDR
*)datap
;
832 buf
= datap
+ sizeof(WMI_BSS_INFO_HDR
);
833 len
-= sizeof(WMI_BSS_INFO_HDR
);
835 A_DPRINTF(DBG_WMI2
, (DBGFMT
"bssInfo event - ch %u, rssi %02x, "
836 "bssid \"%02x:%02x:%02x:%02x:%02x:%02x\"\n", DBGARG
,
837 bih
->channel
, (unsigned char) bih
->rssi
, bih
->bssid
[0],
838 bih
->bssid
[1], bih
->bssid
[2], bih
->bssid
[3], bih
->bssid
[4],
841 if(wps_enable
&& (bih
->frameType
== PROBERESP_FTYPE
) ) {
842 printk("%s() A_OK 2\n", __FUNCTION__
);
846 bss
= wlan_find_node(&wmip
->wmi_scan_table
, bih
->bssid
);
849 * Free up the node. Not the most efficient process given
850 * we are about to allocate a new node but it is simple and should be
853 wlan_node_reclaim(&wmip
->wmi_scan_table
, bss
);
856 bss
= wlan_node_alloc(&wmip
->wmi_scan_table
, len
);
861 bss
->ni_snr
= bih
->snr
;
862 bss
->ni_rssi
= bih
->rssi
;
863 A_ASSERT(bss
->ni_buf
!= NULL
);
864 A_MEMCPY(bss
->ni_buf
, buf
, len
);
866 if (wlan_parse_beacon(bss
->ni_buf
, len
, &bss
->ni_cie
) != A_OK
) {
872 * Update the frequency in ie_chan, overwriting of channel number
873 * which is done in wlan_parse_beacon
875 bss
->ni_cie
.ie_chan
= bih
->channel
;
876 wlan_setup_node(&wmip
->wmi_scan_table
, bss
, bih
->bssid
);
882 wmi_opt_frame_event_rx(struct wmi_t
*wmip
, A_UINT8
*datap
, int len
)
885 WMI_OPT_RX_INFO_HDR
*bih
;
888 if (len
<= sizeof(WMI_OPT_RX_INFO_HDR
)) {
892 bih
= (WMI_OPT_RX_INFO_HDR
*)datap
;
893 buf
= datap
+ sizeof(WMI_OPT_RX_INFO_HDR
);
894 len
-= sizeof(WMI_OPT_RX_INFO_HDR
);
896 A_DPRINTF(DBG_WMI2
, (DBGFMT
"opt frame event %2.2x:%2.2x\n", DBGARG
,
897 bih
->bssid
[4], bih
->bssid
[5]));
899 bss
= wlan_find_node(&wmip
->wmi_scan_table
, bih
->bssid
);
902 * Free up the node. Not the most efficient process given
903 * we are about to allocate a new node but it is simple and should be
906 wlan_node_reclaim(&wmip
->wmi_scan_table
, bss
);
909 bss
= wlan_node_alloc(&wmip
->wmi_scan_table
, len
);
914 bss
->ni_snr
= bih
->snr
;
915 bss
->ni_cie
.ie_chan
= bih
->channel
;
916 A_ASSERT(bss
->ni_buf
!= NULL
);
917 A_MEMCPY(bss
->ni_buf
, buf
, len
);
918 wlan_setup_node(&wmip
->wmi_scan_table
, bss
, bih
->bssid
);
923 /* This event indicates inactivity timeout of a fatpipe(pstream)
927 wmi_pstream_timeout_event_rx(struct wmi_t
*wmip
, A_UINT8
*datap
, int len
)
929 WMI_PSTREAM_TIMEOUT_EVENT
*ev
;
931 if (len
< sizeof(WMI_PSTREAM_TIMEOUT_EVENT
)) {
935 A_DPRINTF(DBG_WMI
, (DBGFMT
"wmi_pstream_timeout_event_rx\n", DBGARG
));
937 ev
= (WMI_PSTREAM_TIMEOUT_EVENT
*)datap
;
939 /* When the pstream (fat pipe == AC) timesout, it means there were no
940 * thinStreams within this pstream & it got implicitly created due to
941 * data flow on this AC. We start the inactivity timer only for
942 * implicitly created pstream. Just reset the host state.
944 /* Set the activeTsids for this AC to 0 */
946 wmip
->wmi_streamExistsForAC
[ev
->trafficClass
]=0;
947 wmip
->wmi_fatPipeExists
&= ~(1 << ev
->trafficClass
);
950 /*Indicate inactivity to driver layer for this fatpipe (pstream)*/
951 A_WMI_STREAM_TX_INACTIVE(wmip
->wmi_devt
, ev
->trafficClass
);
957 wmi_bitrate_reply_rx(struct wmi_t
*wmip
, A_UINT8
*datap
, int len
)
959 WMI_BIT_RATE_CMD
*reply
;
962 if (len
< sizeof(WMI_BIT_RATE_CMD
)) {
965 reply
= (WMI_BIT_RATE_CMD
*)datap
;
967 (DBGFMT
"Enter - rateindex %d\n", DBGARG
, reply
->rateIndex
));
969 if (reply
->rateIndex
== RATE_AUTO
) {
972 rate
= wmi_rateTable
[(A_UINT32
) reply
->rateIndex
];
975 A_WMI_BITRATE_RX(wmip
->wmi_devt
, rate
);
981 wmi_ratemask_reply_rx(struct wmi_t
*wmip
, A_UINT8
*datap
, int len
)
983 WMI_FIX_RATES_CMD
*reply
;
985 if (len
< sizeof(WMI_BIT_RATE_CMD
)) {
988 reply
= (WMI_FIX_RATES_CMD
*)datap
;
990 (DBGFMT
"Enter - fixed rate mask %x\n", DBGARG
, reply
->fixRateMask
));
992 A_WMI_RATEMASK_RX(wmip
->wmi_devt
, reply
->fixRateMask
);
998 wmi_channelList_reply_rx(struct wmi_t
*wmip
, A_UINT8
*datap
, int len
)
1000 WMI_CHANNEL_LIST_REPLY
*reply
;
1002 if (len
< sizeof(WMI_CHANNEL_LIST_REPLY
)) {
1005 reply
= (WMI_CHANNEL_LIST_REPLY
*)datap
;
1006 A_DPRINTF(DBG_WMI
, (DBGFMT
"Enter\n", DBGARG
));
1008 A_WMI_CHANNELLIST_RX(wmip
->wmi_devt
, reply
->numChannels
,
1009 reply
->channelList
);
1015 wmi_txPwr_reply_rx(struct wmi_t
*wmip
, A_UINT8
*datap
, int len
)
1017 WMI_TX_PWR_REPLY
*reply
;
1019 if (len
< sizeof(*reply
)) {
1022 reply
= (WMI_TX_PWR_REPLY
*)datap
;
1023 A_DPRINTF(DBG_WMI
, (DBGFMT
"Enter\n", DBGARG
));
1025 A_WMI_TXPWR_RX(wmip
->wmi_devt
, reply
->dbM
);
1030 wmi_keepalive_reply_rx(struct wmi_t
*wmip
, A_UINT8
*datap
, int len
)
1032 WMI_GET_KEEPALIVE_CMD
*reply
;
1034 if (len
< sizeof(*reply
)) {
1037 reply
= (WMI_GET_KEEPALIVE_CMD
*)datap
;
1038 A_DPRINTF(DBG_WMI
, (DBGFMT
"Enter\n", DBGARG
));
1040 A_WMI_KEEPALIVE_RX(wmip
->wmi_devt
, reply
->configured
);
1047 wmi_dset_open_req_rx(struct wmi_t
*wmip
, A_UINT8
*datap
, int len
)
1049 WMIX_DSETOPENREQ_EVENT
*dsetopenreq
;
1051 if (len
< sizeof(WMIX_DSETOPENREQ_EVENT
)) {
1054 dsetopenreq
= (WMIX_DSETOPENREQ_EVENT
*)datap
;
1056 (DBGFMT
"Enter - dset_id=0x%x\n", DBGARG
, dsetopenreq
->dset_id
));
1057 A_WMI_DSET_OPEN_REQ(wmip
->wmi_devt
,
1058 dsetopenreq
->dset_id
,
1059 dsetopenreq
->targ_dset_handle
,
1060 dsetopenreq
->targ_reply_fn
,
1061 dsetopenreq
->targ_reply_arg
);
1066 #ifdef CONFIG_HOST_DSET_SUPPORT
1068 wmi_dset_close_rx(struct wmi_t
*wmip
, A_UINT8
*datap
, int len
)
1070 WMIX_DSETCLOSE_EVENT
*dsetclose
;
1072 if (len
< sizeof(WMIX_DSETCLOSE_EVENT
)) {
1075 A_DPRINTF(DBG_WMI
, (DBGFMT
"Enter\n", DBGARG
));
1077 dsetclose
= (WMIX_DSETCLOSE_EVENT
*)datap
;
1078 A_WMI_DSET_CLOSE(wmip
->wmi_devt
, dsetclose
->access_cookie
);
1084 wmi_dset_data_req_rx(struct wmi_t
*wmip
, A_UINT8
*datap
, int len
)
1086 WMIX_DSETDATAREQ_EVENT
*dsetdatareq
;
1088 if (len
< sizeof(WMIX_DSETDATAREQ_EVENT
)) {
1091 A_DPRINTF(DBG_WMI
, (DBGFMT
"Enter\n", DBGARG
));
1093 dsetdatareq
= (WMIX_DSETDATAREQ_EVENT
*)datap
;
1094 A_WMI_DSET_DATA_REQ(wmip
->wmi_devt
,
1095 dsetdatareq
->access_cookie
,
1096 dsetdatareq
->offset
,
1097 dsetdatareq
->length
,
1098 dsetdatareq
->targ_buf
,
1099 dsetdatareq
->targ_reply_fn
,
1100 dsetdatareq
->targ_reply_arg
);
1104 #endif /* CONFIG_HOST_DSET_SUPPORT */
1107 wmi_scanComplete_rx(struct wmi_t
*wmip
, A_UINT8
*datap
, int len
)
1109 WMI_SCAN_COMPLETE_EVENT
*ev
;
1111 ev
= (WMI_SCAN_COMPLETE_EVENT
*)datap
;
1112 A_WMI_SCANCOMPLETE_EVENT(wmip
->wmi_devt
, ev
->status
);
1118 * Target is reporting a programming error. This is for
1119 * developer aid only. Target only checks a few common violations
1120 * and it is responsibility of host to do all error checking.
1121 * Behavior of target after wmi error event is undefined.
1122 * A reset is recommended.
1125 wmi_errorEvent_rx(struct wmi_t
*wmip
, A_UINT8
*datap
, int len
)
1127 WMI_CMD_ERROR_EVENT
*ev
;
1129 ev
= (WMI_CMD_ERROR_EVENT
*)datap
;
1130 AR_DEBUG_PRINTF(ATH_DEBUG_WMI
, ("Programming Error: cmd=%d ", ev
->commandId
));
1131 switch (ev
->errorCode
) {
1132 case (INVALID_PARAM
):
1133 AR_DEBUG_PRINTF(ATH_DEBUG_WMI
, ("Illegal Parameter\n"));
1135 case (ILLEGAL_STATE
):
1136 AR_DEBUG_PRINTF(ATH_DEBUG_WMI
, ("Illegal State\n"));
1138 case (INTERNAL_ERROR
):
1139 AR_DEBUG_PRINTF(ATH_DEBUG_WMI
, ("Internal Error\n"));
1148 wmi_statsEvent_rx(struct wmi_t
*wmip
, A_UINT8
*datap
, int len
)
1150 WMI_TARGET_STATS
*reply
;
1152 if (len
< sizeof(*reply
)) {
1155 reply
= (WMI_TARGET_STATS
*)datap
;
1156 A_DPRINTF(DBG_WMI
, (DBGFMT
"Enter\n", DBGARG
));
1158 A_WMI_TARGETSTATS_EVENT(wmip
->wmi_devt
, reply
);
1164 wmi_rssiThresholdEvent_rx(struct wmi_t
*wmip
, A_UINT8
*datap
, int len
)
1166 WMI_RSSI_THRESHOLD_EVENT
*reply
;
1168 if (len
< sizeof(*reply
)) {
1171 reply
= (WMI_RSSI_THRESHOLD_EVENT
*)datap
;
1172 A_DPRINTF(DBG_WMI
, (DBGFMT
"Enter\n", DBGARG
));
1174 A_WMI_RSSI_THRESHOLD_EVENT(wmip
->wmi_devt
, reply
->range
, reply
->rssi
);
1181 wmi_reportErrorEvent_rx(struct wmi_t
*wmip
, A_UINT8
*datap
, int len
)
1183 WMI_TARGET_ERROR_REPORT_EVENT
*reply
;
1185 if (len
< sizeof(*reply
)) {
1188 reply
= (WMI_TARGET_ERROR_REPORT_EVENT
*)datap
;
1189 A_DPRINTF(DBG_WMI
, (DBGFMT
"Enter\n", DBGARG
));
1191 A_WMI_REPORT_ERROR_EVENT(wmip
->wmi_devt
, reply
->errorVal
);
1197 wmi_cac_event_rx(struct wmi_t
*wmip
, A_UINT8
*datap
, int len
)
1199 WMI_CAC_EVENT
*reply
;
1201 if (len
< sizeof(*reply
)) {
1204 reply
= (WMI_CAC_EVENT
*)datap
;
1205 A_DPRINTF(DBG_WMI
, (DBGFMT
"Enter\n", DBGARG
));
1207 A_WMI_CAC_EVENT(wmip
->wmi_devt
, reply
->ac
,
1208 reply
->cac_indication
, reply
->statusCode
,
1209 reply
->tspecSuggestion
);
1215 wmi_hbChallengeResp_rx(struct wmi_t
*wmip
, A_UINT8
*datap
, int len
)
1217 WMIX_HB_CHALLENGE_RESP_EVENT
*reply
;
1219 if (len
< sizeof(*reply
)) {
1222 reply
= (WMIX_HB_CHALLENGE_RESP_EVENT
*)datap
;
1223 A_DPRINTF(DBG_WMI
, (DBGFMT
"wmi: challenge response event\n", DBGARG
));
1225 A_WMI_HBCHALLENGERESP_EVENT(wmip
->wmi_devt
, reply
->cookie
, reply
->source
);
1231 wmi_roam_tbl_event_rx(struct wmi_t
*wmip
, A_UINT8
*datap
, int len
)
1233 WMI_TARGET_ROAM_TBL
*reply
;
1235 if (len
< sizeof(*reply
)) {
1238 reply
= (WMI_TARGET_ROAM_TBL
*)datap
;
1239 A_DPRINTF(DBG_WMI
, (DBGFMT
"Enter\n", DBGARG
));
1241 A_WMI_ROAM_TABLE_EVENT(wmip
->wmi_devt
, reply
);
1247 wmi_roam_data_event_rx(struct wmi_t
*wmip
, A_UINT8
*datap
, int len
)
1249 WMI_TARGET_ROAM_DATA
*reply
;
1251 if (len
< sizeof(*reply
)) {
1254 reply
= (WMI_TARGET_ROAM_DATA
*)datap
;
1255 A_DPRINTF(DBG_WMI
, (DBGFMT
"Enter\n", DBGARG
));
1257 A_WMI_ROAM_DATA_EVENT(wmip
->wmi_devt
, reply
);
1263 wmi_txRetryErrEvent_rx(struct wmi_t
*wmip
, A_UINT8
*datap
, int len
)
1265 WMI_TX_RETRY_ERR_EVENT
*reply
;
1267 if (len
< sizeof(*reply
)) {
1270 reply
= (WMI_TX_RETRY_ERR_EVENT
*)datap
;
1271 A_DPRINTF(DBG_WMI
, (DBGFMT
"Enter\n", DBGARG
));
1273 A_WMI_TX_RETRY_ERR_EVENT(wmip
->wmi_devt
);
1279 wmi_snrThresholdEvent_rx(struct wmi_t
*wmip
, A_UINT8
*datap
, int len
)
1281 WMI_SNR_THRESHOLD_EVENT
*reply
;
1283 if (len
< sizeof(*reply
)) {
1286 reply
= (WMI_SNR_THRESHOLD_EVENT
*)datap
;
1287 A_DPRINTF(DBG_WMI
, (DBGFMT
"Enter\n", DBGARG
));
1289 A_WMI_SNR_THRESHOLD_EVENT_RX(wmip
->wmi_devt
, reply
->range
, reply
->snr
);
1295 wmi_lqThresholdEvent_rx(struct wmi_t
*wmip
, A_UINT8
*datap
, int len
)
1297 WMI_LQ_THRESHOLD_EVENT
*reply
;
1299 if (len
< sizeof(*reply
)) {
1302 reply
= (WMI_LQ_THRESHOLD_EVENT
*)datap
;
1303 A_DPRINTF(DBG_WMI
, (DBGFMT
"Enter\n", DBGARG
));
1305 A_WMI_LQ_THRESHOLD_EVENT_RX(wmip
->wmi_devt
, reply
->range
, reply
->lq
);
1311 wmi_aplistEvent_rx(struct wmi_t
*wmip
, A_UINT8
*datap
, int len
)
1313 A_UINT16 ap_info_entry_size
;
1314 WMI_APLIST_EVENT
*ev
= (WMI_APLIST_EVENT
*)datap
;
1315 WMI_AP_INFO_V1
*ap_info_v1
;
1318 if (len
< sizeof(WMI_APLIST_EVENT
)) {
1322 if (ev
->apListVer
== APLIST_VER1
) {
1323 ap_info_entry_size
= sizeof(WMI_AP_INFO_V1
);
1324 ap_info_v1
= (WMI_AP_INFO_V1
*)ev
->apList
;
1329 AR_DEBUG_PRINTF(ATH_DEBUG_WMI
, ("Number of APs in APLIST Event is %d\n", ev
->numAP
));
1330 if (len
< (int)(sizeof(WMI_APLIST_EVENT
) +
1331 (ev
->numAP
- 1) * ap_info_entry_size
))
1337 * AP List Ver1 Contents
1339 for (i
= 0; i
< ev
->numAP
; i
++) {
1340 AR_DEBUG_PRINTF(ATH_DEBUG_WMI
, ("AP#%d BSSID %2.2x %2.2x %2.2x %2.2x %2.2x %2.2x "\
1342 ap_info_v1
->bssid
[0], ap_info_v1
->bssid
[1],
1343 ap_info_v1
->bssid
[2], ap_info_v1
->bssid
[3],
1344 ap_info_v1
->bssid
[4], ap_info_v1
->bssid
[5],
1345 ap_info_v1
->channel
));
1352 wmi_dbglog_event_rx(struct wmi_t
*wmip
, A_UINT8
*datap
, int len
)
1356 dropped
= *((A_UINT32
*)datap
);
1357 datap
+= sizeof(dropped
);
1358 len
-= sizeof(dropped
);
1359 A_WMI_DBGLOG_EVENT(wmip
->wmi_devt
, dropped
, datap
, len
);
1363 #ifdef CONFIG_HOST_GPIO_SUPPORT
1365 wmi_gpio_intr_rx(struct wmi_t
*wmip
, A_UINT8
*datap
, int len
)
1367 WMIX_GPIO_INTR_EVENT
*gpio_intr
= (WMIX_GPIO_INTR_EVENT
*)datap
;
1370 (DBGFMT
"Enter - intrmask=0x%x input=0x%x.\n", DBGARG
,
1371 gpio_intr
->intr_mask
, gpio_intr
->input_values
));
1373 A_WMI_GPIO_INTR_RX(gpio_intr
->intr_mask
, gpio_intr
->input_values
);
1379 wmi_gpio_data_rx(struct wmi_t
*wmip
, A_UINT8
*datap
, int len
)
1381 WMIX_GPIO_DATA_EVENT
*gpio_data
= (WMIX_GPIO_DATA_EVENT
*)datap
;
1384 (DBGFMT
"Enter - reg=%d value=0x%x\n", DBGARG
,
1385 gpio_data
->reg_id
, gpio_data
->value
));
1387 A_WMI_GPIO_DATA_RX(gpio_data
->reg_id
, gpio_data
->value
);
1393 wmi_gpio_ack_rx(struct wmi_t
*wmip
, A_UINT8
*datap
, int len
)
1395 A_DPRINTF(DBG_WMI
, (DBGFMT
"Enter\n", DBGARG
));
1397 A_WMI_GPIO_ACK_RX();
1401 #endif /* CONFIG_HOST_GPIO_SUPPORT */
1404 * Called to send a wmi command. Command specific data is already built
1405 * on osbuf and current osbuf->data points to it.
1408 wmi_cmd_send(struct wmi_t
*wmip
, void *osbuf
, WMI_COMMAND_ID cmdId
,
1409 WMI_SYNC_FLAG syncflag
)
1411 #define IS_LONG_CMD(cmdId) ((cmdId == WMI_OPT_TX_FRAME_CMDID) || (cmdId == WMI_ADD_WOW_PATTERN_CMDID))
1413 WMI_PRI_STREAM_ID streamID
= WMI_CONTROL_PRI
;
1415 A_ASSERT(osbuf
!= NULL
);
1417 if (syncflag
>= END_WMIFLAG
) {
1421 if ((syncflag
== SYNC_BEFORE_WMIFLAG
) || (syncflag
== SYNC_BOTH_WMIFLAG
)) {
1423 * We want to make sure all data currently queued is transmitted before
1424 * the cmd execution. Establish a new sync point.
1426 wmi_sync_point(wmip
);
1429 if (A_NETBUF_PUSH(osbuf
, sizeof(WMI_CMD_HDR
)) != A_OK
) {
1433 cHdr
= (WMI_CMD_HDR
*)A_NETBUF_DATA(osbuf
);
1434 cHdr
->commandId
= cmdId
;
1437 * Send cmd, some via control pipe, others via data pipe
1439 if (IS_LONG_CMD(cmdId
)) {
1440 wmi_data_hdr_add(wmip
, osbuf
, CNTL_MSGTYPE
);
1441 // TODO ... these can now go through the control endpoint via HTC 2.0
1442 streamID
= WMI_BEST_EFFORT_PRI
;
1444 A_WMI_CONTROL_TX(wmip
->wmi_devt
, osbuf
, streamID
);
1446 if ((syncflag
== SYNC_AFTER_WMIFLAG
) || (syncflag
== SYNC_BOTH_WMIFLAG
)) {
1448 * We want to make sure all new data queued waits for the command to
1449 * execute. Establish a new sync point.
1451 wmi_sync_point(wmip
);
1458 wmi_cmd_send_xtnd(struct wmi_t
*wmip
, void *osbuf
, WMI_COMMAND_ID cmdId
,
1459 WMI_SYNC_FLAG syncflag
)
1463 if (A_NETBUF_PUSH(osbuf
, sizeof(WMIX_CMD_HDR
)) != A_OK
) {
1467 cHdr
= (WMIX_CMD_HDR
*)A_NETBUF_DATA(osbuf
);
1468 cHdr
->commandId
= cmdId
;
1470 return wmi_cmd_send(wmip
, osbuf
, WMI_EXTENSION_CMDID
, syncflag
);
1474 wmi_connect_cmd(struct wmi_t
*wmip
, NETWORK_TYPE netType
,
1475 DOT11_AUTH_MODE dot11AuthMode
, AUTH_MODE authMode
,
1476 CRYPTO_TYPE pairwiseCrypto
, A_UINT8 pairwiseCryptoLen
,
1477 CRYPTO_TYPE groupCrypto
,A_UINT8 groupCryptoLen
,
1478 int ssidLength
, A_UCHAR
*ssid
,
1479 A_UINT8
*bssid
, A_UINT16 channel
, A_UINT32 ctrl_flags
)
1482 WMI_CONNECT_CMD
*cc
;
1484 if ((pairwiseCrypto
== NONE_CRYPT
) && (groupCrypto
!= NONE_CRYPT
)) {
1487 if ((pairwiseCrypto
!= NONE_CRYPT
) && (groupCrypto
== NONE_CRYPT
)) {
1491 osbuf
= A_NETBUF_ALLOC(sizeof(WMI_CONNECT_CMD
));
1492 if (osbuf
== NULL
) {
1496 A_NETBUF_PUT(osbuf
, sizeof(WMI_CONNECT_CMD
));
1498 cc
= (WMI_CONNECT_CMD
*)(A_NETBUF_DATA(osbuf
));
1499 A_MEMZERO(cc
, sizeof(*cc
));
1501 A_MEMCPY(cc
->ssid
, ssid
, ssidLength
);
1502 cc
->ssidLength
= ssidLength
;
1503 cc
->networkType
= netType
;
1504 cc
->dot11AuthMode
= dot11AuthMode
;
1505 cc
->authMode
= authMode
;
1506 cc
->pairwiseCryptoType
= pairwiseCrypto
;
1507 cc
->pairwiseCryptoLen
= pairwiseCryptoLen
;
1508 cc
->groupCryptoType
= groupCrypto
;
1509 cc
->groupCryptoLen
= groupCryptoLen
;
1510 cc
->channel
= channel
;
1511 cc
->ctrl_flags
= ctrl_flags
;
1513 if (bssid
!= NULL
) {
1514 A_MEMCPY(cc
->bssid
, bssid
, ATH_MAC_LEN
);
1516 if (wmi_set_keepalive_cmd(wmip
, wmip
->wmi_keepaliveInterval
) != A_OK
) {
1520 return (wmi_cmd_send(wmip
, osbuf
, WMI_CONNECT_CMDID
, NO_SYNC_WMIFLAG
));
1524 wmi_reconnect_cmd(struct wmi_t
*wmip
, A_UINT8
*bssid
, A_UINT16 channel
)
1527 WMI_RECONNECT_CMD
*cc
;
1529 osbuf
= A_NETBUF_ALLOC(sizeof(WMI_RECONNECT_CMD
));
1530 if (osbuf
== NULL
) {
1534 A_NETBUF_PUT(osbuf
, sizeof(WMI_RECONNECT_CMD
));
1536 cc
= (WMI_RECONNECT_CMD
*)(A_NETBUF_DATA(osbuf
));
1537 A_MEMZERO(cc
, sizeof(*cc
));
1539 cc
->channel
= channel
;
1541 if (bssid
!= NULL
) {
1542 A_MEMCPY(cc
->bssid
, bssid
, ATH_MAC_LEN
);
1545 return (wmi_cmd_send(wmip
, osbuf
, WMI_RECONNECT_CMDID
, NO_SYNC_WMIFLAG
));
1549 wmi_disconnect_cmd(struct wmi_t
*wmip
)
1554 osbuf
= A_NETBUF_ALLOC(0); /* no payload */
1555 if (osbuf
== NULL
) {
1559 /* Bug fix for 24817(elevator bug) - the disconnect command does not
1560 need to do a SYNC before.*/
1561 status
= (wmi_cmd_send(wmip
, osbuf
, WMI_DISCONNECT_CMDID
,
1568 wmi_startscan_cmd(struct wmi_t
*wmip
, WMI_SCAN_TYPE scanType
,
1569 A_BOOL forceFgScan
, A_BOOL isLegacy
,
1570 A_UINT32 homeDwellTime
, A_UINT32 forceScanInterval
)
1573 WMI_START_SCAN_CMD
*sc
;
1575 if ((scanType
!= WMI_LONG_SCAN
) && (scanType
!= WMI_SHORT_SCAN
)) {
1579 osbuf
= A_NETBUF_ALLOC(sizeof(*sc
));
1580 if (osbuf
== NULL
) {
1584 A_NETBUF_PUT(osbuf
, sizeof(*sc
));
1586 sc
= (WMI_START_SCAN_CMD
*)(A_NETBUF_DATA(osbuf
));
1587 sc
->scanType
= scanType
;
1588 sc
->forceFgScan
= forceFgScan
;
1589 sc
->isLegacy
= isLegacy
;
1590 sc
->homeDwellTime
= homeDwellTime
;
1591 sc
->forceScanInterval
= forceScanInterval
;
1593 return (wmi_cmd_send(wmip
, osbuf
, WMI_START_SCAN_CMDID
, NO_SYNC_WMIFLAG
));
1597 wmi_scanparams_cmd(struct wmi_t
*wmip
, A_UINT16 fg_start_sec
,
1598 A_UINT16 fg_end_sec
, A_UINT16 bg_sec
,
1599 A_UINT16 minact_chdw_msec
, A_UINT16 maxact_chdw_msec
,
1600 A_UINT16 pas_chdw_msec
,
1601 A_UINT8 shScanRatio
, A_UINT8 scanCtrlFlags
,
1602 A_UINT32 max_dfsch_act_time
)
1605 WMI_SCAN_PARAMS_CMD
*sc
;
1607 osbuf
= A_NETBUF_ALLOC(sizeof(*sc
));
1608 if (osbuf
== NULL
) {
1612 A_NETBUF_PUT(osbuf
, sizeof(*sc
));
1614 sc
= (WMI_SCAN_PARAMS_CMD
*)(A_NETBUF_DATA(osbuf
));
1615 A_MEMZERO(sc
, sizeof(*sc
));
1616 sc
->fg_start_period
= fg_start_sec
;
1617 sc
->fg_end_period
= fg_end_sec
;
1618 sc
->bg_period
= bg_sec
;
1619 sc
->minact_chdwell_time
= minact_chdw_msec
;
1620 sc
->maxact_chdwell_time
= maxact_chdw_msec
;
1621 sc
->pas_chdwell_time
= pas_chdw_msec
;
1622 sc
->shortScanRatio
= shScanRatio
;
1623 sc
->scanCtrlFlags
= scanCtrlFlags
;
1624 sc
->max_dfsch_act_time
= max_dfsch_act_time
;
1626 return (wmi_cmd_send(wmip
, osbuf
, WMI_SET_SCAN_PARAMS_CMDID
,
1631 wmi_bssfilter_cmd(struct wmi_t
*wmip
, A_UINT8 filter
, A_UINT32 ieMask
)
1634 WMI_BSS_FILTER_CMD
*cmd
;
1636 if (filter
>= LAST_BSS_FILTER
) {
1640 osbuf
= A_NETBUF_ALLOC(sizeof(*cmd
));
1641 if (osbuf
== NULL
) {
1645 A_NETBUF_PUT(osbuf
, sizeof(*cmd
));
1647 cmd
= (WMI_BSS_FILTER_CMD
*)(A_NETBUF_DATA(osbuf
));
1648 A_MEMZERO(cmd
, sizeof(*cmd
));
1649 cmd
->bssFilter
= filter
;
1650 cmd
->ieMask
= ieMask
;
1652 return (wmi_cmd_send(wmip
, osbuf
, WMI_SET_BSS_FILTER_CMDID
,
1657 wmi_probedSsid_cmd(struct wmi_t
*wmip
, A_UINT8 index
, A_UINT8 flag
,
1658 A_UINT8 ssidLength
, A_UCHAR
*ssid
)
1661 WMI_PROBED_SSID_CMD
*cmd
;
1663 if (index
> MAX_PROBED_SSID_INDEX
) {
1666 if (ssidLength
> sizeof(cmd
->ssid
)) {
1669 if ((flag
& (DISABLE_SSID_FLAG
| ANY_SSID_FLAG
)) && (ssidLength
> 0)) {
1672 if ((flag
& SPECIFIC_SSID_FLAG
) && !ssidLength
) {
1676 osbuf
= A_NETBUF_ALLOC(sizeof(*cmd
));
1677 if (osbuf
== NULL
) {
1681 A_NETBUF_PUT(osbuf
, sizeof(*cmd
));
1683 cmd
= (WMI_PROBED_SSID_CMD
*)(A_NETBUF_DATA(osbuf
));
1684 A_MEMZERO(cmd
, sizeof(*cmd
));
1685 cmd
->entryIndex
= index
;
1687 cmd
->ssidLength
= ssidLength
;
1688 A_MEMCPY(cmd
->ssid
, ssid
, ssidLength
);
1690 return (wmi_cmd_send(wmip
, osbuf
, WMI_SET_PROBED_SSID_CMDID
,
1695 wmi_listeninterval_cmd(struct wmi_t
*wmip
, A_UINT16 listenInterval
, A_UINT16 listenBeacons
)
1698 WMI_LISTEN_INT_CMD
*cmd
;
1700 osbuf
= A_NETBUF_ALLOC(sizeof(*cmd
));
1701 if (osbuf
== NULL
) {
1705 A_NETBUF_PUT(osbuf
, sizeof(*cmd
));
1707 cmd
= (WMI_LISTEN_INT_CMD
*)(A_NETBUF_DATA(osbuf
));
1708 A_MEMZERO(cmd
, sizeof(*cmd
));
1709 cmd
->listenInterval
= listenInterval
;
1710 cmd
->numBeacons
= listenBeacons
;
1712 return (wmi_cmd_send(wmip
, osbuf
, WMI_SET_LISTEN_INT_CMDID
,
1717 wmi_bmisstime_cmd(struct wmi_t
*wmip
, A_UINT16 bmissTime
, A_UINT16 bmissBeacons
)
1720 WMI_BMISS_TIME_CMD
*cmd
;
1722 osbuf
= A_NETBUF_ALLOC(sizeof(*cmd
));
1723 if (osbuf
== NULL
) {
1727 A_NETBUF_PUT(osbuf
, sizeof(*cmd
));
1729 cmd
= (WMI_BMISS_TIME_CMD
*)(A_NETBUF_DATA(osbuf
));
1730 A_MEMZERO(cmd
, sizeof(*cmd
));
1731 cmd
->bmissTime
= bmissTime
;
1732 cmd
->numBeacons
= bmissBeacons
;
1734 return (wmi_cmd_send(wmip
, osbuf
, WMI_SET_BMISS_TIME_CMDID
,
1739 wmi_associnfo_cmd(struct wmi_t
*wmip
, A_UINT8 ieType
,
1740 A_UINT8 ieLen
, A_UINT8
*ieInfo
)
1743 WMI_SET_ASSOC_INFO_CMD
*cmd
;
1746 cmdLen
= sizeof(*cmd
) + ieLen
- 1;
1747 osbuf
= A_NETBUF_ALLOC(cmdLen
);
1748 if (osbuf
== NULL
) {
1752 A_NETBUF_PUT(osbuf
, cmdLen
);
1754 cmd
= (WMI_SET_ASSOC_INFO_CMD
*)(A_NETBUF_DATA(osbuf
));
1755 A_MEMZERO(cmd
, cmdLen
);
1756 cmd
->ieType
= ieType
;
1757 cmd
->bufferSize
= ieLen
;
1758 A_MEMCPY(cmd
->assocInfo
, ieInfo
, ieLen
);
1760 return (wmi_cmd_send(wmip
, osbuf
, WMI_SET_ASSOC_INFO_CMDID
,
1765 wmi_powermode_cmd(struct wmi_t
*wmip
, A_UINT8 powerMode
)
1768 WMI_POWER_MODE_CMD
*cmd
;
1770 osbuf
= A_NETBUF_ALLOC(sizeof(*cmd
));
1771 if (osbuf
== NULL
) {
1775 A_NETBUF_PUT(osbuf
, sizeof(*cmd
));
1777 cmd
= (WMI_POWER_MODE_CMD
*)(A_NETBUF_DATA(osbuf
));
1778 A_MEMZERO(cmd
, sizeof(*cmd
));
1779 cmd
->powerMode
= powerMode
;
1780 wmip
->wmi_powerMode
= powerMode
;
1782 return (wmi_cmd_send(wmip
, osbuf
, WMI_SET_POWER_MODE_CMDID
,
1787 wmi_ibsspmcaps_cmd(struct wmi_t
*wmip
, A_UINT8 pmEnable
, A_UINT8 ttl
,
1788 A_UINT16 atim_windows
, A_UINT16 timeout_value
)
1791 WMI_IBSS_PM_CAPS_CMD
*cmd
;
1793 osbuf
= A_NETBUF_ALLOC(sizeof(*cmd
));
1794 if (osbuf
== NULL
) {
1798 A_NETBUF_PUT(osbuf
, sizeof(*cmd
));
1800 cmd
= (WMI_IBSS_PM_CAPS_CMD
*)(A_NETBUF_DATA(osbuf
));
1801 A_MEMZERO(cmd
, sizeof(*cmd
));
1802 cmd
->power_saving
= pmEnable
;
1804 cmd
->atim_windows
= atim_windows
;
1805 cmd
->timeout_value
= timeout_value
;
1807 return (wmi_cmd_send(wmip
, osbuf
, WMI_SET_IBSS_PM_CAPS_CMDID
,
1812 wmi_pmparams_cmd(struct wmi_t
*wmip
, A_UINT16 idlePeriod
,
1813 A_UINT16 psPollNum
, A_UINT16 dtimPolicy
)
1816 WMI_POWER_PARAMS_CMD
*pm
;
1818 osbuf
= A_NETBUF_ALLOC(sizeof(*pm
));
1819 if (osbuf
== NULL
) {
1823 A_NETBUF_PUT(osbuf
, sizeof(*pm
));
1825 pm
= (WMI_POWER_PARAMS_CMD
*)(A_NETBUF_DATA(osbuf
));
1826 A_MEMZERO(pm
, sizeof(*pm
));
1827 pm
->idle_period
= idlePeriod
;
1828 pm
->pspoll_number
= psPollNum
;
1829 pm
->dtim_policy
= dtimPolicy
;
1831 return (wmi_cmd_send(wmip
, osbuf
, WMI_SET_POWER_PARAMS_CMDID
,
1836 wmi_disctimeout_cmd(struct wmi_t
*wmip
, A_UINT8 timeout
)
1839 WMI_DISC_TIMEOUT_CMD
*cmd
;
1841 osbuf
= A_NETBUF_ALLOC(sizeof(*cmd
));
1842 if (osbuf
== NULL
) {
1846 A_NETBUF_PUT(osbuf
, sizeof(*cmd
));
1848 cmd
= (WMI_DISC_TIMEOUT_CMD
*)(A_NETBUF_DATA(osbuf
));
1849 A_MEMZERO(cmd
, sizeof(*cmd
));
1850 cmd
->disconnectTimeout
= timeout
;
1852 return (wmi_cmd_send(wmip
, osbuf
, WMI_SET_DISC_TIMEOUT_CMDID
,
1857 wmi_addKey_cmd(struct wmi_t
*wmip
, A_UINT8 keyIndex
, CRYPTO_TYPE keyType
,
1858 A_UINT8 keyUsage
, A_UINT8 keyLength
, A_UINT8
*keyRSC
,
1859 A_UINT8
*keyMaterial
, A_UINT8 key_op_ctrl
,
1860 WMI_SYNC_FLAG sync_flag
)
1863 WMI_ADD_CIPHER_KEY_CMD
*cmd
;
1865 if ((keyIndex
> WMI_MAX_KEY_INDEX
) || (keyLength
> WMI_MAX_KEY_LEN
) ||
1866 (keyMaterial
== NULL
))
1871 if ((WEP_CRYPT
!= keyType
) && (NULL
== keyRSC
)) {
1875 osbuf
= A_NETBUF_ALLOC(sizeof(*cmd
));
1876 if (osbuf
== NULL
) {
1880 A_NETBUF_PUT(osbuf
, sizeof(*cmd
));
1882 cmd
= (WMI_ADD_CIPHER_KEY_CMD
*)(A_NETBUF_DATA(osbuf
));
1883 A_MEMZERO(cmd
, sizeof(*cmd
));
1884 cmd
->keyIndex
= keyIndex
;
1885 cmd
->keyType
= keyType
;
1886 cmd
->keyUsage
= keyUsage
;
1887 cmd
->keyLength
= keyLength
;
1888 A_MEMCPY(cmd
->key
, keyMaterial
, keyLength
);
1889 if (NULL
!= keyRSC
) {
1890 A_MEMCPY(cmd
->keyRSC
, keyRSC
, sizeof(cmd
->keyRSC
));
1892 cmd
->key_op_ctrl
= key_op_ctrl
;
1894 return (wmi_cmd_send(wmip
, osbuf
, WMI_ADD_CIPHER_KEY_CMDID
, sync_flag
));
1898 wmi_add_krk_cmd(struct wmi_t
*wmip
, A_UINT8
*krk
)
1901 WMI_ADD_KRK_CMD
*cmd
;
1903 osbuf
= A_NETBUF_ALLOC(sizeof(*cmd
));
1905 if (osbuf
== NULL
) {
1909 A_NETBUF_PUT(osbuf
, sizeof(*cmd
));
1911 cmd
= (WMI_ADD_KRK_CMD
*)(A_NETBUF_DATA(osbuf
));
1912 A_MEMZERO(cmd
, sizeof(*cmd
));
1913 A_MEMCPY(cmd
->krk
, krk
, WMI_KRK_LEN
);
1915 return (wmi_cmd_send(wmip
, osbuf
, WMI_ADD_KRK_CMDID
, NO_SYNC_WMIFLAG
));
1919 wmi_delete_krk_cmd(struct wmi_t
*wmip
)
1923 osbuf
= A_NETBUF_ALLOC(0);
1925 if (osbuf
== NULL
) {
1929 return (wmi_cmd_send(wmip
, osbuf
, WMI_DELETE_KRK_CMDID
, NO_SYNC_WMIFLAG
));
1933 wmi_deleteKey_cmd(struct wmi_t
*wmip
, A_UINT8 keyIndex
)
1936 WMI_DELETE_CIPHER_KEY_CMD
*cmd
;
1938 if (keyIndex
> WMI_MAX_KEY_INDEX
) {
1942 osbuf
= A_NETBUF_ALLOC(sizeof(*cmd
));
1943 if (osbuf
== NULL
) {
1947 A_NETBUF_PUT(osbuf
, sizeof(*cmd
));
1949 cmd
= (WMI_DELETE_CIPHER_KEY_CMD
*)(A_NETBUF_DATA(osbuf
));
1950 A_MEMZERO(cmd
, sizeof(*cmd
));
1951 cmd
->keyIndex
= keyIndex
;
1953 return (wmi_cmd_send(wmip
, osbuf
, WMI_DELETE_CIPHER_KEY_CMDID
,
1958 wmi_setPmkid_cmd(struct wmi_t
*wmip
, A_UINT8
*bssid
, A_UINT8
*pmkId
,
1962 WMI_SET_PMKID_CMD
*cmd
;
1964 if (bssid
== NULL
) {
1968 if ((set
== TRUE
) && (pmkId
== NULL
)) {
1972 osbuf
= A_NETBUF_ALLOC(sizeof(*cmd
));
1973 if (osbuf
== NULL
) {
1977 A_NETBUF_PUT(osbuf
, sizeof(*cmd
));
1979 cmd
= (WMI_SET_PMKID_CMD
*)(A_NETBUF_DATA(osbuf
));
1980 A_MEMCPY(cmd
->bssid
, bssid
, sizeof(cmd
->bssid
));
1982 A_MEMCPY(cmd
->pmkid
, pmkId
, sizeof(cmd
->pmkid
));
1983 cmd
->enable
= PMKID_ENABLE
;
1985 A_MEMZERO(cmd
->pmkid
, sizeof(cmd
->pmkid
));
1986 cmd
->enable
= PMKID_DISABLE
;
1989 return (wmi_cmd_send(wmip
, osbuf
, WMI_SET_PMKID_CMDID
, NO_SYNC_WMIFLAG
));
1993 wmi_set_tkip_countermeasures_cmd(struct wmi_t
*wmip
, A_BOOL en
)
1996 WMI_SET_TKIP_COUNTERMEASURES_CMD
*cmd
;
1998 osbuf
= A_NETBUF_ALLOC(sizeof(*cmd
));
1999 if (osbuf
== NULL
) {
2003 A_NETBUF_PUT(osbuf
, sizeof(*cmd
));
2005 cmd
= (WMI_SET_TKIP_COUNTERMEASURES_CMD
*)(A_NETBUF_DATA(osbuf
));
2006 cmd
->cm_en
= (en
== TRUE
)? WMI_TKIP_CM_ENABLE
: WMI_TKIP_CM_DISABLE
;
2008 return (wmi_cmd_send(wmip
, osbuf
, WMI_SET_TKIP_COUNTERMEASURES_CMDID
,
2013 wmi_set_akmp_params_cmd(struct wmi_t
*wmip
,
2014 WMI_SET_AKMP_PARAMS_CMD
*akmpParams
)
2017 WMI_SET_AKMP_PARAMS_CMD
*cmd
;
2019 osbuf
= A_NETBUF_ALLOC(sizeof(*cmd
));
2020 if (osbuf
== NULL
) {
2024 A_NETBUF_PUT(osbuf
, sizeof(*cmd
));
2025 cmd
= (WMI_SET_AKMP_PARAMS_CMD
*)(A_NETBUF_DATA(osbuf
));
2026 cmd
->akmpInfo
= akmpParams
->akmpInfo
;
2028 return (wmi_cmd_send(wmip
, osbuf
, WMI_SET_AKMP_PARAMS_CMDID
,
2033 wmi_set_pmkid_list_cmd(struct wmi_t
*wmip
,
2034 WMI_SET_PMKID_LIST_CMD
*pmkInfo
)
2037 WMI_SET_PMKID_LIST_CMD
*cmd
;
2041 cmdLen
= sizeof(pmkInfo
->numPMKID
) +
2042 pmkInfo
->numPMKID
* sizeof(WMI_PMKID
);
2044 osbuf
= A_NETBUF_ALLOC(cmdLen
);
2046 if (osbuf
== NULL
) {
2050 A_NETBUF_PUT(osbuf
, cmdLen
);
2051 cmd
= (WMI_SET_PMKID_LIST_CMD
*)(A_NETBUF_DATA(osbuf
));
2052 cmd
->numPMKID
= pmkInfo
->numPMKID
;
2054 for (i
= 0; i
< cmd
->numPMKID
; i
++) {
2055 A_MEMCPY(&cmd
->pmkidList
[i
], &pmkInfo
->pmkidList
[i
],
2059 return (wmi_cmd_send(wmip
, osbuf
, WMI_SET_PMKID_LIST_CMDID
,
2064 wmi_get_pmkid_list_cmd(struct wmi_t
*wmip
)
2068 osbuf
= A_NETBUF_ALLOC(0); /* no payload */
2069 if (osbuf
== NULL
) {
2073 return (wmi_cmd_send(wmip
, osbuf
, WMI_GET_PMKID_LIST_CMDID
,
2078 wmi_dataSync_send(struct wmi_t
*wmip
, void *osbuf
, WMI_PRI_STREAM_ID streamID
)
2080 WMI_DATA_HDR
*dtHdr
;
2082 A_ASSERT(streamID
!= WMI_CONTROL_PRI
);
2083 A_ASSERT(osbuf
!= NULL
);
2085 if (A_NETBUF_PUSH(osbuf
, sizeof(WMI_DATA_HDR
)) != A_OK
) {
2089 dtHdr
= (WMI_DATA_HDR
*)A_NETBUF_DATA(osbuf
);
2091 (SYNC_MSGTYPE
& WMI_DATA_HDR_MSG_TYPE_MASK
) << WMI_DATA_HDR_MSG_TYPE_SHIFT
;
2093 A_DPRINTF(DBG_WMI
, (DBGFMT
"Enter - streamID %d\n", DBGARG
, streamID
));
2095 return (A_WMI_CONTROL_TX(wmip
->wmi_devt
, osbuf
, streamID
));
2098 typedef struct _WMI_DATA_SYNC_BUFS
{
2099 A_UINT8 trafficClass
;
2101 }WMI_DATA_SYNC_BUFS
;
2104 wmi_sync_point(struct wmi_t
*wmip
)
2107 WMI_DATA_SYNC_BUFS dataSyncBufs
[WMM_NUM_AC
];
2108 A_UINT8 i
,numPriStreams
=0;
2111 A_DPRINTF(DBG_WMI
, (DBGFMT
"Enter\n", DBGARG
));
2113 memset(dataSyncBufs
,0,sizeof(dataSyncBufs
));
2115 /* lock out while we walk through the priority list and assemble our local array */
2118 for (i
=0; i
< WMM_NUM_AC
; i
++) {
2119 if (wmip
->wmi_fatPipeExists
& (1 << i
)) {
2121 dataSyncBufs
[numPriStreams
-1].trafficClass
= i
;
2127 /* dataSyncBufs is now filled with entries (starting at index 0) containing valid streamIDs */
2131 * We allocate all network buffers needed so we will be able to
2132 * send all required frames.
2134 cmd_osbuf
= A_NETBUF_ALLOC(0); /* no payload */
2135 if (cmd_osbuf
== NULL
) {
2136 status
= A_NO_MEMORY
;
2140 for (i
=0; i
< numPriStreams
; i
++) {
2141 dataSyncBufs
[i
].osbuf
= A_NETBUF_ALLOC(0);
2142 if (dataSyncBufs
[i
].osbuf
== NULL
) {
2143 status
= A_NO_MEMORY
;
2149 * Send sync cmd followed by sync data messages on all endpoints being
2152 status
= wmi_cmd_send(wmip
, cmd_osbuf
, WMI_SYNCHRONIZE_CMDID
,
2155 if (A_FAILED(status
)) {
2158 /* cmd buffer sent, we no longer own it */
2161 for(i
=0; i
< numPriStreams
; i
++) {
2162 A_ASSERT(dataSyncBufs
[i
].osbuf
!= NULL
);
2164 status
= wmi_dataSync_send(wmip
, dataSyncBufs
[i
].osbuf
,
2165 WMI_ACCESSCATEGORY_WMISTREAM(wmip
,dataSyncBufs
[i
].trafficClass
));
2167 if (A_FAILED(status
)) {
2170 /* we don't own this buffer anymore, NULL it out of the array so it
2171 * won't get cleaned up */
2172 dataSyncBufs
[i
].osbuf
= NULL
;
2177 /* free up any resources left over (possibly due to an error) */
2179 if (cmd_osbuf
!= NULL
) {
2180 A_NETBUF_FREE(cmd_osbuf
);
2183 for (i
= 0; i
< numPriStreams
; i
++) {
2184 if (dataSyncBufs
[i
].osbuf
!= NULL
) {
2185 A_NETBUF_FREE(dataSyncBufs
[i
].osbuf
);
2193 wmi_create_pstream_cmd(struct wmi_t
*wmip
, WMI_CREATE_PSTREAM_CMD
*params
)
2196 WMI_CREATE_PSTREAM_CMD
*cmd
;
2197 A_UINT16 activeTsids
=0;
2198 A_UINT8 fatPipeExistsForAC
=0;
2200 /* Validate all the parameters. */
2201 if( !((params
->userPriority
< 8) &&
2202 (params
->userPriority
<= 0x7) &&
2203 (convert_userPriority_to_trafficClass(params
->userPriority
) == params
->trafficClass
) &&
2204 (params
->trafficDirection
== UPLINK_TRAFFIC
||
2205 params
->trafficDirection
== DNLINK_TRAFFIC
||
2206 params
->trafficDirection
== BIDIR_TRAFFIC
) &&
2207 (params
->trafficType
== TRAFFIC_TYPE_APERIODIC
||
2208 params
->trafficType
== TRAFFIC_TYPE_PERIODIC
) &&
2209 (params
->voicePSCapability
== DISABLE_FOR_THIS_AC
||
2210 params
->voicePSCapability
== ENABLE_FOR_THIS_AC
||
2211 params
->voicePSCapability
== ENABLE_FOR_ALL_AC
) &&
2212 (params
->tsid
== WMI_IMPLICIT_PSTREAM
|| params
->tsid
<= WMI_MAX_THINSTREAM
)) )
2217 osbuf
= A_NETBUF_ALLOC(sizeof(*cmd
));
2218 if (osbuf
== NULL
) {
2222 A_NETBUF_PUT(osbuf
, sizeof(*cmd
));
2225 (DBGFMT
"Sending create_pstream_cmd: ac=%d tsid:%d\n", DBGARG
,
2226 params
->trafficClass
, params
->tsid
));
2228 cmd
= (WMI_CREATE_PSTREAM_CMD
*)(A_NETBUF_DATA(osbuf
));
2229 A_MEMZERO(cmd
, sizeof(*cmd
));
2230 A_MEMCPY(cmd
, params
, sizeof(*cmd
));
2232 /* this is an implicitly created Fat pipe */
2233 if (params
->tsid
== WMI_IMPLICIT_PSTREAM
) {
2235 fatPipeExistsForAC
= (wmip
->wmi_fatPipeExists
& (1 << params
->trafficClass
));
2236 wmip
->wmi_fatPipeExists
|= (1<<params
->trafficClass
);
2239 /* this is an explicitly created thin stream within a fat pipe */
2241 fatPipeExistsForAC
= (wmip
->wmi_fatPipeExists
& (1 << params
->trafficClass
));
2242 activeTsids
= wmip
->wmi_streamExistsForAC
[params
->trafficClass
];
2243 wmip
->wmi_streamExistsForAC
[params
->trafficClass
] |= (1<<params
->tsid
);
2244 /* if a thinstream becomes active, the fat pipe automatically
2247 wmip
->wmi_fatPipeExists
|= (1<<params
->trafficClass
);
2251 /* Indicate activty change to driver layer only if this is the
2252 * first TSID to get created in this AC explicitly or an implicit
2253 * fat pipe is getting created.
2255 if (!fatPipeExistsForAC
) {
2256 A_WMI_STREAM_TX_ACTIVE(wmip
->wmi_devt
, params
->trafficClass
);
2259 /* mike: should be SYNC_BEFORE_WMIFLAG */
2260 return (wmi_cmd_send(wmip
, osbuf
, WMI_CREATE_PSTREAM_CMDID
,
2265 wmi_delete_pstream_cmd(struct wmi_t
*wmip
, A_UINT8 trafficClass
, A_UINT8 tsid
)
2268 WMI_DELETE_PSTREAM_CMD
*cmd
;
2270 A_UINT16 activeTsids
=0;
2272 osbuf
= A_NETBUF_ALLOC(sizeof(*cmd
));
2273 if (osbuf
== NULL
) {
2277 A_NETBUF_PUT(osbuf
, sizeof(*cmd
));
2279 cmd
= (WMI_DELETE_PSTREAM_CMD
*)(A_NETBUF_DATA(osbuf
));
2280 A_MEMZERO(cmd
, sizeof(*cmd
));
2282 cmd
->trafficClass
= trafficClass
;
2286 activeTsids
= wmip
->wmi_streamExistsForAC
[trafficClass
];
2289 /* Check if the tsid was created & exists */
2290 if (!(activeTsids
& (1<<tsid
))) {
2293 (DBGFMT
"TSID %d does'nt exist for trafficClass: %d\n", DBGARG
, tsid
, trafficClass
));
2294 /* TODO: return a more appropriate err code */
2299 (DBGFMT
"Sending delete_pstream_cmd: trafficClass: %d tsid=%d\n", DBGARG
, trafficClass
, tsid
));
2301 status
= (wmi_cmd_send(wmip
, osbuf
, WMI_DELETE_PSTREAM_CMDID
,
2302 SYNC_BEFORE_WMIFLAG
));
2305 wmip
->wmi_streamExistsForAC
[trafficClass
] &= ~(1<<tsid
);
2306 activeTsids
= wmip
->wmi_streamExistsForAC
[trafficClass
];
2310 /* Indicate stream inactivity to driver layer only if all tsids
2311 * within this AC are deleted.
2314 A_WMI_STREAM_TX_INACTIVE(wmip
->wmi_devt
, trafficClass
);
2315 wmip
->wmi_fatPipeExists
&= ~(1<<trafficClass
);
2322 * used to set the bit rate. rate is in Kbps. If rate == -1
2323 * then auto selection is used.
2326 wmi_set_bitrate_cmd(struct wmi_t
*wmip
, A_INT32 rate
)
2329 WMI_BIT_RATE_CMD
*cmd
;
2333 index
= wmi_validate_bitrate(wmip
, rate
);
2334 if(index
== A_EINVAL
){
2341 osbuf
= A_NETBUF_ALLOC(sizeof(*cmd
));
2342 if (osbuf
== NULL
) {
2346 A_NETBUF_PUT(osbuf
, sizeof(*cmd
));
2348 cmd
= (WMI_BIT_RATE_CMD
*)(A_NETBUF_DATA(osbuf
));
2349 A_MEMZERO(cmd
, sizeof(*cmd
));
2351 cmd
->rateIndex
= index
;
2353 return (wmi_cmd_send(wmip
, osbuf
, WMI_SET_BITRATE_CMDID
, NO_SYNC_WMIFLAG
));
2357 wmi_get_bitrate_cmd(struct wmi_t
*wmip
)
2361 osbuf
= A_NETBUF_ALLOC(0); /* no payload */
2362 if (osbuf
== NULL
) {
2366 return (wmi_cmd_send(wmip
, osbuf
, WMI_GET_BITRATE_CMDID
, NO_SYNC_WMIFLAG
));
2370 * Returns TRUE iff the given rate index is legal in the current PHY mode.
2373 wmi_is_bitrate_index_valid(struct wmi_t
*wmip
, A_UINT32 rateIndex
)
2375 WMI_PHY_MODE phyMode
= wmip
->wmi_phyMode
;
2376 A_BOOL isValid
= TRUE
;
2379 if ((rateIndex
< MODE_A_SUPPORT_RATE_START
) || (rateIndex
> MODE_A_SUPPORT_RATE_STOP
)) {
2385 if ((rateIndex
< MODE_B_SUPPORT_RATE_START
) || (rateIndex
> MODE_B_SUPPORT_RATE_STOP
)) {
2390 case WMI_11GONLY_MODE
:
2391 if ((rateIndex
< MODE_GONLY_SUPPORT_RATE_START
) || (rateIndex
> MODE_GONLY_SUPPORT_RATE_STOP
)) {
2398 if ((rateIndex
< MODE_G_SUPPORT_RATE_START
) || (rateIndex
> MODE_G_SUPPORT_RATE_STOP
)) {
2412 wmi_validate_bitrate(struct wmi_t
*wmip
, A_INT32 rate
)
2419 if (wmi_rateTable
[(A_UINT32
) i
] == 0) {
2422 if (wmi_rateTable
[(A_UINT32
) i
] == rate
) {
2431 if(wmi_is_bitrate_index_valid(wmip
, i
) != TRUE
) {
2439 wmi_set_fixrates_cmd(struct wmi_t
*wmip
, A_INT16 fixRatesMask
)
2442 WMI_FIX_RATES_CMD
*cmd
;
2445 /* Make sure all rates in the mask are valid in the current PHY mode */
2446 for(rateIndex
= 0; rateIndex
< MAX_NUMBER_OF_SUPPORT_RATES
; rateIndex
++) {
2447 if((1 << rateIndex
) & (A_UINT32
)fixRatesMask
) {
2448 if(wmi_is_bitrate_index_valid(wmip
, rateIndex
) != TRUE
) {
2449 A_DPRINTF(DBG_WMI
, (DBGFMT
"Set Fix Rates command failed: Given rate is illegal in current PHY mode\n", DBGARG
));
2456 osbuf
= A_NETBUF_ALLOC(sizeof(*cmd
));
2457 if (osbuf
== NULL
) {
2461 A_NETBUF_PUT(osbuf
, sizeof(*cmd
));
2463 cmd
= (WMI_FIX_RATES_CMD
*)(A_NETBUF_DATA(osbuf
));
2464 A_MEMZERO(cmd
, sizeof(*cmd
));
2466 cmd
->fixRateMask
= fixRatesMask
;
2468 return (wmi_cmd_send(wmip
, osbuf
, WMI_SET_FIXRATES_CMDID
, NO_SYNC_WMIFLAG
));
2472 wmi_get_ratemask_cmd(struct wmi_t
*wmip
)
2476 osbuf
= A_NETBUF_ALLOC(0); /* no payload */
2477 if (osbuf
== NULL
) {
2481 return (wmi_cmd_send(wmip
, osbuf
, WMI_GET_FIXRATES_CMDID
, NO_SYNC_WMIFLAG
));
2485 wmi_get_channelList_cmd(struct wmi_t
*wmip
)
2489 osbuf
= A_NETBUF_ALLOC(0); /* no payload */
2490 if (osbuf
== NULL
) {
2494 return (wmi_cmd_send(wmip
, osbuf
, WMI_GET_CHANNEL_LIST_CMDID
,
2499 * used to generate a wmi sey channel Parameters cmd.
2500 * mode should always be specified and corresponds to the phy mode of the
2502 * numChan should alway sbe specified. If zero indicates that all available
2503 * channels should be used.
2504 * channelList is an array of channel frequencies (in Mhz) which the radio
2505 * should limit its operation to. It should be NULL if numChan == 0. Size of
2506 * array should correspond to numChan entries.
2509 wmi_set_channelParams_cmd(struct wmi_t
*wmip
, A_UINT8 scanParam
,
2510 WMI_PHY_MODE mode
, A_INT8 numChan
,
2511 A_UINT16
*channelList
)
2514 WMI_CHANNEL_PARAMS_CMD
*cmd
;
2517 size
= sizeof (*cmd
);
2520 if (numChan
> WMI_MAX_CHANNELS
) {
2523 size
+= sizeof(A_UINT16
) * (numChan
- 1);
2526 osbuf
= A_NETBUF_ALLOC(size
);
2527 if (osbuf
== NULL
) {
2531 A_NETBUF_PUT(osbuf
, size
);
2533 cmd
= (WMI_CHANNEL_PARAMS_CMD
*)(A_NETBUF_DATA(osbuf
));
2534 A_MEMZERO(cmd
, size
);
2536 wmip
->wmi_phyMode
= mode
;
2537 cmd
->scanParam
= scanParam
;
2538 cmd
->phyMode
= mode
;
2539 cmd
->numChannels
= numChan
;
2540 A_MEMCPY(cmd
->channelList
, channelList
, numChan
* sizeof(A_UINT16
));
2542 return (wmi_cmd_send(wmip
, osbuf
, WMI_SET_CHANNEL_PARAMS_CMDID
,
2547 wmi_set_rssi_threshold_params(struct wmi_t
*wmip
,
2548 WMI_RSSI_THRESHOLD_PARAMS_CMD
*rssiCmd
)
2552 WMI_RSSI_THRESHOLD_PARAMS_CMD
*cmd
;
2553 /* These values are in ascending order */
2554 if( rssiCmd
->thresholdAbove6_Val
<= rssiCmd
->thresholdAbove5_Val
||
2555 rssiCmd
->thresholdAbove5_Val
<= rssiCmd
->thresholdAbove4_Val
||
2556 rssiCmd
->thresholdAbove4_Val
<= rssiCmd
->thresholdAbove3_Val
||
2557 rssiCmd
->thresholdAbove3_Val
<= rssiCmd
->thresholdAbove2_Val
||
2558 rssiCmd
->thresholdAbove2_Val
<= rssiCmd
->thresholdAbove1_Val
||
2559 rssiCmd
->thresholdBelow6_Val
<= rssiCmd
->thresholdBelow5_Val
||
2560 rssiCmd
->thresholdBelow5_Val
<= rssiCmd
->thresholdBelow4_Val
||
2561 rssiCmd
->thresholdBelow4_Val
<= rssiCmd
->thresholdBelow3_Val
||
2562 rssiCmd
->thresholdBelow3_Val
<= rssiCmd
->thresholdBelow2_Val
||
2563 rssiCmd
->thresholdBelow2_Val
<= rssiCmd
->thresholdBelow1_Val
) {
2568 size
= sizeof (*cmd
);
2570 osbuf
= A_NETBUF_ALLOC(size
);
2571 if (osbuf
== NULL
) {
2575 A_NETBUF_PUT(osbuf
, size
);
2577 cmd
= (WMI_RSSI_THRESHOLD_PARAMS_CMD
*)(A_NETBUF_DATA(osbuf
));
2578 A_MEMZERO(cmd
, size
);
2579 A_MEMCPY(cmd
, rssiCmd
, sizeof(WMI_RSSI_THRESHOLD_PARAMS_CMD
));
2581 return (wmi_cmd_send(wmip
, osbuf
, WMI_RSSI_THRESHOLD_PARAMS_CMDID
,
2586 wmi_set_host_sleep_mode_cmd(struct wmi_t
*wmip
,
2587 WMI_SET_HOST_SLEEP_MODE_CMD
*hostModeCmd
)
2591 WMI_SET_HOST_SLEEP_MODE_CMD
*cmd
;
2593 if( hostModeCmd
->awake
== hostModeCmd
->asleep
) {
2597 size
= sizeof (*cmd
);
2599 osbuf
= A_NETBUF_ALLOC(size
);
2600 if (osbuf
== NULL
) {
2604 A_NETBUF_PUT(osbuf
, size
);
2606 cmd
= (WMI_SET_HOST_SLEEP_MODE_CMD
*)(A_NETBUF_DATA(osbuf
));
2607 A_MEMZERO(cmd
, size
);
2608 A_MEMCPY(cmd
, hostModeCmd
, sizeof(WMI_SET_HOST_SLEEP_MODE_CMD
));
2610 return (wmi_cmd_send(wmip
, osbuf
, WMI_SET_HOST_SLEEP_MODE_CMDID
,
2615 wmi_set_wow_mode_cmd(struct wmi_t
*wmip
,
2616 WMI_SET_WOW_MODE_CMD
*wowModeCmd
)
2620 WMI_SET_WOW_MODE_CMD
*cmd
;
2622 size
= sizeof (*cmd
);
2624 osbuf
= A_NETBUF_ALLOC(size
);
2625 if (osbuf
== NULL
) {
2629 A_NETBUF_PUT(osbuf
, size
);
2631 cmd
= (WMI_SET_WOW_MODE_CMD
*)(A_NETBUF_DATA(osbuf
));
2632 A_MEMZERO(cmd
, size
);
2633 A_MEMCPY(cmd
, wowModeCmd
, sizeof(WMI_SET_WOW_MODE_CMD
));
2635 return (wmi_cmd_send(wmip
, osbuf
, WMI_SET_WOW_MODE_CMDID
,
2641 wmi_get_wow_list_cmd(struct wmi_t
*wmip
,
2642 WMI_GET_WOW_LIST_CMD
*wowListCmd
)
2646 WMI_GET_WOW_LIST_CMD
*cmd
;
2648 size
= sizeof (*cmd
);
2650 osbuf
= A_NETBUF_ALLOC(size
);
2651 if (osbuf
== NULL
) {
2655 A_NETBUF_PUT(osbuf
, size
);
2657 cmd
= (WMI_GET_WOW_LIST_CMD
*)(A_NETBUF_DATA(osbuf
));
2658 A_MEMZERO(cmd
, size
);
2659 A_MEMCPY(cmd
, wowListCmd
, sizeof(WMI_GET_WOW_LIST_CMD
));
2661 return (wmi_cmd_send(wmip
, osbuf
, WMI_GET_WOW_LIST_CMDID
,
2667 wmi_get_wow_list_event_rx(struct wmi_t
*wmip
, A_UINT8
*datap
, int len
)
2669 WMI_GET_WOW_LIST_REPLY
*reply
;
2671 if (len
< sizeof(WMI_GET_WOW_LIST_REPLY
)) {
2674 reply
= (WMI_GET_WOW_LIST_REPLY
*)datap
;
2676 A_WMI_WOW_LIST_EVENT(wmip
->wmi_devt
, reply
->num_filters
,
2682 A_STATUS
wmi_add_wow_pattern_cmd(struct wmi_t
*wmip
,
2683 WMI_ADD_WOW_PATTERN_CMD
*addWowCmd
,
2684 A_UINT8
* pattern
, A_UINT8
* mask
,
2685 A_UINT8 pattern_size
)
2689 WMI_ADD_WOW_PATTERN_CMD
*cmd
;
2690 A_UINT8
*filter_mask
= NULL
;
2692 size
= sizeof (*cmd
);
2694 size
+= ((2 * addWowCmd
->filter_size
)* sizeof(A_UINT8
));
2695 osbuf
= A_NETBUF_ALLOC(size
);
2696 if (osbuf
== NULL
) {
2700 A_NETBUF_PUT(osbuf
, size
);
2702 cmd
= (WMI_ADD_WOW_PATTERN_CMD
*)(A_NETBUF_DATA(osbuf
));
2703 cmd
->filter_list_id
= addWowCmd
->filter_list_id
;
2704 cmd
->filter_offset
= addWowCmd
->filter_offset
;
2705 cmd
->filter_size
= addWowCmd
->filter_size
;
2707 A_MEMCPY(cmd
->filter
, pattern
, addWowCmd
->filter_size
);
2709 filter_mask
= (A_UINT8
*)(cmd
->filter
+ cmd
->filter_size
);
2710 A_MEMCPY(filter_mask
, mask
, addWowCmd
->filter_size
);
2713 return (wmi_cmd_send(wmip
, osbuf
, WMI_ADD_WOW_PATTERN_CMDID
,
2718 wmi_del_wow_pattern_cmd(struct wmi_t
*wmip
,
2719 WMI_DEL_WOW_PATTERN_CMD
*delWowCmd
)
2723 WMI_DEL_WOW_PATTERN_CMD
*cmd
;
2725 size
= sizeof (*cmd
);
2727 osbuf
= A_NETBUF_ALLOC(size
);
2728 if (osbuf
== NULL
) {
2732 A_NETBUF_PUT(osbuf
, size
);
2734 cmd
= (WMI_DEL_WOW_PATTERN_CMD
*)(A_NETBUF_DATA(osbuf
));
2735 A_MEMZERO(cmd
, size
);
2736 A_MEMCPY(cmd
, delWowCmd
, sizeof(WMI_DEL_WOW_PATTERN_CMD
));
2738 return (wmi_cmd_send(wmip
, osbuf
, WMI_DEL_WOW_PATTERN_CMDID
,
2744 wmi_set_snr_threshold_params(struct wmi_t
*wmip
,
2745 WMI_SNR_THRESHOLD_PARAMS_CMD
*snrCmd
)
2749 WMI_SNR_THRESHOLD_PARAMS_CMD
*cmd
;
2750 /* These values are in ascending order */
2751 if( snrCmd
->thresholdAbove4_Val
<= snrCmd
->thresholdAbove3_Val
||
2752 snrCmd
->thresholdAbove3_Val
<= snrCmd
->thresholdAbove2_Val
||
2753 snrCmd
->thresholdAbove2_Val
<= snrCmd
->thresholdAbove1_Val
||
2754 snrCmd
->thresholdBelow4_Val
<= snrCmd
->thresholdBelow3_Val
||
2755 snrCmd
->thresholdBelow3_Val
<= snrCmd
->thresholdBelow2_Val
||
2756 snrCmd
->thresholdBelow2_Val
<= snrCmd
->thresholdBelow1_Val
) {
2761 size
= sizeof (*cmd
);
2763 osbuf
= A_NETBUF_ALLOC(size
);
2764 if (osbuf
== NULL
) {
2768 A_NETBUF_PUT(osbuf
, size
);
2770 cmd
= (WMI_SNR_THRESHOLD_PARAMS_CMD
*)(A_NETBUF_DATA(osbuf
));
2771 A_MEMZERO(cmd
, size
);
2772 A_MEMCPY(cmd
, snrCmd
, sizeof(WMI_SNR_THRESHOLD_PARAMS_CMD
));
2774 return (wmi_cmd_send(wmip
, osbuf
, WMI_SNR_THRESHOLD_PARAMS_CMDID
,
2779 wmi_clr_rssi_snr(struct wmi_t
*wmip
)
2783 osbuf
= A_NETBUF_ALLOC(sizeof(int));
2784 if (osbuf
== NULL
) {
2788 return (wmi_cmd_send(wmip
, osbuf
, WMI_CLR_RSSI_SNR_CMDID
,
2793 wmi_set_lq_threshold_params(struct wmi_t
*wmip
,
2794 WMI_LQ_THRESHOLD_PARAMS_CMD
*lqCmd
)
2798 WMI_LQ_THRESHOLD_PARAMS_CMD
*cmd
;
2799 /* These values are in ascending order */
2800 if( lqCmd
->thresholdAbove4_Val
<= lqCmd
->thresholdAbove3_Val
||
2801 lqCmd
->thresholdAbove3_Val
<= lqCmd
->thresholdAbove2_Val
||
2802 lqCmd
->thresholdAbove2_Val
<= lqCmd
->thresholdAbove1_Val
||
2803 lqCmd
->thresholdBelow4_Val
<= lqCmd
->thresholdBelow3_Val
||
2804 lqCmd
->thresholdBelow3_Val
<= lqCmd
->thresholdBelow2_Val
||
2805 lqCmd
->thresholdBelow2_Val
<= lqCmd
->thresholdBelow1_Val
) {
2810 size
= sizeof (*cmd
);
2812 osbuf
= A_NETBUF_ALLOC(size
);
2813 if (osbuf
== NULL
) {
2817 A_NETBUF_PUT(osbuf
, size
);
2819 cmd
= (WMI_LQ_THRESHOLD_PARAMS_CMD
*)(A_NETBUF_DATA(osbuf
));
2820 A_MEMZERO(cmd
, size
);
2821 A_MEMCPY(cmd
, lqCmd
, sizeof(WMI_LQ_THRESHOLD_PARAMS_CMD
));
2823 return (wmi_cmd_send(wmip
, osbuf
, WMI_LQ_THRESHOLD_PARAMS_CMDID
,
2828 wmi_set_error_report_bitmask(struct wmi_t
*wmip
, A_UINT32 mask
)
2832 WMI_TARGET_ERROR_REPORT_BITMASK
*cmd
;
2834 size
= sizeof (*cmd
);
2836 osbuf
= A_NETBUF_ALLOC(size
);
2837 if (osbuf
== NULL
) {
2841 A_NETBUF_PUT(osbuf
, size
);
2843 cmd
= (WMI_TARGET_ERROR_REPORT_BITMASK
*)(A_NETBUF_DATA(osbuf
));
2844 A_MEMZERO(cmd
, size
);
2846 cmd
->bitmask
= mask
;
2848 return (wmi_cmd_send(wmip
, osbuf
, WMI_TARGET_ERROR_REPORT_BITMASK_CMDID
,
2853 wmi_get_challenge_resp_cmd(struct wmi_t
*wmip
, A_UINT32 cookie
, A_UINT32 source
)
2856 WMIX_HB_CHALLENGE_RESP_CMD
*cmd
;
2858 osbuf
= A_NETBUF_ALLOC(sizeof(*cmd
));
2859 if (osbuf
== NULL
) {
2863 A_NETBUF_PUT(osbuf
, sizeof(*cmd
));
2865 cmd
= (WMIX_HB_CHALLENGE_RESP_CMD
*)(A_NETBUF_DATA(osbuf
));
2866 cmd
->cookie
= cookie
;
2867 cmd
->source
= source
;
2869 return (wmi_cmd_send_xtnd(wmip
, osbuf
, WMIX_HB_CHALLENGE_RESP_CMDID
,
2874 wmi_config_debug_module_cmd(struct wmi_t
*wmip
, A_UINT16 mmask
,
2875 A_UINT16 tsr
, A_BOOL rep
, A_UINT16 size
,
2879 WMIX_DBGLOG_CFG_MODULE_CMD
*cmd
;
2881 osbuf
= A_NETBUF_ALLOC(sizeof(*cmd
));
2882 if (osbuf
== NULL
) {
2886 A_NETBUF_PUT(osbuf
, sizeof(*cmd
));
2888 cmd
= (WMIX_DBGLOG_CFG_MODULE_CMD
*)(A_NETBUF_DATA(osbuf
));
2889 cmd
->config
.cfgmmask
= mmask
;
2890 cmd
->config
.cfgtsr
= tsr
;
2891 cmd
->config
.cfgrep
= rep
;
2892 cmd
->config
.cfgsize
= size
;
2893 cmd
->config
.cfgvalid
= valid
;
2895 return (wmi_cmd_send_xtnd(wmip
, osbuf
, WMIX_DBGLOG_CFG_MODULE_CMDID
,
2900 wmi_get_stats_cmd(struct wmi_t
*wmip
)
2904 osbuf
= A_NETBUF_ALLOC(0); /* no payload */
2905 if (osbuf
== NULL
) {
2909 return (wmi_cmd_send(wmip
, osbuf
, WMI_GET_STATISTICS_CMDID
,
2914 wmi_addBadAp_cmd(struct wmi_t
*wmip
, A_UINT8 apIndex
, A_UINT8
*bssid
)
2917 WMI_ADD_BAD_AP_CMD
*cmd
;
2919 if ((bssid
== NULL
) || (apIndex
> WMI_MAX_BAD_AP_INDEX
)) {
2923 osbuf
= A_NETBUF_ALLOC(sizeof(*cmd
));
2924 if (osbuf
== NULL
) {
2928 A_NETBUF_PUT(osbuf
, sizeof(*cmd
));
2930 cmd
= (WMI_ADD_BAD_AP_CMD
*)(A_NETBUF_DATA(osbuf
));
2931 cmd
->badApIndex
= apIndex
;
2932 A_MEMCPY(cmd
->bssid
, bssid
, sizeof(cmd
->bssid
));
2934 return (wmi_cmd_send(wmip
, osbuf
, WMI_ADD_BAD_AP_CMDID
, NO_SYNC_WMIFLAG
));
2938 wmi_deleteBadAp_cmd(struct wmi_t
*wmip
, A_UINT8 apIndex
)
2941 WMI_DELETE_BAD_AP_CMD
*cmd
;
2943 if (apIndex
> WMI_MAX_BAD_AP_INDEX
) {
2947 osbuf
= A_NETBUF_ALLOC(sizeof(*cmd
));
2948 if (osbuf
== NULL
) {
2952 A_NETBUF_PUT(osbuf
, sizeof(*cmd
));
2954 cmd
= (WMI_DELETE_BAD_AP_CMD
*)(A_NETBUF_DATA(osbuf
));
2955 cmd
->badApIndex
= apIndex
;
2957 return (wmi_cmd_send(wmip
, osbuf
, WMI_DELETE_BAD_AP_CMDID
,
2962 wmi_set_txPwr_cmd(struct wmi_t
*wmip
, A_UINT8 dbM
)
2965 WMI_SET_TX_PWR_CMD
*cmd
;
2967 osbuf
= A_NETBUF_ALLOC(sizeof(*cmd
));
2968 if (osbuf
== NULL
) {
2972 A_NETBUF_PUT(osbuf
, sizeof(*cmd
));
2974 cmd
= (WMI_SET_TX_PWR_CMD
*)(A_NETBUF_DATA(osbuf
));
2977 return (wmi_cmd_send(wmip
, osbuf
, WMI_SET_TX_PWR_CMDID
, NO_SYNC_WMIFLAG
));
2981 wmi_get_txPwr_cmd(struct wmi_t
*wmip
)
2985 osbuf
= A_NETBUF_ALLOC(0); /* no payload */
2986 if (osbuf
== NULL
) {
2990 return (wmi_cmd_send(wmip
, osbuf
, WMI_GET_TX_PWR_CMDID
, NO_SYNC_WMIFLAG
));
2994 wmi_switch_radio(struct wmi_t
*wmip
, A_UINT8 on
)
2996 WMI_SCAN_PARAMS_CMD scParams
= {0, 0, 0, 0, 0,
2997 WMI_SHORTSCANRATIO_DEFAULT
,
2998 DEFAULT_SCAN_CTRL_FLAGS
,
3002 /* Enable foreground scanning */
3003 if (wmi_scanparams_cmd(wmip
, scParams
.fg_start_period
,
3004 scParams
.fg_end_period
,
3006 scParams
.minact_chdwell_time
,
3007 scParams
.maxact_chdwell_time
,
3008 scParams
.pas_chdwell_time
,
3009 scParams
.shortScanRatio
,
3010 scParams
.scanCtrlFlags
,
3011 scParams
.max_dfsch_act_time
) != A_OK
) {
3015 wmi_disconnect_cmd(wmip
);
3016 if (wmi_scanparams_cmd(wmip
, 0xFFFF, 0, 0, 0,
3017 0, 0, 0, 0xFF, 0) != A_OK
) {
3027 wmi_get_mapped_qos_queue(struct wmi_t
*wmip
, A_UINT8 trafficClass
)
3029 A_UINT16 activeTsids
=0;
3032 activeTsids
= wmip
->wmi_streamExistsForAC
[trafficClass
];
3039 wmi_get_roam_tbl_cmd(struct wmi_t
*wmip
)
3043 osbuf
= A_NETBUF_ALLOC(0); /* no payload */
3044 if (osbuf
== NULL
) {
3048 return (wmi_cmd_send(wmip
, osbuf
, WMI_GET_ROAM_TBL_CMDID
,
3053 wmi_get_roam_data_cmd(struct wmi_t
*wmip
, A_UINT8 roamDataType
)
3056 A_UINT32 size
= sizeof(A_UINT8
);
3057 WMI_TARGET_ROAM_DATA
*cmd
;
3059 osbuf
= A_NETBUF_ALLOC(size
); /* no payload */
3060 if (osbuf
== NULL
) {
3064 A_NETBUF_PUT(osbuf
, size
);
3066 cmd
= (WMI_TARGET_ROAM_DATA
*)(A_NETBUF_DATA(osbuf
));
3067 cmd
->roamDataType
= roamDataType
;
3069 return (wmi_cmd_send(wmip
, osbuf
, WMI_GET_ROAM_DATA_CMDID
,
3074 wmi_set_roam_ctrl_cmd(struct wmi_t
*wmip
, WMI_SET_ROAM_CTRL_CMD
*p
,
3078 WMI_SET_ROAM_CTRL_CMD
*cmd
;
3080 osbuf
= A_NETBUF_ALLOC(size
);
3081 if (osbuf
== NULL
) {
3085 A_NETBUF_PUT(osbuf
, size
);
3087 cmd
= (WMI_SET_ROAM_CTRL_CMD
*)(A_NETBUF_DATA(osbuf
));
3088 A_MEMZERO(cmd
, size
);
3090 A_MEMCPY(cmd
, p
, size
);
3092 return (wmi_cmd_send(wmip
, osbuf
, WMI_SET_ROAM_CTRL_CMDID
,
3097 wmi_set_powersave_timers_cmd(struct wmi_t
*wmip
,
3098 WMI_POWERSAVE_TIMERS_POLICY_CMD
*pCmd
,
3102 WMI_POWERSAVE_TIMERS_POLICY_CMD
*cmd
;
3104 /* These timers can't be zero */
3105 if(!pCmd
->psPollTimeout
|| !pCmd
->triggerTimeout
||
3106 !(pCmd
->apsdTimPolicy
== IGNORE_TIM_ALL_QUEUES_APSD
||
3107 pCmd
->apsdTimPolicy
== PROCESS_TIM_ALL_QUEUES_APSD
) ||
3108 !(pCmd
->simulatedAPSDTimPolicy
== IGNORE_TIM_SIMULATED_APSD
||
3109 pCmd
->simulatedAPSDTimPolicy
== PROCESS_TIM_SIMULATED_APSD
))
3112 osbuf
= A_NETBUF_ALLOC(size
);
3113 if (osbuf
== NULL
) {
3117 A_NETBUF_PUT(osbuf
, size
);
3119 cmd
= (WMI_POWERSAVE_TIMERS_POLICY_CMD
*)(A_NETBUF_DATA(osbuf
));
3120 A_MEMZERO(cmd
, size
);
3122 A_MEMCPY(cmd
, pCmd
, size
);
3124 return (wmi_cmd_send(wmip
, osbuf
, WMI_SET_POWERSAVE_TIMERS_POLICY_CMDID
,
3128 #ifdef CONFIG_HOST_GPIO_SUPPORT
3129 /* Send a command to Target to change GPIO output pins. */
3131 wmi_gpio_output_set(struct wmi_t
*wmip
,
3133 A_UINT32 clear_mask
,
3134 A_UINT32 enable_mask
,
3135 A_UINT32 disable_mask
)
3138 WMIX_GPIO_OUTPUT_SET_CMD
*output_set
;
3141 size
= sizeof(*output_set
);
3144 (DBGFMT
"Enter - set=0x%x clear=0x%x enb=0x%x dis=0x%x\n", DBGARG
,
3145 set_mask
, clear_mask
, enable_mask
, disable_mask
));
3147 osbuf
= A_NETBUF_ALLOC(size
);
3148 if (osbuf
== NULL
) {
3151 A_NETBUF_PUT(osbuf
, size
);
3152 output_set
= (WMIX_GPIO_OUTPUT_SET_CMD
*)(A_NETBUF_DATA(osbuf
));
3154 output_set
->set_mask
= set_mask
;
3155 output_set
->clear_mask
= clear_mask
;
3156 output_set
->enable_mask
= enable_mask
;
3157 output_set
->disable_mask
= disable_mask
;
3159 return (wmi_cmd_send_xtnd(wmip
, osbuf
, WMIX_GPIO_OUTPUT_SET_CMDID
,
3163 /* Send a command to the Target requesting state of the GPIO input pins */
3165 wmi_gpio_input_get(struct wmi_t
*wmip
)
3169 A_DPRINTF(DBG_WMI
, (DBGFMT
"Enter\n", DBGARG
));
3171 osbuf
= A_NETBUF_ALLOC(0);
3172 if (osbuf
== NULL
) {
3176 return (wmi_cmd_send_xtnd(wmip
, osbuf
, WMIX_GPIO_INPUT_GET_CMDID
,
3180 /* Send a command to the Target that changes the value of a GPIO register. */
3182 wmi_gpio_register_set(struct wmi_t
*wmip
,
3183 A_UINT32 gpioreg_id
,
3187 WMIX_GPIO_REGISTER_SET_CMD
*register_set
;
3190 size
= sizeof(*register_set
);
3193 (DBGFMT
"Enter - reg=%d value=0x%x\n", DBGARG
, gpioreg_id
, value
));
3195 osbuf
= A_NETBUF_ALLOC(size
);
3196 if (osbuf
== NULL
) {
3199 A_NETBUF_PUT(osbuf
, size
);
3200 register_set
= (WMIX_GPIO_REGISTER_SET_CMD
*)(A_NETBUF_DATA(osbuf
));
3202 register_set
->gpioreg_id
= gpioreg_id
;
3203 register_set
->value
= value
;
3205 return (wmi_cmd_send_xtnd(wmip
, osbuf
, WMIX_GPIO_REGISTER_SET_CMDID
,
3209 /* Send a command to the Target to fetch the value of a GPIO register. */
3211 wmi_gpio_register_get(struct wmi_t
*wmip
,
3212 A_UINT32 gpioreg_id
)
3215 WMIX_GPIO_REGISTER_GET_CMD
*register_get
;
3218 size
= sizeof(*register_get
);
3220 A_DPRINTF(DBG_WMI
, (DBGFMT
"Enter - reg=%d\n", DBGARG
, gpioreg_id
));
3222 osbuf
= A_NETBUF_ALLOC(size
);
3223 if (osbuf
== NULL
) {
3226 A_NETBUF_PUT(osbuf
, size
);
3227 register_get
= (WMIX_GPIO_REGISTER_GET_CMD
*)(A_NETBUF_DATA(osbuf
));
3229 register_get
->gpioreg_id
= gpioreg_id
;
3231 return (wmi_cmd_send_xtnd(wmip
, osbuf
, WMIX_GPIO_REGISTER_GET_CMDID
,
3235 /* Send a command to the Target acknowledging some GPIO interrupts. */
3237 wmi_gpio_intr_ack(struct wmi_t
*wmip
,
3241 WMIX_GPIO_INTR_ACK_CMD
*intr_ack
;
3244 size
= sizeof(*intr_ack
);
3246 A_DPRINTF(DBG_WMI
, (DBGFMT
"Enter ack_mask=0x%x\n", DBGARG
, ack_mask
));
3248 osbuf
= A_NETBUF_ALLOC(size
);
3249 if (osbuf
== NULL
) {
3252 A_NETBUF_PUT(osbuf
, size
);
3253 intr_ack
= (WMIX_GPIO_INTR_ACK_CMD
*)(A_NETBUF_DATA(osbuf
));
3255 intr_ack
->ack_mask
= ack_mask
;
3257 return (wmi_cmd_send_xtnd(wmip
, osbuf
, WMIX_GPIO_INTR_ACK_CMDID
,
3260 #endif /* CONFIG_HOST_GPIO_SUPPORT */
3263 wmi_set_access_params_cmd(struct wmi_t
*wmip
, A_UINT16 txop
, A_UINT8 eCWmin
,
3264 A_UINT8 eCWmax
, A_UINT8 aifsn
)
3267 WMI_SET_ACCESS_PARAMS_CMD
*cmd
;
3269 if ((eCWmin
> WMI_MAX_CW_ACPARAM
) || (eCWmax
> WMI_MAX_CW_ACPARAM
) ||
3270 (aifsn
> WMI_MAX_AIFSN_ACPARAM
))
3275 osbuf
= A_NETBUF_ALLOC(sizeof(*cmd
));
3276 if (osbuf
== NULL
) {
3280 A_NETBUF_PUT(osbuf
, sizeof(*cmd
));
3282 cmd
= (WMI_SET_ACCESS_PARAMS_CMD
*)(A_NETBUF_DATA(osbuf
));
3284 cmd
->eCWmin
= eCWmin
;
3285 cmd
->eCWmax
= eCWmax
;
3288 return (wmi_cmd_send(wmip
, osbuf
, WMI_SET_ACCESS_PARAMS_CMDID
,
3293 wmi_set_retry_limits_cmd(struct wmi_t
*wmip
, A_UINT8 frameType
,
3294 A_UINT8 trafficClass
, A_UINT8 maxRetries
,
3295 A_UINT8 enableNotify
)
3298 WMI_SET_RETRY_LIMITS_CMD
*cmd
;
3300 if ((frameType
!= MGMT_FRAMETYPE
) && (frameType
!= CONTROL_FRAMETYPE
) &&
3301 (frameType
!= DATA_FRAMETYPE
))
3306 if (maxRetries
> WMI_MAX_RETRIES
) {
3310 if (frameType
!= DATA_FRAMETYPE
) {
3314 osbuf
= A_NETBUF_ALLOC(sizeof(*cmd
));
3315 if (osbuf
== NULL
) {
3319 A_NETBUF_PUT(osbuf
, sizeof(*cmd
));
3321 cmd
= (WMI_SET_RETRY_LIMITS_CMD
*)(A_NETBUF_DATA(osbuf
));
3322 cmd
->frameType
= frameType
;
3323 cmd
->trafficClass
= trafficClass
;
3324 cmd
->maxRetries
= maxRetries
;
3325 cmd
->enableNotify
= enableNotify
;
3327 return (wmi_cmd_send(wmip
, osbuf
, WMI_SET_RETRY_LIMITS_CMDID
,
3332 wmi_get_current_bssid(struct wmi_t
*wmip
, A_UINT8
*bssid
)
3334 if (bssid
!= NULL
) {
3335 A_MEMCPY(bssid
, wmip
->wmi_bssid
, ATH_MAC_LEN
);
3340 wmi_set_opt_mode_cmd(struct wmi_t
*wmip
, A_UINT8 optMode
)
3343 WMI_SET_OPT_MODE_CMD
*cmd
;
3345 osbuf
= A_NETBUF_ALLOC(sizeof(*cmd
));
3346 if (osbuf
== NULL
) {
3350 A_NETBUF_PUT(osbuf
, sizeof(*cmd
));
3352 cmd
= (WMI_SET_OPT_MODE_CMD
*)(A_NETBUF_DATA(osbuf
));
3353 A_MEMZERO(cmd
, sizeof(*cmd
));
3354 cmd
->optMode
= optMode
;
3356 return (wmi_cmd_send(wmip
, osbuf
, WMI_SET_OPT_MODE_CMDID
,
3357 SYNC_BOTH_WMIFLAG
));
3361 wmi_opt_tx_frame_cmd(struct wmi_t
*wmip
,
3363 A_UINT8
*dstMacAddr
,
3365 A_UINT16 optIEDataLen
,
3369 WMI_OPT_TX_FRAME_CMD
*cmd
;
3370 osbuf
= A_NETBUF_ALLOC(optIEDataLen
+ sizeof(*cmd
));
3371 if (osbuf
== NULL
) {
3375 A_NETBUF_PUT(osbuf
, (optIEDataLen
+ sizeof(*cmd
)));
3377 cmd
= (WMI_OPT_TX_FRAME_CMD
*)(A_NETBUF_DATA(osbuf
));
3378 A_MEMZERO(cmd
, (optIEDataLen
+ sizeof(*cmd
)-1));
3380 cmd
->frmType
= frmType
;
3381 cmd
->optIEDataLen
= optIEDataLen
;
3382 //cmd->optIEData = (A_UINT8 *)((int)cmd + sizeof(*cmd));
3383 A_MEMCPY(cmd
->bssid
, bssid
, sizeof(cmd
->bssid
));
3384 A_MEMCPY(cmd
->dstAddr
, dstMacAddr
, sizeof(cmd
->dstAddr
));
3385 A_MEMCPY(&cmd
->optIEData
[0], optIEData
, optIEDataLen
);
3387 return (wmi_cmd_send(wmip
, osbuf
, WMI_OPT_TX_FRAME_CMDID
,
3392 wmi_set_adhoc_bconIntvl_cmd(struct wmi_t
*wmip
, A_UINT16 intvl
)
3395 WMI_BEACON_INT_CMD
*cmd
;
3397 osbuf
= A_NETBUF_ALLOC(sizeof(*cmd
));
3398 if (osbuf
== NULL
) {
3402 A_NETBUF_PUT(osbuf
, sizeof(*cmd
));
3404 cmd
= (WMI_BEACON_INT_CMD
*)(A_NETBUF_DATA(osbuf
));
3405 A_MEMZERO(cmd
, sizeof(*cmd
));
3406 cmd
->beaconInterval
= intvl
;
3408 return (wmi_cmd_send(wmip
, osbuf
, WMI_SET_BEACON_INT_CMDID
,
3414 wmi_set_voice_pkt_size_cmd(struct wmi_t
*wmip
, A_UINT16 voicePktSize
)
3417 WMI_SET_VOICE_PKT_SIZE_CMD
*cmd
;
3419 osbuf
= A_NETBUF_ALLOC(sizeof(*cmd
));
3420 if (osbuf
== NULL
) {
3424 A_NETBUF_PUT(osbuf
, sizeof(*cmd
));
3426 cmd
= (WMI_SET_VOICE_PKT_SIZE_CMD
*)(A_NETBUF_DATA(osbuf
));
3427 A_MEMZERO(cmd
, sizeof(*cmd
));
3428 cmd
->voicePktSize
= voicePktSize
;
3430 return (wmi_cmd_send(wmip
, osbuf
, WMI_SET_VOICE_PKT_SIZE_CMDID
,
3436 wmi_set_max_sp_len_cmd(struct wmi_t
*wmip
, A_UINT8 maxSPLen
)
3439 WMI_SET_MAX_SP_LEN_CMD
*cmd
;
3441 /* maxSPLen is a two-bit value. If user trys to set anything
3442 * other than this, then its invalid
3444 if(maxSPLen
& ~0x03)
3447 osbuf
= A_NETBUF_ALLOC(sizeof(*cmd
));
3448 if (osbuf
== NULL
) {
3452 A_NETBUF_PUT(osbuf
, sizeof(*cmd
));
3454 cmd
= (WMI_SET_MAX_SP_LEN_CMD
*)(A_NETBUF_DATA(osbuf
));
3455 A_MEMZERO(cmd
, sizeof(*cmd
));
3456 cmd
->maxSPLen
= maxSPLen
;
3458 return (wmi_cmd_send(wmip
, osbuf
, WMI_SET_MAX_SP_LEN_CMDID
,
3463 convert_userPriority_to_trafficClass(A_UINT8 userPriority
)
3465 return (up_to_ac
[userPriority
& 0x7]);
3469 wmi_get_power_mode_cmd(struct wmi_t
*wmip
)
3471 return wmip
->wmi_powerMode
;
3475 wmi_verify_tspec_params(WMI_CREATE_PSTREAM_CMD
*pCmd
, A_BOOL tspecCompliance
)
3480 #ifdef CONFIG_HOST_TCMD_SUPPORT
3482 wmi_tcmd_test_report_rx(struct wmi_t
*wmip
, A_UINT8
*datap
, int len
)
3485 A_DPRINTF(DBG_WMI
, (DBGFMT
"Enter\n", DBGARG
));
3487 A_WMI_TCMD_RX_REPORT_EVENT(wmip
->wmi_devt
, datap
, len
);
3492 #endif /* CONFIG_HOST_TCMD_SUPPORT*/
3495 wmi_set_authmode_cmd(struct wmi_t
*wmip
, A_UINT8 mode
)
3498 WMI_SET_AUTH_MODE_CMD
*cmd
;
3500 osbuf
= A_NETBUF_ALLOC(sizeof(*cmd
));
3501 if (osbuf
== NULL
) {
3505 A_NETBUF_PUT(osbuf
, sizeof(*cmd
));
3507 cmd
= (WMI_SET_AUTH_MODE_CMD
*)(A_NETBUF_DATA(osbuf
));
3508 A_MEMZERO(cmd
, sizeof(*cmd
));
3511 return (wmi_cmd_send(wmip
, osbuf
, WMI_SET_AUTH_MODE_CMDID
,
3516 wmi_set_reassocmode_cmd(struct wmi_t
*wmip
, A_UINT8 mode
)
3519 WMI_SET_REASSOC_MODE_CMD
*cmd
;
3521 osbuf
= A_NETBUF_ALLOC(sizeof(*cmd
));
3522 if (osbuf
== NULL
) {
3526 A_NETBUF_PUT(osbuf
, sizeof(*cmd
));
3528 cmd
= (WMI_SET_REASSOC_MODE_CMD
*)(A_NETBUF_DATA(osbuf
));
3529 A_MEMZERO(cmd
, sizeof(*cmd
));
3532 return (wmi_cmd_send(wmip
, osbuf
, WMI_SET_REASSOC_MODE_CMDID
,
3537 wmi_set_lpreamble_cmd(struct wmi_t
*wmip
, A_UINT8 status
)
3540 WMI_SET_LPREAMBLE_CMD
*cmd
;
3542 osbuf
= A_NETBUF_ALLOC(sizeof(*cmd
));
3543 if (osbuf
== NULL
) {
3547 A_NETBUF_PUT(osbuf
, sizeof(*cmd
));
3549 cmd
= (WMI_SET_LPREAMBLE_CMD
*)(A_NETBUF_DATA(osbuf
));
3550 A_MEMZERO(cmd
, sizeof(*cmd
));
3551 cmd
->status
= status
;
3553 return (wmi_cmd_send(wmip
, osbuf
, WMI_SET_LPREAMBLE_CMDID
,
3558 wmi_set_rts_cmd(struct wmi_t
*wmip
, A_UINT16 threshold
)
3561 WMI_SET_RTS_CMD
*cmd
;
3563 osbuf
= A_NETBUF_ALLOC(sizeof(*cmd
));
3564 if (osbuf
== NULL
) {
3568 A_NETBUF_PUT(osbuf
, sizeof(*cmd
));
3570 cmd
= (WMI_SET_RTS_CMD
*)(A_NETBUF_DATA(osbuf
));
3571 A_MEMZERO(cmd
, sizeof(*cmd
));
3572 cmd
->threshold
= threshold
;
3574 return (wmi_cmd_send(wmip
, osbuf
, WMI_SET_RTS_CMDID
,
3579 wmi_set_wmm_cmd(struct wmi_t
*wmip
, WMI_WMM_STATUS status
)
3582 WMI_SET_WMM_CMD
*cmd
;
3584 osbuf
= A_NETBUF_ALLOC(sizeof(*cmd
));
3585 if (osbuf
== NULL
) {
3589 A_NETBUF_PUT(osbuf
, sizeof(*cmd
));
3591 cmd
= (WMI_SET_WMM_CMD
*)(A_NETBUF_DATA(osbuf
));
3592 A_MEMZERO(cmd
, sizeof(*cmd
));
3593 cmd
->status
= status
;
3595 return (wmi_cmd_send(wmip
, osbuf
, WMI_SET_WMM_CMDID
,
3601 wmi_set_wmm_txop(struct wmi_t
*wmip
, WMI_TXOP_CFG cfg
)
3604 WMI_SET_WMM_TXOP_CMD
*cmd
;
3606 if( !((cfg
== WMI_TXOP_DISABLED
) || (cfg
== WMI_TXOP_ENABLED
)) )
3609 osbuf
= A_NETBUF_ALLOC(sizeof(*cmd
));
3610 if (osbuf
== NULL
) {
3614 A_NETBUF_PUT(osbuf
, sizeof(*cmd
));
3616 cmd
= (WMI_SET_WMM_TXOP_CMD
*)(A_NETBUF_DATA(osbuf
));
3617 A_MEMZERO(cmd
, sizeof(*cmd
));
3618 cmd
->txopEnable
= cfg
;
3620 return (wmi_cmd_send(wmip
, osbuf
, WMI_SET_WMM_TXOP_CMDID
,
3625 #ifdef CONFIG_HOST_TCMD_SUPPORT
3626 /* WMI layer doesn't need to know the data type of the test cmd.
3627 This would be beneficial for customers like Qualcomm, who might
3628 have different test command requirements from differnt manufacturers
3631 wmi_test_cmd(struct wmi_t
*wmip
, A_UINT8
*buf
, A_UINT32 len
)
3636 A_DPRINTF(DBG_WMI
, (DBGFMT
"Enter\n", DBGARG
));
3638 osbuf
= A_NETBUF_ALLOC(len
);
3643 A_NETBUF_PUT(osbuf
, len
);
3644 data
= A_NETBUF_DATA(osbuf
);
3645 A_MEMCPY(data
, buf
, len
);
3647 return(wmi_cmd_send(wmip
, osbuf
, WMI_TEST_CMDID
,
3654 wmi_set_bt_status_cmd(struct wmi_t
*wmip
, A_UINT8 streamType
, A_UINT8 status
)
3657 WMI_SET_BT_STATUS_CMD
*cmd
;
3659 osbuf
= A_NETBUF_ALLOC(sizeof(*cmd
));
3660 if (osbuf
== NULL
) {
3664 A_NETBUF_PUT(osbuf
, sizeof(*cmd
));
3666 cmd
= (WMI_SET_BT_STATUS_CMD
*)(A_NETBUF_DATA(osbuf
));
3667 A_MEMZERO(cmd
, sizeof(*cmd
));
3668 cmd
->streamType
= streamType
;
3669 cmd
->status
= status
;
3671 return (wmi_cmd_send(wmip
, osbuf
, WMI_SET_BT_STATUS_CMDID
,
3676 wmi_set_bt_params_cmd(struct wmi_t
*wmip
, WMI_SET_BT_PARAMS_CMD
* cmd
)
3679 WMI_SET_BT_PARAMS_CMD
* alloc_cmd
;
3681 osbuf
= A_NETBUF_ALLOC(sizeof(*cmd
));
3682 if (osbuf
== NULL
) {
3686 A_NETBUF_PUT(osbuf
, sizeof(*cmd
));
3688 alloc_cmd
= (WMI_SET_BT_PARAMS_CMD
*)(A_NETBUF_DATA(osbuf
));
3689 A_MEMZERO(alloc_cmd
, sizeof(*cmd
));
3690 A_MEMCPY(alloc_cmd
, cmd
, sizeof(*cmd
));
3692 return (wmi_cmd_send(wmip
, osbuf
, WMI_SET_BT_PARAMS_CMDID
,
3697 wmi_get_keepalive_configured(struct wmi_t
*wmip
)
3700 WMI_GET_KEEPALIVE_CMD
*cmd
;
3701 osbuf
= A_NETBUF_ALLOC(sizeof(*cmd
));
3702 if (osbuf
== NULL
) {
3705 A_NETBUF_PUT(osbuf
, sizeof(*cmd
));
3706 cmd
= (WMI_GET_KEEPALIVE_CMD
*)(A_NETBUF_DATA(osbuf
));
3707 A_MEMZERO(cmd
, sizeof(*cmd
));
3708 return (wmi_cmd_send(wmip
, osbuf
, WMI_GET_KEEPALIVE_CMDID
,
3713 wmi_get_keepalive_cmd(struct wmi_t
*wmip
)
3715 return wmip
->wmi_keepaliveInterval
;
3719 wmi_set_keepalive_cmd(struct wmi_t
*wmip
, A_UINT8 keepaliveInterval
)
3722 WMI_SET_KEEPALIVE_CMD
*cmd
;
3724 osbuf
= A_NETBUF_ALLOC(sizeof(*cmd
));
3725 if (osbuf
== NULL
) {
3729 A_NETBUF_PUT(osbuf
, sizeof(*cmd
));
3731 cmd
= (WMI_SET_KEEPALIVE_CMD
*)(A_NETBUF_DATA(osbuf
));
3732 A_MEMZERO(cmd
, sizeof(*cmd
));
3733 cmd
->keepaliveInterval
= keepaliveInterval
;
3734 wmip
->wmi_keepaliveInterval
= keepaliveInterval
;
3736 return (wmi_cmd_send(wmip
, osbuf
, WMI_SET_KEEPALIVE_CMDID
,
3741 wmi_set_appie_cmd(struct wmi_t
*wmip
, A_UINT8 mgmtFrmType
, A_UINT8 ieLen
,
3745 WMI_SET_APPIE_CMD
*cmd
;
3748 if (ieLen
> WMI_MAX_IE_LEN
) {
3751 cmdLen
= sizeof(*cmd
) + ieLen
- 1;
3752 osbuf
= A_NETBUF_ALLOC(cmdLen
);
3753 if (osbuf
== NULL
) {
3757 A_NETBUF_PUT(osbuf
, cmdLen
);
3759 cmd
= (WMI_SET_APPIE_CMD
*)(A_NETBUF_DATA(osbuf
));
3760 A_MEMZERO(cmd
, cmdLen
);
3762 cmd
->mgmtFrmType
= mgmtFrmType
;
3764 A_MEMCPY(cmd
->ieInfo
, ieInfo
, ieLen
);
3766 return (wmi_cmd_send(wmip
, osbuf
, WMI_SET_APPIE_CMDID
, NO_SYNC_WMIFLAG
));
3770 wmi_set_halparam_cmd(struct wmi_t
*wmip
, A_UINT8
*cmd
, A_UINT16 dataLen
)
3775 osbuf
= A_NETBUF_ALLOC(dataLen
);
3776 if (osbuf
== NULL
) {
3780 A_NETBUF_PUT(osbuf
, dataLen
);
3782 data
= A_NETBUF_DATA(osbuf
);
3784 A_MEMCPY(data
, cmd
, dataLen
);
3786 return (wmi_cmd_send(wmip
, osbuf
, WMI_SET_WHALPARAM_CMDID
, NO_SYNC_WMIFLAG
));
3790 wmi_get_rate(A_INT8 rateindex
)
3792 if (rateindex
== RATE_AUTO
) {
3795 return(wmi_rateTable
[(A_UINT32
) rateindex
]);
3800 wmi_node_return (struct wmi_t
*wmip
, bss_t
*bss
)
3804 wlan_node_return (&wmip
->wmi_scan_table
, bss
);
3809 wmi_find_Ssidnode (struct wmi_t
*wmip
, A_UCHAR
*pSsid
,
3810 A_UINT32 ssidLength
, A_BOOL bIsWPA2
)
3813 node
= wlan_find_Ssidnode (&wmip
->wmi_scan_table
, pSsid
,
3814 ssidLength
, bIsWPA2
);
3819 wmi_free_allnodes(struct wmi_t
*wmip
)
3821 wlan_free_allnodes(&wmip
->wmi_scan_table
);
3825 wmi_find_node(struct wmi_t
*wmip
, const A_UINT8
*macaddr
)
3828 ni
=wlan_find_node(&wmip
->wmi_scan_table
,macaddr
);
3833 wmi_dset_open_reply(struct wmi_t
*wmip
,
3835 A_UINT32 access_cookie
,
3837 A_UINT32 dset_version
,
3838 A_UINT32 targ_handle
,
3839 A_UINT32 targ_reply_fn
,
3840 A_UINT32 targ_reply_arg
)
3843 WMIX_DSETOPEN_REPLY_CMD
*open_reply
;
3845 A_DPRINTF(DBG_WMI
, (DBGFMT
"Enter - wmip=0x%x\n", DBGARG
, (int)wmip
));
3847 osbuf
= A_NETBUF_ALLOC(sizeof(*open_reply
));
3848 if (osbuf
== NULL
) {
3852 A_NETBUF_PUT(osbuf
, sizeof(*open_reply
));
3853 open_reply
= (WMIX_DSETOPEN_REPLY_CMD
*)(A_NETBUF_DATA(osbuf
));
3855 open_reply
->status
= status
;
3856 open_reply
->targ_dset_handle
= targ_handle
;
3857 open_reply
->targ_reply_fn
= targ_reply_fn
;
3858 open_reply
->targ_reply_arg
= targ_reply_arg
;
3859 open_reply
->access_cookie
= access_cookie
;
3860 open_reply
->size
= dset_size
;
3861 open_reply
->version
= dset_version
;
3863 return (wmi_cmd_send_xtnd(wmip
, osbuf
, WMIX_DSETOPEN_REPLY_CMDID
,
3868 wmi_get_pmkid_list_event_rx(struct wmi_t
*wmip
, A_UINT8
*datap
, A_UINT32 len
)
3870 WMI_PMKID_LIST_REPLY
*reply
;
3871 A_UINT32 expected_len
;
3873 if (len
< sizeof(WMI_PMKID_LIST_REPLY
)) {
3876 reply
= (WMI_PMKID_LIST_REPLY
*)datap
;
3877 expected_len
= sizeof(reply
->numPMKID
) + reply
->numPMKID
* WMI_PMKID_LEN
;
3879 if (len
< expected_len
) {
3883 A_WMI_PMKID_LIST_EVENT(wmip
->wmi_devt
, reply
->numPMKID
,
3889 #ifdef CONFIG_HOST_DSET_SUPPORT
3891 wmi_dset_data_reply(struct wmi_t
*wmip
,
3896 A_UINT32 targ_reply_fn
,
3897 A_UINT32 targ_reply_arg
)
3900 WMIX_DSETDATA_REPLY_CMD
*data_reply
;
3903 size
= sizeof(*data_reply
) + length
;
3906 (DBGFMT
"Enter - length=%d status=%d\n", DBGARG
, length
, status
));
3908 osbuf
= A_NETBUF_ALLOC(size
);
3909 if (osbuf
== NULL
) {
3912 A_NETBUF_PUT(osbuf
, size
);
3913 data_reply
= (WMIX_DSETDATA_REPLY_CMD
*)(A_NETBUF_DATA(osbuf
));
3915 data_reply
->status
= status
;
3916 data_reply
->targ_buf
= targ_buf
;
3917 data_reply
->targ_reply_fn
= targ_reply_fn
;
3918 data_reply
->targ_reply_arg
= targ_reply_arg
;
3919 data_reply
->length
= length
;
3921 if (status
== A_OK
) {
3922 if (a_copy_from_user(data_reply
->buf
, user_buf
, length
)) {
3927 return (wmi_cmd_send_xtnd(wmip
, osbuf
, WMIX_DSETDATA_REPLY_CMDID
,
3930 #endif /* CONFIG_HOST_DSET_SUPPORT */
3933 wmi_set_wsc_status_cmd(struct wmi_t
*wmip
, A_UINT32 status
)
3938 wps_enable
= status
;
3940 osbuf
= a_netbuf_alloc(sizeof(1));
3941 if (osbuf
== NULL
) {
3945 a_netbuf_put(osbuf
, sizeof(1));
3947 cmd
= (char *)(a_netbuf_to_data(osbuf
));
3949 A_MEMZERO(cmd
, sizeof(*cmd
));
3950 cmd
[0] = (status
?1:0);
3951 return (wmi_cmd_send(wmip
, osbuf
, WMI_SET_WSC_STATUS_CMDID
,