blob: a422f3306d4d36e1a126d00940dc3876b32e0d15 [file] [log] [blame]
Bing Zhao5e6e3a92011-03-21 18:00:50 -07001/*
2 * Marvell Wireless LAN device driver: station event handling
3 *
Xinming Hu65da33f2014-06-19 21:38:57 -07004 * Copyright (C) 2011-2014, Marvell International Ltd.
Bing Zhao5e6e3a92011-03-21 18:00:50 -07005 *
6 * This software file (the "File") is distributed by Marvell International
7 * Ltd. under the terms of the GNU General Public License Version 2, June 1991
8 * (the "License"). You may use, redistribute and/or modify this File in
9 * accordance with the terms and conditions of the License, a copy of which
10 * is available by writing to the Free Software Foundation, Inc.,
11 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or on the
12 * worldwide web at http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
13 *
14 * THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE
15 * IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE
16 * ARE EXPRESSLY DISCLAIMED. The License provides additional details about
17 * this warranty disclaimer.
18 */
19
20#include "decl.h"
21#include "ioctl.h"
22#include "util.h"
23#include "fw.h"
24#include "main.h"
25#include "wmm.h"
26#include "11n.h"
27
28/*
29 * This function resets the connection state.
30 *
31 * The function is invoked after receiving a disconnect event from firmware,
32 * and performs the following actions -
33 * - Set media status to disconnected
34 * - Clean up Tx and Rx packets
35 * - Resets SNR/NF/RSSI value in driver
36 * - Resets security configurations in driver
37 * - Enables auto data rate
38 * - Saves the previous SSID and BSSID so that they can
39 * be used for re-association, if required
40 * - Erases current SSID and BSSID information
41 * - Sends a disconnect event to upper layers/applications.
42 */
Amitkumar Karwarc62d50a2016-05-25 08:37:35 -070043void mwifiex_reset_connect_state(struct mwifiex_private *priv, u16 reason_code,
44 bool from_ap)
Bing Zhao5e6e3a92011-03-21 18:00:50 -070045{
46 struct mwifiex_adapter *adapter = priv->adapter;
47
48 if (!priv->media_connected)
49 return;
50
Zhaoyang Liuacebe8c2015-05-12 00:48:20 +053051 mwifiex_dbg(adapter, INFO,
52 "info: handles disconnect event\n");
Bing Zhao5e6e3a92011-03-21 18:00:50 -070053
54 priv->media_connected = false;
55
56 priv->scan_block = false;
Avinash Patil5c8946332015-06-22 19:06:18 +053057 priv->port_open = false;
Bing Zhao5e6e3a92011-03-21 18:00:50 -070058
Avinash Patilbe104b92014-02-07 16:30:41 -080059 if ((GET_BSS_ROLE(priv) == MWIFIEX_BSS_ROLE_STA) &&
Avinash Patil9927baa2014-11-13 21:54:16 +053060 ISSUPP_TDLS_ENABLED(priv->adapter->fw_cap_info)) {
Avinash Patilbe104b92014-02-07 16:30:41 -080061 mwifiex_disable_all_tdls_links(priv);
62
Avinash Patil9927baa2014-11-13 21:54:16 +053063 if (priv->adapter->auto_tdls)
64 mwifiex_clean_auto_tdls(priv);
65 }
66
Bing Zhao5e6e3a92011-03-21 18:00:50 -070067 /* Free Tx and Rx packets, report disconnect to upper layer */
68 mwifiex_clean_txrx(priv);
69
70 /* Reset SNR/NF/RSSI values */
71 priv->data_rssi_last = 0;
72 priv->data_nf_last = 0;
73 priv->data_rssi_avg = 0;
74 priv->data_nf_avg = 0;
75 priv->bcn_rssi_last = 0;
76 priv->bcn_nf_last = 0;
77 priv->bcn_rssi_avg = 0;
78 priv->bcn_nf_avg = 0;
79 priv->rxpd_rate = 0;
80 priv->rxpd_htinfo = 0;
81 priv->sec_info.wpa_enabled = false;
82 priv->sec_info.wpa2_enabled = false;
83 priv->wpa_ie_len = 0;
84
85 priv->sec_info.wapi_enabled = false;
86 priv->wapi_ie_len = 0;
87 priv->sec_info.wapi_key_on = false;
88
Yogesh Ashok Powar2be50b82011-04-01 18:36:47 -070089 priv->sec_info.encryption_mode = 0;
Bing Zhao5e6e3a92011-03-21 18:00:50 -070090
91 /* Enable auto data rate */
92 priv->is_data_rate_auto = true;
93 priv->data_rate = 0;
94
Nachiket Kukade44ca5092016-01-31 23:44:46 -080095 priv->assoc_resp_ht_param = 0;
96 priv->ht_param_present = false;
97
Xinming Hucbf6e052014-12-23 19:14:07 +053098 if ((GET_BSS_ROLE(priv) == MWIFIEX_BSS_ROLE_STA ||
99 GET_BSS_ROLE(priv) == MWIFIEX_BSS_ROLE_UAP) && priv->hist_data)
100 mwifiex_hist_data_reset(priv);
101
Bing Zhaoeecd8252011-03-28 17:55:41 -0700102 if (priv->bss_mode == NL80211_IFTYPE_ADHOC) {
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700103 priv->adhoc_state = ADHOC_IDLE;
104 priv->adhoc_is_link_sensed = false;
105 }
106
107 /*
108 * Memorize the previous SSID and BSSID so
109 * it could be used for re-assoc
110 */
111
Zhaoyang Liuacebe8c2015-05-12 00:48:20 +0530112 mwifiex_dbg(adapter, INFO,
113 "info: previous SSID=%s, SSID len=%u\n",
114 priv->prev_ssid.ssid, priv->prev_ssid.ssid_len);
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700115
Zhaoyang Liuacebe8c2015-05-12 00:48:20 +0530116 mwifiex_dbg(adapter, INFO,
117 "info: current SSID=%s, SSID len=%u\n",
118 priv->curr_bss_params.bss_descriptor.ssid.ssid,
119 priv->curr_bss_params.bss_descriptor.ssid.ssid_len);
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700120
121 memcpy(&priv->prev_ssid,
122 &priv->curr_bss_params.bss_descriptor.ssid,
Amitkumar Karwarb9be5f32012-02-27 22:04:14 -0800123 sizeof(struct cfg80211_ssid));
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700124
125 memcpy(priv->prev_bssid,
126 priv->curr_bss_params.bss_descriptor.mac_address, ETH_ALEN);
127
128 /* Need to erase the current SSID and BSSID info */
129 memset(&priv->curr_bss_params, 0x00, sizeof(priv->curr_bss_params));
130
131 adapter->tx_lock_flag = false;
132 adapter->pps_uapsd_mode = false;
133
Amitkumar Karwar0c9c4a02014-02-27 19:35:17 -0800134 if (adapter->is_cmd_timedout && adapter->curr_cmd)
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700135 return;
136 priv->media_connected = false;
Zhaoyang Liuacebe8c2015-05-12 00:48:20 +0530137 mwifiex_dbg(adapter, MSG,
138 "info: successfully disconnected from %pM: reason code %d\n",
139 priv->cfg_bssid, reason_code);
Avinash Patil9612bd12013-10-11 18:31:32 -0700140 if (priv->bss_mode == NL80211_IFTYPE_STATION ||
141 priv->bss_mode == NL80211_IFTYPE_P2P_CLIENT) {
Amitkumar Karwar8cc1d522012-10-05 20:21:43 -0700142 cfg80211_disconnected(priv->netdev, reason_code, NULL, 0,
Amitkumar Karwarc62d50a2016-05-25 08:37:35 -0700143 !from_ap, GFP_KERNEL);
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700144 }
Joe Perches93803b32015-03-02 19:54:49 -0800145 eth_zero_addr(priv->cfg_bssid);
Amitkumar Karwar38c9d662011-12-13 20:43:17 -0800146
Avinash Patil47411a02012-11-01 18:44:16 -0700147 mwifiex_stop_net_dev_queue(priv->netdev, adapter);
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700148 if (netif_carrier_ok(priv->netdev))
149 netif_carrier_off(priv->netdev);
Ganapathi Bhatf6b1cbe2016-04-05 01:04:34 -0700150
151 mwifiex_send_cmd(priv, HostCmd_CMD_GTK_REKEY_OFFLOAD_CFG,
152 HostCmd_ACT_GEN_REMOVE, 0, NULL, false);
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700153}
154
Avinash Patil79ff4342014-05-06 22:02:44 -0700155static int mwifiex_parse_tdls_event(struct mwifiex_private *priv,
156 struct sk_buff *event_skb)
157{
Avinash Patilc1078bc2014-05-21 22:02:29 -0700158 int ret = 0;
Avinash Patil79ff4342014-05-06 22:02:44 -0700159 struct mwifiex_adapter *adapter = priv->adapter;
160 struct mwifiex_sta_node *sta_ptr;
161 struct mwifiex_tdls_generic_event *tdls_evt =
162 (void *)event_skb->data + sizeof(adapter->event_cause);
Xinming Huf7669872015-06-22 19:06:11 +0530163 u8 *mac = tdls_evt->peer_mac;
Avinash Patil79ff4342014-05-06 22:02:44 -0700164
165 /* reserved 2 bytes are not mandatory in tdls event */
166 if (event_skb->len < (sizeof(struct mwifiex_tdls_generic_event) -
167 sizeof(u16) - sizeof(adapter->event_cause))) {
Zhaoyang Liuacebe8c2015-05-12 00:48:20 +0530168 mwifiex_dbg(adapter, ERROR, "Invalid event length!\n");
Avinash Patil79ff4342014-05-06 22:02:44 -0700169 return -1;
170 }
171
172 sta_ptr = mwifiex_get_sta_entry(priv, tdls_evt->peer_mac);
173 if (!sta_ptr) {
Zhaoyang Liuacebe8c2015-05-12 00:48:20 +0530174 mwifiex_dbg(adapter, ERROR, "cannot get sta entry!\n");
Avinash Patil79ff4342014-05-06 22:02:44 -0700175 return -1;
176 }
177
178 switch (le16_to_cpu(tdls_evt->type)) {
179 case TDLS_EVENT_LINK_TEAR_DOWN:
180 cfg80211_tdls_oper_request(priv->netdev,
181 tdls_evt->peer_mac,
182 NL80211_TDLS_TEARDOWN,
183 le16_to_cpu(tdls_evt->u.reason_code),
184 GFP_KERNEL);
185 break;
Xinming Huf7669872015-06-22 19:06:11 +0530186 case TDLS_EVENT_CHAN_SWITCH_RESULT:
187 mwifiex_dbg(adapter, EVENT, "tdls channel switch result :\n");
188 mwifiex_dbg(adapter, EVENT,
189 "status=0x%x, reason=0x%x cur_chan=%d\n",
190 tdls_evt->u.switch_result.status,
191 tdls_evt->u.switch_result.reason,
192 tdls_evt->u.switch_result.cur_chan);
193
194 /* tdls channel switch failed */
195 if (tdls_evt->u.switch_result.status != 0) {
196 switch (tdls_evt->u.switch_result.cur_chan) {
197 case TDLS_BASE_CHANNEL:
198 sta_ptr->tdls_status = TDLS_IN_BASE_CHAN;
199 break;
200 case TDLS_OFF_CHANNEL:
201 sta_ptr->tdls_status = TDLS_IN_OFF_CHAN;
202 break;
203 default:
204 break;
205 }
206 return ret;
207 }
208
209 /* tdls channel switch success */
210 switch (tdls_evt->u.switch_result.cur_chan) {
211 case TDLS_BASE_CHANNEL:
212 if (sta_ptr->tdls_status == TDLS_IN_BASE_CHAN)
213 break;
214 mwifiex_update_ralist_tx_pause_in_tdls_cs(priv, mac,
215 false);
216 sta_ptr->tdls_status = TDLS_IN_BASE_CHAN;
217 break;
218 case TDLS_OFF_CHANNEL:
219 if (sta_ptr->tdls_status == TDLS_IN_OFF_CHAN)
220 break;
221 mwifiex_update_ralist_tx_pause_in_tdls_cs(priv, mac,
222 true);
223 sta_ptr->tdls_status = TDLS_IN_OFF_CHAN;
224 break;
225 default:
226 break;
227 }
228
229 break;
230 case TDLS_EVENT_START_CHAN_SWITCH:
231 mwifiex_dbg(adapter, EVENT, "tdls start channel switch...\n");
232 sta_ptr->tdls_status = TDLS_CHAN_SWITCHING;
233 break;
234 case TDLS_EVENT_CHAN_SWITCH_STOPPED:
235 mwifiex_dbg(adapter, EVENT,
236 "tdls chan switch stopped, reason=%d\n",
237 tdls_evt->u.cs_stop_reason);
238 break;
Avinash Patil79ff4342014-05-06 22:02:44 -0700239 default:
240 break;
241 }
242
Avinash Patilc1078bc2014-05-21 22:02:29 -0700243 return ret;
Avinash Patil79ff4342014-05-06 22:02:44 -0700244}
245
Avinash Patilddd7ceb2015-06-22 19:06:19 +0530246static void mwifiex_process_uap_tx_pause(struct mwifiex_private *priv,
247 struct mwifiex_ie_types_header *tlv)
Avinash Patil4e6ee912015-06-22 19:06:07 +0530248{
Avinash Patilddd7ceb2015-06-22 19:06:19 +0530249 struct mwifiex_tx_pause_tlv *tp;
Avinash Patil4e6ee912015-06-22 19:06:07 +0530250 struct mwifiex_sta_node *sta_ptr;
251 unsigned long flags;
Avinash Patilddd7ceb2015-06-22 19:06:19 +0530252
253 tp = (void *)tlv;
254 mwifiex_dbg(priv->adapter, EVENT,
255 "uap tx_pause: %pM pause=%d, pkts=%d\n",
256 tp->peermac, tp->tx_pause,
257 tp->pkt_cnt);
258
259 if (ether_addr_equal(tp->peermac, priv->netdev->dev_addr)) {
260 if (tp->tx_pause)
261 priv->port_open = false;
262 else
263 priv->port_open = true;
264 } else if (is_multicast_ether_addr(tp->peermac)) {
265 mwifiex_update_ralist_tx_pause(priv, tp->peermac, tp->tx_pause);
266 } else {
267 spin_lock_irqsave(&priv->sta_list_spinlock, flags);
268 sta_ptr = mwifiex_get_sta_entry(priv, tp->peermac);
269 spin_unlock_irqrestore(&priv->sta_list_spinlock, flags);
270
271 if (sta_ptr && sta_ptr->tx_pause != tp->tx_pause) {
272 sta_ptr->tx_pause = tp->tx_pause;
273 mwifiex_update_ralist_tx_pause(priv, tp->peermac,
274 tp->tx_pause);
275 }
276 }
277}
278
279static void mwifiex_process_sta_tx_pause(struct mwifiex_private *priv,
280 struct mwifiex_ie_types_header *tlv)
281{
282 struct mwifiex_tx_pause_tlv *tp;
283 struct mwifiex_sta_node *sta_ptr;
284 int status;
285 unsigned long flags;
286
287 tp = (void *)tlv;
288 mwifiex_dbg(priv->adapter, EVENT,
289 "sta tx_pause: %pM pause=%d, pkts=%d\n",
290 tp->peermac, tp->tx_pause,
291 tp->pkt_cnt);
292
293 if (ether_addr_equal(tp->peermac, priv->cfg_bssid)) {
294 if (tp->tx_pause)
295 priv->port_open = false;
296 else
297 priv->port_open = true;
298 } else {
299 if (!ISSUPP_TDLS_ENABLED(priv->adapter->fw_cap_info))
300 return;
301
302 status = mwifiex_get_tdls_link_status(priv, tp->peermac);
303 if (mwifiex_is_tdls_link_setup(status)) {
304 spin_lock_irqsave(&priv->sta_list_spinlock, flags);
305 sta_ptr = mwifiex_get_sta_entry(priv, tp->peermac);
306 spin_unlock_irqrestore(&priv->sta_list_spinlock, flags);
307
308 if (sta_ptr && sta_ptr->tx_pause != tp->tx_pause) {
309 sta_ptr->tx_pause = tp->tx_pause;
310 mwifiex_update_ralist_tx_pause(priv,
311 tp->peermac,
312 tp->tx_pause);
313 }
314 }
315 }
316}
317
Avinash Patil8d6b5382015-06-22 19:06:23 +0530318void mwifiex_process_multi_chan_event(struct mwifiex_private *priv,
319 struct sk_buff *event_skb)
320{
321 struct mwifiex_ie_types_multi_chan_info *chan_info;
Zhaoyang Liu2b0f9972015-09-18 06:32:15 -0700322 struct mwifiex_ie_types_mc_group_info *grp_info;
323 struct mwifiex_adapter *adapter = priv->adapter;
324 struct mwifiex_ie_types_header *tlv;
325 u16 tlv_buf_left, tlv_type, tlv_len;
326 int intf_num, bss_type, bss_num, i;
327 struct mwifiex_private *intf_priv;
Avinash Patil8d6b5382015-06-22 19:06:23 +0530328
Zhaoyang Liu2b0f9972015-09-18 06:32:15 -0700329 tlv_buf_left = event_skb->len - sizeof(u32);
Avinash Patil8d6b5382015-06-22 19:06:23 +0530330 chan_info = (void *)event_skb->data + sizeof(u32);
331
Zhaoyang Liu2b0f9972015-09-18 06:32:15 -0700332 if (le16_to_cpu(chan_info->header.type) != TLV_TYPE_MULTI_CHAN_INFO ||
333 tlv_buf_left < sizeof(struct mwifiex_ie_types_multi_chan_info)) {
334 mwifiex_dbg(adapter, ERROR,
Avinash Patil8d6b5382015-06-22 19:06:23 +0530335 "unknown TLV in chan_info event\n");
336 return;
337 }
338
Zhaoyang Liu2b0f9972015-09-18 06:32:15 -0700339 adapter->usb_mc_status = le16_to_cpu(chan_info->status);
340 mwifiex_dbg(adapter, EVENT, "multi chan operation %s\n",
341 adapter->usb_mc_status ? "started" : "over");
Avinash Patil8d6b5382015-06-22 19:06:23 +0530342
Zhaoyang Liu2b0f9972015-09-18 06:32:15 -0700343 tlv_buf_left -= sizeof(struct mwifiex_ie_types_multi_chan_info);
344 tlv = (struct mwifiex_ie_types_header *)chan_info->tlv_buffer;
345
346 while (tlv_buf_left >= (int)sizeof(struct mwifiex_ie_types_header)) {
347 tlv_type = le16_to_cpu(tlv->type);
348 tlv_len = le16_to_cpu(tlv->len);
349 if ((sizeof(struct mwifiex_ie_types_header) + tlv_len) >
350 tlv_buf_left) {
351 mwifiex_dbg(adapter, ERROR, "wrong tlv: tlvLen=%d,\t"
352 "tlvBufLeft=%d\n", tlv_len, tlv_buf_left);
353 break;
354 }
355 if (tlv_type != TLV_TYPE_MC_GROUP_INFO) {
356 mwifiex_dbg(adapter, ERROR, "wrong tlv type: 0x%x\n",
357 tlv_type);
358 break;
359 }
360
361 grp_info = (struct mwifiex_ie_types_mc_group_info *)tlv;
362 intf_num = grp_info->intf_num;
363 for (i = 0; i < intf_num; i++) {
364 bss_type = grp_info->bss_type_numlist[i] >> 4;
365 bss_num = grp_info->bss_type_numlist[i] & BSS_NUM_MASK;
366 intf_priv = mwifiex_get_priv_by_id(adapter, bss_num,
367 bss_type);
368 if (!intf_priv) {
369 mwifiex_dbg(adapter, ERROR,
370 "Invalid bss_type bss_num\t"
371 "in multi channel event\n");
372 continue;
373 }
374 if (adapter->iface_type == MWIFIEX_USB) {
375 u8 ep;
376
377 ep = grp_info->hid_num.usb_ep_num;
378 if (ep == MWIFIEX_USB_EP_DATA ||
379 ep == MWIFIEX_USB_EP_DATA_CH2)
380 intf_priv->usb_port = ep;
381 }
382 }
383
384 tlv_buf_left -= sizeof(struct mwifiex_ie_types_header) +
385 tlv_len;
386 tlv = (void *)((u8 *)tlv + tlv_len +
387 sizeof(struct mwifiex_ie_types_header));
Avinash Patil8d6b5382015-06-22 19:06:23 +0530388 }
Zhaoyang Liu2b0f9972015-09-18 06:32:15 -0700389
Zhaoyang Liu7e4e5d22015-09-18 06:32:17 -0700390 if (adapter->iface_type == MWIFIEX_USB) {
391 adapter->tx_lock_flag = true;
392 adapter->usb_mc_setup = true;
393 mwifiex_multi_chan_resync(adapter);
394 }
Avinash Patil8d6b5382015-06-22 19:06:23 +0530395}
396
Avinash Patilddd7ceb2015-06-22 19:06:19 +0530397void mwifiex_process_tx_pause_event(struct mwifiex_private *priv,
398 struct sk_buff *event_skb)
399{
400 struct mwifiex_ie_types_header *tlv;
Avinash Patil4e6ee912015-06-22 19:06:07 +0530401 u16 tlv_type, tlv_len;
Avinash Patilddd7ceb2015-06-22 19:06:19 +0530402 int tlv_buf_left;
Avinash Patil4e6ee912015-06-22 19:06:07 +0530403
Avinash Patilddd7ceb2015-06-22 19:06:19 +0530404 if (!priv->media_connected) {
405 mwifiex_dbg(priv->adapter, ERROR,
406 "tx_pause event while disconnected; bss_role=%d\n",
407 priv->bss_role);
Avinash Patil4e6ee912015-06-22 19:06:07 +0530408 return;
Avinash Patilddd7ceb2015-06-22 19:06:19 +0530409 }
Avinash Patil4e6ee912015-06-22 19:06:07 +0530410
411 tlv_buf_left = event_skb->len - sizeof(u32);
412 tlv = (void *)event_skb->data + sizeof(u32);
Avinash Patilddd7ceb2015-06-22 19:06:19 +0530413
Avinash Patil4e6ee912015-06-22 19:06:07 +0530414 while (tlv_buf_left >= (int)sizeof(struct mwifiex_ie_types_header)) {
415 tlv_type = le16_to_cpu(tlv->type);
416 tlv_len = le16_to_cpu(tlv->len);
417 if ((sizeof(struct mwifiex_ie_types_header) + tlv_len) >
Avinash Patilddd7ceb2015-06-22 19:06:19 +0530418 tlv_buf_left) {
Avinash Patil4e6ee912015-06-22 19:06:07 +0530419 mwifiex_dbg(priv->adapter, ERROR,
420 "wrong tlv: tlvLen=%d, tlvBufLeft=%d\n",
421 tlv_len, tlv_buf_left);
422 break;
423 }
424 if (tlv_type == TLV_TYPE_TX_PAUSE) {
Avinash Patilddd7ceb2015-06-22 19:06:19 +0530425 if (GET_BSS_ROLE(priv) == MWIFIEX_BSS_ROLE_STA)
426 mwifiex_process_sta_tx_pause(priv, tlv);
427 else
428 mwifiex_process_uap_tx_pause(priv, tlv);
Avinash Patil4e6ee912015-06-22 19:06:07 +0530429 }
430
431 tlv_buf_left -= sizeof(struct mwifiex_ie_types_header) +
432 tlv_len;
433 tlv = (void *)((u8 *)tlv + tlv_len +
434 sizeof(struct mwifiex_ie_types_header));
435 }
Avinash Patilddd7ceb2015-06-22 19:06:19 +0530436
Avinash Patil4e6ee912015-06-22 19:06:07 +0530437}
438
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700439/*
Chunfan Chend219b7e2015-06-10 06:19:48 -0700440* This function handles coex events generated by firmware
441*/
442void mwifiex_bt_coex_wlan_param_update_event(struct mwifiex_private *priv,
443 struct sk_buff *event_skb)
444{
445 struct mwifiex_adapter *adapter = priv->adapter;
446 struct mwifiex_ie_types_header *tlv;
447 struct mwifiex_ie_types_btcoex_aggr_win_size *winsizetlv;
448 struct mwifiex_ie_types_btcoex_scan_time *scantlv;
449 s32 len = event_skb->len - sizeof(u32);
450 u8 *cur_ptr = event_skb->data + sizeof(u32);
451 u16 tlv_type, tlv_len;
452
453 while (len >= sizeof(struct mwifiex_ie_types_header)) {
454 tlv = (struct mwifiex_ie_types_header *)cur_ptr;
455 tlv_len = le16_to_cpu(tlv->len);
456 tlv_type = le16_to_cpu(tlv->type);
457
458 if ((tlv_len + sizeof(struct mwifiex_ie_types_header)) > len)
459 break;
460 switch (tlv_type) {
461 case TLV_BTCOEX_WL_AGGR_WINSIZE:
462 winsizetlv =
463 (struct mwifiex_ie_types_btcoex_aggr_win_size *)tlv;
464 adapter->coex_win_size = winsizetlv->coex_win_size;
465 adapter->coex_tx_win_size =
466 winsizetlv->tx_win_size;
467 adapter->coex_rx_win_size =
468 winsizetlv->rx_win_size;
469 mwifiex_coex_ampdu_rxwinsize(adapter);
470 mwifiex_update_ampdu_txwinsize(adapter);
471 break;
472
473 case TLV_BTCOEX_WL_SCANTIME:
474 scantlv =
475 (struct mwifiex_ie_types_btcoex_scan_time *)tlv;
476 adapter->coex_scan = scantlv->coex_scan;
Prasun Maitic18b1042016-06-30 14:01:23 +0530477 adapter->coex_min_scan_time = le16_to_cpu(scantlv->min_scan_time);
478 adapter->coex_max_scan_time = le16_to_cpu(scantlv->max_scan_time);
Chunfan Chend219b7e2015-06-10 06:19:48 -0700479 break;
480
481 default:
482 break;
483 }
484
485 len -= tlv_len + sizeof(struct mwifiex_ie_types_header);
486 cur_ptr += tlv_len +
487 sizeof(struct mwifiex_ie_types_header);
488 }
489
490 dev_dbg(adapter->dev, "coex_scan=%d min_scan=%d coex_win=%d, tx_win=%d rx_win=%d\n",
491 adapter->coex_scan, adapter->coex_min_scan_time,
492 adapter->coex_win_size, adapter->coex_tx_win_size,
493 adapter->coex_rx_win_size);
494}
495
496/*
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700497 * This function handles events generated by firmware.
498 *
499 * This is a generic function and handles all events.
500 *
501 * Event specific routines are called by this function based
502 * upon the generated event cause.
503 *
504 * For the following events, the function just forwards them to upper
505 * layers, optionally recording the change -
506 * - EVENT_LINK_SENSED
507 * - EVENT_MIC_ERR_UNICAST
508 * - EVENT_MIC_ERR_MULTICAST
509 * - EVENT_PORT_RELEASE
510 * - EVENT_RSSI_LOW
511 * - EVENT_SNR_LOW
512 * - EVENT_MAX_FAIL
513 * - EVENT_RSSI_HIGH
514 * - EVENT_SNR_HIGH
515 * - EVENT_DATA_RSSI_LOW
516 * - EVENT_DATA_SNR_LOW
517 * - EVENT_DATA_RSSI_HIGH
518 * - EVENT_DATA_SNR_HIGH
519 * - EVENT_LINK_QUALITY
520 * - EVENT_PRE_BEACON_LOST
521 * - EVENT_IBSS_COALESCED
522 * - EVENT_WEP_ICV_ERR
523 * - EVENT_BW_CHANGE
524 * - EVENT_HOSTWAKE_STAIE
525 *
526 * For the following events, no action is taken -
527 * - EVENT_MIB_CHANGED
528 * - EVENT_INIT_DONE
529 * - EVENT_DUMMY_HOST_WAKEUP_SIGNAL
530 *
531 * Rest of the supported events requires driver handling -
532 * - EVENT_DEAUTHENTICATED
533 * - EVENT_DISASSOCIATED
534 * - EVENT_LINK_LOST
535 * - EVENT_PS_SLEEP
536 * - EVENT_PS_AWAKE
537 * - EVENT_DEEP_SLEEP_AWAKE
538 * - EVENT_HS_ACT_REQ
539 * - EVENT_ADHOC_BCN_LOST
540 * - EVENT_BG_SCAN_REPORT
541 * - EVENT_WMM_STATUS_CHANGE
542 * - EVENT_ADDBA
543 * - EVENT_DELBA
544 * - EVENT_BA_STREAM_TIEMOUT
545 * - EVENT_AMSDU_AGGR_CTRL
546 */
547int mwifiex_process_sta_event(struct mwifiex_private *priv)
548{
549 struct mwifiex_adapter *adapter = priv->adapter;
Avinash Patil3d99d982012-08-03 18:06:06 -0700550 int ret = 0;
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700551 u32 eventcause = adapter->event_cause;
Amitkumar Karwar8cc1d522012-10-05 20:21:43 -0700552 u16 ctrl, reason_code;
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700553
554 switch (eventcause) {
555 case EVENT_DUMMY_HOST_WAKEUP_SIGNAL:
Zhaoyang Liuacebe8c2015-05-12 00:48:20 +0530556 mwifiex_dbg(adapter, ERROR,
557 "invalid EVENT: DUMMY_HOST_WAKEUP_SIGNAL, ignore it\n");
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700558 break;
559 case EVENT_LINK_SENSED:
Zhaoyang Liuacebe8c2015-05-12 00:48:20 +0530560 mwifiex_dbg(adapter, EVENT, "event: LINK_SENSED\n");
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700561 if (!netif_carrier_ok(priv->netdev))
562 netif_carrier_on(priv->netdev);
Avinash Patil47411a02012-11-01 18:44:16 -0700563 mwifiex_wake_up_net_dev_queue(priv->netdev, adapter);
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700564 break;
565
566 case EVENT_DEAUTHENTICATED:
Zhaoyang Liuacebe8c2015-05-12 00:48:20 +0530567 mwifiex_dbg(adapter, EVENT, "event: Deauthenticated\n");
Stone Piaoeaf49db2013-07-22 19:17:43 -0700568 if (priv->wps.session_enable) {
Zhaoyang Liuacebe8c2015-05-12 00:48:20 +0530569 mwifiex_dbg(adapter, INFO,
570 "info: receive deauth event in wps session\n");
Stone Piaoeaf49db2013-07-22 19:17:43 -0700571 break;
572 }
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700573 adapter->dbg.num_event_deauth++;
Amitkumar Karwar8cc1d522012-10-05 20:21:43 -0700574 if (priv->media_connected) {
575 reason_code =
576 le16_to_cpu(*(__le16 *)adapter->event_body);
Amitkumar Karwarc62d50a2016-05-25 08:37:35 -0700577 mwifiex_reset_connect_state(priv, reason_code, true);
Amitkumar Karwar8cc1d522012-10-05 20:21:43 -0700578 }
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700579 break;
580
581 case EVENT_DISASSOCIATED:
Zhaoyang Liuacebe8c2015-05-12 00:48:20 +0530582 mwifiex_dbg(adapter, EVENT, "event: Disassociated\n");
Stone Piaoeaf49db2013-07-22 19:17:43 -0700583 if (priv->wps.session_enable) {
Zhaoyang Liuacebe8c2015-05-12 00:48:20 +0530584 mwifiex_dbg(adapter, INFO,
585 "info: receive disassoc event in wps session\n");
Stone Piaoeaf49db2013-07-22 19:17:43 -0700586 break;
587 }
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700588 adapter->dbg.num_event_disassoc++;
Amitkumar Karwar8cc1d522012-10-05 20:21:43 -0700589 if (priv->media_connected) {
590 reason_code =
591 le16_to_cpu(*(__le16 *)adapter->event_body);
Amitkumar Karwarc62d50a2016-05-25 08:37:35 -0700592 mwifiex_reset_connect_state(priv, reason_code, true);
Amitkumar Karwar8cc1d522012-10-05 20:21:43 -0700593 }
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700594 break;
595
596 case EVENT_LINK_LOST:
Zhaoyang Liuacebe8c2015-05-12 00:48:20 +0530597 mwifiex_dbg(adapter, EVENT, "event: Link lost\n");
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700598 adapter->dbg.num_event_link_lost++;
Amitkumar Karwar8cc1d522012-10-05 20:21:43 -0700599 if (priv->media_connected) {
600 reason_code =
601 le16_to_cpu(*(__le16 *)adapter->event_body);
Amitkumar Karwarc62d50a2016-05-25 08:37:35 -0700602 mwifiex_reset_connect_state(priv, reason_code, true);
Amitkumar Karwar8cc1d522012-10-05 20:21:43 -0700603 }
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700604 break;
605
606 case EVENT_PS_SLEEP:
Zhaoyang Liuacebe8c2015-05-12 00:48:20 +0530607 mwifiex_dbg(adapter, EVENT, "info: EVENT: SLEEP\n");
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700608
609 adapter->ps_state = PS_STATE_PRE_SLEEP;
610
611 mwifiex_check_ps_cond(adapter);
612 break;
613
614 case EVENT_PS_AWAKE:
Zhaoyang Liuacebe8c2015-05-12 00:48:20 +0530615 mwifiex_dbg(adapter, EVENT, "info: EVENT: AWAKE\n");
chunfan chendc386ce2016-01-06 23:40:48 -0800616 if (!adapter->pps_uapsd_mode &&
617 (priv->port_open ||
618 (priv->bss_mode == NL80211_IFTYPE_ADHOC)) &&
Yogesh Ashok Powar500f7472012-03-13 19:22:41 -0700619 priv->media_connected && adapter->sleep_period.period) {
chunfan chendc386ce2016-01-06 23:40:48 -0800620 adapter->pps_uapsd_mode = true;
621 mwifiex_dbg(adapter, EVENT,
622 "event: PPS/UAPSD mode activated\n");
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700623 }
624 adapter->tx_lock_flag = false;
625 if (adapter->pps_uapsd_mode && adapter->gen_null_pkt) {
626 if (mwifiex_check_last_packet_indication(priv)) {
Zhaoyang Liu735ab6b2015-09-18 06:32:18 -0700627 if (adapter->data_sent ||
628 (adapter->if_ops.is_port_ready &&
629 !adapter->if_ops.is_port_ready(priv))) {
Yogesh Ashok Powar500f7472012-03-13 19:22:41 -0700630 adapter->ps_state = PS_STATE_AWAKE;
631 adapter->pm_wakeup_card_req = false;
632 adapter->pm_wakeup_fw_try = false;
Amitkumar Karwar6e9344f2015-03-12 00:38:40 -0700633 del_timer(&adapter->wakeup_timer);
Yogesh Ashok Powar500f7472012-03-13 19:22:41 -0700634 break;
635 }
636 if (!mwifiex_send_null_packet
637 (priv,
638 MWIFIEX_TxPD_POWER_MGMT_NULL_PACKET |
639 MWIFIEX_TxPD_POWER_MGMT_LAST_PACKET))
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700640 adapter->ps_state =
641 PS_STATE_SLEEP;
642 return 0;
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700643 }
644 }
645 adapter->ps_state = PS_STATE_AWAKE;
646 adapter->pm_wakeup_card_req = false;
647 adapter->pm_wakeup_fw_try = false;
Amitkumar Karwar6e9344f2015-03-12 00:38:40 -0700648 del_timer(&adapter->wakeup_timer);
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700649
650 break;
651
652 case EVENT_DEEP_SLEEP_AWAKE:
653 adapter->if_ops.wakeup_complete(adapter);
Zhaoyang Liuacebe8c2015-05-12 00:48:20 +0530654 mwifiex_dbg(adapter, EVENT, "event: DS_AWAKE\n");
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700655 if (adapter->is_deep_sleep)
656 adapter->is_deep_sleep = false;
657 break;
658
659 case EVENT_HS_ACT_REQ:
Zhaoyang Liuacebe8c2015-05-12 00:48:20 +0530660 mwifiex_dbg(adapter, EVENT, "event: HS_ACT_REQ\n");
Bing Zhaofa0ecbb2014-02-27 19:35:12 -0800661 ret = mwifiex_send_cmd(priv, HostCmd_CMD_802_11_HS_CFG_ENH,
662 0, 0, NULL, false);
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700663 break;
664
665 case EVENT_MIC_ERR_UNICAST:
Zhaoyang Liuacebe8c2015-05-12 00:48:20 +0530666 mwifiex_dbg(adapter, EVENT, "event: UNICAST MIC ERROR\n");
Amitkumar Karwar9c7ff732012-08-08 19:02:56 -0700667 cfg80211_michael_mic_failure(priv->netdev, priv->cfg_bssid,
668 NL80211_KEYTYPE_PAIRWISE,
669 -1, NULL, GFP_KERNEL);
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700670 break;
671
672 case EVENT_MIC_ERR_MULTICAST:
Zhaoyang Liuacebe8c2015-05-12 00:48:20 +0530673 mwifiex_dbg(adapter, EVENT, "event: MULTICAST MIC ERROR\n");
Amitkumar Karwar9c7ff732012-08-08 19:02:56 -0700674 cfg80211_michael_mic_failure(priv->netdev, priv->cfg_bssid,
675 NL80211_KEYTYPE_GROUP,
676 -1, NULL, GFP_KERNEL);
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700677 break;
678 case EVENT_MIB_CHANGED:
679 case EVENT_INIT_DONE:
680 break;
681
682 case EVENT_ADHOC_BCN_LOST:
Zhaoyang Liuacebe8c2015-05-12 00:48:20 +0530683 mwifiex_dbg(adapter, EVENT, "event: ADHOC_BCN_LOST\n");
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700684 priv->adhoc_is_link_sensed = false;
685 mwifiex_clean_txrx(priv);
Avinash Patil47411a02012-11-01 18:44:16 -0700686 mwifiex_stop_net_dev_queue(priv->netdev, adapter);
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700687 if (netif_carrier_ok(priv->netdev))
688 netif_carrier_off(priv->netdev);
689 break;
690
691 case EVENT_BG_SCAN_REPORT:
Zhaoyang Liuacebe8c2015-05-12 00:48:20 +0530692 mwifiex_dbg(adapter, EVENT, "event: BGS_REPORT\n");
Bing Zhaofa0ecbb2014-02-27 19:35:12 -0800693 ret = mwifiex_send_cmd(priv, HostCmd_CMD_802_11_BG_SCAN_QUERY,
694 HostCmd_ACT_GEN_GET, 0, NULL, false);
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700695 break;
696
Xinming Hu0c9b7f22016-01-13 01:26:52 -0800697 case EVENT_BG_SCAN_STOPPED:
698 dev_dbg(adapter->dev, "event: BGS_STOPPED\n");
699 cfg80211_sched_scan_stopped(priv->wdev.wiphy);
700 if (priv->sched_scanning)
701 priv->sched_scanning = false;
702 break;
703
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700704 case EVENT_PORT_RELEASE:
Zhaoyang Liuacebe8c2015-05-12 00:48:20 +0530705 mwifiex_dbg(adapter, EVENT, "event: PORT RELEASE\n");
Avinash Patil5c8946332015-06-22 19:06:18 +0530706 priv->port_open = true;
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700707 break;
708
Amitkumar Karwar21f58d202014-02-11 18:39:56 -0800709 case EVENT_EXT_SCAN_REPORT:
Zhaoyang Liuacebe8c2015-05-12 00:48:20 +0530710 mwifiex_dbg(adapter, EVENT, "event: EXT_SCAN Report\n");
Amitkumar Karwar16d25da2016-06-27 14:16:29 +0530711 if (adapter->ext_scan && !priv->scan_aborting)
Amitkumar Karwar21f58d202014-02-11 18:39:56 -0800712 ret = mwifiex_handle_event_ext_scan_report(priv,
713 adapter->event_skb->data);
714
715 break;
716
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700717 case EVENT_WMM_STATUS_CHANGE:
Zhaoyang Liuacebe8c2015-05-12 00:48:20 +0530718 mwifiex_dbg(adapter, EVENT, "event: WMM status changed\n");
Bing Zhaofa0ecbb2014-02-27 19:35:12 -0800719 ret = mwifiex_send_cmd(priv, HostCmd_CMD_WMM_GET_STATUS,
720 0, 0, NULL, false);
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700721 break;
722
723 case EVENT_RSSI_LOW:
Amitkumar Karwarfa444bf2012-03-15 20:51:51 -0700724 cfg80211_cqm_rssi_notify(priv->netdev,
725 NL80211_CQM_RSSI_THRESHOLD_EVENT_LOW,
726 GFP_KERNEL);
Bing Zhaofa0ecbb2014-02-27 19:35:12 -0800727 mwifiex_send_cmd(priv, HostCmd_CMD_RSSI_INFO,
728 HostCmd_ACT_GEN_GET, 0, NULL, false);
Amitkumar Karwarfa444bf2012-03-15 20:51:51 -0700729 priv->subsc_evt_rssi_state = RSSI_LOW_RECVD;
Zhaoyang Liuacebe8c2015-05-12 00:48:20 +0530730 mwifiex_dbg(adapter, EVENT, "event: Beacon RSSI_LOW\n");
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700731 break;
732 case EVENT_SNR_LOW:
Zhaoyang Liuacebe8c2015-05-12 00:48:20 +0530733 mwifiex_dbg(adapter, EVENT, "event: Beacon SNR_LOW\n");
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700734 break;
735 case EVENT_MAX_FAIL:
Zhaoyang Liuacebe8c2015-05-12 00:48:20 +0530736 mwifiex_dbg(adapter, EVENT, "event: MAX_FAIL\n");
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700737 break;
738 case EVENT_RSSI_HIGH:
Amitkumar Karwarfa444bf2012-03-15 20:51:51 -0700739 cfg80211_cqm_rssi_notify(priv->netdev,
740 NL80211_CQM_RSSI_THRESHOLD_EVENT_HIGH,
741 GFP_KERNEL);
Bing Zhaofa0ecbb2014-02-27 19:35:12 -0800742 mwifiex_send_cmd(priv, HostCmd_CMD_RSSI_INFO,
743 HostCmd_ACT_GEN_GET, 0, NULL, false);
Amitkumar Karwarfa444bf2012-03-15 20:51:51 -0700744 priv->subsc_evt_rssi_state = RSSI_HIGH_RECVD;
Zhaoyang Liuacebe8c2015-05-12 00:48:20 +0530745 mwifiex_dbg(adapter, EVENT, "event: Beacon RSSI_HIGH\n");
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700746 break;
747 case EVENT_SNR_HIGH:
Zhaoyang Liuacebe8c2015-05-12 00:48:20 +0530748 mwifiex_dbg(adapter, EVENT, "event: Beacon SNR_HIGH\n");
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700749 break;
750 case EVENT_DATA_RSSI_LOW:
Zhaoyang Liuacebe8c2015-05-12 00:48:20 +0530751 mwifiex_dbg(adapter, EVENT, "event: Data RSSI_LOW\n");
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700752 break;
753 case EVENT_DATA_SNR_LOW:
Zhaoyang Liuacebe8c2015-05-12 00:48:20 +0530754 mwifiex_dbg(adapter, EVENT, "event: Data SNR_LOW\n");
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700755 break;
756 case EVENT_DATA_RSSI_HIGH:
Zhaoyang Liuacebe8c2015-05-12 00:48:20 +0530757 mwifiex_dbg(adapter, EVENT, "event: Data RSSI_HIGH\n");
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700758 break;
759 case EVENT_DATA_SNR_HIGH:
Zhaoyang Liuacebe8c2015-05-12 00:48:20 +0530760 mwifiex_dbg(adapter, EVENT, "event: Data SNR_HIGH\n");
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700761 break;
762 case EVENT_LINK_QUALITY:
Zhaoyang Liuacebe8c2015-05-12 00:48:20 +0530763 mwifiex_dbg(adapter, EVENT, "event: Link Quality\n");
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700764 break;
765 case EVENT_PRE_BEACON_LOST:
Zhaoyang Liuacebe8c2015-05-12 00:48:20 +0530766 mwifiex_dbg(adapter, EVENT, "event: Pre-Beacon Lost\n");
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700767 break;
768 case EVENT_IBSS_COALESCED:
Zhaoyang Liuacebe8c2015-05-12 00:48:20 +0530769 mwifiex_dbg(adapter, EVENT, "event: IBSS_COALESCED\n");
Bing Zhaofa0ecbb2014-02-27 19:35:12 -0800770 ret = mwifiex_send_cmd(priv,
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700771 HostCmd_CMD_802_11_IBSS_COALESCING_STATUS,
Bing Zhaofa0ecbb2014-02-27 19:35:12 -0800772 HostCmd_ACT_GEN_GET, 0, NULL, false);
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700773 break;
774 case EVENT_ADDBA:
Zhaoyang Liuacebe8c2015-05-12 00:48:20 +0530775 mwifiex_dbg(adapter, EVENT, "event: ADDBA Request\n");
Bing Zhaofa0ecbb2014-02-27 19:35:12 -0800776 mwifiex_send_cmd(priv, HostCmd_CMD_11N_ADDBA_RSP,
777 HostCmd_ACT_GEN_SET, 0,
778 adapter->event_body, false);
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700779 break;
780 case EVENT_DELBA:
Zhaoyang Liuacebe8c2015-05-12 00:48:20 +0530781 mwifiex_dbg(adapter, EVENT, "event: DELBA Request\n");
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700782 mwifiex_11n_delete_ba_stream(priv, adapter->event_body);
783 break;
784 case EVENT_BA_STREAM_TIEMOUT:
Zhaoyang Liuacebe8c2015-05-12 00:48:20 +0530785 mwifiex_dbg(adapter, EVENT, "event: BA Stream timeout\n");
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700786 mwifiex_11n_ba_stream_timeout(priv,
787 (struct host_cmd_ds_11n_batimeout
788 *)
789 adapter->event_body);
790 break;
791 case EVENT_AMSDU_AGGR_CTRL:
Bing Zhao8dd43722012-08-07 16:08:08 -0700792 ctrl = le16_to_cpu(*(__le16 *)adapter->event_body);
Zhaoyang Liuacebe8c2015-05-12 00:48:20 +0530793 mwifiex_dbg(adapter, EVENT,
794 "event: AMSDU_AGGR_CTRL %d\n", ctrl);
Bing Zhao8dd43722012-08-07 16:08:08 -0700795
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700796 adapter->tx_buf_size =
Bing Zhao8dd43722012-08-07 16:08:08 -0700797 min_t(u16, adapter->curr_tx_buf_size, ctrl);
Zhaoyang Liuacebe8c2015-05-12 00:48:20 +0530798 mwifiex_dbg(adapter, EVENT, "event: tx_buf_size %d\n",
799 adapter->tx_buf_size);
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700800 break;
801
802 case EVENT_WEP_ICV_ERR:
Zhaoyang Liuacebe8c2015-05-12 00:48:20 +0530803 mwifiex_dbg(adapter, EVENT, "event: WEP ICV error\n");
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700804 break;
805
806 case EVENT_BW_CHANGE:
Zhaoyang Liuacebe8c2015-05-12 00:48:20 +0530807 mwifiex_dbg(adapter, EVENT, "event: BW Change\n");
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700808 break;
809
810 case EVENT_HOSTWAKE_STAIE:
Zhaoyang Liuacebe8c2015-05-12 00:48:20 +0530811 mwifiex_dbg(adapter, EVENT,
812 "event: HOSTWAKE_STAIE %d\n", eventcause);
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700813 break;
Avinash Patile5686342012-05-08 18:30:25 -0700814
Stone Piaoeab1c762012-09-25 20:23:37 -0700815 case EVENT_REMAIN_ON_CHAN_EXPIRED:
Zhaoyang Liuacebe8c2015-05-12 00:48:20 +0530816 mwifiex_dbg(adapter, EVENT,
817 "event: Remain on channel expired\n");
Avinash Patil4facc342015-01-28 15:42:00 +0530818 cfg80211_remain_on_channel_expired(&priv->wdev,
Stone Piaoeab1c762012-09-25 20:23:37 -0700819 priv->roc_cfg.cookie,
820 &priv->roc_cfg.chan,
Stone Piaoeab1c762012-09-25 20:23:37 -0700821 GFP_ATOMIC);
822
823 memset(&priv->roc_cfg, 0x00, sizeof(struct mwifiex_roc_cfg));
824
825 break;
826
Amitkumar Karwar2a7305c2013-06-19 08:49:05 -0700827 case EVENT_CHANNEL_SWITCH_ANN:
Zhaoyang Liuacebe8c2015-05-12 00:48:20 +0530828 mwifiex_dbg(adapter, EVENT, "event: Channel Switch Announcement\n");
Amitkumar Karwarb8876642013-06-18 16:36:58 -0700829 priv->csa_expire_time =
830 jiffies + msecs_to_jiffies(DFS_CHAN_MOVE_TIME);
831 priv->csa_chan = priv->curr_bss_params.bss_descriptor.channel;
Bing Zhaofa0ecbb2014-02-27 19:35:12 -0800832 ret = mwifiex_send_cmd(priv, HostCmd_CMD_802_11_DEAUTHENTICATE,
Amitkumar Karwar2a7305c2013-06-19 08:49:05 -0700833 HostCmd_ACT_GEN_SET, 0,
Bing Zhaofa0ecbb2014-02-27 19:35:12 -0800834 priv->curr_bss_params.bss_descriptor.mac_address,
835 false);
Amitkumar Karwar2a7305c2013-06-19 08:49:05 -0700836 break;
837
Avinash Patil79ff4342014-05-06 22:02:44 -0700838 case EVENT_TDLS_GENERIC_EVENT:
839 ret = mwifiex_parse_tdls_event(priv, adapter->event_skb);
840 break;
841
Avinash Patil4e6ee912015-06-22 19:06:07 +0530842 case EVENT_TX_DATA_PAUSE:
Avinash Patil4e6ee912015-06-22 19:06:07 +0530843 mwifiex_dbg(adapter, EVENT, "event: TX DATA PAUSE\n");
Avinash Patilddd7ceb2015-06-22 19:06:19 +0530844 mwifiex_process_tx_pause_event(priv, adapter->event_skb);
Avinash Patil4e6ee912015-06-22 19:06:07 +0530845 break;
846
Avinash Patil8d6b5382015-06-22 19:06:23 +0530847 case EVENT_MULTI_CHAN_INFO:
848 mwifiex_dbg(adapter, EVENT, "event: multi-chan info\n");
849 mwifiex_process_multi_chan_event(priv, adapter->event_skb);
850 break;
851
Amitkumar Karwar808bbeb2014-11-25 06:43:05 -0800852 case EVENT_TX_STATUS_REPORT:
Zhaoyang Liuacebe8c2015-05-12 00:48:20 +0530853 mwifiex_dbg(adapter, EVENT, "event: TX_STATUS Report\n");
Amitkumar Karwar808bbeb2014-11-25 06:43:05 -0800854 mwifiex_parse_tx_status_event(priv, adapter->event_body);
855 break;
856
Avinash Patil0a694d62015-01-28 15:54:22 +0530857 case EVENT_CHANNEL_REPORT_RDY:
Zhaoyang Liuacebe8c2015-05-12 00:48:20 +0530858 mwifiex_dbg(adapter, EVENT, "event: Channel Report\n");
Avinash Patil0a694d62015-01-28 15:54:22 +0530859 ret = mwifiex_11h_handle_chanrpt_ready(priv,
860 adapter->event_skb);
861 break;
Avinash Patil3b57c1a2015-01-28 15:54:23 +0530862 case EVENT_RADAR_DETECTED:
Zhaoyang Liuacebe8c2015-05-12 00:48:20 +0530863 mwifiex_dbg(adapter, EVENT, "event: Radar detected\n");
Avinash Patil3b57c1a2015-01-28 15:54:23 +0530864 ret = mwifiex_11h_handle_radar_detected(priv,
865 adapter->event_skb);
866 break;
Chunfan Chend219b7e2015-06-10 06:19:48 -0700867 case EVENT_BT_COEX_WLAN_PARA_CHANGE:
868 dev_dbg(adapter->dev, "EVENT: BT coex wlan param update\n");
869 mwifiex_bt_coex_wlan_param_update_event(priv,
870 adapter->event_skb);
Amitkumar Karwar323d8f12015-06-15 04:03:35 -0700871 break;
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700872 default:
Zhaoyang Liuacebe8c2015-05-12 00:48:20 +0530873 mwifiex_dbg(adapter, ERROR, "event: unknown event id: %#x\n",
874 eventcause);
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700875 break;
876 }
877
878 return ret;
879}