Bing Zhao | 5e6e3a9 | 2011-03-21 18:00:50 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Marvell Wireless LAN device driver: station event handling |
| 3 | * |
Xinming Hu | 65da33f | 2014-06-19 21:38:57 -0700 | [diff] [blame] | 4 | * Copyright (C) 2011-2014, Marvell International Ltd. |
Bing Zhao | 5e6e3a9 | 2011-03-21 18:00:50 -0700 | [diff] [blame] | 5 | * |
| 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 | */ |
| 43 | void |
Amitkumar Karwar | 8cc1d52 | 2012-10-05 20:21:43 -0700 | [diff] [blame] | 44 | mwifiex_reset_connect_state(struct mwifiex_private *priv, u16 reason_code) |
Bing Zhao | 5e6e3a9 | 2011-03-21 18:00:50 -0700 | [diff] [blame] | 45 | { |
| 46 | struct mwifiex_adapter *adapter = priv->adapter; |
| 47 | |
| 48 | if (!priv->media_connected) |
| 49 | return; |
| 50 | |
Zhaoyang Liu | acebe8c | 2015-05-12 00:48:20 +0530 | [diff] [blame] | 51 | mwifiex_dbg(adapter, INFO, |
| 52 | "info: handles disconnect event\n"); |
Bing Zhao | 5e6e3a9 | 2011-03-21 18:00:50 -0700 | [diff] [blame] | 53 | |
| 54 | priv->media_connected = false; |
| 55 | |
| 56 | priv->scan_block = false; |
| 57 | |
Avinash Patil | be104b9 | 2014-02-07 16:30:41 -0800 | [diff] [blame] | 58 | if ((GET_BSS_ROLE(priv) == MWIFIEX_BSS_ROLE_STA) && |
Avinash Patil | 9927baa | 2014-11-13 21:54:16 +0530 | [diff] [blame] | 59 | ISSUPP_TDLS_ENABLED(priv->adapter->fw_cap_info)) { |
Avinash Patil | be104b9 | 2014-02-07 16:30:41 -0800 | [diff] [blame] | 60 | mwifiex_disable_all_tdls_links(priv); |
| 61 | |
Avinash Patil | 9927baa | 2014-11-13 21:54:16 +0530 | [diff] [blame] | 62 | if (priv->adapter->auto_tdls) |
| 63 | mwifiex_clean_auto_tdls(priv); |
| 64 | } |
| 65 | |
Bing Zhao | 5e6e3a9 | 2011-03-21 18:00:50 -0700 | [diff] [blame] | 66 | /* Free Tx and Rx packets, report disconnect to upper layer */ |
| 67 | mwifiex_clean_txrx(priv); |
| 68 | |
| 69 | /* Reset SNR/NF/RSSI values */ |
| 70 | priv->data_rssi_last = 0; |
| 71 | priv->data_nf_last = 0; |
| 72 | priv->data_rssi_avg = 0; |
| 73 | priv->data_nf_avg = 0; |
| 74 | priv->bcn_rssi_last = 0; |
| 75 | priv->bcn_nf_last = 0; |
| 76 | priv->bcn_rssi_avg = 0; |
| 77 | priv->bcn_nf_avg = 0; |
| 78 | priv->rxpd_rate = 0; |
| 79 | priv->rxpd_htinfo = 0; |
| 80 | priv->sec_info.wpa_enabled = false; |
| 81 | priv->sec_info.wpa2_enabled = false; |
| 82 | priv->wpa_ie_len = 0; |
| 83 | |
| 84 | priv->sec_info.wapi_enabled = false; |
| 85 | priv->wapi_ie_len = 0; |
| 86 | priv->sec_info.wapi_key_on = false; |
| 87 | |
Yogesh Ashok Powar | 2be50b8 | 2011-04-01 18:36:47 -0700 | [diff] [blame] | 88 | priv->sec_info.encryption_mode = 0; |
Bing Zhao | 5e6e3a9 | 2011-03-21 18:00:50 -0700 | [diff] [blame] | 89 | |
| 90 | /* Enable auto data rate */ |
| 91 | priv->is_data_rate_auto = true; |
| 92 | priv->data_rate = 0; |
| 93 | |
Xinming Hu | cbf6e05 | 2014-12-23 19:14:07 +0530 | [diff] [blame] | 94 | if ((GET_BSS_ROLE(priv) == MWIFIEX_BSS_ROLE_STA || |
| 95 | GET_BSS_ROLE(priv) == MWIFIEX_BSS_ROLE_UAP) && priv->hist_data) |
| 96 | mwifiex_hist_data_reset(priv); |
| 97 | |
Bing Zhao | eecd825 | 2011-03-28 17:55:41 -0700 | [diff] [blame] | 98 | if (priv->bss_mode == NL80211_IFTYPE_ADHOC) { |
Bing Zhao | 5e6e3a9 | 2011-03-21 18:00:50 -0700 | [diff] [blame] | 99 | priv->adhoc_state = ADHOC_IDLE; |
| 100 | priv->adhoc_is_link_sensed = false; |
| 101 | } |
| 102 | |
| 103 | /* |
| 104 | * Memorize the previous SSID and BSSID so |
| 105 | * it could be used for re-assoc |
| 106 | */ |
| 107 | |
Zhaoyang Liu | acebe8c | 2015-05-12 00:48:20 +0530 | [diff] [blame] | 108 | mwifiex_dbg(adapter, INFO, |
| 109 | "info: previous SSID=%s, SSID len=%u\n", |
| 110 | priv->prev_ssid.ssid, priv->prev_ssid.ssid_len); |
Bing Zhao | 5e6e3a9 | 2011-03-21 18:00:50 -0700 | [diff] [blame] | 111 | |
Zhaoyang Liu | acebe8c | 2015-05-12 00:48:20 +0530 | [diff] [blame] | 112 | mwifiex_dbg(adapter, INFO, |
| 113 | "info: current SSID=%s, SSID len=%u\n", |
| 114 | priv->curr_bss_params.bss_descriptor.ssid.ssid, |
| 115 | priv->curr_bss_params.bss_descriptor.ssid.ssid_len); |
Bing Zhao | 5e6e3a9 | 2011-03-21 18:00:50 -0700 | [diff] [blame] | 116 | |
| 117 | memcpy(&priv->prev_ssid, |
| 118 | &priv->curr_bss_params.bss_descriptor.ssid, |
Amitkumar Karwar | b9be5f3 | 2012-02-27 22:04:14 -0800 | [diff] [blame] | 119 | sizeof(struct cfg80211_ssid)); |
Bing Zhao | 5e6e3a9 | 2011-03-21 18:00:50 -0700 | [diff] [blame] | 120 | |
| 121 | memcpy(priv->prev_bssid, |
| 122 | priv->curr_bss_params.bss_descriptor.mac_address, ETH_ALEN); |
| 123 | |
| 124 | /* Need to erase the current SSID and BSSID info */ |
| 125 | memset(&priv->curr_bss_params, 0x00, sizeof(priv->curr_bss_params)); |
| 126 | |
| 127 | adapter->tx_lock_flag = false; |
| 128 | adapter->pps_uapsd_mode = false; |
| 129 | |
Amitkumar Karwar | 0c9c4a0 | 2014-02-27 19:35:17 -0800 | [diff] [blame] | 130 | if (adapter->is_cmd_timedout && adapter->curr_cmd) |
Bing Zhao | 5e6e3a9 | 2011-03-21 18:00:50 -0700 | [diff] [blame] | 131 | return; |
| 132 | priv->media_connected = false; |
Zhaoyang Liu | acebe8c | 2015-05-12 00:48:20 +0530 | [diff] [blame] | 133 | mwifiex_dbg(adapter, MSG, |
| 134 | "info: successfully disconnected from %pM: reason code %d\n", |
| 135 | priv->cfg_bssid, reason_code); |
Avinash Patil | 9612bd1 | 2013-10-11 18:31:32 -0700 | [diff] [blame] | 136 | if (priv->bss_mode == NL80211_IFTYPE_STATION || |
| 137 | priv->bss_mode == NL80211_IFTYPE_P2P_CLIENT) { |
Amitkumar Karwar | 8cc1d52 | 2012-10-05 20:21:43 -0700 | [diff] [blame] | 138 | cfg80211_disconnected(priv->netdev, reason_code, NULL, 0, |
Johannes Berg | 80279fb | 2015-05-22 16:22:20 +0200 | [diff] [blame] | 139 | false, GFP_KERNEL); |
Bing Zhao | 5e6e3a9 | 2011-03-21 18:00:50 -0700 | [diff] [blame] | 140 | } |
Joe Perches | 93803b3 | 2015-03-02 19:54:49 -0800 | [diff] [blame] | 141 | eth_zero_addr(priv->cfg_bssid); |
Amitkumar Karwar | 38c9d66 | 2011-12-13 20:43:17 -0800 | [diff] [blame] | 142 | |
Avinash Patil | 47411a0 | 2012-11-01 18:44:16 -0700 | [diff] [blame] | 143 | mwifiex_stop_net_dev_queue(priv->netdev, adapter); |
Bing Zhao | 5e6e3a9 | 2011-03-21 18:00:50 -0700 | [diff] [blame] | 144 | if (netif_carrier_ok(priv->netdev)) |
| 145 | netif_carrier_off(priv->netdev); |
Bing Zhao | 5e6e3a9 | 2011-03-21 18:00:50 -0700 | [diff] [blame] | 146 | } |
| 147 | |
Avinash Patil | 79ff434 | 2014-05-06 22:02:44 -0700 | [diff] [blame] | 148 | static int mwifiex_parse_tdls_event(struct mwifiex_private *priv, |
| 149 | struct sk_buff *event_skb) |
| 150 | { |
Avinash Patil | c1078bc | 2014-05-21 22:02:29 -0700 | [diff] [blame] | 151 | int ret = 0; |
Avinash Patil | 79ff434 | 2014-05-06 22:02:44 -0700 | [diff] [blame] | 152 | struct mwifiex_adapter *adapter = priv->adapter; |
| 153 | struct mwifiex_sta_node *sta_ptr; |
| 154 | struct mwifiex_tdls_generic_event *tdls_evt = |
| 155 | (void *)event_skb->data + sizeof(adapter->event_cause); |
Xinming Hu | f766987 | 2015-06-22 19:06:11 +0530 | [diff] [blame] | 156 | u8 *mac = tdls_evt->peer_mac; |
Avinash Patil | 79ff434 | 2014-05-06 22:02:44 -0700 | [diff] [blame] | 157 | |
| 158 | /* reserved 2 bytes are not mandatory in tdls event */ |
| 159 | if (event_skb->len < (sizeof(struct mwifiex_tdls_generic_event) - |
| 160 | sizeof(u16) - sizeof(adapter->event_cause))) { |
Zhaoyang Liu | acebe8c | 2015-05-12 00:48:20 +0530 | [diff] [blame] | 161 | mwifiex_dbg(adapter, ERROR, "Invalid event length!\n"); |
Avinash Patil | 79ff434 | 2014-05-06 22:02:44 -0700 | [diff] [blame] | 162 | return -1; |
| 163 | } |
| 164 | |
| 165 | sta_ptr = mwifiex_get_sta_entry(priv, tdls_evt->peer_mac); |
| 166 | if (!sta_ptr) { |
Zhaoyang Liu | acebe8c | 2015-05-12 00:48:20 +0530 | [diff] [blame] | 167 | mwifiex_dbg(adapter, ERROR, "cannot get sta entry!\n"); |
Avinash Patil | 79ff434 | 2014-05-06 22:02:44 -0700 | [diff] [blame] | 168 | return -1; |
| 169 | } |
| 170 | |
| 171 | switch (le16_to_cpu(tdls_evt->type)) { |
| 172 | case TDLS_EVENT_LINK_TEAR_DOWN: |
| 173 | cfg80211_tdls_oper_request(priv->netdev, |
| 174 | tdls_evt->peer_mac, |
| 175 | NL80211_TDLS_TEARDOWN, |
| 176 | le16_to_cpu(tdls_evt->u.reason_code), |
| 177 | GFP_KERNEL); |
| 178 | break; |
Xinming Hu | f766987 | 2015-06-22 19:06:11 +0530 | [diff] [blame] | 179 | case TDLS_EVENT_CHAN_SWITCH_RESULT: |
| 180 | mwifiex_dbg(adapter, EVENT, "tdls channel switch result :\n"); |
| 181 | mwifiex_dbg(adapter, EVENT, |
| 182 | "status=0x%x, reason=0x%x cur_chan=%d\n", |
| 183 | tdls_evt->u.switch_result.status, |
| 184 | tdls_evt->u.switch_result.reason, |
| 185 | tdls_evt->u.switch_result.cur_chan); |
| 186 | |
| 187 | /* tdls channel switch failed */ |
| 188 | if (tdls_evt->u.switch_result.status != 0) { |
| 189 | switch (tdls_evt->u.switch_result.cur_chan) { |
| 190 | case TDLS_BASE_CHANNEL: |
| 191 | sta_ptr->tdls_status = TDLS_IN_BASE_CHAN; |
| 192 | break; |
| 193 | case TDLS_OFF_CHANNEL: |
| 194 | sta_ptr->tdls_status = TDLS_IN_OFF_CHAN; |
| 195 | break; |
| 196 | default: |
| 197 | break; |
| 198 | } |
| 199 | return ret; |
| 200 | } |
| 201 | |
| 202 | /* tdls channel switch success */ |
| 203 | switch (tdls_evt->u.switch_result.cur_chan) { |
| 204 | case TDLS_BASE_CHANNEL: |
| 205 | if (sta_ptr->tdls_status == TDLS_IN_BASE_CHAN) |
| 206 | break; |
| 207 | mwifiex_update_ralist_tx_pause_in_tdls_cs(priv, mac, |
| 208 | false); |
| 209 | sta_ptr->tdls_status = TDLS_IN_BASE_CHAN; |
| 210 | break; |
| 211 | case TDLS_OFF_CHANNEL: |
| 212 | if (sta_ptr->tdls_status == TDLS_IN_OFF_CHAN) |
| 213 | break; |
| 214 | mwifiex_update_ralist_tx_pause_in_tdls_cs(priv, mac, |
| 215 | true); |
| 216 | sta_ptr->tdls_status = TDLS_IN_OFF_CHAN; |
| 217 | break; |
| 218 | default: |
| 219 | break; |
| 220 | } |
| 221 | |
| 222 | break; |
| 223 | case TDLS_EVENT_START_CHAN_SWITCH: |
| 224 | mwifiex_dbg(adapter, EVENT, "tdls start channel switch...\n"); |
| 225 | sta_ptr->tdls_status = TDLS_CHAN_SWITCHING; |
| 226 | break; |
| 227 | case TDLS_EVENT_CHAN_SWITCH_STOPPED: |
| 228 | mwifiex_dbg(adapter, EVENT, |
| 229 | "tdls chan switch stopped, reason=%d\n", |
| 230 | tdls_evt->u.cs_stop_reason); |
| 231 | break; |
Avinash Patil | 79ff434 | 2014-05-06 22:02:44 -0700 | [diff] [blame] | 232 | default: |
| 233 | break; |
| 234 | } |
| 235 | |
Avinash Patil | c1078bc | 2014-05-21 22:02:29 -0700 | [diff] [blame] | 236 | return ret; |
Avinash Patil | 79ff434 | 2014-05-06 22:02:44 -0700 | [diff] [blame] | 237 | } |
| 238 | |
Avinash Patil | 4e6ee91 | 2015-06-22 19:06:07 +0530 | [diff] [blame] | 239 | static void |
| 240 | mwifiex_process_sta_tx_pause_event(struct mwifiex_private *priv, |
| 241 | struct sk_buff *event_skb) |
| 242 | { |
| 243 | struct mwifiex_ie_types_header *tlv; |
| 244 | struct mwifiex_tx_pause_tlv *tp_tlv; |
| 245 | struct mwifiex_sta_node *sta_ptr; |
| 246 | unsigned long flags; |
| 247 | u16 tlv_type, tlv_len; |
| 248 | int tlv_buf_left, status; |
| 249 | |
| 250 | if (!ISSUPP_TDLS_ENABLED(priv->adapter->fw_cap_info)) |
| 251 | return; |
| 252 | |
| 253 | if (!(priv->bss_type == MWIFIEX_BSS_TYPE_STA && priv->media_connected)) |
| 254 | return; |
| 255 | |
| 256 | tlv_buf_left = event_skb->len - sizeof(u32); |
| 257 | tlv = (void *)event_skb->data + sizeof(u32); |
| 258 | while (tlv_buf_left >= (int)sizeof(struct mwifiex_ie_types_header)) { |
| 259 | tlv_type = le16_to_cpu(tlv->type); |
| 260 | tlv_len = le16_to_cpu(tlv->len); |
| 261 | if ((sizeof(struct mwifiex_ie_types_header) + tlv_len) > |
| 262 | tlv_buf_left) { |
| 263 | mwifiex_dbg(priv->adapter, ERROR, |
| 264 | "wrong tlv: tlvLen=%d, tlvBufLeft=%d\n", |
| 265 | tlv_len, tlv_buf_left); |
| 266 | break; |
| 267 | } |
| 268 | if (tlv_type == TLV_TYPE_TX_PAUSE) { |
| 269 | tp_tlv = (void *)tlv; |
| 270 | mwifiex_dbg(priv->adapter, ERROR, |
| 271 | "TxPause: %pM pause=%d, pkts=%d\n", |
| 272 | tp_tlv->peermac, tp_tlv->tx_pause, |
| 273 | tp_tlv->pkt_cnt); |
| 274 | status = mwifiex_get_tdls_link_status |
| 275 | (priv, tp_tlv->peermac); |
Xinming Hu | 55a2c07 | 2015-06-22 19:06:14 +0530 | [diff] [blame] | 276 | if (mwifiex_is_tdls_link_setup(status)) { |
Avinash Patil | 4e6ee91 | 2015-06-22 19:06:07 +0530 | [diff] [blame] | 277 | spin_lock_irqsave(&priv->sta_list_spinlock, |
| 278 | flags); |
| 279 | sta_ptr = mwifiex_get_sta_entry |
| 280 | (priv, tp_tlv->peermac); |
| 281 | spin_unlock_irqrestore(&priv->sta_list_spinlock, |
| 282 | flags); |
| 283 | if (sta_ptr && sta_ptr->tx_pause != |
| 284 | tp_tlv->tx_pause) { |
| 285 | sta_ptr->tx_pause = tp_tlv->tx_pause; |
| 286 | mwifiex_update_ralist_tx_pause |
| 287 | (priv, tp_tlv->peermac, |
| 288 | tp_tlv->tx_pause); |
| 289 | } |
| 290 | } |
| 291 | } |
| 292 | |
| 293 | tlv_buf_left -= sizeof(struct mwifiex_ie_types_header) + |
| 294 | tlv_len; |
| 295 | tlv = (void *)((u8 *)tlv + tlv_len + |
| 296 | sizeof(struct mwifiex_ie_types_header)); |
| 297 | } |
| 298 | } |
| 299 | |
Bing Zhao | 5e6e3a9 | 2011-03-21 18:00:50 -0700 | [diff] [blame] | 300 | /* |
Chunfan Chen | d219b7e | 2015-06-10 06:19:48 -0700 | [diff] [blame] | 301 | * This function handles coex events generated by firmware |
| 302 | */ |
| 303 | void mwifiex_bt_coex_wlan_param_update_event(struct mwifiex_private *priv, |
| 304 | struct sk_buff *event_skb) |
| 305 | { |
| 306 | struct mwifiex_adapter *adapter = priv->adapter; |
| 307 | struct mwifiex_ie_types_header *tlv; |
| 308 | struct mwifiex_ie_types_btcoex_aggr_win_size *winsizetlv; |
| 309 | struct mwifiex_ie_types_btcoex_scan_time *scantlv; |
| 310 | s32 len = event_skb->len - sizeof(u32); |
| 311 | u8 *cur_ptr = event_skb->data + sizeof(u32); |
| 312 | u16 tlv_type, tlv_len; |
| 313 | |
| 314 | while (len >= sizeof(struct mwifiex_ie_types_header)) { |
| 315 | tlv = (struct mwifiex_ie_types_header *)cur_ptr; |
| 316 | tlv_len = le16_to_cpu(tlv->len); |
| 317 | tlv_type = le16_to_cpu(tlv->type); |
| 318 | |
| 319 | if ((tlv_len + sizeof(struct mwifiex_ie_types_header)) > len) |
| 320 | break; |
| 321 | switch (tlv_type) { |
| 322 | case TLV_BTCOEX_WL_AGGR_WINSIZE: |
| 323 | winsizetlv = |
| 324 | (struct mwifiex_ie_types_btcoex_aggr_win_size *)tlv; |
| 325 | adapter->coex_win_size = winsizetlv->coex_win_size; |
| 326 | adapter->coex_tx_win_size = |
| 327 | winsizetlv->tx_win_size; |
| 328 | adapter->coex_rx_win_size = |
| 329 | winsizetlv->rx_win_size; |
| 330 | mwifiex_coex_ampdu_rxwinsize(adapter); |
| 331 | mwifiex_update_ampdu_txwinsize(adapter); |
| 332 | break; |
| 333 | |
| 334 | case TLV_BTCOEX_WL_SCANTIME: |
| 335 | scantlv = |
| 336 | (struct mwifiex_ie_types_btcoex_scan_time *)tlv; |
| 337 | adapter->coex_scan = scantlv->coex_scan; |
| 338 | adapter->coex_min_scan_time = scantlv->min_scan_time; |
| 339 | adapter->coex_max_scan_time = scantlv->max_scan_time; |
| 340 | break; |
| 341 | |
| 342 | default: |
| 343 | break; |
| 344 | } |
| 345 | |
| 346 | len -= tlv_len + sizeof(struct mwifiex_ie_types_header); |
| 347 | cur_ptr += tlv_len + |
| 348 | sizeof(struct mwifiex_ie_types_header); |
| 349 | } |
| 350 | |
| 351 | dev_dbg(adapter->dev, "coex_scan=%d min_scan=%d coex_win=%d, tx_win=%d rx_win=%d\n", |
| 352 | adapter->coex_scan, adapter->coex_min_scan_time, |
| 353 | adapter->coex_win_size, adapter->coex_tx_win_size, |
| 354 | adapter->coex_rx_win_size); |
| 355 | } |
| 356 | |
| 357 | /* |
Bing Zhao | 5e6e3a9 | 2011-03-21 18:00:50 -0700 | [diff] [blame] | 358 | * This function handles events generated by firmware. |
| 359 | * |
| 360 | * This is a generic function and handles all events. |
| 361 | * |
| 362 | * Event specific routines are called by this function based |
| 363 | * upon the generated event cause. |
| 364 | * |
| 365 | * For the following events, the function just forwards them to upper |
| 366 | * layers, optionally recording the change - |
| 367 | * - EVENT_LINK_SENSED |
| 368 | * - EVENT_MIC_ERR_UNICAST |
| 369 | * - EVENT_MIC_ERR_MULTICAST |
| 370 | * - EVENT_PORT_RELEASE |
| 371 | * - EVENT_RSSI_LOW |
| 372 | * - EVENT_SNR_LOW |
| 373 | * - EVENT_MAX_FAIL |
| 374 | * - EVENT_RSSI_HIGH |
| 375 | * - EVENT_SNR_HIGH |
| 376 | * - EVENT_DATA_RSSI_LOW |
| 377 | * - EVENT_DATA_SNR_LOW |
| 378 | * - EVENT_DATA_RSSI_HIGH |
| 379 | * - EVENT_DATA_SNR_HIGH |
| 380 | * - EVENT_LINK_QUALITY |
| 381 | * - EVENT_PRE_BEACON_LOST |
| 382 | * - EVENT_IBSS_COALESCED |
| 383 | * - EVENT_WEP_ICV_ERR |
| 384 | * - EVENT_BW_CHANGE |
| 385 | * - EVENT_HOSTWAKE_STAIE |
| 386 | * |
| 387 | * For the following events, no action is taken - |
| 388 | * - EVENT_MIB_CHANGED |
| 389 | * - EVENT_INIT_DONE |
| 390 | * - EVENT_DUMMY_HOST_WAKEUP_SIGNAL |
| 391 | * |
| 392 | * Rest of the supported events requires driver handling - |
| 393 | * - EVENT_DEAUTHENTICATED |
| 394 | * - EVENT_DISASSOCIATED |
| 395 | * - EVENT_LINK_LOST |
| 396 | * - EVENT_PS_SLEEP |
| 397 | * - EVENT_PS_AWAKE |
| 398 | * - EVENT_DEEP_SLEEP_AWAKE |
| 399 | * - EVENT_HS_ACT_REQ |
| 400 | * - EVENT_ADHOC_BCN_LOST |
| 401 | * - EVENT_BG_SCAN_REPORT |
| 402 | * - EVENT_WMM_STATUS_CHANGE |
| 403 | * - EVENT_ADDBA |
| 404 | * - EVENT_DELBA |
| 405 | * - EVENT_BA_STREAM_TIEMOUT |
| 406 | * - EVENT_AMSDU_AGGR_CTRL |
| 407 | */ |
| 408 | int mwifiex_process_sta_event(struct mwifiex_private *priv) |
| 409 | { |
| 410 | struct mwifiex_adapter *adapter = priv->adapter; |
Avinash Patil | 3d99d98 | 2012-08-03 18:06:06 -0700 | [diff] [blame] | 411 | int ret = 0; |
Bing Zhao | 5e6e3a9 | 2011-03-21 18:00:50 -0700 | [diff] [blame] | 412 | u32 eventcause = adapter->event_cause; |
Amitkumar Karwar | 8cc1d52 | 2012-10-05 20:21:43 -0700 | [diff] [blame] | 413 | u16 ctrl, reason_code; |
Bing Zhao | 5e6e3a9 | 2011-03-21 18:00:50 -0700 | [diff] [blame] | 414 | |
| 415 | switch (eventcause) { |
| 416 | case EVENT_DUMMY_HOST_WAKEUP_SIGNAL: |
Zhaoyang Liu | acebe8c | 2015-05-12 00:48:20 +0530 | [diff] [blame] | 417 | mwifiex_dbg(adapter, ERROR, |
| 418 | "invalid EVENT: DUMMY_HOST_WAKEUP_SIGNAL, ignore it\n"); |
Bing Zhao | 5e6e3a9 | 2011-03-21 18:00:50 -0700 | [diff] [blame] | 419 | break; |
| 420 | case EVENT_LINK_SENSED: |
Zhaoyang Liu | acebe8c | 2015-05-12 00:48:20 +0530 | [diff] [blame] | 421 | mwifiex_dbg(adapter, EVENT, "event: LINK_SENSED\n"); |
Bing Zhao | 5e6e3a9 | 2011-03-21 18:00:50 -0700 | [diff] [blame] | 422 | if (!netif_carrier_ok(priv->netdev)) |
| 423 | netif_carrier_on(priv->netdev); |
Avinash Patil | 47411a0 | 2012-11-01 18:44:16 -0700 | [diff] [blame] | 424 | mwifiex_wake_up_net_dev_queue(priv->netdev, adapter); |
Bing Zhao | 5e6e3a9 | 2011-03-21 18:00:50 -0700 | [diff] [blame] | 425 | break; |
| 426 | |
| 427 | case EVENT_DEAUTHENTICATED: |
Zhaoyang Liu | acebe8c | 2015-05-12 00:48:20 +0530 | [diff] [blame] | 428 | mwifiex_dbg(adapter, EVENT, "event: Deauthenticated\n"); |
Stone Piao | eaf49db | 2013-07-22 19:17:43 -0700 | [diff] [blame] | 429 | if (priv->wps.session_enable) { |
Zhaoyang Liu | acebe8c | 2015-05-12 00:48:20 +0530 | [diff] [blame] | 430 | mwifiex_dbg(adapter, INFO, |
| 431 | "info: receive deauth event in wps session\n"); |
Stone Piao | eaf49db | 2013-07-22 19:17:43 -0700 | [diff] [blame] | 432 | break; |
| 433 | } |
Bing Zhao | 5e6e3a9 | 2011-03-21 18:00:50 -0700 | [diff] [blame] | 434 | adapter->dbg.num_event_deauth++; |
Amitkumar Karwar | 8cc1d52 | 2012-10-05 20:21:43 -0700 | [diff] [blame] | 435 | if (priv->media_connected) { |
| 436 | reason_code = |
| 437 | le16_to_cpu(*(__le16 *)adapter->event_body); |
| 438 | mwifiex_reset_connect_state(priv, reason_code); |
| 439 | } |
Bing Zhao | 5e6e3a9 | 2011-03-21 18:00:50 -0700 | [diff] [blame] | 440 | break; |
| 441 | |
| 442 | case EVENT_DISASSOCIATED: |
Zhaoyang Liu | acebe8c | 2015-05-12 00:48:20 +0530 | [diff] [blame] | 443 | mwifiex_dbg(adapter, EVENT, "event: Disassociated\n"); |
Stone Piao | eaf49db | 2013-07-22 19:17:43 -0700 | [diff] [blame] | 444 | if (priv->wps.session_enable) { |
Zhaoyang Liu | acebe8c | 2015-05-12 00:48:20 +0530 | [diff] [blame] | 445 | mwifiex_dbg(adapter, INFO, |
| 446 | "info: receive disassoc event in wps session\n"); |
Stone Piao | eaf49db | 2013-07-22 19:17:43 -0700 | [diff] [blame] | 447 | break; |
| 448 | } |
Bing Zhao | 5e6e3a9 | 2011-03-21 18:00:50 -0700 | [diff] [blame] | 449 | adapter->dbg.num_event_disassoc++; |
Amitkumar Karwar | 8cc1d52 | 2012-10-05 20:21:43 -0700 | [diff] [blame] | 450 | if (priv->media_connected) { |
| 451 | reason_code = |
| 452 | le16_to_cpu(*(__le16 *)adapter->event_body); |
| 453 | mwifiex_reset_connect_state(priv, reason_code); |
| 454 | } |
Bing Zhao | 5e6e3a9 | 2011-03-21 18:00:50 -0700 | [diff] [blame] | 455 | break; |
| 456 | |
| 457 | case EVENT_LINK_LOST: |
Zhaoyang Liu | acebe8c | 2015-05-12 00:48:20 +0530 | [diff] [blame] | 458 | mwifiex_dbg(adapter, EVENT, "event: Link lost\n"); |
Bing Zhao | 5e6e3a9 | 2011-03-21 18:00:50 -0700 | [diff] [blame] | 459 | adapter->dbg.num_event_link_lost++; |
Amitkumar Karwar | 8cc1d52 | 2012-10-05 20:21:43 -0700 | [diff] [blame] | 460 | if (priv->media_connected) { |
| 461 | reason_code = |
| 462 | le16_to_cpu(*(__le16 *)adapter->event_body); |
| 463 | mwifiex_reset_connect_state(priv, reason_code); |
| 464 | } |
Bing Zhao | 5e6e3a9 | 2011-03-21 18:00:50 -0700 | [diff] [blame] | 465 | break; |
| 466 | |
| 467 | case EVENT_PS_SLEEP: |
Zhaoyang Liu | acebe8c | 2015-05-12 00:48:20 +0530 | [diff] [blame] | 468 | mwifiex_dbg(adapter, EVENT, "info: EVENT: SLEEP\n"); |
Bing Zhao | 5e6e3a9 | 2011-03-21 18:00:50 -0700 | [diff] [blame] | 469 | |
| 470 | adapter->ps_state = PS_STATE_PRE_SLEEP; |
| 471 | |
| 472 | mwifiex_check_ps_cond(adapter); |
| 473 | break; |
| 474 | |
| 475 | case EVENT_PS_AWAKE: |
Zhaoyang Liu | acebe8c | 2015-05-12 00:48:20 +0530 | [diff] [blame] | 476 | mwifiex_dbg(adapter, EVENT, "info: EVENT: AWAKE\n"); |
Bing Zhao | 5e6e3a9 | 2011-03-21 18:00:50 -0700 | [diff] [blame] | 477 | if (!adapter->pps_uapsd_mode && |
Yogesh Ashok Powar | 500f747 | 2012-03-13 19:22:41 -0700 | [diff] [blame] | 478 | priv->media_connected && adapter->sleep_period.period) { |
Bing Zhao | 5e6e3a9 | 2011-03-21 18:00:50 -0700 | [diff] [blame] | 479 | adapter->pps_uapsd_mode = true; |
Zhaoyang Liu | acebe8c | 2015-05-12 00:48:20 +0530 | [diff] [blame] | 480 | mwifiex_dbg(adapter, EVENT, |
| 481 | "event: PPS/UAPSD mode activated\n"); |
Bing Zhao | 5e6e3a9 | 2011-03-21 18:00:50 -0700 | [diff] [blame] | 482 | } |
| 483 | adapter->tx_lock_flag = false; |
| 484 | if (adapter->pps_uapsd_mode && adapter->gen_null_pkt) { |
| 485 | if (mwifiex_check_last_packet_indication(priv)) { |
Yogesh Ashok Powar | 500f747 | 2012-03-13 19:22:41 -0700 | [diff] [blame] | 486 | if (adapter->data_sent) { |
| 487 | adapter->ps_state = PS_STATE_AWAKE; |
| 488 | adapter->pm_wakeup_card_req = false; |
| 489 | adapter->pm_wakeup_fw_try = false; |
Amitkumar Karwar | 6e9344f | 2015-03-12 00:38:40 -0700 | [diff] [blame] | 490 | del_timer(&adapter->wakeup_timer); |
Yogesh Ashok Powar | 500f747 | 2012-03-13 19:22:41 -0700 | [diff] [blame] | 491 | break; |
| 492 | } |
| 493 | if (!mwifiex_send_null_packet |
| 494 | (priv, |
| 495 | MWIFIEX_TxPD_POWER_MGMT_NULL_PACKET | |
| 496 | MWIFIEX_TxPD_POWER_MGMT_LAST_PACKET)) |
Bing Zhao | 5e6e3a9 | 2011-03-21 18:00:50 -0700 | [diff] [blame] | 497 | adapter->ps_state = |
| 498 | PS_STATE_SLEEP; |
| 499 | return 0; |
Bing Zhao | 5e6e3a9 | 2011-03-21 18:00:50 -0700 | [diff] [blame] | 500 | } |
| 501 | } |
| 502 | adapter->ps_state = PS_STATE_AWAKE; |
| 503 | adapter->pm_wakeup_card_req = false; |
| 504 | adapter->pm_wakeup_fw_try = false; |
Amitkumar Karwar | 6e9344f | 2015-03-12 00:38:40 -0700 | [diff] [blame] | 505 | del_timer(&adapter->wakeup_timer); |
Bing Zhao | 5e6e3a9 | 2011-03-21 18:00:50 -0700 | [diff] [blame] | 506 | |
| 507 | break; |
| 508 | |
| 509 | case EVENT_DEEP_SLEEP_AWAKE: |
| 510 | adapter->if_ops.wakeup_complete(adapter); |
Zhaoyang Liu | acebe8c | 2015-05-12 00:48:20 +0530 | [diff] [blame] | 511 | mwifiex_dbg(adapter, EVENT, "event: DS_AWAKE\n"); |
Bing Zhao | 5e6e3a9 | 2011-03-21 18:00:50 -0700 | [diff] [blame] | 512 | if (adapter->is_deep_sleep) |
| 513 | adapter->is_deep_sleep = false; |
| 514 | break; |
| 515 | |
| 516 | case EVENT_HS_ACT_REQ: |
Zhaoyang Liu | acebe8c | 2015-05-12 00:48:20 +0530 | [diff] [blame] | 517 | mwifiex_dbg(adapter, EVENT, "event: HS_ACT_REQ\n"); |
Bing Zhao | fa0ecbb | 2014-02-27 19:35:12 -0800 | [diff] [blame] | 518 | ret = mwifiex_send_cmd(priv, HostCmd_CMD_802_11_HS_CFG_ENH, |
| 519 | 0, 0, NULL, false); |
Bing Zhao | 5e6e3a9 | 2011-03-21 18:00:50 -0700 | [diff] [blame] | 520 | break; |
| 521 | |
| 522 | case EVENT_MIC_ERR_UNICAST: |
Zhaoyang Liu | acebe8c | 2015-05-12 00:48:20 +0530 | [diff] [blame] | 523 | mwifiex_dbg(adapter, EVENT, "event: UNICAST MIC ERROR\n"); |
Amitkumar Karwar | 9c7ff73 | 2012-08-08 19:02:56 -0700 | [diff] [blame] | 524 | cfg80211_michael_mic_failure(priv->netdev, priv->cfg_bssid, |
| 525 | NL80211_KEYTYPE_PAIRWISE, |
| 526 | -1, NULL, GFP_KERNEL); |
Bing Zhao | 5e6e3a9 | 2011-03-21 18:00:50 -0700 | [diff] [blame] | 527 | break; |
| 528 | |
| 529 | case EVENT_MIC_ERR_MULTICAST: |
Zhaoyang Liu | acebe8c | 2015-05-12 00:48:20 +0530 | [diff] [blame] | 530 | mwifiex_dbg(adapter, EVENT, "event: MULTICAST MIC ERROR\n"); |
Amitkumar Karwar | 9c7ff73 | 2012-08-08 19:02:56 -0700 | [diff] [blame] | 531 | cfg80211_michael_mic_failure(priv->netdev, priv->cfg_bssid, |
| 532 | NL80211_KEYTYPE_GROUP, |
| 533 | -1, NULL, GFP_KERNEL); |
Bing Zhao | 5e6e3a9 | 2011-03-21 18:00:50 -0700 | [diff] [blame] | 534 | break; |
| 535 | case EVENT_MIB_CHANGED: |
| 536 | case EVENT_INIT_DONE: |
| 537 | break; |
| 538 | |
| 539 | case EVENT_ADHOC_BCN_LOST: |
Zhaoyang Liu | acebe8c | 2015-05-12 00:48:20 +0530 | [diff] [blame] | 540 | mwifiex_dbg(adapter, EVENT, "event: ADHOC_BCN_LOST\n"); |
Bing Zhao | 5e6e3a9 | 2011-03-21 18:00:50 -0700 | [diff] [blame] | 541 | priv->adhoc_is_link_sensed = false; |
| 542 | mwifiex_clean_txrx(priv); |
Avinash Patil | 47411a0 | 2012-11-01 18:44:16 -0700 | [diff] [blame] | 543 | mwifiex_stop_net_dev_queue(priv->netdev, adapter); |
Bing Zhao | 5e6e3a9 | 2011-03-21 18:00:50 -0700 | [diff] [blame] | 544 | if (netif_carrier_ok(priv->netdev)) |
| 545 | netif_carrier_off(priv->netdev); |
| 546 | break; |
| 547 | |
| 548 | case EVENT_BG_SCAN_REPORT: |
Zhaoyang Liu | acebe8c | 2015-05-12 00:48:20 +0530 | [diff] [blame] | 549 | mwifiex_dbg(adapter, EVENT, "event: BGS_REPORT\n"); |
Bing Zhao | fa0ecbb | 2014-02-27 19:35:12 -0800 | [diff] [blame] | 550 | ret = mwifiex_send_cmd(priv, HostCmd_CMD_802_11_BG_SCAN_QUERY, |
| 551 | HostCmd_ACT_GEN_GET, 0, NULL, false); |
Bing Zhao | 5e6e3a9 | 2011-03-21 18:00:50 -0700 | [diff] [blame] | 552 | break; |
| 553 | |
| 554 | case EVENT_PORT_RELEASE: |
Zhaoyang Liu | acebe8c | 2015-05-12 00:48:20 +0530 | [diff] [blame] | 555 | mwifiex_dbg(adapter, EVENT, "event: PORT RELEASE\n"); |
Bing Zhao | 5e6e3a9 | 2011-03-21 18:00:50 -0700 | [diff] [blame] | 556 | break; |
| 557 | |
Amitkumar Karwar | 21f58d20 | 2014-02-11 18:39:56 -0800 | [diff] [blame] | 558 | case EVENT_EXT_SCAN_REPORT: |
Zhaoyang Liu | acebe8c | 2015-05-12 00:48:20 +0530 | [diff] [blame] | 559 | mwifiex_dbg(adapter, EVENT, "event: EXT_SCAN Report\n"); |
Amitkumar Karwar | 21f58d20 | 2014-02-11 18:39:56 -0800 | [diff] [blame] | 560 | if (adapter->ext_scan) |
| 561 | ret = mwifiex_handle_event_ext_scan_report(priv, |
| 562 | adapter->event_skb->data); |
| 563 | |
| 564 | break; |
| 565 | |
Bing Zhao | 5e6e3a9 | 2011-03-21 18:00:50 -0700 | [diff] [blame] | 566 | case EVENT_WMM_STATUS_CHANGE: |
Zhaoyang Liu | acebe8c | 2015-05-12 00:48:20 +0530 | [diff] [blame] | 567 | mwifiex_dbg(adapter, EVENT, "event: WMM status changed\n"); |
Bing Zhao | fa0ecbb | 2014-02-27 19:35:12 -0800 | [diff] [blame] | 568 | ret = mwifiex_send_cmd(priv, HostCmd_CMD_WMM_GET_STATUS, |
| 569 | 0, 0, NULL, false); |
Bing Zhao | 5e6e3a9 | 2011-03-21 18:00:50 -0700 | [diff] [blame] | 570 | break; |
| 571 | |
| 572 | case EVENT_RSSI_LOW: |
Amitkumar Karwar | fa444bf | 2012-03-15 20:51:51 -0700 | [diff] [blame] | 573 | cfg80211_cqm_rssi_notify(priv->netdev, |
| 574 | NL80211_CQM_RSSI_THRESHOLD_EVENT_LOW, |
| 575 | GFP_KERNEL); |
Bing Zhao | fa0ecbb | 2014-02-27 19:35:12 -0800 | [diff] [blame] | 576 | mwifiex_send_cmd(priv, HostCmd_CMD_RSSI_INFO, |
| 577 | HostCmd_ACT_GEN_GET, 0, NULL, false); |
Amitkumar Karwar | fa444bf | 2012-03-15 20:51:51 -0700 | [diff] [blame] | 578 | priv->subsc_evt_rssi_state = RSSI_LOW_RECVD; |
Zhaoyang Liu | acebe8c | 2015-05-12 00:48:20 +0530 | [diff] [blame] | 579 | mwifiex_dbg(adapter, EVENT, "event: Beacon RSSI_LOW\n"); |
Bing Zhao | 5e6e3a9 | 2011-03-21 18:00:50 -0700 | [diff] [blame] | 580 | break; |
| 581 | case EVENT_SNR_LOW: |
Zhaoyang Liu | acebe8c | 2015-05-12 00:48:20 +0530 | [diff] [blame] | 582 | mwifiex_dbg(adapter, EVENT, "event: Beacon SNR_LOW\n"); |
Bing Zhao | 5e6e3a9 | 2011-03-21 18:00:50 -0700 | [diff] [blame] | 583 | break; |
| 584 | case EVENT_MAX_FAIL: |
Zhaoyang Liu | acebe8c | 2015-05-12 00:48:20 +0530 | [diff] [blame] | 585 | mwifiex_dbg(adapter, EVENT, "event: MAX_FAIL\n"); |
Bing Zhao | 5e6e3a9 | 2011-03-21 18:00:50 -0700 | [diff] [blame] | 586 | break; |
| 587 | case EVENT_RSSI_HIGH: |
Amitkumar Karwar | fa444bf | 2012-03-15 20:51:51 -0700 | [diff] [blame] | 588 | cfg80211_cqm_rssi_notify(priv->netdev, |
| 589 | NL80211_CQM_RSSI_THRESHOLD_EVENT_HIGH, |
| 590 | GFP_KERNEL); |
Bing Zhao | fa0ecbb | 2014-02-27 19:35:12 -0800 | [diff] [blame] | 591 | mwifiex_send_cmd(priv, HostCmd_CMD_RSSI_INFO, |
| 592 | HostCmd_ACT_GEN_GET, 0, NULL, false); |
Amitkumar Karwar | fa444bf | 2012-03-15 20:51:51 -0700 | [diff] [blame] | 593 | priv->subsc_evt_rssi_state = RSSI_HIGH_RECVD; |
Zhaoyang Liu | acebe8c | 2015-05-12 00:48:20 +0530 | [diff] [blame] | 594 | mwifiex_dbg(adapter, EVENT, "event: Beacon RSSI_HIGH\n"); |
Bing Zhao | 5e6e3a9 | 2011-03-21 18:00:50 -0700 | [diff] [blame] | 595 | break; |
| 596 | case EVENT_SNR_HIGH: |
Zhaoyang Liu | acebe8c | 2015-05-12 00:48:20 +0530 | [diff] [blame] | 597 | mwifiex_dbg(adapter, EVENT, "event: Beacon SNR_HIGH\n"); |
Bing Zhao | 5e6e3a9 | 2011-03-21 18:00:50 -0700 | [diff] [blame] | 598 | break; |
| 599 | case EVENT_DATA_RSSI_LOW: |
Zhaoyang Liu | acebe8c | 2015-05-12 00:48:20 +0530 | [diff] [blame] | 600 | mwifiex_dbg(adapter, EVENT, "event: Data RSSI_LOW\n"); |
Bing Zhao | 5e6e3a9 | 2011-03-21 18:00:50 -0700 | [diff] [blame] | 601 | break; |
| 602 | case EVENT_DATA_SNR_LOW: |
Zhaoyang Liu | acebe8c | 2015-05-12 00:48:20 +0530 | [diff] [blame] | 603 | mwifiex_dbg(adapter, EVENT, "event: Data SNR_LOW\n"); |
Bing Zhao | 5e6e3a9 | 2011-03-21 18:00:50 -0700 | [diff] [blame] | 604 | break; |
| 605 | case EVENT_DATA_RSSI_HIGH: |
Zhaoyang Liu | acebe8c | 2015-05-12 00:48:20 +0530 | [diff] [blame] | 606 | mwifiex_dbg(adapter, EVENT, "event: Data RSSI_HIGH\n"); |
Bing Zhao | 5e6e3a9 | 2011-03-21 18:00:50 -0700 | [diff] [blame] | 607 | break; |
| 608 | case EVENT_DATA_SNR_HIGH: |
Zhaoyang Liu | acebe8c | 2015-05-12 00:48:20 +0530 | [diff] [blame] | 609 | mwifiex_dbg(adapter, EVENT, "event: Data SNR_HIGH\n"); |
Bing Zhao | 5e6e3a9 | 2011-03-21 18:00:50 -0700 | [diff] [blame] | 610 | break; |
| 611 | case EVENT_LINK_QUALITY: |
Zhaoyang Liu | acebe8c | 2015-05-12 00:48:20 +0530 | [diff] [blame] | 612 | mwifiex_dbg(adapter, EVENT, "event: Link Quality\n"); |
Bing Zhao | 5e6e3a9 | 2011-03-21 18:00:50 -0700 | [diff] [blame] | 613 | break; |
| 614 | case EVENT_PRE_BEACON_LOST: |
Zhaoyang Liu | acebe8c | 2015-05-12 00:48:20 +0530 | [diff] [blame] | 615 | mwifiex_dbg(adapter, EVENT, "event: Pre-Beacon Lost\n"); |
Bing Zhao | 5e6e3a9 | 2011-03-21 18:00:50 -0700 | [diff] [blame] | 616 | break; |
| 617 | case EVENT_IBSS_COALESCED: |
Zhaoyang Liu | acebe8c | 2015-05-12 00:48:20 +0530 | [diff] [blame] | 618 | mwifiex_dbg(adapter, EVENT, "event: IBSS_COALESCED\n"); |
Bing Zhao | fa0ecbb | 2014-02-27 19:35:12 -0800 | [diff] [blame] | 619 | ret = mwifiex_send_cmd(priv, |
Bing Zhao | 5e6e3a9 | 2011-03-21 18:00:50 -0700 | [diff] [blame] | 620 | HostCmd_CMD_802_11_IBSS_COALESCING_STATUS, |
Bing Zhao | fa0ecbb | 2014-02-27 19:35:12 -0800 | [diff] [blame] | 621 | HostCmd_ACT_GEN_GET, 0, NULL, false); |
Bing Zhao | 5e6e3a9 | 2011-03-21 18:00:50 -0700 | [diff] [blame] | 622 | break; |
| 623 | case EVENT_ADDBA: |
Zhaoyang Liu | acebe8c | 2015-05-12 00:48:20 +0530 | [diff] [blame] | 624 | mwifiex_dbg(adapter, EVENT, "event: ADDBA Request\n"); |
Bing Zhao | fa0ecbb | 2014-02-27 19:35:12 -0800 | [diff] [blame] | 625 | mwifiex_send_cmd(priv, HostCmd_CMD_11N_ADDBA_RSP, |
| 626 | HostCmd_ACT_GEN_SET, 0, |
| 627 | adapter->event_body, false); |
Bing Zhao | 5e6e3a9 | 2011-03-21 18:00:50 -0700 | [diff] [blame] | 628 | break; |
| 629 | case EVENT_DELBA: |
Zhaoyang Liu | acebe8c | 2015-05-12 00:48:20 +0530 | [diff] [blame] | 630 | mwifiex_dbg(adapter, EVENT, "event: DELBA Request\n"); |
Bing Zhao | 5e6e3a9 | 2011-03-21 18:00:50 -0700 | [diff] [blame] | 631 | mwifiex_11n_delete_ba_stream(priv, adapter->event_body); |
| 632 | break; |
| 633 | case EVENT_BA_STREAM_TIEMOUT: |
Zhaoyang Liu | acebe8c | 2015-05-12 00:48:20 +0530 | [diff] [blame] | 634 | mwifiex_dbg(adapter, EVENT, "event: BA Stream timeout\n"); |
Bing Zhao | 5e6e3a9 | 2011-03-21 18:00:50 -0700 | [diff] [blame] | 635 | mwifiex_11n_ba_stream_timeout(priv, |
| 636 | (struct host_cmd_ds_11n_batimeout |
| 637 | *) |
| 638 | adapter->event_body); |
| 639 | break; |
| 640 | case EVENT_AMSDU_AGGR_CTRL: |
Bing Zhao | 8dd4372 | 2012-08-07 16:08:08 -0700 | [diff] [blame] | 641 | ctrl = le16_to_cpu(*(__le16 *)adapter->event_body); |
Zhaoyang Liu | acebe8c | 2015-05-12 00:48:20 +0530 | [diff] [blame] | 642 | mwifiex_dbg(adapter, EVENT, |
| 643 | "event: AMSDU_AGGR_CTRL %d\n", ctrl); |
Bing Zhao | 8dd4372 | 2012-08-07 16:08:08 -0700 | [diff] [blame] | 644 | |
Bing Zhao | 5e6e3a9 | 2011-03-21 18:00:50 -0700 | [diff] [blame] | 645 | adapter->tx_buf_size = |
Bing Zhao | 8dd4372 | 2012-08-07 16:08:08 -0700 | [diff] [blame] | 646 | min_t(u16, adapter->curr_tx_buf_size, ctrl); |
Zhaoyang Liu | acebe8c | 2015-05-12 00:48:20 +0530 | [diff] [blame] | 647 | mwifiex_dbg(adapter, EVENT, "event: tx_buf_size %d\n", |
| 648 | adapter->tx_buf_size); |
Bing Zhao | 5e6e3a9 | 2011-03-21 18:00:50 -0700 | [diff] [blame] | 649 | break; |
| 650 | |
| 651 | case EVENT_WEP_ICV_ERR: |
Zhaoyang Liu | acebe8c | 2015-05-12 00:48:20 +0530 | [diff] [blame] | 652 | mwifiex_dbg(adapter, EVENT, "event: WEP ICV error\n"); |
Bing Zhao | 5e6e3a9 | 2011-03-21 18:00:50 -0700 | [diff] [blame] | 653 | break; |
| 654 | |
| 655 | case EVENT_BW_CHANGE: |
Zhaoyang Liu | acebe8c | 2015-05-12 00:48:20 +0530 | [diff] [blame] | 656 | mwifiex_dbg(adapter, EVENT, "event: BW Change\n"); |
Bing Zhao | 5e6e3a9 | 2011-03-21 18:00:50 -0700 | [diff] [blame] | 657 | break; |
| 658 | |
| 659 | case EVENT_HOSTWAKE_STAIE: |
Zhaoyang Liu | acebe8c | 2015-05-12 00:48:20 +0530 | [diff] [blame] | 660 | mwifiex_dbg(adapter, EVENT, |
| 661 | "event: HOSTWAKE_STAIE %d\n", eventcause); |
Bing Zhao | 5e6e3a9 | 2011-03-21 18:00:50 -0700 | [diff] [blame] | 662 | break; |
Avinash Patil | e568634 | 2012-05-08 18:30:25 -0700 | [diff] [blame] | 663 | |
Stone Piao | eab1c76 | 2012-09-25 20:23:37 -0700 | [diff] [blame] | 664 | case EVENT_REMAIN_ON_CHAN_EXPIRED: |
Zhaoyang Liu | acebe8c | 2015-05-12 00:48:20 +0530 | [diff] [blame] | 665 | mwifiex_dbg(adapter, EVENT, |
| 666 | "event: Remain on channel expired\n"); |
Avinash Patil | 4facc34 | 2015-01-28 15:42:00 +0530 | [diff] [blame] | 667 | cfg80211_remain_on_channel_expired(&priv->wdev, |
Stone Piao | eab1c76 | 2012-09-25 20:23:37 -0700 | [diff] [blame] | 668 | priv->roc_cfg.cookie, |
| 669 | &priv->roc_cfg.chan, |
Stone Piao | eab1c76 | 2012-09-25 20:23:37 -0700 | [diff] [blame] | 670 | GFP_ATOMIC); |
| 671 | |
| 672 | memset(&priv->roc_cfg, 0x00, sizeof(struct mwifiex_roc_cfg)); |
| 673 | |
| 674 | break; |
| 675 | |
Amitkumar Karwar | 2a7305c | 2013-06-19 08:49:05 -0700 | [diff] [blame] | 676 | case EVENT_CHANNEL_SWITCH_ANN: |
Zhaoyang Liu | acebe8c | 2015-05-12 00:48:20 +0530 | [diff] [blame] | 677 | mwifiex_dbg(adapter, EVENT, "event: Channel Switch Announcement\n"); |
Amitkumar Karwar | b887664 | 2013-06-18 16:36:58 -0700 | [diff] [blame] | 678 | priv->csa_expire_time = |
| 679 | jiffies + msecs_to_jiffies(DFS_CHAN_MOVE_TIME); |
| 680 | priv->csa_chan = priv->curr_bss_params.bss_descriptor.channel; |
Bing Zhao | fa0ecbb | 2014-02-27 19:35:12 -0800 | [diff] [blame] | 681 | ret = mwifiex_send_cmd(priv, HostCmd_CMD_802_11_DEAUTHENTICATE, |
Amitkumar Karwar | 2a7305c | 2013-06-19 08:49:05 -0700 | [diff] [blame] | 682 | HostCmd_ACT_GEN_SET, 0, |
Bing Zhao | fa0ecbb | 2014-02-27 19:35:12 -0800 | [diff] [blame] | 683 | priv->curr_bss_params.bss_descriptor.mac_address, |
| 684 | false); |
Amitkumar Karwar | 2a7305c | 2013-06-19 08:49:05 -0700 | [diff] [blame] | 685 | break; |
| 686 | |
Avinash Patil | 79ff434 | 2014-05-06 22:02:44 -0700 | [diff] [blame] | 687 | case EVENT_TDLS_GENERIC_EVENT: |
| 688 | ret = mwifiex_parse_tdls_event(priv, adapter->event_skb); |
| 689 | break; |
| 690 | |
Avinash Patil | 4e6ee91 | 2015-06-22 19:06:07 +0530 | [diff] [blame] | 691 | case EVENT_TX_DATA_PAUSE: |
| 692 | mwifiex_process_sta_tx_pause_event(priv, adapter->event_skb); |
| 693 | mwifiex_dbg(adapter, EVENT, "event: TX DATA PAUSE\n"); |
| 694 | break; |
| 695 | |
Amitkumar Karwar | 808bbeb | 2014-11-25 06:43:05 -0800 | [diff] [blame] | 696 | case EVENT_TX_STATUS_REPORT: |
Zhaoyang Liu | acebe8c | 2015-05-12 00:48:20 +0530 | [diff] [blame] | 697 | mwifiex_dbg(adapter, EVENT, "event: TX_STATUS Report\n"); |
Amitkumar Karwar | 808bbeb | 2014-11-25 06:43:05 -0800 | [diff] [blame] | 698 | mwifiex_parse_tx_status_event(priv, adapter->event_body); |
| 699 | break; |
| 700 | |
Avinash Patil | 0a694d6 | 2015-01-28 15:54:22 +0530 | [diff] [blame] | 701 | case EVENT_CHANNEL_REPORT_RDY: |
Zhaoyang Liu | acebe8c | 2015-05-12 00:48:20 +0530 | [diff] [blame] | 702 | mwifiex_dbg(adapter, EVENT, "event: Channel Report\n"); |
Avinash Patil | 0a694d6 | 2015-01-28 15:54:22 +0530 | [diff] [blame] | 703 | ret = mwifiex_11h_handle_chanrpt_ready(priv, |
| 704 | adapter->event_skb); |
| 705 | break; |
Avinash Patil | 3b57c1a | 2015-01-28 15:54:23 +0530 | [diff] [blame] | 706 | case EVENT_RADAR_DETECTED: |
Zhaoyang Liu | acebe8c | 2015-05-12 00:48:20 +0530 | [diff] [blame] | 707 | mwifiex_dbg(adapter, EVENT, "event: Radar detected\n"); |
Avinash Patil | 3b57c1a | 2015-01-28 15:54:23 +0530 | [diff] [blame] | 708 | ret = mwifiex_11h_handle_radar_detected(priv, |
| 709 | adapter->event_skb); |
| 710 | break; |
Chunfan Chen | d219b7e | 2015-06-10 06:19:48 -0700 | [diff] [blame] | 711 | case EVENT_BT_COEX_WLAN_PARA_CHANGE: |
| 712 | dev_dbg(adapter->dev, "EVENT: BT coex wlan param update\n"); |
| 713 | mwifiex_bt_coex_wlan_param_update_event(priv, |
| 714 | adapter->event_skb); |
Amitkumar Karwar | 323d8f1 | 2015-06-15 04:03:35 -0700 | [diff] [blame] | 715 | break; |
Bing Zhao | 5e6e3a9 | 2011-03-21 18:00:50 -0700 | [diff] [blame] | 716 | default: |
Zhaoyang Liu | acebe8c | 2015-05-12 00:48:20 +0530 | [diff] [blame] | 717 | mwifiex_dbg(adapter, ERROR, "event: unknown event id: %#x\n", |
| 718 | eventcause); |
Bing Zhao | 5e6e3a9 | 2011-03-21 18:00:50 -0700 | [diff] [blame] | 719 | break; |
| 720 | } |
| 721 | |
| 722 | return ret; |
| 723 | } |