2 * Copyright (c) 2004-2011 Atheros Communications Inc.
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.
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.
22 #include "../regd_common.h"
24 static int ath6kl_wmi_sync_point(struct wmi
*wmi
);
26 static const s32 wmi_rate_tbl
[][2] = {
27 /* {W/O SGI, with SGI} */
59 /* 802.1d to AC mapping. Refer pg 57 of WMM-test-plan-v1.2 */
60 static const u8 up_to_ac
[] = {
71 void ath6kl_wmi_set_control_ep(struct wmi
*wmi
, enum htc_endpoint_id ep_id
)
73 if (WARN_ON(ep_id
== ENDPOINT_UNUSED
|| ep_id
>= ENDPOINT_MAX
))
79 enum htc_endpoint_id
ath6kl_wmi_get_control_ep(struct wmi
*wmi
)
84 /* Performs DIX to 802.3 encapsulation for transmit packets.
85 * Assumes the entire DIX header is contigous and that there is
86 * enough room in the buffer for a 802.3 mac header and LLC+SNAP headers.
88 int ath6kl_wmi_dix_2_dot3(struct wmi
*wmi
, struct sk_buff
*skb
)
90 struct ath6kl_llc_snap_hdr
*llc_hdr
;
91 struct ethhdr
*eth_hdr
;
97 if (WARN_ON(skb
== NULL
))
100 size
= sizeof(struct ath6kl_llc_snap_hdr
) + sizeof(struct wmi_data_hdr
);
101 if (skb_headroom(skb
) < size
)
104 eth_hdr
= (struct ethhdr
*) skb
->data
;
105 type
= eth_hdr
->h_proto
;
107 if (!is_ethertype(be16_to_cpu(type
))) {
108 ath6kl_dbg(ATH6KL_DBG_WMI
,
109 "%s: pkt is already in 802.3 format\n", __func__
);
113 new_len
= skb
->len
- sizeof(*eth_hdr
) + sizeof(*llc_hdr
);
115 skb_push(skb
, sizeof(struct ath6kl_llc_snap_hdr
));
118 eth_hdr
->h_proto
= cpu_to_be16(new_len
);
120 memcpy(datap
, eth_hdr
, sizeof(*eth_hdr
));
122 llc_hdr
= (struct ath6kl_llc_snap_hdr
*)(datap
+ sizeof(*eth_hdr
));
123 llc_hdr
->dsap
= 0xAA;
124 llc_hdr
->ssap
= 0xAA;
125 llc_hdr
->cntl
= 0x03;
126 llc_hdr
->org_code
[0] = 0x0;
127 llc_hdr
->org_code
[1] = 0x0;
128 llc_hdr
->org_code
[2] = 0x0;
129 llc_hdr
->eth_type
= type
;
134 static int ath6kl_wmi_meta_add(struct wmi
*wmi
, struct sk_buff
*skb
,
135 u8
*version
, void *tx_meta_info
)
137 struct wmi_tx_meta_v1
*v1
;
138 struct wmi_tx_meta_v2
*v2
;
140 if (WARN_ON(skb
== NULL
|| version
== NULL
))
144 case WMI_META_VERSION_1
:
145 skb_push(skb
, WMI_MAX_TX_META_SZ
);
146 v1
= (struct wmi_tx_meta_v1
*) skb
->data
;
148 v1
->rate_plcy_id
= 0;
149 *version
= WMI_META_VERSION_1
;
151 case WMI_META_VERSION_2
:
152 skb_push(skb
, WMI_MAX_TX_META_SZ
);
153 v2
= (struct wmi_tx_meta_v2
*) skb
->data
;
154 memcpy(v2
, (struct wmi_tx_meta_v2
*) tx_meta_info
,
155 sizeof(struct wmi_tx_meta_v2
));
162 int ath6kl_wmi_data_hdr_add(struct wmi
*wmi
, struct sk_buff
*skb
,
163 u8 msg_type
, bool more_data
,
164 enum wmi_data_hdr_data_type data_type
,
165 u8 meta_ver
, void *tx_meta_info
)
167 struct wmi_data_hdr
*data_hdr
;
170 if (WARN_ON(skb
== NULL
))
174 ret
= ath6kl_wmi_meta_add(wmi
, skb
, &meta_ver
, tx_meta_info
);
179 skb_push(skb
, sizeof(struct wmi_data_hdr
));
181 data_hdr
= (struct wmi_data_hdr
*)skb
->data
;
182 memset(data_hdr
, 0, sizeof(struct wmi_data_hdr
));
184 data_hdr
->info
= msg_type
<< WMI_DATA_HDR_MSG_TYPE_SHIFT
;
185 data_hdr
->info
|= data_type
<< WMI_DATA_HDR_DATA_TYPE_SHIFT
;
189 WMI_DATA_HDR_MORE_MASK
<< WMI_DATA_HDR_MORE_SHIFT
;
191 data_hdr
->info2
= cpu_to_le16(meta_ver
<< WMI_DATA_HDR_META_SHIFT
);
197 static u8
ath6kl_wmi_determine_user_priority(u8
*pkt
, u32 layer2_pri
)
199 struct iphdr
*ip_hdr
= (struct iphdr
*) pkt
;
203 * Determine IPTOS priority
206 * : DSCP(6-bits) ECN(2-bits)
207 * : DSCP - P2 P1 P0 X X X
208 * where (P2 P1 P0) form 802.1D
210 ip_pri
= ip_hdr
->tos
>> 5;
213 if ((layer2_pri
& 0x7) > ip_pri
)
214 return (u8
) layer2_pri
& 0x7;
219 int ath6kl_wmi_implicit_create_pstream(struct wmi
*wmi
, struct sk_buff
*skb
,
220 u32 layer2_priority
, bool wmm_enabled
,
223 struct wmi_data_hdr
*data_hdr
;
224 struct ath6kl_llc_snap_hdr
*llc_hdr
;
225 struct wmi_create_pstream_cmd cmd
;
226 u32 meta_size
, hdr_size
;
227 u16 ip_type
= IP_ETHERTYPE
;
228 u8 stream_exist
, usr_pri
;
229 u8 traffic_class
= WMM_AC_BE
;
232 if (WARN_ON(skb
== NULL
))
236 data_hdr
= (struct wmi_data_hdr
*) datap
;
238 meta_size
= ((le16_to_cpu(data_hdr
->info2
) >> WMI_DATA_HDR_META_SHIFT
) &
239 WMI_DATA_HDR_META_MASK
) ? WMI_MAX_TX_META_SZ
: 0;
242 /* If WMM is disabled all traffic goes as BE traffic */
245 hdr_size
= sizeof(struct ethhdr
);
247 llc_hdr
= (struct ath6kl_llc_snap_hdr
*)(datap
+
250 meta_size
+ hdr_size
);
252 if (llc_hdr
->eth_type
== htons(ip_type
)) {
254 * Extract the endpoint info from the TOS field
258 ath6kl_wmi_determine_user_priority(((u8
*) llc_hdr
) +
259 sizeof(struct ath6kl_llc_snap_hdr
),
262 usr_pri
= layer2_priority
& 0x7;
265 /* workaround for WMM S5 */
266 if ((wmi
->traffic_class
== WMM_AC_VI
) &&
267 ((usr_pri
== 5) || (usr_pri
== 4)))
270 /* Convert user priority to traffic class */
271 traffic_class
= up_to_ac
[usr_pri
& 0x7];
273 wmi_data_hdr_set_up(data_hdr
, usr_pri
);
275 spin_lock_bh(&wmi
->lock
);
276 stream_exist
= wmi
->fat_pipe_exist
;
277 spin_unlock_bh(&wmi
->lock
);
279 if (!(stream_exist
& (1 << traffic_class
))) {
280 memset(&cmd
, 0, sizeof(cmd
));
281 cmd
.traffic_class
= traffic_class
;
282 cmd
.user_pri
= usr_pri
;
284 cpu_to_le32(WMI_IMPLICIT_PSTREAM_INACTIVITY_INT
);
285 /* Implicit streams are created with TSID 0xFF */
286 cmd
.tsid
= WMI_IMPLICIT_PSTREAM
;
287 ath6kl_wmi_create_pstream_cmd(wmi
, &cmd
);
295 int ath6kl_wmi_dot11_hdr_remove(struct wmi
*wmi
, struct sk_buff
*skb
)
297 struct ieee80211_hdr_3addr
*pwh
, wh
;
298 struct ath6kl_llc_snap_hdr
*llc_hdr
;
299 struct ethhdr eth_hdr
;
304 if (WARN_ON(skb
== NULL
))
308 pwh
= (struct ieee80211_hdr_3addr
*) datap
;
310 sub_type
= pwh
->frame_control
& cpu_to_le16(IEEE80211_FCTL_STYPE
);
312 memcpy((u8
*) &wh
, datap
, sizeof(struct ieee80211_hdr_3addr
));
314 /* Strip off the 802.11 header */
315 if (sub_type
== cpu_to_le16(IEEE80211_STYPE_QOS_DATA
)) {
316 hdr_size
= roundup(sizeof(struct ieee80211_qos_hdr
),
318 skb_pull(skb
, hdr_size
);
319 } else if (sub_type
== cpu_to_le16(IEEE80211_STYPE_DATA
))
320 skb_pull(skb
, sizeof(struct ieee80211_hdr_3addr
));
323 llc_hdr
= (struct ath6kl_llc_snap_hdr
*)(datap
);
325 memset(ð_hdr
, 0, sizeof(eth_hdr
));
326 eth_hdr
.h_proto
= llc_hdr
->eth_type
;
328 switch ((le16_to_cpu(wh
.frame_control
)) &
329 (IEEE80211_FCTL_FROMDS
| IEEE80211_FCTL_TODS
)) {
331 memcpy(eth_hdr
.h_dest
, wh
.addr1
, ETH_ALEN
);
332 memcpy(eth_hdr
.h_source
, wh
.addr2
, ETH_ALEN
);
334 case IEEE80211_FCTL_TODS
:
335 memcpy(eth_hdr
.h_dest
, wh
.addr3
, ETH_ALEN
);
336 memcpy(eth_hdr
.h_source
, wh
.addr2
, ETH_ALEN
);
338 case IEEE80211_FCTL_FROMDS
:
339 memcpy(eth_hdr
.h_dest
, wh
.addr1
, ETH_ALEN
);
340 memcpy(eth_hdr
.h_source
, wh
.addr3
, ETH_ALEN
);
342 case IEEE80211_FCTL_FROMDS
| IEEE80211_FCTL_TODS
:
346 skb_pull(skb
, sizeof(struct ath6kl_llc_snap_hdr
));
347 skb_push(skb
, sizeof(eth_hdr
));
351 memcpy(datap
, ð_hdr
, sizeof(eth_hdr
));
357 * Performs 802.3 to DIX encapsulation for received packets.
358 * Assumes the entire 802.3 header is contigous.
360 int ath6kl_wmi_dot3_2_dix(struct sk_buff
*skb
)
362 struct ath6kl_llc_snap_hdr
*llc_hdr
;
363 struct ethhdr eth_hdr
;
366 if (WARN_ON(skb
== NULL
))
371 memcpy(ð_hdr
, datap
, sizeof(eth_hdr
));
373 llc_hdr
= (struct ath6kl_llc_snap_hdr
*) (datap
+ sizeof(eth_hdr
));
374 eth_hdr
.h_proto
= llc_hdr
->eth_type
;
376 skb_pull(skb
, sizeof(struct ath6kl_llc_snap_hdr
));
379 memcpy(datap
, ð_hdr
, sizeof(eth_hdr
));
384 static void ath6kl_wmi_convert_bssinfo_hdr2_to_hdr(struct sk_buff
*skb
,
387 struct wmi_bss_info_hdr2 bih2
;
388 struct wmi_bss_info_hdr
*bih
;
390 memcpy(&bih2
, datap
, sizeof(struct wmi_bss_info_hdr2
));
393 bih
= (struct wmi_bss_info_hdr
*) skb
->data
;
396 bih
->frame_type
= bih2
.frame_type
;
398 bih
->rssi
= a_cpu_to_sle16(bih2
.snr
- 95);
399 bih
->ie_mask
= cpu_to_le32(le16_to_cpu(bih2
.ie_mask
));
400 memcpy(bih
->bssid
, bih2
.bssid
, ETH_ALEN
);
403 static int ath6kl_wmi_tx_complete_event_rx(u8
*datap
, int len
)
405 struct tx_complete_msg_v1
*msg_v1
;
406 struct wmi_tx_complete_event
*evt
;
410 evt
= (struct wmi_tx_complete_event
*) datap
;
412 ath6kl_dbg(ATH6KL_DBG_WMI
, "comp: %d %d %d\n",
413 evt
->num_msg
, evt
->msg_len
, evt
->msg_type
);
415 if (!AR_DBG_LVL_CHECK(ATH6KL_DBG_WMI
))
418 for (index
= 0; index
< evt
->num_msg
; index
++) {
419 size
= sizeof(struct wmi_tx_complete_event
) +
420 (index
* sizeof(struct tx_complete_msg_v1
));
421 msg_v1
= (struct tx_complete_msg_v1
*)(datap
+ size
);
423 ath6kl_dbg(ATH6KL_DBG_WMI
, "msg: %d %d %d %d\n",
424 msg_v1
->status
, msg_v1
->pkt_id
,
425 msg_v1
->rate_idx
, msg_v1
->ack_failures
);
431 static int ath6kl_wmi_remain_on_chnl_event_rx(struct wmi
*wmi
, u8
*datap
,
434 struct wmi_remain_on_chnl_event
*ev
;
437 struct ieee80211_channel
*chan
;
438 struct ath6kl
*ar
= wmi
->parent_dev
;
440 if (len
< sizeof(*ev
))
443 ev
= (struct wmi_remain_on_chnl_event
*) datap
;
444 freq
= le32_to_cpu(ev
->freq
);
445 dur
= le32_to_cpu(ev
->duration
);
446 ath6kl_dbg(ATH6KL_DBG_WMI
, "remain_on_chnl: freq=%u dur=%u\n",
448 chan
= ieee80211_get_channel(ar
->wdev
->wiphy
, freq
);
450 ath6kl_dbg(ATH6KL_DBG_WMI
, "remain_on_chnl: Unknown channel "
451 "(freq=%u)\n", freq
);
454 cfg80211_ready_on_channel(ar
->net_dev
, 1, chan
, NL80211_CHAN_NO_HT
,
460 static int ath6kl_wmi_cancel_remain_on_chnl_event_rx(struct wmi
*wmi
,
463 struct wmi_cancel_remain_on_chnl_event
*ev
;
466 struct ieee80211_channel
*chan
;
467 struct ath6kl
*ar
= wmi
->parent_dev
;
469 if (len
< sizeof(*ev
))
472 ev
= (struct wmi_cancel_remain_on_chnl_event
*) datap
;
473 freq
= le32_to_cpu(ev
->freq
);
474 dur
= le32_to_cpu(ev
->duration
);
475 ath6kl_dbg(ATH6KL_DBG_WMI
, "cancel_remain_on_chnl: freq=%u dur=%u "
476 "status=%u\n", freq
, dur
, ev
->status
);
477 chan
= ieee80211_get_channel(ar
->wdev
->wiphy
, freq
);
479 ath6kl_dbg(ATH6KL_DBG_WMI
, "cancel_remain_on_chnl: Unknown "
480 "channel (freq=%u)\n", freq
);
483 cfg80211_remain_on_channel_expired(ar
->net_dev
, 1, chan
,
484 NL80211_CHAN_NO_HT
, GFP_ATOMIC
);
489 static int ath6kl_wmi_tx_status_event_rx(struct wmi
*wmi
, u8
*datap
, int len
)
491 struct wmi_tx_status_event
*ev
;
493 struct ath6kl
*ar
= wmi
->parent_dev
;
495 if (len
< sizeof(*ev
))
498 ev
= (struct wmi_tx_status_event
*) datap
;
499 id
= le32_to_cpu(ev
->id
);
500 ath6kl_dbg(ATH6KL_DBG_WMI
, "tx_status: id=%x ack_status=%u\n",
502 if (wmi
->last_mgmt_tx_frame
) {
503 cfg80211_mgmt_tx_status(ar
->net_dev
, id
,
504 wmi
->last_mgmt_tx_frame
,
505 wmi
->last_mgmt_tx_frame_len
,
506 !!ev
->ack_status
, GFP_ATOMIC
);
507 kfree(wmi
->last_mgmt_tx_frame
);
508 wmi
->last_mgmt_tx_frame
= NULL
;
509 wmi
->last_mgmt_tx_frame_len
= 0;
515 static int ath6kl_wmi_rx_probe_req_event_rx(struct wmi
*wmi
, u8
*datap
, int len
)
517 struct wmi_p2p_rx_probe_req_event
*ev
;
520 struct ath6kl
*ar
= wmi
->parent_dev
;
522 if (len
< sizeof(*ev
))
525 ev
= (struct wmi_p2p_rx_probe_req_event
*) datap
;
526 freq
= le32_to_cpu(ev
->freq
);
527 dlen
= le16_to_cpu(ev
->len
);
528 if (datap
+ len
< ev
->data
+ dlen
) {
529 ath6kl_err("invalid wmi_p2p_rx_probe_req_event: "
530 "len=%d dlen=%u\n", len
, dlen
);
533 ath6kl_dbg(ATH6KL_DBG_WMI
, "rx_probe_req: len=%u freq=%u "
534 "probe_req_report=%d\n",
535 dlen
, freq
, ar
->probe_req_report
);
537 if (ar
->probe_req_report
|| ar
->nw_type
== AP_NETWORK
)
538 cfg80211_rx_mgmt(ar
->net_dev
, freq
, ev
->data
, dlen
, GFP_ATOMIC
);
543 static int ath6kl_wmi_p2p_capabilities_event_rx(u8
*datap
, int len
)
545 struct wmi_p2p_capabilities_event
*ev
;
548 if (len
< sizeof(*ev
))
551 ev
= (struct wmi_p2p_capabilities_event
*) datap
;
552 dlen
= le16_to_cpu(ev
->len
);
553 ath6kl_dbg(ATH6KL_DBG_WMI
, "p2p_capab: len=%u\n", dlen
);
558 static int ath6kl_wmi_rx_action_event_rx(struct wmi
*wmi
, u8
*datap
, int len
)
560 struct wmi_rx_action_event
*ev
;
563 struct ath6kl
*ar
= wmi
->parent_dev
;
565 if (len
< sizeof(*ev
))
568 ev
= (struct wmi_rx_action_event
*) datap
;
569 freq
= le32_to_cpu(ev
->freq
);
570 dlen
= le16_to_cpu(ev
->len
);
571 if (datap
+ len
< ev
->data
+ dlen
) {
572 ath6kl_err("invalid wmi_rx_action_event: "
573 "len=%d dlen=%u\n", len
, dlen
);
576 ath6kl_dbg(ATH6KL_DBG_WMI
, "rx_action: len=%u freq=%u\n", dlen
, freq
);
577 cfg80211_rx_mgmt(ar
->net_dev
, freq
, ev
->data
, dlen
, GFP_ATOMIC
);
582 static int ath6kl_wmi_p2p_info_event_rx(u8
*datap
, int len
)
584 struct wmi_p2p_info_event
*ev
;
588 if (len
< sizeof(*ev
))
591 ev
= (struct wmi_p2p_info_event
*) datap
;
592 flags
= le32_to_cpu(ev
->info_req_flags
);
593 dlen
= le16_to_cpu(ev
->len
);
594 ath6kl_dbg(ATH6KL_DBG_WMI
, "p2p_info: flags=%x len=%d\n", flags
, dlen
);
596 if (flags
& P2P_FLAG_CAPABILITIES_REQ
) {
597 struct wmi_p2p_capabilities
*cap
;
598 if (dlen
< sizeof(*cap
))
600 cap
= (struct wmi_p2p_capabilities
*) ev
->data
;
601 ath6kl_dbg(ATH6KL_DBG_WMI
, "p2p_info: GO Power Save = %d\n",
605 if (flags
& P2P_FLAG_MACADDR_REQ
) {
606 struct wmi_p2p_macaddr
*mac
;
607 if (dlen
< sizeof(*mac
))
609 mac
= (struct wmi_p2p_macaddr
*) ev
->data
;
610 ath6kl_dbg(ATH6KL_DBG_WMI
, "p2p_info: MAC Address = %pM\n",
614 if (flags
& P2P_FLAG_HMODEL_REQ
) {
615 struct wmi_p2p_hmodel
*mod
;
616 if (dlen
< sizeof(*mod
))
618 mod
= (struct wmi_p2p_hmodel
*) ev
->data
;
619 ath6kl_dbg(ATH6KL_DBG_WMI
, "p2p_info: P2P Model = %d (%s)\n",
621 mod
->p2p_model
? "host" : "firmware");
626 static inline struct sk_buff
*ath6kl_wmi_get_new_buf(u32 size
)
630 skb
= ath6kl_buf_alloc(size
);
636 memset(skb
->data
, 0, size
);
641 /* Send a "simple" wmi command -- one with no arguments */
642 static int ath6kl_wmi_simple_cmd(struct wmi
*wmi
, enum wmi_cmd_id cmd_id
)
647 skb
= ath6kl_wmi_get_new_buf(0);
651 ret
= ath6kl_wmi_cmd_send(wmi
, skb
, cmd_id
, NO_SYNC_WMIFLAG
);
656 static int ath6kl_wmi_ready_event_rx(struct wmi
*wmi
, u8
*datap
, int len
)
658 struct wmi_ready_event_2
*ev
= (struct wmi_ready_event_2
*) datap
;
660 if (len
< sizeof(struct wmi_ready_event_2
))
664 ath6kl_ready_event(wmi
->parent_dev
, ev
->mac_addr
,
665 le32_to_cpu(ev
->sw_version
),
666 le32_to_cpu(ev
->abi_version
));
672 * Mechanism to modify the roaming behavior in the firmware. The lower rssi
673 * at which the station has to roam can be passed with
674 * WMI_SET_LRSSI_SCAN_PARAMS. Subtract 96 from RSSI to get the signal level
677 int ath6kl_wmi_set_roam_lrssi_cmd(struct wmi
*wmi
, u8 lrssi
)
680 struct roam_ctrl_cmd
*cmd
;
682 skb
= ath6kl_wmi_get_new_buf(sizeof(*cmd
));
686 cmd
= (struct roam_ctrl_cmd
*) skb
->data
;
688 cmd
->info
.params
.lrssi_scan_period
= cpu_to_le16(DEF_LRSSI_SCAN_PERIOD
);
689 cmd
->info
.params
.lrssi_scan_threshold
= a_cpu_to_sle16(lrssi
+
690 DEF_SCAN_FOR_ROAM_INTVL
);
691 cmd
->info
.params
.lrssi_roam_threshold
= a_cpu_to_sle16(lrssi
);
692 cmd
->info
.params
.roam_rssi_floor
= DEF_LRSSI_ROAM_FLOOR
;
693 cmd
->roam_ctrl
= WMI_SET_LRSSI_SCAN_PARAMS
;
695 ath6kl_wmi_cmd_send(wmi
, skb
, WMI_SET_ROAM_CTRL_CMDID
, NO_SYNC_WMIFLAG
);
700 static int ath6kl_wmi_connect_event_rx(struct wmi
*wmi
, u8
*datap
, int len
)
702 struct wmi_connect_event
*ev
;
704 struct ath6kl
*ar
= wmi
->parent_dev
;
706 if (len
< sizeof(struct wmi_connect_event
))
709 ev
= (struct wmi_connect_event
*) datap
;
711 if (ar
->nw_type
== AP_NETWORK
) {
712 /* AP mode start/STA connected event */
713 struct net_device
*dev
= ar
->net_dev
;
714 if (memcmp(dev
->dev_addr
, ev
->u
.ap_bss
.bssid
, ETH_ALEN
) == 0) {
715 ath6kl_dbg(ATH6KL_DBG_WMI
, "%s: freq %d bssid %pM "
717 __func__
, le16_to_cpu(ev
->u
.ap_bss
.ch
),
719 ath6kl_connect_ap_mode_bss(
720 ar
, le16_to_cpu(ev
->u
.ap_bss
.ch
));
722 ath6kl_dbg(ATH6KL_DBG_WMI
, "%s: aid %u mac_addr %pM "
723 "auth=%u keymgmt=%u cipher=%u apsd_info=%u "
725 __func__
, ev
->u
.ap_sta
.aid
,
726 ev
->u
.ap_sta
.mac_addr
,
728 ev
->u
.ap_sta
.keymgmt
,
729 le16_to_cpu(ev
->u
.ap_sta
.cipher
),
730 ev
->u
.ap_sta
.apsd_info
);
731 ath6kl_connect_ap_mode_sta(
732 ar
, ev
->u
.ap_sta
.aid
, ev
->u
.ap_sta
.mac_addr
,
733 ev
->u
.ap_sta
.keymgmt
,
734 le16_to_cpu(ev
->u
.ap_sta
.cipher
),
735 ev
->u
.ap_sta
.auth
, ev
->assoc_req_len
,
736 ev
->assoc_info
+ ev
->beacon_ie_len
);
741 /* STA/IBSS mode connection event */
743 ath6kl_dbg(ATH6KL_DBG_WMI
, "%s: freq %d bssid %pM\n",
744 __func__
, le16_to_cpu(ev
->u
.sta
.ch
), ev
->u
.sta
.bssid
);
746 /* Start of assoc rsp IEs */
747 pie
= ev
->assoc_info
+ ev
->beacon_ie_len
+
748 ev
->assoc_req_len
+ (sizeof(u16
) * 3); /* capinfo, status, aid */
750 /* End of assoc rsp IEs */
751 peie
= ev
->assoc_info
+ ev
->beacon_ie_len
+ ev
->assoc_req_len
+
756 case WLAN_EID_VENDOR_SPECIFIC
:
757 if (pie
[1] > 3 && pie
[2] == 0x00 && pie
[3] == 0x50 &&
758 pie
[4] == 0xf2 && pie
[5] == WMM_OUI_TYPE
) {
759 /* WMM OUT (00:50:F2) */
761 && pie
[6] == WMM_PARAM_OUI_SUBTYPE
)
762 wmi
->is_wmm_enabled
= true;
767 if (wmi
->is_wmm_enabled
)
773 ath6kl_connect_event(wmi
->parent_dev
, le16_to_cpu(ev
->u
.sta
.ch
),
775 le16_to_cpu(ev
->u
.sta
.listen_intvl
),
776 le16_to_cpu(ev
->u
.sta
.beacon_intvl
),
777 le32_to_cpu(ev
->u
.sta
.nw_type
),
778 ev
->beacon_ie_len
, ev
->assoc_req_len
,
779 ev
->assoc_resp_len
, ev
->assoc_info
);
784 static struct country_code_to_enum_rd
*
785 ath6kl_regd_find_country(u16 countryCode
)
789 for (i
= 0; i
< ARRAY_SIZE(allCountries
); i
++) {
790 if (allCountries
[i
].countryCode
== countryCode
)
791 return &allCountries
[i
];
797 static struct reg_dmn_pair_mapping
*
798 ath6kl_get_regpair(u16 regdmn
)
802 if (regdmn
== NO_ENUMRD
)
805 for (i
= 0; i
< ARRAY_SIZE(regDomainPairs
); i
++) {
806 if (regDomainPairs
[i
].regDmnEnum
== regdmn
)
807 return ®DomainPairs
[i
];
813 static struct country_code_to_enum_rd
*
814 ath6kl_regd_find_country_by_rd(u16 regdmn
)
818 for (i
= 0; i
< ARRAY_SIZE(allCountries
); i
++) {
819 if (allCountries
[i
].regDmnEnum
== regdmn
)
820 return &allCountries
[i
];
826 static void ath6kl_wmi_regdomain_event(struct wmi
*wmi
, u8
*datap
, int len
)
829 struct ath6kl_wmi_regdomain
*ev
;
830 struct country_code_to_enum_rd
*country
= NULL
;
831 struct reg_dmn_pair_mapping
*regpair
= NULL
;
835 ev
= (struct ath6kl_wmi_regdomain
*) datap
;
836 reg_code
= le32_to_cpu(ev
->reg_code
);
838 if ((reg_code
>> ATH6KL_COUNTRY_RD_SHIFT
) & COUNTRY_ERD_FLAG
)
839 country
= ath6kl_regd_find_country((u16
) reg_code
);
840 else if (!(((u16
) reg_code
& WORLD_SKU_MASK
) == WORLD_SKU_PREFIX
)) {
842 regpair
= ath6kl_get_regpair((u16
) reg_code
);
843 country
= ath6kl_regd_find_country_by_rd((u16
) reg_code
);
844 ath6kl_dbg(ATH6KL_DBG_WMI
, "ath6kl: Regpair used: 0x%0x\n",
845 regpair
->regDmnEnum
);
849 alpha2
[0] = country
->isoName
[0];
850 alpha2
[1] = country
->isoName
[1];
852 regulatory_hint(wmi
->parent_dev
->wdev
->wiphy
, alpha2
);
854 ath6kl_dbg(ATH6KL_DBG_WMI
, "ath6kl: Country alpha2 being used: %c%c\n",
855 alpha2
[0], alpha2
[1]);
859 static int ath6kl_wmi_disconnect_event_rx(struct wmi
*wmi
, u8
*datap
, int len
)
861 struct wmi_disconnect_event
*ev
;
862 wmi
->traffic_class
= 100;
864 if (len
< sizeof(struct wmi_disconnect_event
))
867 ev
= (struct wmi_disconnect_event
*) datap
;
869 wmi
->is_wmm_enabled
= false;
870 wmi
->pair_crypto_type
= NONE_CRYPT
;
871 wmi
->grp_crypto_type
= NONE_CRYPT
;
873 ath6kl_disconnect_event(wmi
->parent_dev
, ev
->disconn_reason
,
874 ev
->bssid
, ev
->assoc_resp_len
, ev
->assoc_info
,
875 le16_to_cpu(ev
->proto_reason_status
));
880 static int ath6kl_wmi_peer_node_event_rx(struct wmi
*wmi
, u8
*datap
, int len
)
882 struct wmi_peer_node_event
*ev
;
884 if (len
< sizeof(struct wmi_peer_node_event
))
887 ev
= (struct wmi_peer_node_event
*) datap
;
889 if (ev
->event_code
== PEER_NODE_JOIN_EVENT
)
890 ath6kl_dbg(ATH6KL_DBG_WMI
, "joined node with mac addr: %pM\n",
892 else if (ev
->event_code
== PEER_NODE_LEAVE_EVENT
)
893 ath6kl_dbg(ATH6KL_DBG_WMI
, "left node with mac addr: %pM\n",
899 static int ath6kl_wmi_tkip_micerr_event_rx(struct wmi
*wmi
, u8
*datap
, int len
)
901 struct wmi_tkip_micerr_event
*ev
;
903 if (len
< sizeof(struct wmi_tkip_micerr_event
))
906 ev
= (struct wmi_tkip_micerr_event
*) datap
;
908 ath6kl_tkip_micerr_event(wmi
->parent_dev
, ev
->key_id
, ev
->is_mcast
);
913 static int ath6kl_wlan_parse_beacon(u8
*buf
, int frame_len
,
914 struct ath6kl_common_ie
*cie
)
917 u8 elemid_ssid
= false;
920 efrm
= (u8
*) (frm
+ frame_len
);
923 * beacon/probe response frame format
925 * [2] beacon interval
926 * [2] capability information
928 * [tlv] supported rates
929 * [tlv] country information
930 * [tlv] parameter set (FH/DS)
931 * [tlv] erp information
932 * [tlv] extended supported rates
935 * [tlv] Atheros Advanced Capabilities
937 if ((efrm
- frm
) < 12)
940 memset(cie
, 0, sizeof(*cie
));
942 cie
->ie_tstamp
= frm
;
944 cie
->ie_beaconInt
= *(u16
*) frm
;
946 cie
->ie_capInfo
= *(u16
*) frm
;
958 case WLAN_EID_SUPP_RATES
:
961 case WLAN_EID_COUNTRY
:
962 cie
->ie_country
= frm
;
964 case WLAN_EID_FH_PARAMS
:
966 case WLAN_EID_DS_PARAMS
:
967 cie
->ie_chan
= frm
[2];
972 case WLAN_EID_IBSS_PARAMS
:
974 case WLAN_EID_EXT_SUPP_RATES
:
975 cie
->ie_xrates
= frm
;
977 case WLAN_EID_ERP_INFO
:
981 cie
->ie_erp
= frm
[2];
986 case WLAN_EID_HT_CAPABILITY
:
989 case WLAN_EID_HT_INFORMATION
:
992 case WLAN_EID_VENDOR_SPECIFIC
:
993 if (frm
[1] > 3 && frm
[2] == 0x00 && frm
[3] == 0x50 &&
995 /* OUT Type (00:50:F2) */
997 if (frm
[5] == WPA_OUI_TYPE
) {
1000 } else if (frm
[5] == WMM_OUI_TYPE
) {
1003 } else if (frm
[5] == WSC_OUT_TYPE
) {
1008 } else if (frm
[1] > 3 && frm
[2] == 0x00
1009 && frm
[3] == 0x03 && frm
[4] == 0x7f
1010 && frm
[5] == ATH_OUI_TYPE
) {
1011 /* Atheros OUI (00:03:7f) */
1021 if ((cie
->ie_rates
== NULL
)
1022 || (cie
->ie_rates
[1] > ATH6KL_RATE_MAXSIZE
))
1025 if ((cie
->ie_ssid
== NULL
)
1026 || (cie
->ie_ssid
[1] > IEEE80211_MAX_SSID_LEN
))
1032 static int ath6kl_wmi_bssinfo_event_rx(struct wmi
*wmi
, u8
*datap
, int len
)
1034 struct bss
*bss
= NULL
;
1035 struct wmi_bss_info_hdr
*bih
;
1036 u8 cached_ssid_len
= 0;
1037 u8 cached_ssid
[IEEE80211_MAX_SSID_LEN
] = { 0 };
1038 u8 beacon_ssid_len
= 0;
1045 if (len
<= sizeof(struct wmi_bss_info_hdr
))
1048 bih
= (struct wmi_bss_info_hdr
*) datap
;
1049 bss
= wlan_find_node(&wmi
->parent_dev
->scan_table
, bih
->bssid
);
1051 if (a_sle16_to_cpu(bih
->rssi
) > 0) {
1055 bih
->rssi
= a_cpu_to_sle16(bss
->ni_rssi
);
1058 buf
= datap
+ sizeof(struct wmi_bss_info_hdr
);
1059 len
-= sizeof(struct wmi_bss_info_hdr
);
1061 ath6kl_dbg(ATH6KL_DBG_WMI
,
1062 "bss info evt - ch %u, rssi %02x, bssid \"%pM\"\n",
1063 bih
->ch
, a_sle16_to_cpu(bih
->rssi
), bih
->bssid
);
1067 * Free up the node. We are about to allocate a new node.
1068 * In case of hidden AP, beacon will not have ssid,
1069 * but a directed probe response will have it,
1070 * so cache the probe-resp-ssid if already present.
1072 if (wmi
->is_probe_ssid
&& (bih
->frame_type
== BEACON_FTYPE
)) {
1073 ie_ssid
= bss
->ni_cie
.ie_ssid
;
1074 if (ie_ssid
&& (ie_ssid
[1] <= IEEE80211_MAX_SSID_LEN
) &&
1075 (ie_ssid
[2] != 0)) {
1076 cached_ssid_len
= ie_ssid
[1];
1077 memcpy(cached_ssid
, ie_ssid
+ 2,
1083 * Use the current average rssi of associated AP base on
1085 * 1. Most os with GUI will update RSSI by
1086 * ath6kl_wmi_get_stats_cmd() periodically.
1087 * 2. ath6kl_wmi_get_stats_cmd(..) will be called when calling
1088 * ath6kl_wmi_startscan_cmd(...)
1089 * The average value of RSSI give end-user better feeling for
1090 * instance value of scan result. It also sync up RSSI info
1091 * in GUI between scan result and RSSI signal icon.
1093 if (memcmp(wmi
->parent_dev
->bssid
, bih
->bssid
, ETH_ALEN
) == 0) {
1094 bih
->rssi
= a_cpu_to_sle16(bss
->ni_rssi
);
1095 bih
->snr
= bss
->ni_snr
;
1098 wlan_node_reclaim(&wmi
->parent_dev
->scan_table
, bss
);
1102 * beacon/probe response frame format
1104 * [2] beacon interval
1105 * [2] capability information
1108 beacon_ssid_len
= buf
[SSID_IE_LEN_INDEX
];
1111 * If ssid is cached for this hidden AP, then change
1112 * buffer len accordingly.
1114 if (wmi
->is_probe_ssid
&& (bih
->frame_type
== BEACON_FTYPE
) &&
1115 (cached_ssid_len
!= 0) &&
1116 (beacon_ssid_len
== 0 || (cached_ssid_len
> beacon_ssid_len
&&
1117 buf
[SSID_IE_LEN_INDEX
+ 1] == 0))) {
1119 len
+= (cached_ssid_len
- beacon_ssid_len
);
1122 bss
= wlan_node_alloc(len
);
1126 bss
->ni_snr
= bih
->snr
;
1127 bss
->ni_rssi
= a_sle16_to_cpu(bih
->rssi
);
1129 if (WARN_ON(!bss
->ni_buf
))
1133 * In case of hidden AP, beacon will not have ssid,
1134 * but a directed probe response will have it,
1135 * so place the cached-ssid(probe-resp) in the bss info.
1137 if (wmi
->is_probe_ssid
&& (bih
->frame_type
== BEACON_FTYPE
) &&
1138 (cached_ssid_len
!= 0) &&
1139 (beacon_ssid_len
== 0 || (beacon_ssid_len
&&
1140 buf
[SSID_IE_LEN_INDEX
+ 1] == 0))) {
1141 ni_buf
= bss
->ni_buf
;
1145 * Copy the first 14 bytes:
1146 * time-stamp(8), beacon-interval(2),
1147 * cap-info(2), ssid-id(1), ssid-len(1).
1149 memcpy(ni_buf
, buf
, SSID_IE_LEN_INDEX
+ 1);
1151 ni_buf
[SSID_IE_LEN_INDEX
] = cached_ssid_len
;
1152 ni_buf
+= (SSID_IE_LEN_INDEX
+ 1);
1154 buf
+= (SSID_IE_LEN_INDEX
+ 1);
1155 buf_len
-= (SSID_IE_LEN_INDEX
+ 1);
1157 memcpy(ni_buf
, cached_ssid
, cached_ssid_len
);
1158 ni_buf
+= cached_ssid_len
;
1160 buf
+= beacon_ssid_len
;
1161 buf_len
-= beacon_ssid_len
;
1163 if (cached_ssid_len
> beacon_ssid_len
)
1164 buf_len
-= (cached_ssid_len
- beacon_ssid_len
);
1166 memcpy(ni_buf
, buf
, buf_len
);
1168 memcpy(bss
->ni_buf
, buf
, len
);
1170 bss
->ni_framelen
= len
;
1172 ret
= ath6kl_wlan_parse_beacon(bss
->ni_buf
, len
, &bss
->ni_cie
);
1174 wlan_node_free(bss
);
1179 * Update the frequency in ie_chan, overwriting of channel number
1180 * which is done in ath6kl_wlan_parse_beacon
1182 bss
->ni_cie
.ie_chan
= le16_to_cpu(bih
->ch
);
1183 wlan_setup_node(&wmi
->parent_dev
->scan_table
, bss
, bih
->bssid
);
1188 static int ath6kl_wmi_opt_frame_event_rx(struct wmi
*wmi
, u8
*datap
, int len
)
1191 struct wmi_opt_rx_info_hdr
*bih
;
1194 if (len
<= sizeof(struct wmi_opt_rx_info_hdr
))
1197 bih
= (struct wmi_opt_rx_info_hdr
*) datap
;
1198 buf
= datap
+ sizeof(struct wmi_opt_rx_info_hdr
);
1199 len
-= sizeof(struct wmi_opt_rx_info_hdr
);
1201 ath6kl_dbg(ATH6KL_DBG_WMI
, "opt frame event %2.2x:%2.2x\n",
1202 bih
->bssid
[4], bih
->bssid
[5]);
1204 bss
= wlan_find_node(&wmi
->parent_dev
->scan_table
, bih
->bssid
);
1206 /* Free up the node. We are about to allocate a new node. */
1207 wlan_node_reclaim(&wmi
->parent_dev
->scan_table
, bss
);
1210 bss
= wlan_node_alloc(len
);
1214 bss
->ni_snr
= bih
->snr
;
1215 bss
->ni_cie
.ie_chan
= le16_to_cpu(bih
->ch
);
1217 if (WARN_ON(!bss
->ni_buf
))
1220 memcpy(bss
->ni_buf
, buf
, len
);
1221 wlan_setup_node(&wmi
->parent_dev
->scan_table
, bss
, bih
->bssid
);
1226 /* Inactivity timeout of a fatpipe(pstream) at the target */
1227 static int ath6kl_wmi_pstream_timeout_event_rx(struct wmi
*wmi
, u8
*datap
,
1230 struct wmi_pstream_timeout_event
*ev
;
1232 if (len
< sizeof(struct wmi_pstream_timeout_event
))
1235 ev
= (struct wmi_pstream_timeout_event
*) datap
;
1238 * When the pstream (fat pipe == AC) timesout, it means there were
1239 * no thinStreams within this pstream & it got implicitly created
1240 * due to data flow on this AC. We start the inactivity timer only
1241 * for implicitly created pstream. Just reset the host state.
1243 spin_lock_bh(&wmi
->lock
);
1244 wmi
->stream_exist_for_ac
[ev
->traffic_class
] = 0;
1245 wmi
->fat_pipe_exist
&= ~(1 << ev
->traffic_class
);
1246 spin_unlock_bh(&wmi
->lock
);
1248 /* Indicate inactivity to driver layer for this fatpipe (pstream) */
1249 ath6kl_indicate_tx_activity(wmi
->parent_dev
, ev
->traffic_class
, false);
1254 static int ath6kl_wmi_bitrate_reply_rx(struct wmi
*wmi
, u8
*datap
, int len
)
1256 struct wmi_bit_rate_reply
*reply
;
1260 if (len
< sizeof(struct wmi_bit_rate_reply
))
1263 reply
= (struct wmi_bit_rate_reply
*) datap
;
1265 ath6kl_dbg(ATH6KL_DBG_WMI
, "rateindex %d\n", reply
->rate_index
);
1267 if (reply
->rate_index
== (s8
) RATE_AUTO
) {
1270 index
= reply
->rate_index
& 0x7f;
1271 sgi
= (reply
->rate_index
& 0x80) ? 1 : 0;
1272 rate
= wmi_rate_tbl
[index
][sgi
];
1275 ath6kl_wakeup_event(wmi
->parent_dev
);
1280 static int ath6kl_wmi_tcmd_test_report_rx(struct wmi
*wmi
, u8
*datap
, int len
)
1282 ath6kl_tm_rx_report_event(wmi
->parent_dev
, datap
, len
);
1287 static int ath6kl_wmi_ratemask_reply_rx(struct wmi
*wmi
, u8
*datap
, int len
)
1289 if (len
< sizeof(struct wmi_fix_rates_reply
))
1292 ath6kl_wakeup_event(wmi
->parent_dev
);
1297 static int ath6kl_wmi_ch_list_reply_rx(struct wmi
*wmi
, u8
*datap
, int len
)
1299 if (len
< sizeof(struct wmi_channel_list_reply
))
1302 ath6kl_wakeup_event(wmi
->parent_dev
);
1307 static int ath6kl_wmi_tx_pwr_reply_rx(struct wmi
*wmi
, u8
*datap
, int len
)
1309 struct wmi_tx_pwr_reply
*reply
;
1311 if (len
< sizeof(struct wmi_tx_pwr_reply
))
1314 reply
= (struct wmi_tx_pwr_reply
*) datap
;
1315 ath6kl_txpwr_rx_evt(wmi
->parent_dev
, reply
->dbM
);
1320 static int ath6kl_wmi_keepalive_reply_rx(struct wmi
*wmi
, u8
*datap
, int len
)
1322 if (len
< sizeof(struct wmi_get_keepalive_cmd
))
1325 ath6kl_wakeup_event(wmi
->parent_dev
);
1330 static int ath6kl_wmi_scan_complete_rx(struct wmi
*wmi
, u8
*datap
, int len
)
1332 struct wmi_scan_complete_event
*ev
;
1334 ev
= (struct wmi_scan_complete_event
*) datap
;
1336 if (a_sle32_to_cpu(ev
->status
) == 0)
1337 wlan_refresh_inactive_nodes(wmi
->parent_dev
);
1339 ath6kl_scan_complete_evt(wmi
->parent_dev
, a_sle32_to_cpu(ev
->status
));
1340 wmi
->is_probe_ssid
= false;
1346 * Target is reporting a programming error. This is for
1347 * developer aid only. Target only checks a few common violations
1348 * and it is responsibility of host to do all error checking.
1349 * Behavior of target after wmi error event is undefined.
1350 * A reset is recommended.
1352 static int ath6kl_wmi_error_event_rx(struct wmi
*wmi
, u8
*datap
, int len
)
1354 const char *type
= "unknown error";
1355 struct wmi_cmd_error_event
*ev
;
1356 ev
= (struct wmi_cmd_error_event
*) datap
;
1358 switch (ev
->err_code
) {
1360 type
= "invalid parameter";
1363 type
= "invalid state";
1365 case INTERNAL_ERROR
:
1366 type
= "internal error";
1370 ath6kl_dbg(ATH6KL_DBG_WMI
, "programming error, cmd=%d %s\n",
1376 static int ath6kl_wmi_stats_event_rx(struct wmi
*wmi
, u8
*datap
, int len
)
1378 ath6kl_tgt_stats_event(wmi
->parent_dev
, datap
, len
);
1383 static u8
ath6kl_wmi_get_upper_threshold(s16 rssi
,
1384 struct sq_threshold_params
*sq_thresh
,
1388 u8 threshold
= (u8
) sq_thresh
->upper_threshold
[size
- 1];
1390 /* The list is already in sorted order. Get the next lower value */
1391 for (index
= 0; index
< size
; index
++) {
1392 if (rssi
< sq_thresh
->upper_threshold
[index
]) {
1393 threshold
= (u8
) sq_thresh
->upper_threshold
[index
];
1401 static u8
ath6kl_wmi_get_lower_threshold(s16 rssi
,
1402 struct sq_threshold_params
*sq_thresh
,
1406 u8 threshold
= (u8
) sq_thresh
->lower_threshold
[size
- 1];
1408 /* The list is already in sorted order. Get the next lower value */
1409 for (index
= 0; index
< size
; index
++) {
1410 if (rssi
> sq_thresh
->lower_threshold
[index
]) {
1411 threshold
= (u8
) sq_thresh
->lower_threshold
[index
];
1419 static int ath6kl_wmi_send_rssi_threshold_params(struct wmi
*wmi
,
1420 struct wmi_rssi_threshold_params_cmd
*rssi_cmd
)
1422 struct sk_buff
*skb
;
1423 struct wmi_rssi_threshold_params_cmd
*cmd
;
1425 skb
= ath6kl_wmi_get_new_buf(sizeof(*cmd
));
1429 cmd
= (struct wmi_rssi_threshold_params_cmd
*) skb
->data
;
1430 memcpy(cmd
, rssi_cmd
, sizeof(struct wmi_rssi_threshold_params_cmd
));
1432 return ath6kl_wmi_cmd_send(wmi
, skb
, WMI_RSSI_THRESHOLD_PARAMS_CMDID
,
1436 static int ath6kl_wmi_rssi_threshold_event_rx(struct wmi
*wmi
, u8
*datap
,
1439 struct wmi_rssi_threshold_event
*reply
;
1440 struct wmi_rssi_threshold_params_cmd cmd
;
1441 struct sq_threshold_params
*sq_thresh
;
1442 enum wmi_rssi_threshold_val new_threshold
;
1443 u8 upper_rssi_threshold
, lower_rssi_threshold
;
1447 if (len
< sizeof(struct wmi_rssi_threshold_event
))
1450 reply
= (struct wmi_rssi_threshold_event
*) datap
;
1451 new_threshold
= (enum wmi_rssi_threshold_val
) reply
->range
;
1452 rssi
= a_sle16_to_cpu(reply
->rssi
);
1454 sq_thresh
= &wmi
->sq_threshld
[SIGNAL_QUALITY_METRICS_RSSI
];
1457 * Identify the threshold breached and communicate that to the app.
1458 * After that install a new set of thresholds based on the signal
1459 * quality reported by the target
1461 if (new_threshold
) {
1462 /* Upper threshold breached */
1463 if (rssi
< sq_thresh
->upper_threshold
[0]) {
1464 ath6kl_dbg(ATH6KL_DBG_WMI
,
1465 "spurious upper rssi threshold event: %d\n",
1467 } else if ((rssi
< sq_thresh
->upper_threshold
[1]) &&
1468 (rssi
>= sq_thresh
->upper_threshold
[0])) {
1469 new_threshold
= WMI_RSSI_THRESHOLD1_ABOVE
;
1470 } else if ((rssi
< sq_thresh
->upper_threshold
[2]) &&
1471 (rssi
>= sq_thresh
->upper_threshold
[1])) {
1472 new_threshold
= WMI_RSSI_THRESHOLD2_ABOVE
;
1473 } else if ((rssi
< sq_thresh
->upper_threshold
[3]) &&
1474 (rssi
>= sq_thresh
->upper_threshold
[2])) {
1475 new_threshold
= WMI_RSSI_THRESHOLD3_ABOVE
;
1476 } else if ((rssi
< sq_thresh
->upper_threshold
[4]) &&
1477 (rssi
>= sq_thresh
->upper_threshold
[3])) {
1478 new_threshold
= WMI_RSSI_THRESHOLD4_ABOVE
;
1479 } else if ((rssi
< sq_thresh
->upper_threshold
[5]) &&
1480 (rssi
>= sq_thresh
->upper_threshold
[4])) {
1481 new_threshold
= WMI_RSSI_THRESHOLD5_ABOVE
;
1482 } else if (rssi
>= sq_thresh
->upper_threshold
[5]) {
1483 new_threshold
= WMI_RSSI_THRESHOLD6_ABOVE
;
1486 /* Lower threshold breached */
1487 if (rssi
> sq_thresh
->lower_threshold
[0]) {
1488 ath6kl_dbg(ATH6KL_DBG_WMI
,
1489 "spurious lower rssi threshold event: %d %d\n",
1490 rssi
, sq_thresh
->lower_threshold
[0]);
1491 } else if ((rssi
> sq_thresh
->lower_threshold
[1]) &&
1492 (rssi
<= sq_thresh
->lower_threshold
[0])) {
1493 new_threshold
= WMI_RSSI_THRESHOLD6_BELOW
;
1494 } else if ((rssi
> sq_thresh
->lower_threshold
[2]) &&
1495 (rssi
<= sq_thresh
->lower_threshold
[1])) {
1496 new_threshold
= WMI_RSSI_THRESHOLD5_BELOW
;
1497 } else if ((rssi
> sq_thresh
->lower_threshold
[3]) &&
1498 (rssi
<= sq_thresh
->lower_threshold
[2])) {
1499 new_threshold
= WMI_RSSI_THRESHOLD4_BELOW
;
1500 } else if ((rssi
> sq_thresh
->lower_threshold
[4]) &&
1501 (rssi
<= sq_thresh
->lower_threshold
[3])) {
1502 new_threshold
= WMI_RSSI_THRESHOLD3_BELOW
;
1503 } else if ((rssi
> sq_thresh
->lower_threshold
[5]) &&
1504 (rssi
<= sq_thresh
->lower_threshold
[4])) {
1505 new_threshold
= WMI_RSSI_THRESHOLD2_BELOW
;
1506 } else if (rssi
<= sq_thresh
->lower_threshold
[5]) {
1507 new_threshold
= WMI_RSSI_THRESHOLD1_BELOW
;
1511 /* Calculate and install the next set of thresholds */
1512 lower_rssi_threshold
= ath6kl_wmi_get_lower_threshold(rssi
, sq_thresh
,
1513 sq_thresh
->lower_threshold_valid_count
);
1514 upper_rssi_threshold
= ath6kl_wmi_get_upper_threshold(rssi
, sq_thresh
,
1515 sq_thresh
->upper_threshold_valid_count
);
1517 /* Issue a wmi command to install the thresholds */
1518 cmd
.thresh_above1_val
= a_cpu_to_sle16(upper_rssi_threshold
);
1519 cmd
.thresh_below1_val
= a_cpu_to_sle16(lower_rssi_threshold
);
1520 cmd
.weight
= sq_thresh
->weight
;
1521 cmd
.poll_time
= cpu_to_le32(sq_thresh
->polling_interval
);
1523 ret
= ath6kl_wmi_send_rssi_threshold_params(wmi
, &cmd
);
1525 ath6kl_err("unable to configure rssi thresholds\n");
1532 static int ath6kl_wmi_cac_event_rx(struct wmi
*wmi
, u8
*datap
, int len
)
1534 struct wmi_cac_event
*reply
;
1535 struct ieee80211_tspec_ie
*ts
;
1536 u16 active_tsids
, tsinfo
;
1540 if (len
< sizeof(struct wmi_cac_event
))
1543 reply
= (struct wmi_cac_event
*) datap
;
1545 if ((reply
->cac_indication
== CAC_INDICATION_ADMISSION_RESP
) &&
1546 (reply
->status_code
!= IEEE80211_TSPEC_STATUS_ADMISS_ACCEPTED
)) {
1548 ts
= (struct ieee80211_tspec_ie
*) &(reply
->tspec_suggestion
);
1549 tsinfo
= le16_to_cpu(ts
->tsinfo
);
1550 tsid
= (tsinfo
>> IEEE80211_WMM_IE_TSPEC_TID_SHIFT
) &
1551 IEEE80211_WMM_IE_TSPEC_TID_MASK
;
1553 ath6kl_wmi_delete_pstream_cmd(wmi
, reply
->ac
, tsid
);
1554 } else if (reply
->cac_indication
== CAC_INDICATION_NO_RESP
) {
1556 * Following assumes that there is only one outstanding
1557 * ADDTS request when this event is received
1559 spin_lock_bh(&wmi
->lock
);
1560 active_tsids
= wmi
->stream_exist_for_ac
[reply
->ac
];
1561 spin_unlock_bh(&wmi
->lock
);
1563 for (index
= 0; index
< sizeof(active_tsids
) * 8; index
++) {
1564 if ((active_tsids
>> index
) & 1)
1567 if (index
< (sizeof(active_tsids
) * 8))
1568 ath6kl_wmi_delete_pstream_cmd(wmi
, reply
->ac
, index
);
1572 * Clear active tsids and Add missing handling
1573 * for delete qos stream from AP
1575 else if (reply
->cac_indication
== CAC_INDICATION_DELETE
) {
1577 ts
= (struct ieee80211_tspec_ie
*) &(reply
->tspec_suggestion
);
1578 tsinfo
= le16_to_cpu(ts
->tsinfo
);
1579 ts_id
= ((tsinfo
>> IEEE80211_WMM_IE_TSPEC_TID_SHIFT
) &
1580 IEEE80211_WMM_IE_TSPEC_TID_MASK
);
1582 spin_lock_bh(&wmi
->lock
);
1583 wmi
->stream_exist_for_ac
[reply
->ac
] &= ~(1 << ts_id
);
1584 active_tsids
= wmi
->stream_exist_for_ac
[reply
->ac
];
1585 spin_unlock_bh(&wmi
->lock
);
1587 /* Indicate stream inactivity to driver layer only if all tsids
1588 * within this AC are deleted.
1590 if (!active_tsids
) {
1591 ath6kl_indicate_tx_activity(wmi
->parent_dev
, reply
->ac
,
1593 wmi
->fat_pipe_exist
&= ~(1 << reply
->ac
);
1600 static int ath6kl_wmi_send_snr_threshold_params(struct wmi
*wmi
,
1601 struct wmi_snr_threshold_params_cmd
*snr_cmd
)
1603 struct sk_buff
*skb
;
1604 struct wmi_snr_threshold_params_cmd
*cmd
;
1606 skb
= ath6kl_wmi_get_new_buf(sizeof(*cmd
));
1610 cmd
= (struct wmi_snr_threshold_params_cmd
*) skb
->data
;
1611 memcpy(cmd
, snr_cmd
, sizeof(struct wmi_snr_threshold_params_cmd
));
1613 return ath6kl_wmi_cmd_send(wmi
, skb
, WMI_SNR_THRESHOLD_PARAMS_CMDID
,
1617 static int ath6kl_wmi_snr_threshold_event_rx(struct wmi
*wmi
, u8
*datap
,
1620 struct wmi_snr_threshold_event
*reply
;
1621 struct sq_threshold_params
*sq_thresh
;
1622 struct wmi_snr_threshold_params_cmd cmd
;
1623 enum wmi_snr_threshold_val new_threshold
;
1624 u8 upper_snr_threshold
, lower_snr_threshold
;
1628 if (len
< sizeof(struct wmi_snr_threshold_event
))
1631 reply
= (struct wmi_snr_threshold_event
*) datap
;
1633 new_threshold
= (enum wmi_snr_threshold_val
) reply
->range
;
1636 sq_thresh
= &wmi
->sq_threshld
[SIGNAL_QUALITY_METRICS_SNR
];
1639 * Identify the threshold breached and communicate that to the app.
1640 * After that install a new set of thresholds based on the signal
1641 * quality reported by the target.
1643 if (new_threshold
) {
1644 /* Upper threshold breached */
1645 if (snr
< sq_thresh
->upper_threshold
[0]) {
1646 ath6kl_dbg(ATH6KL_DBG_WMI
,
1647 "spurious upper snr threshold event: %d\n",
1649 } else if ((snr
< sq_thresh
->upper_threshold
[1]) &&
1650 (snr
>= sq_thresh
->upper_threshold
[0])) {
1651 new_threshold
= WMI_SNR_THRESHOLD1_ABOVE
;
1652 } else if ((snr
< sq_thresh
->upper_threshold
[2]) &&
1653 (snr
>= sq_thresh
->upper_threshold
[1])) {
1654 new_threshold
= WMI_SNR_THRESHOLD2_ABOVE
;
1655 } else if ((snr
< sq_thresh
->upper_threshold
[3]) &&
1656 (snr
>= sq_thresh
->upper_threshold
[2])) {
1657 new_threshold
= WMI_SNR_THRESHOLD3_ABOVE
;
1658 } else if (snr
>= sq_thresh
->upper_threshold
[3]) {
1659 new_threshold
= WMI_SNR_THRESHOLD4_ABOVE
;
1662 /* Lower threshold breached */
1663 if (snr
> sq_thresh
->lower_threshold
[0]) {
1664 ath6kl_dbg(ATH6KL_DBG_WMI
,
1665 "spurious lower snr threshold event: %d\n",
1666 sq_thresh
->lower_threshold
[0]);
1667 } else if ((snr
> sq_thresh
->lower_threshold
[1]) &&
1668 (snr
<= sq_thresh
->lower_threshold
[0])) {
1669 new_threshold
= WMI_SNR_THRESHOLD4_BELOW
;
1670 } else if ((snr
> sq_thresh
->lower_threshold
[2]) &&
1671 (snr
<= sq_thresh
->lower_threshold
[1])) {
1672 new_threshold
= WMI_SNR_THRESHOLD3_BELOW
;
1673 } else if ((snr
> sq_thresh
->lower_threshold
[3]) &&
1674 (snr
<= sq_thresh
->lower_threshold
[2])) {
1675 new_threshold
= WMI_SNR_THRESHOLD2_BELOW
;
1676 } else if (snr
<= sq_thresh
->lower_threshold
[3]) {
1677 new_threshold
= WMI_SNR_THRESHOLD1_BELOW
;
1681 /* Calculate and install the next set of thresholds */
1682 lower_snr_threshold
= ath6kl_wmi_get_lower_threshold(snr
, sq_thresh
,
1683 sq_thresh
->lower_threshold_valid_count
);
1684 upper_snr_threshold
= ath6kl_wmi_get_upper_threshold(snr
, sq_thresh
,
1685 sq_thresh
->upper_threshold_valid_count
);
1687 /* Issue a wmi command to install the thresholds */
1688 cmd
.thresh_above1_val
= upper_snr_threshold
;
1689 cmd
.thresh_below1_val
= lower_snr_threshold
;
1690 cmd
.weight
= sq_thresh
->weight
;
1691 cmd
.poll_time
= cpu_to_le32(sq_thresh
->polling_interval
);
1693 ath6kl_dbg(ATH6KL_DBG_WMI
,
1694 "snr: %d, threshold: %d, lower: %d, upper: %d\n",
1696 lower_snr_threshold
, upper_snr_threshold
);
1698 ret
= ath6kl_wmi_send_snr_threshold_params(wmi
, &cmd
);
1700 ath6kl_err("unable to configure snr threshold\n");
1707 static int ath6kl_wmi_aplist_event_rx(struct wmi
*wmi
, u8
*datap
, int len
)
1709 u16 ap_info_entry_size
;
1710 struct wmi_aplist_event
*ev
= (struct wmi_aplist_event
*) datap
;
1711 struct wmi_ap_info_v1
*ap_info_v1
;
1714 if (len
< sizeof(struct wmi_aplist_event
) ||
1715 ev
->ap_list_ver
!= APLIST_VER1
)
1718 ap_info_entry_size
= sizeof(struct wmi_ap_info_v1
);
1719 ap_info_v1
= (struct wmi_ap_info_v1
*) ev
->ap_list
;
1721 ath6kl_dbg(ATH6KL_DBG_WMI
,
1722 "number of APs in aplist event: %d\n", ev
->num_ap
);
1724 if (len
< (int) (sizeof(struct wmi_aplist_event
) +
1725 (ev
->num_ap
- 1) * ap_info_entry_size
))
1728 /* AP list version 1 contents */
1729 for (index
= 0; index
< ev
->num_ap
; index
++) {
1730 ath6kl_dbg(ATH6KL_DBG_WMI
, "AP#%d BSSID %pM Channel %d\n",
1731 index
, ap_info_v1
->bssid
, ap_info_v1
->channel
);
1738 int ath6kl_wmi_cmd_send(struct wmi
*wmi
, struct sk_buff
*skb
,
1739 enum wmi_cmd_id cmd_id
, enum wmi_sync_flag sync_flag
)
1741 struct wmi_cmd_hdr
*cmd_hdr
;
1742 enum htc_endpoint_id ep_id
= wmi
->ep_id
;
1745 ath6kl_dbg(ATH6KL_DBG_WMI
, "%s: cmd_id=%d\n", __func__
, cmd_id
);
1747 if (WARN_ON(skb
== NULL
))
1750 if (sync_flag
>= END_WMIFLAG
) {
1755 if ((sync_flag
== SYNC_BEFORE_WMIFLAG
) ||
1756 (sync_flag
== SYNC_BOTH_WMIFLAG
)) {
1758 * Make sure all data currently queued is transmitted before
1759 * the cmd execution. Establish a new sync point.
1761 ath6kl_wmi_sync_point(wmi
);
1764 skb_push(skb
, sizeof(struct wmi_cmd_hdr
));
1766 cmd_hdr
= (struct wmi_cmd_hdr
*) skb
->data
;
1767 cmd_hdr
->cmd_id
= cpu_to_le16(cmd_id
);
1768 cmd_hdr
->info1
= 0; /* added for virtual interface */
1770 /* Only for OPT_TX_CMD, use BE endpoint. */
1771 if (cmd_id
== WMI_OPT_TX_FRAME_CMDID
) {
1772 ret
= ath6kl_wmi_data_hdr_add(wmi
, skb
, OPT_MSGTYPE
,
1773 false, false, 0, NULL
);
1778 ep_id
= ath6kl_ac2_endpoint_id(wmi
->parent_dev
, WMM_AC_BE
);
1781 ath6kl_control_tx(wmi
->parent_dev
, skb
, ep_id
);
1783 if ((sync_flag
== SYNC_AFTER_WMIFLAG
) ||
1784 (sync_flag
== SYNC_BOTH_WMIFLAG
)) {
1786 * Make sure all new data queued waits for the command to
1787 * execute. Establish a new sync point.
1789 ath6kl_wmi_sync_point(wmi
);
1795 int ath6kl_wmi_connect_cmd(struct wmi
*wmi
, enum network_type nw_type
,
1796 enum dot11_auth_mode dot11_auth_mode
,
1797 enum auth_mode auth_mode
,
1798 enum crypto_type pairwise_crypto
,
1799 u8 pairwise_crypto_len
,
1800 enum crypto_type group_crypto
,
1801 u8 group_crypto_len
, int ssid_len
, u8
*ssid
,
1802 u8
*bssid
, u16 channel
, u32 ctrl_flags
)
1804 struct sk_buff
*skb
;
1805 struct wmi_connect_cmd
*cc
;
1808 wmi
->traffic_class
= 100;
1810 if ((pairwise_crypto
== NONE_CRYPT
) && (group_crypto
!= NONE_CRYPT
))
1813 if ((pairwise_crypto
!= NONE_CRYPT
) && (group_crypto
== NONE_CRYPT
))
1816 skb
= ath6kl_wmi_get_new_buf(sizeof(struct wmi_connect_cmd
));
1820 cc
= (struct wmi_connect_cmd
*) skb
->data
;
1823 memcpy(cc
->ssid
, ssid
, ssid_len
);
1825 cc
->ssid_len
= ssid_len
;
1826 cc
->nw_type
= nw_type
;
1827 cc
->dot11_auth_mode
= dot11_auth_mode
;
1828 cc
->auth_mode
= auth_mode
;
1829 cc
->prwise_crypto_type
= pairwise_crypto
;
1830 cc
->prwise_crypto_len
= pairwise_crypto_len
;
1831 cc
->grp_crypto_type
= group_crypto
;
1832 cc
->grp_crypto_len
= group_crypto_len
;
1833 cc
->ch
= cpu_to_le16(channel
);
1834 cc
->ctrl_flags
= cpu_to_le32(ctrl_flags
);
1837 memcpy(cc
->bssid
, bssid
, ETH_ALEN
);
1839 wmi
->pair_crypto_type
= pairwise_crypto
;
1840 wmi
->grp_crypto_type
= group_crypto
;
1842 ret
= ath6kl_wmi_cmd_send(wmi
, skb
, WMI_CONNECT_CMDID
, NO_SYNC_WMIFLAG
);
1847 int ath6kl_wmi_reconnect_cmd(struct wmi
*wmi
, u8
*bssid
, u16 channel
)
1849 struct sk_buff
*skb
;
1850 struct wmi_reconnect_cmd
*cc
;
1853 wmi
->traffic_class
= 100;
1855 skb
= ath6kl_wmi_get_new_buf(sizeof(struct wmi_reconnect_cmd
));
1859 cc
= (struct wmi_reconnect_cmd
*) skb
->data
;
1860 cc
->channel
= cpu_to_le16(channel
);
1863 memcpy(cc
->bssid
, bssid
, ETH_ALEN
);
1865 ret
= ath6kl_wmi_cmd_send(wmi
, skb
, WMI_RECONNECT_CMDID
,
1871 int ath6kl_wmi_disconnect_cmd(struct wmi
*wmi
)
1875 wmi
->traffic_class
= 100;
1877 /* Disconnect command does not need to do a SYNC before. */
1878 ret
= ath6kl_wmi_simple_cmd(wmi
, WMI_DISCONNECT_CMDID
);
1883 int ath6kl_wmi_startscan_cmd(struct wmi
*wmi
, enum wmi_scan_type scan_type
,
1884 u32 force_fgscan
, u32 is_legacy
,
1885 u32 home_dwell_time
, u32 force_scan_interval
,
1886 s8 num_chan
, u16
*ch_list
)
1888 struct sk_buff
*skb
;
1889 struct wmi_start_scan_cmd
*sc
;
1893 size
= sizeof(struct wmi_start_scan_cmd
);
1895 if ((scan_type
!= WMI_LONG_SCAN
) && (scan_type
!= WMI_SHORT_SCAN
))
1898 if (num_chan
> WMI_MAX_CHANNELS
)
1902 size
+= sizeof(u16
) * (num_chan
- 1);
1904 skb
= ath6kl_wmi_get_new_buf(size
);
1908 sc
= (struct wmi_start_scan_cmd
*) skb
->data
;
1909 sc
->scan_type
= scan_type
;
1910 sc
->force_fg_scan
= cpu_to_le32(force_fgscan
);
1911 sc
->is_legacy
= cpu_to_le32(is_legacy
);
1912 sc
->home_dwell_time
= cpu_to_le32(home_dwell_time
);
1913 sc
->force_scan_intvl
= cpu_to_le32(force_scan_interval
);
1914 sc
->num_ch
= num_chan
;
1916 for (i
= 0; i
< num_chan
; i
++)
1917 sc
->ch_list
[i
] = cpu_to_le16(ch_list
[i
]);
1919 ret
= ath6kl_wmi_cmd_send(wmi
, skb
, WMI_START_SCAN_CMDID
,
1925 int ath6kl_wmi_scanparams_cmd(struct wmi
*wmi
, u16 fg_start_sec
,
1926 u16 fg_end_sec
, u16 bg_sec
,
1927 u16 minact_chdw_msec
, u16 maxact_chdw_msec
,
1928 u16 pas_chdw_msec
, u8 short_scan_ratio
,
1929 u8 scan_ctrl_flag
, u32 max_dfsch_act_time
,
1930 u16 maxact_scan_per_ssid
)
1932 struct sk_buff
*skb
;
1933 struct wmi_scan_params_cmd
*sc
;
1936 skb
= ath6kl_wmi_get_new_buf(sizeof(*sc
));
1940 sc
= (struct wmi_scan_params_cmd
*) skb
->data
;
1941 sc
->fg_start_period
= cpu_to_le16(fg_start_sec
);
1942 sc
->fg_end_period
= cpu_to_le16(fg_end_sec
);
1943 sc
->bg_period
= cpu_to_le16(bg_sec
);
1944 sc
->minact_chdwell_time
= cpu_to_le16(minact_chdw_msec
);
1945 sc
->maxact_chdwell_time
= cpu_to_le16(maxact_chdw_msec
);
1946 sc
->pas_chdwell_time
= cpu_to_le16(pas_chdw_msec
);
1947 sc
->short_scan_ratio
= short_scan_ratio
;
1948 sc
->scan_ctrl_flags
= scan_ctrl_flag
;
1949 sc
->max_dfsch_act_time
= cpu_to_le32(max_dfsch_act_time
);
1950 sc
->maxact_scan_per_ssid
= cpu_to_le16(maxact_scan_per_ssid
);
1952 ret
= ath6kl_wmi_cmd_send(wmi
, skb
, WMI_SET_SCAN_PARAMS_CMDID
,
1957 int ath6kl_wmi_bssfilter_cmd(struct wmi
*wmi
, u8 filter
, u32 ie_mask
)
1959 struct sk_buff
*skb
;
1960 struct wmi_bss_filter_cmd
*cmd
;
1963 if (filter
>= LAST_BSS_FILTER
)
1966 skb
= ath6kl_wmi_get_new_buf(sizeof(*cmd
));
1970 cmd
= (struct wmi_bss_filter_cmd
*) skb
->data
;
1971 cmd
->bss_filter
= filter
;
1972 cmd
->ie_mask
= cpu_to_le32(ie_mask
);
1974 ret
= ath6kl_wmi_cmd_send(wmi
, skb
, WMI_SET_BSS_FILTER_CMDID
,
1979 int ath6kl_wmi_probedssid_cmd(struct wmi
*wmi
, u8 index
, u8 flag
,
1980 u8 ssid_len
, u8
*ssid
)
1982 struct sk_buff
*skb
;
1983 struct wmi_probed_ssid_cmd
*cmd
;
1986 if (index
> MAX_PROBED_SSID_INDEX
)
1989 if (ssid_len
> sizeof(cmd
->ssid
))
1992 if ((flag
& (DISABLE_SSID_FLAG
| ANY_SSID_FLAG
)) && (ssid_len
> 0))
1995 if ((flag
& SPECIFIC_SSID_FLAG
) && !ssid_len
)
1998 if (flag
& SPECIFIC_SSID_FLAG
)
1999 wmi
->is_probe_ssid
= true;
2001 skb
= ath6kl_wmi_get_new_buf(sizeof(*cmd
));
2005 cmd
= (struct wmi_probed_ssid_cmd
*) skb
->data
;
2006 cmd
->entry_index
= index
;
2008 cmd
->ssid_len
= ssid_len
;
2009 memcpy(cmd
->ssid
, ssid
, ssid_len
);
2011 ret
= ath6kl_wmi_cmd_send(wmi
, skb
, WMI_SET_PROBED_SSID_CMDID
,
2016 int ath6kl_wmi_listeninterval_cmd(struct wmi
*wmi
, u16 listen_interval
,
2019 struct sk_buff
*skb
;
2020 struct wmi_listen_int_cmd
*cmd
;
2023 skb
= ath6kl_wmi_get_new_buf(sizeof(*cmd
));
2027 cmd
= (struct wmi_listen_int_cmd
*) skb
->data
;
2028 cmd
->listen_intvl
= cpu_to_le16(listen_interval
);
2029 cmd
->num_beacons
= cpu_to_le16(listen_beacons
);
2031 ret
= ath6kl_wmi_cmd_send(wmi
, skb
, WMI_SET_LISTEN_INT_CMDID
,
2036 int ath6kl_wmi_powermode_cmd(struct wmi
*wmi
, u8 pwr_mode
)
2038 struct sk_buff
*skb
;
2039 struct wmi_power_mode_cmd
*cmd
;
2042 skb
= ath6kl_wmi_get_new_buf(sizeof(*cmd
));
2046 cmd
= (struct wmi_power_mode_cmd
*) skb
->data
;
2047 cmd
->pwr_mode
= pwr_mode
;
2048 wmi
->pwr_mode
= pwr_mode
;
2050 ret
= ath6kl_wmi_cmd_send(wmi
, skb
, WMI_SET_POWER_MODE_CMDID
,
2055 int ath6kl_wmi_pmparams_cmd(struct wmi
*wmi
, u16 idle_period
,
2056 u16 ps_poll_num
, u16 dtim_policy
,
2057 u16 tx_wakeup_policy
, u16 num_tx_to_wakeup
,
2058 u16 ps_fail_event_policy
)
2060 struct sk_buff
*skb
;
2061 struct wmi_power_params_cmd
*pm
;
2064 skb
= ath6kl_wmi_get_new_buf(sizeof(*pm
));
2068 pm
= (struct wmi_power_params_cmd
*)skb
->data
;
2069 pm
->idle_period
= cpu_to_le16(idle_period
);
2070 pm
->pspoll_number
= cpu_to_le16(ps_poll_num
);
2071 pm
->dtim_policy
= cpu_to_le16(dtim_policy
);
2072 pm
->tx_wakeup_policy
= cpu_to_le16(tx_wakeup_policy
);
2073 pm
->num_tx_to_wakeup
= cpu_to_le16(num_tx_to_wakeup
);
2074 pm
->ps_fail_event_policy
= cpu_to_le16(ps_fail_event_policy
);
2076 ret
= ath6kl_wmi_cmd_send(wmi
, skb
, WMI_SET_POWER_PARAMS_CMDID
,
2081 int ath6kl_wmi_disctimeout_cmd(struct wmi
*wmi
, u8 timeout
)
2083 struct sk_buff
*skb
;
2084 struct wmi_disc_timeout_cmd
*cmd
;
2087 skb
= ath6kl_wmi_get_new_buf(sizeof(*cmd
));
2091 cmd
= (struct wmi_disc_timeout_cmd
*) skb
->data
;
2092 cmd
->discon_timeout
= timeout
;
2094 ret
= ath6kl_wmi_cmd_send(wmi
, skb
, WMI_SET_DISC_TIMEOUT_CMDID
,
2099 int ath6kl_wmi_addkey_cmd(struct wmi
*wmi
, u8 key_index
,
2100 enum crypto_type key_type
,
2101 u8 key_usage
, u8 key_len
,
2102 u8
*key_rsc
, u8
*key_material
,
2103 u8 key_op_ctrl
, u8
*mac_addr
,
2104 enum wmi_sync_flag sync_flag
)
2106 struct sk_buff
*skb
;
2107 struct wmi_add_cipher_key_cmd
*cmd
;
2110 ath6kl_dbg(ATH6KL_DBG_WMI
, "addkey cmd: key_index=%u key_type=%d "
2111 "key_usage=%d key_len=%d key_op_ctrl=%d\n",
2112 key_index
, key_type
, key_usage
, key_len
, key_op_ctrl
);
2114 if ((key_index
> WMI_MAX_KEY_INDEX
) || (key_len
> WMI_MAX_KEY_LEN
) ||
2115 (key_material
== NULL
))
2118 if ((WEP_CRYPT
!= key_type
) && (NULL
== key_rsc
))
2121 skb
= ath6kl_wmi_get_new_buf(sizeof(*cmd
));
2125 cmd
= (struct wmi_add_cipher_key_cmd
*) skb
->data
;
2126 cmd
->key_index
= key_index
;
2127 cmd
->key_type
= key_type
;
2128 cmd
->key_usage
= key_usage
;
2129 cmd
->key_len
= key_len
;
2130 memcpy(cmd
->key
, key_material
, key_len
);
2132 if (key_rsc
!= NULL
)
2133 memcpy(cmd
->key_rsc
, key_rsc
, sizeof(cmd
->key_rsc
));
2135 cmd
->key_op_ctrl
= key_op_ctrl
;
2138 memcpy(cmd
->key_mac_addr
, mac_addr
, ETH_ALEN
);
2140 ret
= ath6kl_wmi_cmd_send(wmi
, skb
, WMI_ADD_CIPHER_KEY_CMDID
,
2146 int ath6kl_wmi_add_krk_cmd(struct wmi
*wmi
, u8
*krk
)
2148 struct sk_buff
*skb
;
2149 struct wmi_add_krk_cmd
*cmd
;
2152 skb
= ath6kl_wmi_get_new_buf(sizeof(*cmd
));
2156 cmd
= (struct wmi_add_krk_cmd
*) skb
->data
;
2157 memcpy(cmd
->krk
, krk
, WMI_KRK_LEN
);
2159 ret
= ath6kl_wmi_cmd_send(wmi
, skb
, WMI_ADD_KRK_CMDID
, NO_SYNC_WMIFLAG
);
2164 int ath6kl_wmi_deletekey_cmd(struct wmi
*wmi
, u8 key_index
)
2166 struct sk_buff
*skb
;
2167 struct wmi_delete_cipher_key_cmd
*cmd
;
2170 if (key_index
> WMI_MAX_KEY_INDEX
)
2173 skb
= ath6kl_wmi_get_new_buf(sizeof(*cmd
));
2177 cmd
= (struct wmi_delete_cipher_key_cmd
*) skb
->data
;
2178 cmd
->key_index
= key_index
;
2180 ret
= ath6kl_wmi_cmd_send(wmi
, skb
, WMI_DELETE_CIPHER_KEY_CMDID
,
2186 int ath6kl_wmi_setpmkid_cmd(struct wmi
*wmi
, const u8
*bssid
,
2187 const u8
*pmkid
, bool set
)
2189 struct sk_buff
*skb
;
2190 struct wmi_setpmkid_cmd
*cmd
;
2196 if (set
&& pmkid
== NULL
)
2199 skb
= ath6kl_wmi_get_new_buf(sizeof(*cmd
));
2203 cmd
= (struct wmi_setpmkid_cmd
*) skb
->data
;
2204 memcpy(cmd
->bssid
, bssid
, ETH_ALEN
);
2206 memcpy(cmd
->pmkid
, pmkid
, sizeof(cmd
->pmkid
));
2207 cmd
->enable
= PMKID_ENABLE
;
2209 memset(cmd
->pmkid
, 0, sizeof(cmd
->pmkid
));
2210 cmd
->enable
= PMKID_DISABLE
;
2213 ret
= ath6kl_wmi_cmd_send(wmi
, skb
, WMI_SET_PMKID_CMDID
,
2219 static int ath6kl_wmi_data_sync_send(struct wmi
*wmi
, struct sk_buff
*skb
,
2220 enum htc_endpoint_id ep_id
)
2222 struct wmi_data_hdr
*data_hdr
;
2225 if (WARN_ON(skb
== NULL
|| ep_id
== wmi
->ep_id
))
2228 skb_push(skb
, sizeof(struct wmi_data_hdr
));
2230 data_hdr
= (struct wmi_data_hdr
*) skb
->data
;
2231 data_hdr
->info
= SYNC_MSGTYPE
<< WMI_DATA_HDR_MSG_TYPE_SHIFT
;
2232 data_hdr
->info3
= 0;
2234 ret
= ath6kl_control_tx(wmi
->parent_dev
, skb
, ep_id
);
2239 static int ath6kl_wmi_sync_point(struct wmi
*wmi
)
2241 struct sk_buff
*skb
;
2242 struct wmi_sync_cmd
*cmd
;
2243 struct wmi_data_sync_bufs data_sync_bufs
[WMM_NUM_AC
];
2244 enum htc_endpoint_id ep_id
;
2245 u8 index
, num_pri_streams
= 0;
2248 memset(data_sync_bufs
, 0, sizeof(data_sync_bufs
));
2250 spin_lock_bh(&wmi
->lock
);
2252 for (index
= 0; index
< WMM_NUM_AC
; index
++) {
2253 if (wmi
->fat_pipe_exist
& (1 << index
)) {
2255 data_sync_bufs
[num_pri_streams
- 1].traffic_class
=
2260 spin_unlock_bh(&wmi
->lock
);
2262 skb
= ath6kl_wmi_get_new_buf(sizeof(*cmd
));
2268 cmd
= (struct wmi_sync_cmd
*) skb
->data
;
2271 * In the SYNC cmd sent on the control Ep, send a bitmap
2272 * of the data eps on which the Data Sync will be sent
2274 cmd
->data_sync_map
= wmi
->fat_pipe_exist
;
2276 for (index
= 0; index
< num_pri_streams
; index
++) {
2277 data_sync_bufs
[index
].skb
= ath6kl_buf_alloc(0);
2278 if (data_sync_bufs
[index
].skb
== NULL
) {
2285 * If buffer allocation for any of the dataSync fails,
2286 * then do not send the Synchronize cmd on the control ep
2292 * Send sync cmd followed by sync data messages on all
2293 * endpoints being used
2295 ret
= ath6kl_wmi_cmd_send(wmi
, skb
, WMI_SYNCHRONIZE_CMDID
,
2301 /* cmd buffer sent, we no longer own it */
2304 for (index
= 0; index
< num_pri_streams
; index
++) {
2306 if (WARN_ON(!data_sync_bufs
[index
].skb
))
2309 ep_id
= ath6kl_ac2_endpoint_id(wmi
->parent_dev
,
2310 data_sync_bufs
[index
].
2313 ath6kl_wmi_data_sync_send(wmi
, data_sync_bufs
[index
].skb
,
2319 data_sync_bufs
[index
].skb
= NULL
;
2323 /* free up any resources left over (possibly due to an error) */
2327 for (index
= 0; index
< num_pri_streams
; index
++) {
2328 if (data_sync_bufs
[index
].skb
!= NULL
) {
2329 dev_kfree_skb((struct sk_buff
*)data_sync_bufs
[index
].
2337 int ath6kl_wmi_create_pstream_cmd(struct wmi
*wmi
,
2338 struct wmi_create_pstream_cmd
*params
)
2340 struct sk_buff
*skb
;
2341 struct wmi_create_pstream_cmd
*cmd
;
2342 u8 fatpipe_exist_for_ac
= 0;
2344 s32 nominal_phy
= 0;
2347 if (!((params
->user_pri
< 8) &&
2348 (params
->user_pri
<= 0x7) &&
2349 (up_to_ac
[params
->user_pri
& 0x7] == params
->traffic_class
) &&
2350 (params
->traffic_direc
== UPLINK_TRAFFIC
||
2351 params
->traffic_direc
== DNLINK_TRAFFIC
||
2352 params
->traffic_direc
== BIDIR_TRAFFIC
) &&
2353 (params
->traffic_type
== TRAFFIC_TYPE_APERIODIC
||
2354 params
->traffic_type
== TRAFFIC_TYPE_PERIODIC
) &&
2355 (params
->voice_psc_cap
== DISABLE_FOR_THIS_AC
||
2356 params
->voice_psc_cap
== ENABLE_FOR_THIS_AC
||
2357 params
->voice_psc_cap
== ENABLE_FOR_ALL_AC
) &&
2358 (params
->tsid
== WMI_IMPLICIT_PSTREAM
||
2359 params
->tsid
<= WMI_MAX_THINSTREAM
))) {
2364 * Check nominal PHY rate is >= minimalPHY,
2365 * so that DUT can allow TSRS IE
2368 /* Get the physical rate (units of bps) */
2369 min_phy
= ((le32_to_cpu(params
->min_phy_rate
) / 1000) / 1000);
2371 /* Check minimal phy < nominal phy rate */
2372 if (params
->nominal_phy
>= min_phy
) {
2373 /* unit of 500 kbps */
2374 nominal_phy
= (params
->nominal_phy
* 1000) / 500;
2375 ath6kl_dbg(ATH6KL_DBG_WMI
,
2376 "TSRS IE enabled::MinPhy %x->NominalPhy ===> %x\n",
2377 min_phy
, nominal_phy
);
2379 params
->nominal_phy
= nominal_phy
;
2381 params
->nominal_phy
= 0;
2384 skb
= ath6kl_wmi_get_new_buf(sizeof(*cmd
));
2388 ath6kl_dbg(ATH6KL_DBG_WMI
,
2389 "sending create_pstream_cmd: ac=%d tsid:%d\n",
2390 params
->traffic_class
, params
->tsid
);
2392 cmd
= (struct wmi_create_pstream_cmd
*) skb
->data
;
2393 memcpy(cmd
, params
, sizeof(*cmd
));
2395 /* This is an implicitly created Fat pipe */
2396 if ((u32
) params
->tsid
== (u32
) WMI_IMPLICIT_PSTREAM
) {
2397 spin_lock_bh(&wmi
->lock
);
2398 fatpipe_exist_for_ac
= (wmi
->fat_pipe_exist
&
2399 (1 << params
->traffic_class
));
2400 wmi
->fat_pipe_exist
|= (1 << params
->traffic_class
);
2401 spin_unlock_bh(&wmi
->lock
);
2403 /* explicitly created thin stream within a fat pipe */
2404 spin_lock_bh(&wmi
->lock
);
2405 fatpipe_exist_for_ac
= (wmi
->fat_pipe_exist
&
2406 (1 << params
->traffic_class
));
2407 wmi
->stream_exist_for_ac
[params
->traffic_class
] |=
2408 (1 << params
->tsid
);
2410 * If a thinstream becomes active, the fat pipe automatically
2413 wmi
->fat_pipe_exist
|= (1 << params
->traffic_class
);
2414 spin_unlock_bh(&wmi
->lock
);
2418 * Indicate activty change to driver layer only if this is the
2419 * first TSID to get created in this AC explicitly or an implicit
2420 * fat pipe is getting created.
2422 if (!fatpipe_exist_for_ac
)
2423 ath6kl_indicate_tx_activity(wmi
->parent_dev
,
2424 params
->traffic_class
, true);
2426 ret
= ath6kl_wmi_cmd_send(wmi
, skb
, WMI_CREATE_PSTREAM_CMDID
,
2431 int ath6kl_wmi_delete_pstream_cmd(struct wmi
*wmi
, u8 traffic_class
, u8 tsid
)
2433 struct sk_buff
*skb
;
2434 struct wmi_delete_pstream_cmd
*cmd
;
2435 u16 active_tsids
= 0;
2438 if (traffic_class
> 3) {
2439 ath6kl_err("invalid traffic class: %d\n", traffic_class
);
2443 skb
= ath6kl_wmi_get_new_buf(sizeof(*cmd
));
2447 cmd
= (struct wmi_delete_pstream_cmd
*) skb
->data
;
2448 cmd
->traffic_class
= traffic_class
;
2451 spin_lock_bh(&wmi
->lock
);
2452 active_tsids
= wmi
->stream_exist_for_ac
[traffic_class
];
2453 spin_unlock_bh(&wmi
->lock
);
2455 if (!(active_tsids
& (1 << tsid
))) {
2457 ath6kl_dbg(ATH6KL_DBG_WMI
,
2458 "TSID %d doesn't exist for traffic class: %d\n",
2459 tsid
, traffic_class
);
2463 ath6kl_dbg(ATH6KL_DBG_WMI
,
2464 "sending delete_pstream_cmd: traffic class: %d tsid=%d\n",
2465 traffic_class
, tsid
);
2467 ret
= ath6kl_wmi_cmd_send(wmi
, skb
, WMI_DELETE_PSTREAM_CMDID
,
2468 SYNC_BEFORE_WMIFLAG
);
2470 spin_lock_bh(&wmi
->lock
);
2471 wmi
->stream_exist_for_ac
[traffic_class
] &= ~(1 << tsid
);
2472 active_tsids
= wmi
->stream_exist_for_ac
[traffic_class
];
2473 spin_unlock_bh(&wmi
->lock
);
2476 * Indicate stream inactivity to driver layer only if all tsids
2477 * within this AC are deleted.
2479 if (!active_tsids
) {
2480 ath6kl_indicate_tx_activity(wmi
->parent_dev
,
2481 traffic_class
, false);
2482 wmi
->fat_pipe_exist
&= ~(1 << traffic_class
);
2488 int ath6kl_wmi_set_ip_cmd(struct wmi
*wmi
, struct wmi_set_ip_cmd
*ip_cmd
)
2490 struct sk_buff
*skb
;
2491 struct wmi_set_ip_cmd
*cmd
;
2494 /* Multicast address are not valid */
2495 if ((*((u8
*) &ip_cmd
->ips
[0]) >= 0xE0) ||
2496 (*((u8
*) &ip_cmd
->ips
[1]) >= 0xE0))
2499 skb
= ath6kl_wmi_get_new_buf(sizeof(struct wmi_set_ip_cmd
));
2503 cmd
= (struct wmi_set_ip_cmd
*) skb
->data
;
2504 memcpy(cmd
, ip_cmd
, sizeof(struct wmi_set_ip_cmd
));
2506 ret
= ath6kl_wmi_cmd_send(wmi
, skb
, WMI_SET_IP_CMDID
, NO_SYNC_WMIFLAG
);
2510 static int ath6kl_wmi_get_wow_list_event_rx(struct wmi
*wmi
, u8
* datap
,
2513 if (len
< sizeof(struct wmi_get_wow_list_reply
))
2519 static int ath6kl_wmi_cmd_send_xtnd(struct wmi
*wmi
, struct sk_buff
*skb
,
2520 enum wmix_command_id cmd_id
,
2521 enum wmi_sync_flag sync_flag
)
2523 struct wmix_cmd_hdr
*cmd_hdr
;
2526 skb_push(skb
, sizeof(struct wmix_cmd_hdr
));
2528 cmd_hdr
= (struct wmix_cmd_hdr
*) skb
->data
;
2529 cmd_hdr
->cmd_id
= cpu_to_le32(cmd_id
);
2531 ret
= ath6kl_wmi_cmd_send(wmi
, skb
, WMI_EXTENSION_CMDID
, sync_flag
);
2536 int ath6kl_wmi_get_challenge_resp_cmd(struct wmi
*wmi
, u32 cookie
, u32 source
)
2538 struct sk_buff
*skb
;
2539 struct wmix_hb_challenge_resp_cmd
*cmd
;
2542 skb
= ath6kl_wmi_get_new_buf(sizeof(*cmd
));
2546 cmd
= (struct wmix_hb_challenge_resp_cmd
*) skb
->data
;
2547 cmd
->cookie
= cpu_to_le32(cookie
);
2548 cmd
->source
= cpu_to_le32(source
);
2550 ret
= ath6kl_wmi_cmd_send_xtnd(wmi
, skb
, WMIX_HB_CHALLENGE_RESP_CMDID
,
2555 int ath6kl_wmi_config_debug_module_cmd(struct wmi
*wmi
, u32 valid
, u32 config
)
2557 struct ath6kl_wmix_dbglog_cfg_module_cmd
*cmd
;
2558 struct sk_buff
*skb
;
2561 skb
= ath6kl_wmi_get_new_buf(sizeof(*cmd
));
2565 cmd
= (struct ath6kl_wmix_dbglog_cfg_module_cmd
*) skb
->data
;
2566 cmd
->valid
= cpu_to_le32(valid
);
2567 cmd
->config
= cpu_to_le32(config
);
2569 ret
= ath6kl_wmi_cmd_send_xtnd(wmi
, skb
, WMIX_DBGLOG_CFG_MODULE_CMDID
,
2574 int ath6kl_wmi_get_stats_cmd(struct wmi
*wmi
)
2576 return ath6kl_wmi_simple_cmd(wmi
, WMI_GET_STATISTICS_CMDID
);
2579 int ath6kl_wmi_set_tx_pwr_cmd(struct wmi
*wmi
, u8 dbM
)
2581 struct sk_buff
*skb
;
2582 struct wmi_set_tx_pwr_cmd
*cmd
;
2585 skb
= ath6kl_wmi_get_new_buf(sizeof(struct wmi_set_tx_pwr_cmd
));
2589 cmd
= (struct wmi_set_tx_pwr_cmd
*) skb
->data
;
2592 ret
= ath6kl_wmi_cmd_send(wmi
, skb
, WMI_SET_TX_PWR_CMDID
,
2598 int ath6kl_wmi_get_tx_pwr_cmd(struct wmi
*wmi
)
2600 return ath6kl_wmi_simple_cmd(wmi
, WMI_GET_TX_PWR_CMDID
);
2603 int ath6kl_wmi_set_lpreamble_cmd(struct wmi
*wmi
, u8 status
, u8 preamble_policy
)
2605 struct sk_buff
*skb
;
2606 struct wmi_set_lpreamble_cmd
*cmd
;
2609 skb
= ath6kl_wmi_get_new_buf(sizeof(struct wmi_set_lpreamble_cmd
));
2613 cmd
= (struct wmi_set_lpreamble_cmd
*) skb
->data
;
2614 cmd
->status
= status
;
2615 cmd
->preamble_policy
= preamble_policy
;
2617 ret
= ath6kl_wmi_cmd_send(wmi
, skb
, WMI_SET_LPREAMBLE_CMDID
,
2622 int ath6kl_wmi_set_rts_cmd(struct wmi
*wmi
, u16 threshold
)
2624 struct sk_buff
*skb
;
2625 struct wmi_set_rts_cmd
*cmd
;
2628 skb
= ath6kl_wmi_get_new_buf(sizeof(struct wmi_set_rts_cmd
));
2632 cmd
= (struct wmi_set_rts_cmd
*) skb
->data
;
2633 cmd
->threshold
= cpu_to_le16(threshold
);
2635 ret
= ath6kl_wmi_cmd_send(wmi
, skb
, WMI_SET_RTS_CMDID
, NO_SYNC_WMIFLAG
);
2639 int ath6kl_wmi_set_wmm_txop(struct wmi
*wmi
, enum wmi_txop_cfg cfg
)
2641 struct sk_buff
*skb
;
2642 struct wmi_set_wmm_txop_cmd
*cmd
;
2645 if (!((cfg
== WMI_TXOP_DISABLED
) || (cfg
== WMI_TXOP_ENABLED
)))
2648 skb
= ath6kl_wmi_get_new_buf(sizeof(struct wmi_set_wmm_txop_cmd
));
2652 cmd
= (struct wmi_set_wmm_txop_cmd
*) skb
->data
;
2653 cmd
->txop_enable
= cfg
;
2655 ret
= ath6kl_wmi_cmd_send(wmi
, skb
, WMI_SET_WMM_TXOP_CMDID
,
2660 int ath6kl_wmi_set_keepalive_cmd(struct wmi
*wmi
, u8 keep_alive_intvl
)
2662 struct sk_buff
*skb
;
2663 struct wmi_set_keepalive_cmd
*cmd
;
2666 skb
= ath6kl_wmi_get_new_buf(sizeof(*cmd
));
2670 cmd
= (struct wmi_set_keepalive_cmd
*) skb
->data
;
2671 cmd
->keep_alive_intvl
= keep_alive_intvl
;
2672 wmi
->keep_alive_intvl
= keep_alive_intvl
;
2674 ret
= ath6kl_wmi_cmd_send(wmi
, skb
, WMI_SET_KEEPALIVE_CMDID
,
2679 int ath6kl_wmi_test_cmd(struct wmi
*wmi
, void *buf
, size_t len
)
2681 struct sk_buff
*skb
;
2684 skb
= ath6kl_wmi_get_new_buf(len
);
2688 memcpy(skb
->data
, buf
, len
);
2690 ret
= ath6kl_wmi_cmd_send(wmi
, skb
, WMI_TEST_CMDID
, NO_SYNC_WMIFLAG
);
2696 s32
ath6kl_wmi_get_rate(s8 rate_index
)
2698 if (rate_index
== RATE_AUTO
)
2701 return wmi_rate_tbl
[(u32
) rate_index
][0];
2704 void ath6kl_wmi_node_return(struct wmi
*wmi
, struct bss
*bss
)
2707 wlan_node_return(&wmi
->parent_dev
->scan_table
, bss
);
2710 struct bss
*ath6kl_wmi_find_ssid_node(struct wmi
*wmi
, u8
* ssid
,
2711 u32 ssid_len
, bool is_wpa2
,
2714 struct bss
*node
= NULL
;
2716 node
= wlan_find_ssid_node(&wmi
->parent_dev
->scan_table
, ssid
,
2717 ssid_len
, is_wpa2
, match_ssid
);
2721 struct bss
*ath6kl_wmi_find_node(struct wmi
*wmi
, const u8
* mac_addr
)
2723 struct bss
*ni
= NULL
;
2725 ni
= wlan_find_node(&wmi
->parent_dev
->scan_table
, mac_addr
);
2730 void ath6kl_wmi_node_free(struct wmi
*wmi
, const u8
* mac_addr
)
2732 struct bss
*ni
= NULL
;
2734 ni
= wlan_find_node(&wmi
->parent_dev
->scan_table
, mac_addr
);
2736 wlan_node_reclaim(&wmi
->parent_dev
->scan_table
, ni
);
2741 static int ath6kl_wmi_get_pmkid_list_event_rx(struct wmi
*wmi
, u8
*datap
,
2744 struct wmi_pmkid_list_reply
*reply
;
2747 if (len
< sizeof(struct wmi_pmkid_list_reply
))
2750 reply
= (struct wmi_pmkid_list_reply
*)datap
;
2751 expected_len
= sizeof(reply
->num_pmkid
) +
2752 le32_to_cpu(reply
->num_pmkid
) * WMI_PMKID_LEN
;
2754 if (len
< expected_len
)
2760 static int ath6kl_wmi_addba_req_event_rx(struct wmi
*wmi
, u8
*datap
, int len
)
2762 struct wmi_addba_req_event
*cmd
= (struct wmi_addba_req_event
*) datap
;
2764 aggr_recv_addba_req_evt(wmi
->parent_dev
, cmd
->tid
,
2765 le16_to_cpu(cmd
->st_seq_no
), cmd
->win_sz
);
2770 static int ath6kl_wmi_delba_req_event_rx(struct wmi
*wmi
, u8
*datap
, int len
)
2772 struct wmi_delba_event
*cmd
= (struct wmi_delba_event
*) datap
;
2774 aggr_recv_delba_req_evt(wmi
->parent_dev
, cmd
->tid
);
2779 /* AP mode functions */
2781 int ath6kl_wmi_ap_profile_commit(struct wmi
*wmip
, struct wmi_connect_cmd
*p
)
2783 struct sk_buff
*skb
;
2784 struct wmi_connect_cmd
*cm
;
2787 skb
= ath6kl_wmi_get_new_buf(sizeof(*cm
));
2791 cm
= (struct wmi_connect_cmd
*) skb
->data
;
2792 memcpy(cm
, p
, sizeof(*cm
));
2794 res
= ath6kl_wmi_cmd_send(wmip
, skb
, WMI_AP_CONFIG_COMMIT_CMDID
,
2796 ath6kl_dbg(ATH6KL_DBG_WMI
, "%s: nw_type=%u auth_mode=%u ch=%u "
2797 "ctrl_flags=0x%x-> res=%d\n",
2798 __func__
, p
->nw_type
, p
->auth_mode
, le16_to_cpu(p
->ch
),
2799 le32_to_cpu(p
->ctrl_flags
), res
);
2803 int ath6kl_wmi_ap_set_mlme(struct wmi
*wmip
, u8 cmd
, const u8
*mac
, u16 reason
)
2805 struct sk_buff
*skb
;
2806 struct wmi_ap_set_mlme_cmd
*cm
;
2808 skb
= ath6kl_wmi_get_new_buf(sizeof(*cm
));
2812 cm
= (struct wmi_ap_set_mlme_cmd
*) skb
->data
;
2813 memcpy(cm
->mac
, mac
, ETH_ALEN
);
2814 cm
->reason
= cpu_to_le16(reason
);
2817 return ath6kl_wmi_cmd_send(wmip
, skb
, WMI_AP_SET_MLME_CMDID
,
2821 static int ath6kl_wmi_pspoll_event_rx(struct wmi
*wmi
, u8
*datap
, int len
)
2823 struct wmi_pspoll_event
*ev
;
2825 if (len
< sizeof(struct wmi_pspoll_event
))
2828 ev
= (struct wmi_pspoll_event
*) datap
;
2830 ath6kl_pspoll_event(wmi
->parent_dev
, le16_to_cpu(ev
->aid
));
2835 static int ath6kl_wmi_dtimexpiry_event_rx(struct wmi
*wmi
, u8
*datap
, int len
)
2837 ath6kl_dtimexpiry_event(wmi
->parent_dev
);
2842 int ath6kl_wmi_set_pvb_cmd(struct wmi
*wmi
, u16 aid
, bool flag
)
2844 struct sk_buff
*skb
;
2845 struct wmi_ap_set_pvb_cmd
*cmd
;
2848 skb
= ath6kl_wmi_get_new_buf(sizeof(struct wmi_ap_set_pvb_cmd
));
2852 cmd
= (struct wmi_ap_set_pvb_cmd
*) skb
->data
;
2853 cmd
->aid
= cpu_to_le16(aid
);
2854 cmd
->rsvd
= cpu_to_le16(0);
2855 cmd
->flag
= cpu_to_le32(flag
);
2857 ret
= ath6kl_wmi_cmd_send(wmi
, skb
, WMI_AP_SET_PVB_CMDID
,
2863 int ath6kl_wmi_set_rx_frame_format_cmd(struct wmi
*wmi
, u8 rx_meta_ver
,
2864 bool rx_dot11_hdr
, bool defrag_on_host
)
2866 struct sk_buff
*skb
;
2867 struct wmi_rx_frame_format_cmd
*cmd
;
2870 skb
= ath6kl_wmi_get_new_buf(sizeof(*cmd
));
2874 cmd
= (struct wmi_rx_frame_format_cmd
*) skb
->data
;
2875 cmd
->dot11_hdr
= rx_dot11_hdr
? 1 : 0;
2876 cmd
->defrag_on_host
= defrag_on_host
? 1 : 0;
2877 cmd
->meta_ver
= rx_meta_ver
;
2879 /* Delete the local aggr state, on host */
2880 ret
= ath6kl_wmi_cmd_send(wmi
, skb
, WMI_RX_FRAME_FORMAT_CMDID
,
2886 int ath6kl_wmi_set_appie_cmd(struct wmi
*wmi
, u8 mgmt_frm_type
, const u8
*ie
,
2889 struct sk_buff
*skb
;
2890 struct wmi_set_appie_cmd
*p
;
2892 skb
= ath6kl_wmi_get_new_buf(sizeof(*p
) + ie_len
);
2896 ath6kl_dbg(ATH6KL_DBG_WMI
, "set_appie_cmd: mgmt_frm_type=%u "
2897 "ie_len=%u\n", mgmt_frm_type
, ie_len
);
2898 p
= (struct wmi_set_appie_cmd
*) skb
->data
;
2899 p
->mgmt_frm_type
= mgmt_frm_type
;
2901 memcpy(p
->ie_info
, ie
, ie_len
);
2902 return ath6kl_wmi_cmd_send(wmi
, skb
, WMI_SET_APPIE_CMDID
,
2906 int ath6kl_wmi_disable_11b_rates_cmd(struct wmi
*wmi
, bool disable
)
2908 struct sk_buff
*skb
;
2909 struct wmi_disable_11b_rates_cmd
*cmd
;
2911 skb
= ath6kl_wmi_get_new_buf(sizeof(*cmd
));
2915 ath6kl_dbg(ATH6KL_DBG_WMI
, "disable_11b_rates_cmd: disable=%u\n",
2917 cmd
= (struct wmi_disable_11b_rates_cmd
*) skb
->data
;
2918 cmd
->disable
= disable
? 1 : 0;
2920 return ath6kl_wmi_cmd_send(wmi
, skb
, WMI_DISABLE_11B_RATES_CMDID
,
2924 int ath6kl_wmi_remain_on_chnl_cmd(struct wmi
*wmi
, u32 freq
, u32 dur
)
2926 struct sk_buff
*skb
;
2927 struct wmi_remain_on_chnl_cmd
*p
;
2929 skb
= ath6kl_wmi_get_new_buf(sizeof(*p
));
2933 ath6kl_dbg(ATH6KL_DBG_WMI
, "remain_on_chnl_cmd: freq=%u dur=%u\n",
2935 p
= (struct wmi_remain_on_chnl_cmd
*) skb
->data
;
2936 p
->freq
= cpu_to_le32(freq
);
2937 p
->duration
= cpu_to_le32(dur
);
2938 return ath6kl_wmi_cmd_send(wmi
, skb
, WMI_REMAIN_ON_CHNL_CMDID
,
2942 int ath6kl_wmi_send_action_cmd(struct wmi
*wmi
, u32 id
, u32 freq
, u32 wait
,
2943 const u8
*data
, u16 data_len
)
2945 struct sk_buff
*skb
;
2946 struct wmi_send_action_cmd
*p
;
2950 return -EINVAL
; /* Offload for wait not supported */
2952 buf
= kmalloc(data_len
, GFP_KERNEL
);
2956 skb
= ath6kl_wmi_get_new_buf(sizeof(*p
) + data_len
);
2962 kfree(wmi
->last_mgmt_tx_frame
);
2963 wmi
->last_mgmt_tx_frame
= buf
;
2964 wmi
->last_mgmt_tx_frame_len
= data_len
;
2966 ath6kl_dbg(ATH6KL_DBG_WMI
, "send_action_cmd: id=%u freq=%u wait=%u "
2967 "len=%u\n", id
, freq
, wait
, data_len
);
2968 p
= (struct wmi_send_action_cmd
*) skb
->data
;
2969 p
->id
= cpu_to_le32(id
);
2970 p
->freq
= cpu_to_le32(freq
);
2971 p
->wait
= cpu_to_le32(wait
);
2972 p
->len
= cpu_to_le16(data_len
);
2973 memcpy(p
->data
, data
, data_len
);
2974 return ath6kl_wmi_cmd_send(wmi
, skb
, WMI_SEND_ACTION_CMDID
,
2978 int ath6kl_wmi_send_probe_response_cmd(struct wmi
*wmi
, u32 freq
,
2980 const u8
*data
, u16 data_len
)
2982 struct sk_buff
*skb
;
2983 struct wmi_p2p_probe_response_cmd
*p
;
2985 skb
= ath6kl_wmi_get_new_buf(sizeof(*p
) + data_len
);
2989 ath6kl_dbg(ATH6KL_DBG_WMI
, "send_probe_response_cmd: freq=%u dst=%pM "
2990 "len=%u\n", freq
, dst
, data_len
);
2991 p
= (struct wmi_p2p_probe_response_cmd
*) skb
->data
;
2992 p
->freq
= cpu_to_le32(freq
);
2993 memcpy(p
->destination_addr
, dst
, ETH_ALEN
);
2994 p
->len
= cpu_to_le16(data_len
);
2995 memcpy(p
->data
, data
, data_len
);
2996 return ath6kl_wmi_cmd_send(wmi
, skb
, WMI_SEND_PROBE_RESPONSE_CMDID
,
3000 int ath6kl_wmi_probe_report_req_cmd(struct wmi
*wmi
, bool enable
)
3002 struct sk_buff
*skb
;
3003 struct wmi_probe_req_report_cmd
*p
;
3005 skb
= ath6kl_wmi_get_new_buf(sizeof(*p
));
3009 ath6kl_dbg(ATH6KL_DBG_WMI
, "probe_report_req_cmd: enable=%u\n",
3011 p
= (struct wmi_probe_req_report_cmd
*) skb
->data
;
3012 p
->enable
= enable
? 1 : 0;
3013 return ath6kl_wmi_cmd_send(wmi
, skb
, WMI_PROBE_REQ_REPORT_CMDID
,
3017 int ath6kl_wmi_info_req_cmd(struct wmi
*wmi
, u32 info_req_flags
)
3019 struct sk_buff
*skb
;
3020 struct wmi_get_p2p_info
*p
;
3022 skb
= ath6kl_wmi_get_new_buf(sizeof(*p
));
3026 ath6kl_dbg(ATH6KL_DBG_WMI
, "info_req_cmd: flags=%x\n",
3028 p
= (struct wmi_get_p2p_info
*) skb
->data
;
3029 p
->info_req_flags
= cpu_to_le32(info_req_flags
);
3030 return ath6kl_wmi_cmd_send(wmi
, skb
, WMI_GET_P2P_INFO_CMDID
,
3034 int ath6kl_wmi_cancel_remain_on_chnl_cmd(struct wmi
*wmi
)
3036 ath6kl_dbg(ATH6KL_DBG_WMI
, "cancel_remain_on_chnl_cmd\n");
3037 return ath6kl_wmi_simple_cmd(wmi
, WMI_CANCEL_REMAIN_ON_CHNL_CMDID
);
3040 static int ath6kl_wmi_control_rx_xtnd(struct wmi
*wmi
, struct sk_buff
*skb
)
3042 struct wmix_cmd_hdr
*cmd
;
3048 if (skb
->len
< sizeof(struct wmix_cmd_hdr
)) {
3049 ath6kl_err("bad packet 1\n");
3050 wmi
->stat
.cmd_len_err
++;
3054 cmd
= (struct wmix_cmd_hdr
*) skb
->data
;
3055 id
= le32_to_cpu(cmd
->cmd_id
);
3057 skb_pull(skb
, sizeof(struct wmix_cmd_hdr
));
3063 case WMIX_HB_CHALLENGE_RESP_EVENTID
:
3065 case WMIX_DBGLOG_EVENTID
:
3066 ath6kl_debug_fwlog_event(wmi
->parent_dev
, datap
, len
);
3069 ath6kl_err("unknown cmd id 0x%x\n", id
);
3070 wmi
->stat
.cmd_id_err
++;
3079 int ath6kl_wmi_control_rx(struct wmi
*wmi
, struct sk_buff
*skb
)
3081 struct wmi_cmd_hdr
*cmd
;
3087 if (WARN_ON(skb
== NULL
))
3090 if (skb
->len
< sizeof(struct wmi_cmd_hdr
)) {
3091 ath6kl_err("bad packet 1\n");
3093 wmi
->stat
.cmd_len_err
++;
3097 cmd
= (struct wmi_cmd_hdr
*) skb
->data
;
3098 id
= le16_to_cpu(cmd
->cmd_id
);
3100 skb_pull(skb
, sizeof(struct wmi_cmd_hdr
));
3105 ath6kl_dbg(ATH6KL_DBG_WMI
, "%s: wmi id: %d\n", __func__
, id
);
3106 ath6kl_dbg_dump(ATH6KL_DBG_RAW_BYTES
, "msg payload ", datap
, len
);
3109 case WMI_GET_BITRATE_CMDID
:
3110 ath6kl_dbg(ATH6KL_DBG_WMI
, "WMI_GET_BITRATE_CMDID\n");
3111 ret
= ath6kl_wmi_bitrate_reply_rx(wmi
, datap
, len
);
3113 case WMI_GET_CHANNEL_LIST_CMDID
:
3114 ath6kl_dbg(ATH6KL_DBG_WMI
, "WMI_GET_CHANNEL_LIST_CMDID\n");
3115 ret
= ath6kl_wmi_ch_list_reply_rx(wmi
, datap
, len
);
3117 case WMI_GET_TX_PWR_CMDID
:
3118 ath6kl_dbg(ATH6KL_DBG_WMI
, "WMI_GET_TX_PWR_CMDID\n");
3119 ret
= ath6kl_wmi_tx_pwr_reply_rx(wmi
, datap
, len
);
3121 case WMI_READY_EVENTID
:
3122 ath6kl_dbg(ATH6KL_DBG_WMI
, "WMI_READY_EVENTID\n");
3123 ret
= ath6kl_wmi_ready_event_rx(wmi
, datap
, len
);
3125 case WMI_CONNECT_EVENTID
:
3126 ath6kl_dbg(ATH6KL_DBG_WMI
, "WMI_CONNECT_EVENTID\n");
3127 ret
= ath6kl_wmi_connect_event_rx(wmi
, datap
, len
);
3129 case WMI_DISCONNECT_EVENTID
:
3130 ath6kl_dbg(ATH6KL_DBG_WMI
, "WMI_DISCONNECT_EVENTID\n");
3131 ret
= ath6kl_wmi_disconnect_event_rx(wmi
, datap
, len
);
3133 case WMI_PEER_NODE_EVENTID
:
3134 ath6kl_dbg(ATH6KL_DBG_WMI
, "WMI_PEER_NODE_EVENTID\n");
3135 ret
= ath6kl_wmi_peer_node_event_rx(wmi
, datap
, len
);
3137 case WMI_TKIP_MICERR_EVENTID
:
3138 ath6kl_dbg(ATH6KL_DBG_WMI
, "WMI_TKIP_MICERR_EVENTID\n");
3139 ret
= ath6kl_wmi_tkip_micerr_event_rx(wmi
, datap
, len
);
3141 case WMI_BSSINFO_EVENTID
:
3142 ath6kl_dbg(ATH6KL_DBG_WMI
, "WMI_BSSINFO_EVENTID\n");
3143 ath6kl_wmi_convert_bssinfo_hdr2_to_hdr(skb
, datap
);
3144 ret
= ath6kl_wmi_bssinfo_event_rx(wmi
, skb
->data
, skb
->len
);
3146 case WMI_REGDOMAIN_EVENTID
:
3147 ath6kl_dbg(ATH6KL_DBG_WMI
, "WMI_REGDOMAIN_EVENTID\n");
3148 ath6kl_wmi_regdomain_event(wmi
, datap
, len
);
3150 case WMI_PSTREAM_TIMEOUT_EVENTID
:
3151 ath6kl_dbg(ATH6KL_DBG_WMI
, "WMI_PSTREAM_TIMEOUT_EVENTID\n");
3152 ret
= ath6kl_wmi_pstream_timeout_event_rx(wmi
, datap
, len
);
3154 case WMI_NEIGHBOR_REPORT_EVENTID
:
3155 ath6kl_dbg(ATH6KL_DBG_WMI
, "WMI_NEIGHBOR_REPORT_EVENTID\n");
3157 case WMI_SCAN_COMPLETE_EVENTID
:
3158 ath6kl_dbg(ATH6KL_DBG_WMI
, "WMI_SCAN_COMPLETE_EVENTID\n");
3159 ret
= ath6kl_wmi_scan_complete_rx(wmi
, datap
, len
);
3161 case WMI_CMDERROR_EVENTID
:
3162 ath6kl_dbg(ATH6KL_DBG_WMI
, "WMI_CMDERROR_EVENTID\n");
3163 ret
= ath6kl_wmi_error_event_rx(wmi
, datap
, len
);
3165 case WMI_REPORT_STATISTICS_EVENTID
:
3166 ath6kl_dbg(ATH6KL_DBG_WMI
, "WMI_REPORT_STATISTICS_EVENTID\n");
3167 ret
= ath6kl_wmi_stats_event_rx(wmi
, datap
, len
);
3169 case WMI_RSSI_THRESHOLD_EVENTID
:
3170 ath6kl_dbg(ATH6KL_DBG_WMI
, "WMI_RSSI_THRESHOLD_EVENTID\n");
3171 ret
= ath6kl_wmi_rssi_threshold_event_rx(wmi
, datap
, len
);
3173 case WMI_ERROR_REPORT_EVENTID
:
3174 ath6kl_dbg(ATH6KL_DBG_WMI
, "WMI_ERROR_REPORT_EVENTID\n");
3176 case WMI_OPT_RX_FRAME_EVENTID
:
3177 ath6kl_dbg(ATH6KL_DBG_WMI
, "WMI_OPT_RX_FRAME_EVENTID\n");
3178 ret
= ath6kl_wmi_opt_frame_event_rx(wmi
, datap
, len
);
3180 case WMI_REPORT_ROAM_TBL_EVENTID
:
3181 ath6kl_dbg(ATH6KL_DBG_WMI
, "WMI_REPORT_ROAM_TBL_EVENTID\n");
3183 case WMI_EXTENSION_EVENTID
:
3184 ath6kl_dbg(ATH6KL_DBG_WMI
, "WMI_EXTENSION_EVENTID\n");
3185 ret
= ath6kl_wmi_control_rx_xtnd(wmi
, skb
);
3187 case WMI_CAC_EVENTID
:
3188 ath6kl_dbg(ATH6KL_DBG_WMI
, "WMI_CAC_EVENTID\n");
3189 ret
= ath6kl_wmi_cac_event_rx(wmi
, datap
, len
);
3191 case WMI_CHANNEL_CHANGE_EVENTID
:
3192 ath6kl_dbg(ATH6KL_DBG_WMI
, "WMI_CHANNEL_CHANGE_EVENTID\n");
3194 case WMI_REPORT_ROAM_DATA_EVENTID
:
3195 ath6kl_dbg(ATH6KL_DBG_WMI
, "WMI_REPORT_ROAM_DATA_EVENTID\n");
3197 case WMI_TEST_EVENTID
:
3198 ath6kl_dbg(ATH6KL_DBG_WMI
, "WMI_TEST_EVENTID\n");
3199 ret
= ath6kl_wmi_tcmd_test_report_rx(wmi
, datap
, len
);
3201 case WMI_GET_FIXRATES_CMDID
:
3202 ath6kl_dbg(ATH6KL_DBG_WMI
, "WMI_GET_FIXRATES_CMDID\n");
3203 ret
= ath6kl_wmi_ratemask_reply_rx(wmi
, datap
, len
);
3205 case WMI_TX_RETRY_ERR_EVENTID
:
3206 ath6kl_dbg(ATH6KL_DBG_WMI
, "WMI_TX_RETRY_ERR_EVENTID\n");
3208 case WMI_SNR_THRESHOLD_EVENTID
:
3209 ath6kl_dbg(ATH6KL_DBG_WMI
, "WMI_SNR_THRESHOLD_EVENTID\n");
3210 ret
= ath6kl_wmi_snr_threshold_event_rx(wmi
, datap
, len
);
3212 case WMI_LQ_THRESHOLD_EVENTID
:
3213 ath6kl_dbg(ATH6KL_DBG_WMI
, "WMI_LQ_THRESHOLD_EVENTID\n");
3215 case WMI_APLIST_EVENTID
:
3216 ath6kl_dbg(ATH6KL_DBG_WMI
, "WMI_APLIST_EVENTID\n");
3217 ret
= ath6kl_wmi_aplist_event_rx(wmi
, datap
, len
);
3219 case WMI_GET_KEEPALIVE_CMDID
:
3220 ath6kl_dbg(ATH6KL_DBG_WMI
, "WMI_GET_KEEPALIVE_CMDID\n");
3221 ret
= ath6kl_wmi_keepalive_reply_rx(wmi
, datap
, len
);
3223 case WMI_GET_WOW_LIST_EVENTID
:
3224 ath6kl_dbg(ATH6KL_DBG_WMI
, "WMI_GET_WOW_LIST_EVENTID\n");
3225 ret
= ath6kl_wmi_get_wow_list_event_rx(wmi
, datap
, len
);
3227 case WMI_GET_PMKID_LIST_EVENTID
:
3228 ath6kl_dbg(ATH6KL_DBG_WMI
, "WMI_GET_PMKID_LIST_EVENTID\n");
3229 ret
= ath6kl_wmi_get_pmkid_list_event_rx(wmi
, datap
, len
);
3231 case WMI_PSPOLL_EVENTID
:
3232 ath6kl_dbg(ATH6KL_DBG_WMI
, "WMI_PSPOLL_EVENTID\n");
3233 ret
= ath6kl_wmi_pspoll_event_rx(wmi
, datap
, len
);
3235 case WMI_DTIMEXPIRY_EVENTID
:
3236 ath6kl_dbg(ATH6KL_DBG_WMI
, "WMI_DTIMEXPIRY_EVENTID\n");
3237 ret
= ath6kl_wmi_dtimexpiry_event_rx(wmi
, datap
, len
);
3239 case WMI_SET_PARAMS_REPLY_EVENTID
:
3240 ath6kl_dbg(ATH6KL_DBG_WMI
, "WMI_SET_PARAMS_REPLY_EVENTID\n");
3242 case WMI_ADDBA_REQ_EVENTID
:
3243 ath6kl_dbg(ATH6KL_DBG_WMI
, "WMI_ADDBA_REQ_EVENTID\n");
3244 ret
= ath6kl_wmi_addba_req_event_rx(wmi
, datap
, len
);
3246 case WMI_ADDBA_RESP_EVENTID
:
3247 ath6kl_dbg(ATH6KL_DBG_WMI
, "WMI_ADDBA_RESP_EVENTID\n");
3249 case WMI_DELBA_REQ_EVENTID
:
3250 ath6kl_dbg(ATH6KL_DBG_WMI
, "WMI_DELBA_REQ_EVENTID\n");
3251 ret
= ath6kl_wmi_delba_req_event_rx(wmi
, datap
, len
);
3253 case WMI_REPORT_BTCOEX_CONFIG_EVENTID
:
3254 ath6kl_dbg(ATH6KL_DBG_WMI
,
3255 "WMI_REPORT_BTCOEX_CONFIG_EVENTID\n");
3257 case WMI_REPORT_BTCOEX_STATS_EVENTID
:
3258 ath6kl_dbg(ATH6KL_DBG_WMI
,
3259 "WMI_REPORT_BTCOEX_STATS_EVENTID\n");
3261 case WMI_TX_COMPLETE_EVENTID
:
3262 ath6kl_dbg(ATH6KL_DBG_WMI
, "WMI_TX_COMPLETE_EVENTID\n");
3263 ret
= ath6kl_wmi_tx_complete_event_rx(datap
, len
);
3265 case WMI_REMAIN_ON_CHNL_EVENTID
:
3266 ath6kl_dbg(ATH6KL_DBG_WMI
, "WMI_REMAIN_ON_CHNL_EVENTID\n");
3267 ret
= ath6kl_wmi_remain_on_chnl_event_rx(wmi
, datap
, len
);
3269 case WMI_CANCEL_REMAIN_ON_CHNL_EVENTID
:
3270 ath6kl_dbg(ATH6KL_DBG_WMI
,
3271 "WMI_CANCEL_REMAIN_ON_CHNL_EVENTID\n");
3272 ret
= ath6kl_wmi_cancel_remain_on_chnl_event_rx(wmi
, datap
,
3275 case WMI_TX_STATUS_EVENTID
:
3276 ath6kl_dbg(ATH6KL_DBG_WMI
, "WMI_TX_STATUS_EVENTID\n");
3277 ret
= ath6kl_wmi_tx_status_event_rx(wmi
, datap
, len
);
3279 case WMI_RX_PROBE_REQ_EVENTID
:
3280 ath6kl_dbg(ATH6KL_DBG_WMI
, "WMI_RX_PROBE_REQ_EVENTID\n");
3281 ret
= ath6kl_wmi_rx_probe_req_event_rx(wmi
, datap
, len
);
3283 case WMI_P2P_CAPABILITIES_EVENTID
:
3284 ath6kl_dbg(ATH6KL_DBG_WMI
, "WMI_P2P_CAPABILITIES_EVENTID\n");
3285 ret
= ath6kl_wmi_p2p_capabilities_event_rx(datap
, len
);
3287 case WMI_RX_ACTION_EVENTID
:
3288 ath6kl_dbg(ATH6KL_DBG_WMI
, "WMI_RX_ACTION_EVENTID\n");
3289 ret
= ath6kl_wmi_rx_action_event_rx(wmi
, datap
, len
);
3291 case WMI_P2P_INFO_EVENTID
:
3292 ath6kl_dbg(ATH6KL_DBG_WMI
, "WMI_P2P_INFO_EVENTID\n");
3293 ret
= ath6kl_wmi_p2p_info_event_rx(datap
, len
);
3296 ath6kl_dbg(ATH6KL_DBG_WMI
, "unknown cmd id 0x%x\n", id
);
3297 wmi
->stat
.cmd_id_err
++;
3307 static void ath6kl_wmi_qos_state_init(struct wmi
*wmi
)
3312 spin_lock_bh(&wmi
->lock
);
3314 wmi
->fat_pipe_exist
= 0;
3315 memset(wmi
->stream_exist_for_ac
, 0, sizeof(wmi
->stream_exist_for_ac
));
3317 spin_unlock_bh(&wmi
->lock
);
3320 void *ath6kl_wmi_init(struct ath6kl
*dev
)
3324 wmi
= kzalloc(sizeof(struct wmi
), GFP_KERNEL
);
3328 spin_lock_init(&wmi
->lock
);
3330 wmi
->parent_dev
= dev
;
3332 ath6kl_wmi_qos_state_init(wmi
);
3334 wmi
->pwr_mode
= REC_POWER
;
3335 wmi
->phy_mode
= WMI_11G_MODE
;
3337 wmi
->pair_crypto_type
= NONE_CRYPT
;
3338 wmi
->grp_crypto_type
= NONE_CRYPT
;
3340 wmi
->ht_allowed
[A_BAND_24GHZ
] = 1;
3341 wmi
->ht_allowed
[A_BAND_5GHZ
] = 1;
3346 void ath6kl_wmi_shutdown(struct wmi
*wmi
)
3351 kfree(wmi
->last_mgmt_tx_frame
);