xref: /linux/drivers/net/wireless/marvell/mwifiex/sta_event.c (revision c532de5a67a70f8533d495f8f2aaa9a0491c3ad0)
1 // SPDX-License-Identifier: GPL-2.0-only
2 /*
3  * NXP Wireless LAN device driver: station event handling
4  *
5  * Copyright 2011-2020 NXP
6  */
7 
8 #include "decl.h"
9 #include "ioctl.h"
10 #include "util.h"
11 #include "fw.h"
12 #include "main.h"
13 #include "wmm.h"
14 #include "11n.h"
15 
16 #define MWIFIEX_IBSS_CONNECT_EVT_FIX_SIZE    12
17 
18 static int mwifiex_check_ibss_peer_capabilities(struct mwifiex_private *priv,
19 					        struct mwifiex_sta_node *sta_ptr,
20 					        struct sk_buff *event)
21 {
22 	int evt_len, ele_len;
23 	u8 *curr;
24 	struct ieee_types_header *ele_hdr;
25 	struct mwifiex_ie_types_mgmt_frame *tlv_mgmt_frame;
26 	const struct ieee80211_ht_cap *ht_cap;
27 	const struct ieee80211_vht_cap *vht_cap;
28 
29 	skb_pull(event, MWIFIEX_IBSS_CONNECT_EVT_FIX_SIZE);
30 	evt_len = event->len;
31 	curr = event->data;
32 
33 	mwifiex_dbg_dump(priv->adapter, EVT_D, "ibss peer capabilities:",
34 			 event->data, event->len);
35 
36 	skb_push(event, MWIFIEX_IBSS_CONNECT_EVT_FIX_SIZE);
37 
38 	tlv_mgmt_frame = (void *)curr;
39 	if (evt_len >= sizeof(*tlv_mgmt_frame) &&
40 	    le16_to_cpu(tlv_mgmt_frame->header.type) ==
41 	    TLV_TYPE_UAP_MGMT_FRAME) {
42 		/* Locate curr pointer to the start of beacon tlv,
43 		 * timestamp 8 bytes, beacon intervel 2 bytes,
44 		 * capability info 2 bytes, totally 12 byte beacon header
45 		 */
46 		evt_len = le16_to_cpu(tlv_mgmt_frame->header.len);
47 		curr += (sizeof(*tlv_mgmt_frame) + 12);
48 	} else {
49 		mwifiex_dbg(priv->adapter, MSG,
50 			    "management frame tlv not found!\n");
51 		return 0;
52 	}
53 
54 	while (evt_len >= sizeof(*ele_hdr)) {
55 		ele_hdr = (struct ieee_types_header *)curr;
56 		ele_len = ele_hdr->len;
57 
58 		if (evt_len < ele_len + sizeof(*ele_hdr))
59 			break;
60 
61 		switch (ele_hdr->element_id) {
62 		case WLAN_EID_HT_CAPABILITY:
63 			sta_ptr->is_11n_enabled = true;
64 			ht_cap = (void *)(ele_hdr + 2);
65 			sta_ptr->max_amsdu = le16_to_cpu(ht_cap->cap_info) &
66 				IEEE80211_HT_CAP_MAX_AMSDU ?
67 				MWIFIEX_TX_DATA_BUF_SIZE_8K :
68 				MWIFIEX_TX_DATA_BUF_SIZE_4K;
69 			mwifiex_dbg(priv->adapter, INFO,
70 				    "11n enabled!, max_amsdu : %d\n",
71 				    sta_ptr->max_amsdu);
72 			break;
73 
74 		case WLAN_EID_VHT_CAPABILITY:
75 			sta_ptr->is_11ac_enabled = true;
76 			vht_cap = (void *)(ele_hdr + 2);
77 			/* check VHT MAXMPDU capability */
78 			switch (le32_to_cpu(vht_cap->vht_cap_info) & 0x3) {
79 			case IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_11454:
80 				sta_ptr->max_amsdu =
81 					MWIFIEX_TX_DATA_BUF_SIZE_12K;
82 				break;
83 			case IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_7991:
84 				sta_ptr->max_amsdu =
85 					MWIFIEX_TX_DATA_BUF_SIZE_8K;
86 				break;
87 			case IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_3895:
88 				sta_ptr->max_amsdu =
89 					MWIFIEX_TX_DATA_BUF_SIZE_4K;
90 				break;
91 			default:
92 				break;
93 			}
94 
95 			mwifiex_dbg(priv->adapter, INFO,
96 				    "11ac enabled!, max_amsdu : %d\n",
97 				    sta_ptr->max_amsdu);
98 			break;
99 		default:
100 			break;
101 		}
102 
103 		curr += (ele_len + sizeof(*ele_hdr));
104 		evt_len -= (ele_len + sizeof(*ele_hdr));
105 	}
106 
107 	return 0;
108 }
109 
110 /*
111  * This function resets the connection state.
112  *
113  * The function is invoked after receiving a disconnect event from firmware,
114  * and performs the following actions -
115  *      - Set media status to disconnected
116  *      - Clean up Tx and Rx packets
117  *      - Resets SNR/NF/RSSI value in driver
118  *      - Resets security configurations in driver
119  *      - Enables auto data rate
120  *      - Saves the previous SSID and BSSID so that they can
121  *        be used for re-association, if required
122  *      - Erases current SSID and BSSID information
123  *      - Sends a disconnect event to upper layers/applications.
124  */
125 void mwifiex_reset_connect_state(struct mwifiex_private *priv, u16 reason_code,
126 				 bool from_ap)
127 {
128 	struct mwifiex_adapter *adapter = priv->adapter;
129 
130 	if (!priv->media_connected)
131 		return;
132 
133 	mwifiex_dbg(adapter, INFO,
134 		    "info: handles disconnect event\n");
135 
136 	priv->media_connected = false;
137 
138 	priv->auth_flag = 0;
139 	priv->auth_alg = WLAN_AUTH_NONE;
140 
141 	priv->scan_block = false;
142 	priv->port_open = false;
143 
144 	if ((GET_BSS_ROLE(priv) == MWIFIEX_BSS_ROLE_STA) &&
145 	    ISSUPP_TDLS_ENABLED(priv->adapter->fw_cap_info)) {
146 		mwifiex_disable_all_tdls_links(priv);
147 
148 		if (priv->adapter->auto_tdls)
149 			mwifiex_clean_auto_tdls(priv);
150 	}
151 
152 	/* Free Tx and Rx packets, report disconnect to upper layer */
153 	mwifiex_clean_txrx(priv);
154 
155 	/* Reset SNR/NF/RSSI values */
156 	priv->data_rssi_last = 0;
157 	priv->data_nf_last = 0;
158 	priv->data_rssi_avg = 0;
159 	priv->data_nf_avg = 0;
160 	priv->bcn_rssi_last = 0;
161 	priv->bcn_nf_last = 0;
162 	priv->bcn_rssi_avg = 0;
163 	priv->bcn_nf_avg = 0;
164 	priv->rxpd_rate = 0;
165 	priv->rxpd_htinfo = 0;
166 	priv->sec_info.wpa_enabled = false;
167 	priv->sec_info.wpa2_enabled = false;
168 	priv->wpa_ie_len = 0;
169 
170 	priv->sec_info.wapi_enabled = false;
171 	priv->wapi_ie_len = 0;
172 	priv->sec_info.wapi_key_on = false;
173 
174 	priv->sec_info.encryption_mode = 0;
175 
176 	/* Enable auto data rate */
177 	priv->is_data_rate_auto = true;
178 	priv->data_rate = 0;
179 
180 	priv->assoc_resp_ht_param = 0;
181 	priv->ht_param_present = false;
182 
183 	if ((GET_BSS_ROLE(priv) == MWIFIEX_BSS_ROLE_STA ||
184 	     GET_BSS_ROLE(priv) == MWIFIEX_BSS_ROLE_UAP) && priv->hist_data)
185 		mwifiex_hist_data_reset(priv);
186 
187 	if (priv->bss_mode == NL80211_IFTYPE_ADHOC) {
188 		priv->adhoc_state = ADHOC_IDLE;
189 		priv->adhoc_is_link_sensed = false;
190 	}
191 
192 	/*
193 	 * Memorize the previous SSID and BSSID so
194 	 * it could be used for re-assoc
195 	 */
196 
197 	mwifiex_dbg(adapter, INFO,
198 		    "info: previous SSID=%s, SSID len=%u\n",
199 		    priv->prev_ssid.ssid, priv->prev_ssid.ssid_len);
200 
201 	mwifiex_dbg(adapter, INFO,
202 		    "info: current SSID=%s, SSID len=%u\n",
203 		    priv->curr_bss_params.bss_descriptor.ssid.ssid,
204 		    priv->curr_bss_params.bss_descriptor.ssid.ssid_len);
205 
206 	memcpy(&priv->prev_ssid,
207 	       &priv->curr_bss_params.bss_descriptor.ssid,
208 	       sizeof(struct cfg80211_ssid));
209 
210 	memcpy(priv->prev_bssid,
211 	       priv->curr_bss_params.bss_descriptor.mac_address, ETH_ALEN);
212 
213 	/* Need to erase the current SSID and BSSID info */
214 	memset(&priv->curr_bss_params, 0x00, sizeof(priv->curr_bss_params));
215 
216 	adapter->tx_lock_flag = false;
217 	adapter->pps_uapsd_mode = false;
218 
219 	if (test_bit(MWIFIEX_IS_CMD_TIMEDOUT, &adapter->work_flags) &&
220 	    adapter->curr_cmd)
221 		return;
222 	priv->media_connected = false;
223 	mwifiex_dbg(adapter, MSG,
224 		    "info: successfully disconnected from %pM: reason code %d\n",
225 		    priv->cfg_bssid, reason_code);
226 	if (priv->bss_mode == NL80211_IFTYPE_STATION ||
227 	    priv->bss_mode == NL80211_IFTYPE_P2P_CLIENT) {
228 		if (adapter->host_mlme_enabled && adapter->host_mlme_link_lost)
229 			mwifiex_host_mlme_disconnect(adapter->priv_link_lost,
230 						     reason_code, NULL);
231 		else
232 			cfg80211_disconnected(priv->netdev, reason_code, NULL,
233 					      0, !from_ap, GFP_KERNEL);
234 	}
235 	eth_zero_addr(priv->cfg_bssid);
236 
237 	mwifiex_stop_net_dev_queue(priv->netdev, adapter);
238 	if (netif_carrier_ok(priv->netdev))
239 		netif_carrier_off(priv->netdev);
240 
241 	if (!ISSUPP_FIRMWARE_SUPPLICANT(priv->adapter->fw_cap_info))
242 		return;
243 
244 	mwifiex_send_cmd(priv, HostCmd_CMD_GTK_REKEY_OFFLOAD_CFG,
245 			 HostCmd_ACT_GEN_REMOVE, 0, NULL, false);
246 }
247 
248 static int mwifiex_parse_tdls_event(struct mwifiex_private *priv,
249 				    struct sk_buff *event_skb)
250 {
251 	int ret = 0;
252 	struct mwifiex_adapter *adapter = priv->adapter;
253 	struct mwifiex_sta_node *sta_ptr;
254 	struct mwifiex_tdls_generic_event *tdls_evt =
255 			(void *)event_skb->data + sizeof(adapter->event_cause);
256 	u8 *mac = tdls_evt->peer_mac;
257 
258 	/* reserved 2 bytes are not mandatory in tdls event */
259 	if (event_skb->len < (sizeof(struct mwifiex_tdls_generic_event) -
260 			      sizeof(u16) - sizeof(adapter->event_cause))) {
261 		mwifiex_dbg(adapter, ERROR, "Invalid event length!\n");
262 		return -1;
263 	}
264 
265 	sta_ptr = mwifiex_get_sta_entry(priv, tdls_evt->peer_mac);
266 	if (!sta_ptr) {
267 		mwifiex_dbg(adapter, ERROR, "cannot get sta entry!\n");
268 		return -1;
269 	}
270 
271 	switch (le16_to_cpu(tdls_evt->type)) {
272 	case TDLS_EVENT_LINK_TEAR_DOWN:
273 		cfg80211_tdls_oper_request(priv->netdev,
274 					   tdls_evt->peer_mac,
275 					   NL80211_TDLS_TEARDOWN,
276 					   le16_to_cpu(tdls_evt->u.reason_code),
277 					   GFP_KERNEL);
278 		break;
279 	case TDLS_EVENT_CHAN_SWITCH_RESULT:
280 		mwifiex_dbg(adapter, EVENT, "tdls channel switch result :\n");
281 		mwifiex_dbg(adapter, EVENT,
282 			    "status=0x%x, reason=0x%x cur_chan=%d\n",
283 			    tdls_evt->u.switch_result.status,
284 			    tdls_evt->u.switch_result.reason,
285 			    tdls_evt->u.switch_result.cur_chan);
286 
287 		/* tdls channel switch failed */
288 		if (tdls_evt->u.switch_result.status != 0) {
289 			switch (tdls_evt->u.switch_result.cur_chan) {
290 			case TDLS_BASE_CHANNEL:
291 				sta_ptr->tdls_status = TDLS_IN_BASE_CHAN;
292 				break;
293 			case TDLS_OFF_CHANNEL:
294 				sta_ptr->tdls_status = TDLS_IN_OFF_CHAN;
295 				break;
296 			default:
297 				break;
298 			}
299 			return ret;
300 		}
301 
302 		/* tdls channel switch success */
303 		switch (tdls_evt->u.switch_result.cur_chan) {
304 		case TDLS_BASE_CHANNEL:
305 			if (sta_ptr->tdls_status == TDLS_IN_BASE_CHAN)
306 				break;
307 			mwifiex_update_ralist_tx_pause_in_tdls_cs(priv, mac,
308 								  false);
309 			sta_ptr->tdls_status = TDLS_IN_BASE_CHAN;
310 			break;
311 		case TDLS_OFF_CHANNEL:
312 			if (sta_ptr->tdls_status == TDLS_IN_OFF_CHAN)
313 				break;
314 			mwifiex_update_ralist_tx_pause_in_tdls_cs(priv, mac,
315 								  true);
316 			sta_ptr->tdls_status = TDLS_IN_OFF_CHAN;
317 			break;
318 		default:
319 			break;
320 		}
321 
322 		break;
323 	case TDLS_EVENT_START_CHAN_SWITCH:
324 		mwifiex_dbg(adapter, EVENT, "tdls start channel switch...\n");
325 		sta_ptr->tdls_status = TDLS_CHAN_SWITCHING;
326 		break;
327 	case TDLS_EVENT_CHAN_SWITCH_STOPPED:
328 		mwifiex_dbg(adapter, EVENT,
329 			    "tdls chan switch stopped, reason=%d\n",
330 			    tdls_evt->u.cs_stop_reason);
331 		break;
332 	default:
333 		break;
334 	}
335 
336 	return ret;
337 }
338 
339 static void mwifiex_process_uap_tx_pause(struct mwifiex_private *priv,
340 					 struct mwifiex_ie_types_header *tlv)
341 {
342 	struct mwifiex_tx_pause_tlv *tp;
343 	struct mwifiex_sta_node *sta_ptr;
344 
345 	tp = (void *)tlv;
346 	mwifiex_dbg(priv->adapter, EVENT,
347 		    "uap tx_pause: %pM pause=%d, pkts=%d\n",
348 		    tp->peermac, tp->tx_pause,
349 		    tp->pkt_cnt);
350 
351 	if (ether_addr_equal(tp->peermac, priv->netdev->dev_addr)) {
352 		if (tp->tx_pause)
353 			priv->port_open = false;
354 		else
355 			priv->port_open = true;
356 	} else if (is_multicast_ether_addr(tp->peermac)) {
357 		mwifiex_update_ralist_tx_pause(priv, tp->peermac, tp->tx_pause);
358 	} else {
359 		spin_lock_bh(&priv->sta_list_spinlock);
360 		sta_ptr = mwifiex_get_sta_entry(priv, tp->peermac);
361 		if (sta_ptr && sta_ptr->tx_pause != tp->tx_pause) {
362 			sta_ptr->tx_pause = tp->tx_pause;
363 			spin_unlock_bh(&priv->sta_list_spinlock);
364 			mwifiex_update_ralist_tx_pause(priv, tp->peermac,
365 						       tp->tx_pause);
366 		} else {
367 			spin_unlock_bh(&priv->sta_list_spinlock);
368 		}
369 	}
370 }
371 
372 static void mwifiex_process_sta_tx_pause(struct mwifiex_private *priv,
373 					 struct mwifiex_ie_types_header *tlv)
374 {
375 	struct mwifiex_tx_pause_tlv *tp;
376 	struct mwifiex_sta_node *sta_ptr;
377 	int status;
378 
379 	tp = (void *)tlv;
380 	mwifiex_dbg(priv->adapter, EVENT,
381 		    "sta tx_pause: %pM pause=%d, pkts=%d\n",
382 		    tp->peermac, tp->tx_pause,
383 		    tp->pkt_cnt);
384 
385 	if (ether_addr_equal(tp->peermac, priv->cfg_bssid)) {
386 		if (tp->tx_pause)
387 			priv->port_open = false;
388 		else
389 			priv->port_open = true;
390 	} else {
391 		if (!ISSUPP_TDLS_ENABLED(priv->adapter->fw_cap_info))
392 			return;
393 
394 		status = mwifiex_get_tdls_link_status(priv, tp->peermac);
395 		if (mwifiex_is_tdls_link_setup(status)) {
396 			spin_lock_bh(&priv->sta_list_spinlock);
397 			sta_ptr = mwifiex_get_sta_entry(priv, tp->peermac);
398 			if (sta_ptr && sta_ptr->tx_pause != tp->tx_pause) {
399 				sta_ptr->tx_pause = tp->tx_pause;
400 				spin_unlock_bh(&priv->sta_list_spinlock);
401 				mwifiex_update_ralist_tx_pause(priv,
402 							       tp->peermac,
403 							       tp->tx_pause);
404 			} else {
405 				spin_unlock_bh(&priv->sta_list_spinlock);
406 			}
407 		}
408 	}
409 }
410 
411 void mwifiex_process_multi_chan_event(struct mwifiex_private *priv,
412 				      struct sk_buff *event_skb)
413 {
414 	struct mwifiex_ie_types_multi_chan_info *chan_info;
415 	struct mwifiex_ie_types_mc_group_info *grp_info;
416 	struct mwifiex_adapter *adapter = priv->adapter;
417 	struct mwifiex_ie_types_header *tlv;
418 	u16 tlv_buf_left, tlv_type, tlv_len;
419 	int intf_num, bss_type, bss_num, i;
420 	struct mwifiex_private *intf_priv;
421 
422 	tlv_buf_left = event_skb->len - sizeof(u32);
423 	chan_info = (void *)event_skb->data + sizeof(u32);
424 
425 	if (le16_to_cpu(chan_info->header.type) != TLV_TYPE_MULTI_CHAN_INFO ||
426 	    tlv_buf_left < sizeof(struct mwifiex_ie_types_multi_chan_info)) {
427 		mwifiex_dbg(adapter, ERROR,
428 			    "unknown TLV in chan_info event\n");
429 		return;
430 	}
431 
432 	adapter->usb_mc_status = le16_to_cpu(chan_info->status);
433 	mwifiex_dbg(adapter, EVENT, "multi chan operation %s\n",
434 		    adapter->usb_mc_status ? "started" : "over");
435 
436 	tlv_buf_left -= sizeof(struct mwifiex_ie_types_multi_chan_info);
437 	tlv = (struct mwifiex_ie_types_header *)chan_info->tlv_buffer;
438 
439 	while (tlv_buf_left >= (int)sizeof(struct mwifiex_ie_types_header)) {
440 		tlv_type = le16_to_cpu(tlv->type);
441 		tlv_len  = le16_to_cpu(tlv->len);
442 		if ((sizeof(struct mwifiex_ie_types_header) + tlv_len) >
443 		    tlv_buf_left) {
444 			mwifiex_dbg(adapter, ERROR, "wrong tlv: tlvLen=%d,\t"
445 				    "tlvBufLeft=%d\n", tlv_len, tlv_buf_left);
446 			break;
447 		}
448 		if (tlv_type != TLV_TYPE_MC_GROUP_INFO) {
449 			mwifiex_dbg(adapter, ERROR, "wrong tlv type: 0x%x\n",
450 				    tlv_type);
451 			break;
452 		}
453 
454 		grp_info = (struct mwifiex_ie_types_mc_group_info *)tlv;
455 		intf_num = grp_info->intf_num;
456 		for (i = 0; i < intf_num; i++) {
457 			bss_type = grp_info->bss_type_numlist[i] >> 4;
458 			bss_num = grp_info->bss_type_numlist[i] & BSS_NUM_MASK;
459 			intf_priv = mwifiex_get_priv_by_id(adapter, bss_num,
460 							   bss_type);
461 			if (!intf_priv) {
462 				mwifiex_dbg(adapter, ERROR,
463 					    "Invalid bss_type bss_num\t"
464 					    "in multi channel event\n");
465 				continue;
466 			}
467 			if (adapter->iface_type == MWIFIEX_USB) {
468 				u8 ep;
469 
470 				ep = grp_info->hid_num.usb_ep_num;
471 				if (ep == MWIFIEX_USB_EP_DATA ||
472 				    ep == MWIFIEX_USB_EP_DATA_CH2)
473 					intf_priv->usb_port = ep;
474 			}
475 		}
476 
477 		tlv_buf_left -= sizeof(struct mwifiex_ie_types_header) +
478 				tlv_len;
479 		tlv = (void *)((u8 *)tlv + tlv_len +
480 			       sizeof(struct mwifiex_ie_types_header));
481 	}
482 
483 	if (adapter->iface_type == MWIFIEX_USB) {
484 		adapter->tx_lock_flag = true;
485 		adapter->usb_mc_setup = true;
486 		mwifiex_multi_chan_resync(adapter);
487 	}
488 }
489 
490 void mwifiex_process_tx_pause_event(struct mwifiex_private *priv,
491 				    struct sk_buff *event_skb)
492 {
493 	struct mwifiex_ie_types_header *tlv;
494 	u16 tlv_type, tlv_len;
495 	int tlv_buf_left;
496 
497 	if (!priv->media_connected) {
498 		mwifiex_dbg(priv->adapter, ERROR,
499 			    "tx_pause event while disconnected; bss_role=%d\n",
500 			    priv->bss_role);
501 		return;
502 	}
503 
504 	tlv_buf_left = event_skb->len - sizeof(u32);
505 	tlv = (void *)event_skb->data + sizeof(u32);
506 
507 	while (tlv_buf_left >= (int)sizeof(struct mwifiex_ie_types_header)) {
508 		tlv_type = le16_to_cpu(tlv->type);
509 		tlv_len  = le16_to_cpu(tlv->len);
510 		if ((sizeof(struct mwifiex_ie_types_header) + tlv_len) >
511 		    tlv_buf_left) {
512 			mwifiex_dbg(priv->adapter, ERROR,
513 				    "wrong tlv: tlvLen=%d, tlvBufLeft=%d\n",
514 				    tlv_len, tlv_buf_left);
515 			break;
516 		}
517 		if (tlv_type == TLV_TYPE_TX_PAUSE) {
518 			if (GET_BSS_ROLE(priv) == MWIFIEX_BSS_ROLE_STA)
519 				mwifiex_process_sta_tx_pause(priv, tlv);
520 			else
521 				mwifiex_process_uap_tx_pause(priv, tlv);
522 		}
523 
524 		tlv_buf_left -= sizeof(struct mwifiex_ie_types_header) +
525 				tlv_len;
526 		tlv = (void *)((u8 *)tlv + tlv_len +
527 			       sizeof(struct mwifiex_ie_types_header));
528 	}
529 
530 }
531 
532 /*
533 * This function handles coex events generated by firmware
534 */
535 void mwifiex_bt_coex_wlan_param_update_event(struct mwifiex_private *priv,
536 					     struct sk_buff *event_skb)
537 {
538 	struct mwifiex_adapter *adapter = priv->adapter;
539 	struct mwifiex_ie_types_header *tlv;
540 	struct mwifiex_ie_types_btcoex_aggr_win_size *winsizetlv;
541 	struct mwifiex_ie_types_btcoex_scan_time *scantlv;
542 	s32 len = event_skb->len - sizeof(u32);
543 	u8 *cur_ptr = event_skb->data + sizeof(u32);
544 	u16 tlv_type, tlv_len;
545 
546 	while (len >= sizeof(struct mwifiex_ie_types_header)) {
547 		tlv = (struct mwifiex_ie_types_header *)cur_ptr;
548 		tlv_len = le16_to_cpu(tlv->len);
549 		tlv_type = le16_to_cpu(tlv->type);
550 
551 		if ((tlv_len + sizeof(struct mwifiex_ie_types_header)) > len)
552 			break;
553 		switch (tlv_type) {
554 		case TLV_BTCOEX_WL_AGGR_WINSIZE:
555 			winsizetlv =
556 			    (struct mwifiex_ie_types_btcoex_aggr_win_size *)tlv;
557 			adapter->coex_win_size = winsizetlv->coex_win_size;
558 			adapter->coex_tx_win_size =
559 				winsizetlv->tx_win_size;
560 			adapter->coex_rx_win_size =
561 				winsizetlv->rx_win_size;
562 			mwifiex_coex_ampdu_rxwinsize(adapter);
563 			mwifiex_update_ampdu_txwinsize(adapter);
564 			break;
565 
566 		case TLV_BTCOEX_WL_SCANTIME:
567 			scantlv =
568 			    (struct mwifiex_ie_types_btcoex_scan_time *)tlv;
569 			adapter->coex_scan = scantlv->coex_scan;
570 			adapter->coex_min_scan_time = le16_to_cpu(scantlv->min_scan_time);
571 			adapter->coex_max_scan_time = le16_to_cpu(scantlv->max_scan_time);
572 			break;
573 
574 		default:
575 			break;
576 		}
577 
578 		len -= tlv_len + sizeof(struct mwifiex_ie_types_header);
579 		cur_ptr += tlv_len +
580 			sizeof(struct mwifiex_ie_types_header);
581 	}
582 
583 	dev_dbg(adapter->dev, "coex_scan=%d min_scan=%d coex_win=%d, tx_win=%d rx_win=%d\n",
584 		adapter->coex_scan, adapter->coex_min_scan_time,
585 		adapter->coex_win_size, adapter->coex_tx_win_size,
586 		adapter->coex_rx_win_size);
587 }
588 
589 static void
590 mwifiex_fw_dump_info_event(struct mwifiex_private *priv,
591 			   struct sk_buff *event_skb)
592 {
593 	struct mwifiex_adapter *adapter = priv->adapter;
594 	struct mwifiex_fw_dump_header *fw_dump_hdr =
595 				(void *)adapter->event_body;
596 
597 	if (adapter->iface_type != MWIFIEX_USB) {
598 		mwifiex_dbg(adapter, MSG,
599 			    "event is not on usb interface, ignore it\n");
600 		return;
601 	}
602 
603 	if (!adapter->devdump_data) {
604 		/* When receive the first event, allocate device dump
605 		 * buffer, dump driver info.
606 		 */
607 		adapter->devdump_data = vzalloc(MWIFIEX_FW_DUMP_SIZE);
608 		if (!adapter->devdump_data) {
609 			mwifiex_dbg(adapter, ERROR,
610 				    "vzalloc devdump data failure!\n");
611 			return;
612 		}
613 
614 		mwifiex_drv_info_dump(adapter);
615 
616 		/* If no proceeded event arrive in 10s, upload device
617 		 * dump data, this will be useful if the end of
618 		 * transmission event get lost, in this cornel case,
619 		 * user would still get partial of the dump.
620 		 */
621 		schedule_delayed_work(&adapter->devdump_work,
622 				      msecs_to_jiffies(MWIFIEX_TIMER_10S));
623 	}
624 
625 	/* Overflow check */
626 	if (adapter->devdump_len + event_skb->len >= MWIFIEX_FW_DUMP_SIZE)
627 		goto upload_dump;
628 
629 	memmove(adapter->devdump_data + adapter->devdump_len,
630 		adapter->event_skb->data, event_skb->len);
631 	adapter->devdump_len += event_skb->len;
632 
633 	if (le16_to_cpu(fw_dump_hdr->type) == FW_DUMP_INFO_ENDED) {
634 		mwifiex_dbg(adapter, MSG,
635 			    "receive end of transmission flag event!\n");
636 		goto upload_dump;
637 	}
638 	return;
639 
640 upload_dump:
641 	cancel_delayed_work_sync(&adapter->devdump_work);
642 	mwifiex_upload_device_dump(adapter);
643 }
644 
645 /*
646  * This function handles events generated by firmware.
647  *
648  * This is a generic function and handles all events.
649  *
650  * Event specific routines are called by this function based
651  * upon the generated event cause.
652  *
653  * For the following events, the function just forwards them to upper
654  * layers, optionally recording the change -
655  *      - EVENT_LINK_SENSED
656  *      - EVENT_MIC_ERR_UNICAST
657  *      - EVENT_MIC_ERR_MULTICAST
658  *      - EVENT_PORT_RELEASE
659  *      - EVENT_RSSI_LOW
660  *      - EVENT_SNR_LOW
661  *      - EVENT_MAX_FAIL
662  *      - EVENT_RSSI_HIGH
663  *      - EVENT_SNR_HIGH
664  *      - EVENT_DATA_RSSI_LOW
665  *      - EVENT_DATA_SNR_LOW
666  *      - EVENT_DATA_RSSI_HIGH
667  *      - EVENT_DATA_SNR_HIGH
668  *      - EVENT_LINK_QUALITY
669  *      - EVENT_PRE_BEACON_LOST
670  *      - EVENT_IBSS_COALESCED
671  *      - EVENT_IBSS_STA_CONNECT
672  *      - EVENT_IBSS_STA_DISCONNECT
673  *      - EVENT_WEP_ICV_ERR
674  *      - EVENT_BW_CHANGE
675  *      - EVENT_HOSTWAKE_STAIE
676   *
677  * For the following events, no action is taken -
678  *      - EVENT_MIB_CHANGED
679  *      - EVENT_INIT_DONE
680  *      - EVENT_DUMMY_HOST_WAKEUP_SIGNAL
681  *
682  * Rest of the supported events requires driver handling -
683  *      - EVENT_DEAUTHENTICATED
684  *      - EVENT_DISASSOCIATED
685  *      - EVENT_LINK_LOST
686  *      - EVENT_PS_SLEEP
687  *      - EVENT_PS_AWAKE
688  *      - EVENT_DEEP_SLEEP_AWAKE
689  *      - EVENT_HS_ACT_REQ
690  *      - EVENT_ADHOC_BCN_LOST
691  *      - EVENT_BG_SCAN_REPORT
692  *      - EVENT_WMM_STATUS_CHANGE
693  *      - EVENT_ADDBA
694  *      - EVENT_DELBA
695  *      - EVENT_BA_STREAM_TIEMOUT
696  *      - EVENT_AMSDU_AGGR_CTRL
697  *      - EVENT_FW_DUMP_INFO
698  */
699 int mwifiex_process_sta_event(struct mwifiex_private *priv)
700 {
701 	struct mwifiex_adapter *adapter = priv->adapter;
702 	int ret = 0, i;
703 	u32 eventcause = adapter->event_cause;
704 	u16 ctrl, reason_code;
705 	u8 ibss_sta_addr[ETH_ALEN];
706 	struct mwifiex_sta_node *sta_ptr;
707 
708 	switch (eventcause) {
709 	case EVENT_DUMMY_HOST_WAKEUP_SIGNAL:
710 		mwifiex_dbg(adapter, ERROR,
711 			    "invalid EVENT: DUMMY_HOST_WAKEUP_SIGNAL, ignore it\n");
712 		break;
713 	case EVENT_LINK_SENSED:
714 		mwifiex_dbg(adapter, EVENT, "event: LINK_SENSED\n");
715 		if (!netif_carrier_ok(priv->netdev))
716 			netif_carrier_on(priv->netdev);
717 		mwifiex_wake_up_net_dev_queue(priv->netdev, adapter);
718 		break;
719 
720 	case EVENT_DEAUTHENTICATED:
721 		mwifiex_dbg(adapter, EVENT, "event: Deauthenticated\n");
722 		if (priv->wps.session_enable) {
723 			mwifiex_dbg(adapter, INFO,
724 				    "info: receive deauth event in wps session\n");
725 			break;
726 		}
727 		adapter->dbg.num_event_deauth++;
728 		if (priv->media_connected) {
729 			reason_code =
730 				get_unaligned_le16(adapter->event_body);
731 			mwifiex_reset_connect_state(priv, reason_code, true);
732 		}
733 		break;
734 
735 	case EVENT_DISASSOCIATED:
736 		mwifiex_dbg(adapter, EVENT, "event: Disassociated\n");
737 		if (priv->wps.session_enable) {
738 			mwifiex_dbg(adapter, INFO,
739 				    "info: receive disassoc event in wps session\n");
740 			break;
741 		}
742 		adapter->dbg.num_event_disassoc++;
743 		if (priv->media_connected) {
744 			reason_code =
745 				get_unaligned_le16(adapter->event_body);
746 			mwifiex_reset_connect_state(priv, reason_code, true);
747 		}
748 		break;
749 
750 	case EVENT_LINK_LOST:
751 		mwifiex_dbg(adapter, EVENT, "event: Link lost\n");
752 		adapter->dbg.num_event_link_lost++;
753 		if (priv->media_connected) {
754 			reason_code =
755 				get_unaligned_le16(adapter->event_body);
756 			if (adapter->host_mlme_enabled) {
757 				adapter->priv_link_lost = priv;
758 				adapter->host_mlme_link_lost = true;
759 				queue_work(adapter->host_mlme_workqueue,
760 					   &adapter->host_mlme_work);
761 			} else {
762 				mwifiex_reset_connect_state(priv, reason_code,
763 							    true);
764 			}
765 		}
766 		break;
767 
768 	case EVENT_PS_SLEEP:
769 		mwifiex_dbg(adapter, EVENT, "info: EVENT: SLEEP\n");
770 
771 		adapter->ps_state = PS_STATE_PRE_SLEEP;
772 
773 		mwifiex_check_ps_cond(adapter);
774 		break;
775 
776 	case EVENT_PS_AWAKE:
777 		mwifiex_dbg(adapter, EVENT, "info: EVENT: AWAKE\n");
778 		if (!adapter->pps_uapsd_mode &&
779 		    (priv->port_open ||
780 		     (priv->bss_mode == NL80211_IFTYPE_ADHOC)) &&
781 		    priv->media_connected && adapter->sleep_period.period) {
782 			adapter->pps_uapsd_mode = true;
783 			mwifiex_dbg(adapter, EVENT,
784 				    "event: PPS/UAPSD mode activated\n");
785 		}
786 		adapter->tx_lock_flag = false;
787 		if (adapter->pps_uapsd_mode && adapter->gen_null_pkt) {
788 			if (mwifiex_check_last_packet_indication(priv)) {
789 				if (adapter->data_sent ||
790 				    (adapter->if_ops.is_port_ready &&
791 				     !adapter->if_ops.is_port_ready(priv))) {
792 					adapter->ps_state = PS_STATE_AWAKE;
793 					adapter->pm_wakeup_card_req = false;
794 					adapter->pm_wakeup_fw_try = false;
795 					del_timer(&adapter->wakeup_timer);
796 					break;
797 				}
798 				if (!mwifiex_send_null_packet
799 					(priv,
800 					 MWIFIEX_TxPD_POWER_MGMT_NULL_PACKET |
801 					 MWIFIEX_TxPD_POWER_MGMT_LAST_PACKET))
802 						adapter->ps_state =
803 							PS_STATE_SLEEP;
804 					return 0;
805 			}
806 		}
807 		adapter->ps_state = PS_STATE_AWAKE;
808 		adapter->pm_wakeup_card_req = false;
809 		adapter->pm_wakeup_fw_try = false;
810 		del_timer(&adapter->wakeup_timer);
811 
812 		break;
813 
814 	case EVENT_DEEP_SLEEP_AWAKE:
815 		adapter->if_ops.wakeup_complete(adapter);
816 		mwifiex_dbg(adapter, EVENT, "event: DS_AWAKE\n");
817 		if (adapter->is_deep_sleep)
818 			adapter->is_deep_sleep = false;
819 		break;
820 
821 	case EVENT_HS_ACT_REQ:
822 		mwifiex_dbg(adapter, EVENT, "event: HS_ACT_REQ\n");
823 		ret = mwifiex_send_cmd(priv, HostCmd_CMD_802_11_HS_CFG_ENH,
824 				       0, 0, NULL, false);
825 		break;
826 
827 	case EVENT_MIC_ERR_UNICAST:
828 		mwifiex_dbg(adapter, EVENT, "event: UNICAST MIC ERROR\n");
829 		cfg80211_michael_mic_failure(priv->netdev, priv->cfg_bssid,
830 					     NL80211_KEYTYPE_PAIRWISE,
831 					     -1, NULL, GFP_KERNEL);
832 		break;
833 
834 	case EVENT_MIC_ERR_MULTICAST:
835 		mwifiex_dbg(adapter, EVENT, "event: MULTICAST MIC ERROR\n");
836 		cfg80211_michael_mic_failure(priv->netdev, priv->cfg_bssid,
837 					     NL80211_KEYTYPE_GROUP,
838 					     -1, NULL, GFP_KERNEL);
839 		break;
840 	case EVENT_MIB_CHANGED:
841 	case EVENT_INIT_DONE:
842 		break;
843 
844 	case EVENT_ADHOC_BCN_LOST:
845 		mwifiex_dbg(adapter, EVENT, "event: ADHOC_BCN_LOST\n");
846 		priv->adhoc_is_link_sensed = false;
847 		mwifiex_clean_txrx(priv);
848 		mwifiex_stop_net_dev_queue(priv->netdev, adapter);
849 		if (netif_carrier_ok(priv->netdev))
850 			netif_carrier_off(priv->netdev);
851 		break;
852 
853 	case EVENT_BG_SCAN_REPORT:
854 		mwifiex_dbg(adapter, EVENT, "event: BGS_REPORT\n");
855 		ret = mwifiex_send_cmd(priv, HostCmd_CMD_802_11_BG_SCAN_QUERY,
856 				       HostCmd_ACT_GEN_GET, 0, NULL, false);
857 		break;
858 
859 	case EVENT_BG_SCAN_STOPPED:
860 		dev_dbg(adapter->dev, "event: BGS_STOPPED\n");
861 		cfg80211_sched_scan_stopped(priv->wdev.wiphy, 0);
862 		if (priv->sched_scanning)
863 			priv->sched_scanning = false;
864 		break;
865 
866 	case EVENT_PORT_RELEASE:
867 		mwifiex_dbg(adapter, EVENT, "event: PORT RELEASE\n");
868 		priv->port_open = true;
869 		break;
870 
871 	case EVENT_EXT_SCAN_REPORT:
872 		mwifiex_dbg(adapter, EVENT, "event: EXT_SCAN Report\n");
873 		/* We intend to skip this event during suspend, but handle
874 		 * it in interface disabled case
875 		 */
876 		if (adapter->ext_scan && (!priv->scan_aborting ||
877 					  !netif_running(priv->netdev)))
878 			ret = mwifiex_handle_event_ext_scan_report(priv,
879 						adapter->event_skb->data);
880 
881 		break;
882 
883 	case EVENT_WMM_STATUS_CHANGE:
884 		mwifiex_dbg(adapter, EVENT, "event: WMM status changed\n");
885 		ret = mwifiex_send_cmd(priv, HostCmd_CMD_WMM_GET_STATUS,
886 				       0, 0, NULL, false);
887 		break;
888 
889 	case EVENT_RSSI_LOW:
890 		cfg80211_cqm_rssi_notify(priv->netdev,
891 					 NL80211_CQM_RSSI_THRESHOLD_EVENT_LOW,
892 					 0, GFP_KERNEL);
893 		mwifiex_send_cmd(priv, HostCmd_CMD_RSSI_INFO,
894 				 HostCmd_ACT_GEN_GET, 0, NULL, false);
895 		priv->subsc_evt_rssi_state = RSSI_LOW_RECVD;
896 		mwifiex_dbg(adapter, EVENT, "event: Beacon RSSI_LOW\n");
897 		break;
898 	case EVENT_SNR_LOW:
899 		mwifiex_dbg(adapter, EVENT, "event: Beacon SNR_LOW\n");
900 		break;
901 	case EVENT_MAX_FAIL:
902 		mwifiex_dbg(adapter, EVENT, "event: MAX_FAIL\n");
903 		break;
904 	case EVENT_RSSI_HIGH:
905 		cfg80211_cqm_rssi_notify(priv->netdev,
906 					 NL80211_CQM_RSSI_THRESHOLD_EVENT_HIGH,
907 					 0, GFP_KERNEL);
908 		mwifiex_send_cmd(priv, HostCmd_CMD_RSSI_INFO,
909 				 HostCmd_ACT_GEN_GET, 0, NULL, false);
910 		priv->subsc_evt_rssi_state = RSSI_HIGH_RECVD;
911 		mwifiex_dbg(adapter, EVENT, "event: Beacon RSSI_HIGH\n");
912 		break;
913 	case EVENT_SNR_HIGH:
914 		mwifiex_dbg(adapter, EVENT, "event: Beacon SNR_HIGH\n");
915 		break;
916 	case EVENT_DATA_RSSI_LOW:
917 		mwifiex_dbg(adapter, EVENT, "event: Data RSSI_LOW\n");
918 		break;
919 	case EVENT_DATA_SNR_LOW:
920 		mwifiex_dbg(adapter, EVENT, "event: Data SNR_LOW\n");
921 		break;
922 	case EVENT_DATA_RSSI_HIGH:
923 		mwifiex_dbg(adapter, EVENT, "event: Data RSSI_HIGH\n");
924 		break;
925 	case EVENT_DATA_SNR_HIGH:
926 		mwifiex_dbg(adapter, EVENT, "event: Data SNR_HIGH\n");
927 		break;
928 	case EVENT_LINK_QUALITY:
929 		mwifiex_dbg(adapter, EVENT, "event: Link Quality\n");
930 		break;
931 	case EVENT_PRE_BEACON_LOST:
932 		mwifiex_dbg(adapter, EVENT, "event: Pre-Beacon Lost\n");
933 		break;
934 	case EVENT_IBSS_COALESCED:
935 		mwifiex_dbg(adapter, EVENT, "event: IBSS_COALESCED\n");
936 		ret = mwifiex_send_cmd(priv,
937 				HostCmd_CMD_802_11_IBSS_COALESCING_STATUS,
938 				HostCmd_ACT_GEN_GET, 0, NULL, false);
939 		break;
940 	case EVENT_IBSS_STA_CONNECT:
941 		ether_addr_copy(ibss_sta_addr, adapter->event_body + 2);
942 		mwifiex_dbg(adapter, EVENT, "event: IBSS_STA_CONNECT %pM\n",
943 			    ibss_sta_addr);
944 		sta_ptr = mwifiex_add_sta_entry(priv, ibss_sta_addr);
945 		if (sta_ptr && adapter->adhoc_11n_enabled) {
946 			mwifiex_check_ibss_peer_capabilities(priv, sta_ptr,
947 							     adapter->event_skb);
948 			if (sta_ptr->is_11n_enabled)
949 				for (i = 0; i < MAX_NUM_TID; i++)
950 					sta_ptr->ampdu_sta[i] =
951 					priv->aggr_prio_tbl[i].ampdu_user;
952 			else
953 				for (i = 0; i < MAX_NUM_TID; i++)
954 					sta_ptr->ampdu_sta[i] =
955 						BA_STREAM_NOT_ALLOWED;
956 			memset(sta_ptr->rx_seq, 0xff, sizeof(sta_ptr->rx_seq));
957 		}
958 
959 		break;
960 	case EVENT_IBSS_STA_DISCONNECT:
961 		ether_addr_copy(ibss_sta_addr, adapter->event_body + 2);
962 		mwifiex_dbg(adapter, EVENT, "event: IBSS_STA_DISCONNECT %pM\n",
963 			    ibss_sta_addr);
964 		sta_ptr = mwifiex_get_sta_entry(priv, ibss_sta_addr);
965 		if (sta_ptr && sta_ptr->is_11n_enabled) {
966 			mwifiex_11n_del_rx_reorder_tbl_by_ta(priv,
967 							     ibss_sta_addr);
968 			mwifiex_del_tx_ba_stream_tbl_by_ra(priv, ibss_sta_addr);
969 		}
970 		mwifiex_wmm_del_peer_ra_list(priv, ibss_sta_addr);
971 		mwifiex_del_sta_entry(priv, ibss_sta_addr);
972 		break;
973 	case EVENT_ADDBA:
974 		mwifiex_dbg(adapter, EVENT, "event: ADDBA Request\n");
975 		mwifiex_send_cmd(priv, HostCmd_CMD_11N_ADDBA_RSP,
976 				 HostCmd_ACT_GEN_SET, 0,
977 				 adapter->event_body, false);
978 		break;
979 	case EVENT_DELBA:
980 		mwifiex_dbg(adapter, EVENT, "event: DELBA Request\n");
981 		mwifiex_11n_delete_ba_stream(priv, adapter->event_body);
982 		break;
983 	case EVENT_BA_STREAM_TIEMOUT:
984 		mwifiex_dbg(adapter, EVENT, "event:  BA Stream timeout\n");
985 		mwifiex_11n_ba_stream_timeout(priv,
986 					      (struct host_cmd_ds_11n_batimeout
987 					       *)
988 					      adapter->event_body);
989 		break;
990 	case EVENT_AMSDU_AGGR_CTRL:
991 		ctrl = get_unaligned_le16(adapter->event_body);
992 		mwifiex_dbg(adapter, EVENT,
993 			    "event: AMSDU_AGGR_CTRL %d\n", ctrl);
994 
995 		adapter->tx_buf_size =
996 				min_t(u16, adapter->curr_tx_buf_size, ctrl);
997 		mwifiex_dbg(adapter, EVENT, "event: tx_buf_size %d\n",
998 			    adapter->tx_buf_size);
999 		break;
1000 
1001 	case EVENT_WEP_ICV_ERR:
1002 		mwifiex_dbg(adapter, EVENT, "event: WEP ICV error\n");
1003 		break;
1004 
1005 	case EVENT_BW_CHANGE:
1006 		mwifiex_dbg(adapter, EVENT, "event: BW Change\n");
1007 		break;
1008 
1009 	case EVENT_HOSTWAKE_STAIE:
1010 		mwifiex_dbg(adapter, EVENT,
1011 			    "event: HOSTWAKE_STAIE %d\n", eventcause);
1012 		break;
1013 
1014 	case EVENT_REMAIN_ON_CHAN_EXPIRED:
1015 		mwifiex_dbg(adapter, EVENT,
1016 			    "event: Remain on channel expired\n");
1017 
1018 		if (adapter->host_mlme_enabled &&
1019 		    (priv->auth_flag & HOST_MLME_AUTH_PENDING)) {
1020 			priv->auth_flag = 0;
1021 			priv->auth_alg = WLAN_AUTH_NONE;
1022 		} else {
1023 			cfg80211_remain_on_channel_expired(&priv->wdev,
1024 							   priv->roc_cfg.cookie,
1025 							   &priv->roc_cfg.chan,
1026 							   GFP_ATOMIC);
1027 		}
1028 
1029 		memset(&priv->roc_cfg, 0x00, sizeof(struct mwifiex_roc_cfg));
1030 
1031 		break;
1032 
1033 	case EVENT_CHANNEL_SWITCH_ANN:
1034 		mwifiex_dbg(adapter, EVENT, "event: Channel Switch Announcement\n");
1035 		priv->csa_expire_time =
1036 				jiffies + msecs_to_jiffies(DFS_CHAN_MOVE_TIME);
1037 		priv->csa_chan = priv->curr_bss_params.bss_descriptor.channel;
1038 		ret = mwifiex_send_cmd(priv, HostCmd_CMD_802_11_DEAUTHENTICATE,
1039 			HostCmd_ACT_GEN_SET, 0,
1040 			priv->curr_bss_params.bss_descriptor.mac_address,
1041 			false);
1042 		break;
1043 
1044 	case EVENT_TDLS_GENERIC_EVENT:
1045 		ret = mwifiex_parse_tdls_event(priv, adapter->event_skb);
1046 		break;
1047 
1048 	case EVENT_TX_DATA_PAUSE:
1049 		mwifiex_dbg(adapter, EVENT, "event: TX DATA PAUSE\n");
1050 		mwifiex_process_tx_pause_event(priv, adapter->event_skb);
1051 		break;
1052 
1053 	case EVENT_MULTI_CHAN_INFO:
1054 		mwifiex_dbg(adapter, EVENT, "event: multi-chan info\n");
1055 		mwifiex_process_multi_chan_event(priv, adapter->event_skb);
1056 		break;
1057 
1058 	case EVENT_TX_STATUS_REPORT:
1059 		mwifiex_dbg(adapter, EVENT, "event: TX_STATUS Report\n");
1060 		mwifiex_parse_tx_status_event(priv, adapter->event_body);
1061 		break;
1062 
1063 	case EVENT_CHANNEL_REPORT_RDY:
1064 		mwifiex_dbg(adapter, EVENT, "event: Channel Report\n");
1065 		ret = mwifiex_11h_handle_chanrpt_ready(priv,
1066 						       adapter->event_skb);
1067 		break;
1068 	case EVENT_RADAR_DETECTED:
1069 		mwifiex_dbg(adapter, EVENT, "event: Radar detected\n");
1070 		ret = mwifiex_11h_handle_radar_detected(priv,
1071 							adapter->event_skb);
1072 		break;
1073 	case EVENT_BT_COEX_WLAN_PARA_CHANGE:
1074 		dev_dbg(adapter->dev, "EVENT: BT coex wlan param update\n");
1075 		if (adapter->ignore_btcoex_events)
1076 			break;
1077 
1078 		mwifiex_bt_coex_wlan_param_update_event(priv,
1079 							adapter->event_skb);
1080 		break;
1081 	case EVENT_RXBA_SYNC:
1082 		dev_dbg(adapter->dev, "EVENT: RXBA_SYNC\n");
1083 		mwifiex_11n_rxba_sync_event(priv, adapter->event_body,
1084 					    adapter->event_skb->len -
1085 					    sizeof(eventcause));
1086 		break;
1087 	case EVENT_FW_DUMP_INFO:
1088 		mwifiex_dbg(adapter, EVENT, "event: firmware debug info\n");
1089 		mwifiex_fw_dump_info_event(priv, adapter->event_skb);
1090 		break;
1091 	/* Debugging event; not used, but let's not print an ERROR for it. */
1092 	case EVENT_UNKNOWN_DEBUG:
1093 		mwifiex_dbg(adapter, EVENT, "event: debug\n");
1094 		break;
1095 	default:
1096 		mwifiex_dbg(adapter, ERROR, "event: unknown event id: %#x\n",
1097 			    eventcause);
1098 		break;
1099 	}
1100 
1101 	return ret;
1102 }
1103