sta_event.c 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604
  1. /*
  2. * Marvell Wireless LAN device driver: station event handling
  3. *
  4. * Copyright (C) 2011-2014, Marvell International Ltd.
  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. #include "decl.h"
  20. #include "ioctl.h"
  21. #include "util.h"
  22. #include "fw.h"
  23. #include "main.h"
  24. #include "wmm.h"
  25. #include "11n.h"
  26. /*
  27. * This function resets the connection state.
  28. *
  29. * The function is invoked after receiving a disconnect event from firmware,
  30. * and performs the following actions -
  31. * - Set media status to disconnected
  32. * - Clean up Tx and Rx packets
  33. * - Resets SNR/NF/RSSI value in driver
  34. * - Resets security configurations in driver
  35. * - Enables auto data rate
  36. * - Saves the previous SSID and BSSID so that they can
  37. * be used for re-association, if required
  38. * - Erases current SSID and BSSID information
  39. * - Sends a disconnect event to upper layers/applications.
  40. */
  41. void
  42. mwifiex_reset_connect_state(struct mwifiex_private *priv, u16 reason_code)
  43. {
  44. struct mwifiex_adapter *adapter = priv->adapter;
  45. if (!priv->media_connected)
  46. return;
  47. mwifiex_dbg(adapter, INFO,
  48. "info: handles disconnect event\n");
  49. priv->media_connected = false;
  50. priv->scan_block = false;
  51. if ((GET_BSS_ROLE(priv) == MWIFIEX_BSS_ROLE_STA) &&
  52. ISSUPP_TDLS_ENABLED(priv->adapter->fw_cap_info)) {
  53. mwifiex_disable_all_tdls_links(priv);
  54. if (priv->adapter->auto_tdls)
  55. mwifiex_clean_auto_tdls(priv);
  56. }
  57. /* Free Tx and Rx packets, report disconnect to upper layer */
  58. mwifiex_clean_txrx(priv);
  59. /* Reset SNR/NF/RSSI values */
  60. priv->data_rssi_last = 0;
  61. priv->data_nf_last = 0;
  62. priv->data_rssi_avg = 0;
  63. priv->data_nf_avg = 0;
  64. priv->bcn_rssi_last = 0;
  65. priv->bcn_nf_last = 0;
  66. priv->bcn_rssi_avg = 0;
  67. priv->bcn_nf_avg = 0;
  68. priv->rxpd_rate = 0;
  69. priv->rxpd_htinfo = 0;
  70. priv->sec_info.wpa_enabled = false;
  71. priv->sec_info.wpa2_enabled = false;
  72. priv->wpa_ie_len = 0;
  73. priv->sec_info.wapi_enabled = false;
  74. priv->wapi_ie_len = 0;
  75. priv->sec_info.wapi_key_on = false;
  76. priv->sec_info.encryption_mode = 0;
  77. /* Enable auto data rate */
  78. priv->is_data_rate_auto = true;
  79. priv->data_rate = 0;
  80. if ((GET_BSS_ROLE(priv) == MWIFIEX_BSS_ROLE_STA ||
  81. GET_BSS_ROLE(priv) == MWIFIEX_BSS_ROLE_UAP) && priv->hist_data)
  82. mwifiex_hist_data_reset(priv);
  83. if (priv->bss_mode == NL80211_IFTYPE_ADHOC) {
  84. priv->adhoc_state = ADHOC_IDLE;
  85. priv->adhoc_is_link_sensed = false;
  86. }
  87. /*
  88. * Memorize the previous SSID and BSSID so
  89. * it could be used for re-assoc
  90. */
  91. mwifiex_dbg(adapter, INFO,
  92. "info: previous SSID=%s, SSID len=%u\n",
  93. priv->prev_ssid.ssid, priv->prev_ssid.ssid_len);
  94. mwifiex_dbg(adapter, INFO,
  95. "info: current SSID=%s, SSID len=%u\n",
  96. priv->curr_bss_params.bss_descriptor.ssid.ssid,
  97. priv->curr_bss_params.bss_descriptor.ssid.ssid_len);
  98. memcpy(&priv->prev_ssid,
  99. &priv->curr_bss_params.bss_descriptor.ssid,
  100. sizeof(struct cfg80211_ssid));
  101. memcpy(priv->prev_bssid,
  102. priv->curr_bss_params.bss_descriptor.mac_address, ETH_ALEN);
  103. /* Need to erase the current SSID and BSSID info */
  104. memset(&priv->curr_bss_params, 0x00, sizeof(priv->curr_bss_params));
  105. adapter->tx_lock_flag = false;
  106. adapter->pps_uapsd_mode = false;
  107. if (adapter->is_cmd_timedout && adapter->curr_cmd)
  108. return;
  109. priv->media_connected = false;
  110. mwifiex_dbg(adapter, MSG,
  111. "info: successfully disconnected from %pM: reason code %d\n",
  112. priv->cfg_bssid, reason_code);
  113. if (priv->bss_mode == NL80211_IFTYPE_STATION ||
  114. priv->bss_mode == NL80211_IFTYPE_P2P_CLIENT) {
  115. cfg80211_disconnected(priv->netdev, reason_code, NULL, 0,
  116. false, GFP_KERNEL);
  117. }
  118. eth_zero_addr(priv->cfg_bssid);
  119. mwifiex_stop_net_dev_queue(priv->netdev, adapter);
  120. if (netif_carrier_ok(priv->netdev))
  121. netif_carrier_off(priv->netdev);
  122. }
  123. static int mwifiex_parse_tdls_event(struct mwifiex_private *priv,
  124. struct sk_buff *event_skb)
  125. {
  126. int ret = 0;
  127. struct mwifiex_adapter *adapter = priv->adapter;
  128. struct mwifiex_sta_node *sta_ptr;
  129. struct mwifiex_tdls_generic_event *tdls_evt =
  130. (void *)event_skb->data + sizeof(adapter->event_cause);
  131. /* reserved 2 bytes are not mandatory in tdls event */
  132. if (event_skb->len < (sizeof(struct mwifiex_tdls_generic_event) -
  133. sizeof(u16) - sizeof(adapter->event_cause))) {
  134. mwifiex_dbg(adapter, ERROR, "Invalid event length!\n");
  135. return -1;
  136. }
  137. sta_ptr = mwifiex_get_sta_entry(priv, tdls_evt->peer_mac);
  138. if (!sta_ptr) {
  139. mwifiex_dbg(adapter, ERROR, "cannot get sta entry!\n");
  140. return -1;
  141. }
  142. switch (le16_to_cpu(tdls_evt->type)) {
  143. case TDLS_EVENT_LINK_TEAR_DOWN:
  144. cfg80211_tdls_oper_request(priv->netdev,
  145. tdls_evt->peer_mac,
  146. NL80211_TDLS_TEARDOWN,
  147. le16_to_cpu(tdls_evt->u.reason_code),
  148. GFP_KERNEL);
  149. break;
  150. default:
  151. break;
  152. }
  153. return ret;
  154. }
  155. /*
  156. * This function handles coex events generated by firmware
  157. */
  158. void mwifiex_bt_coex_wlan_param_update_event(struct mwifiex_private *priv,
  159. struct sk_buff *event_skb)
  160. {
  161. struct mwifiex_adapter *adapter = priv->adapter;
  162. struct mwifiex_ie_types_header *tlv;
  163. struct mwifiex_ie_types_btcoex_aggr_win_size *winsizetlv;
  164. struct mwifiex_ie_types_btcoex_scan_time *scantlv;
  165. s32 len = event_skb->len - sizeof(u32);
  166. u8 *cur_ptr = event_skb->data + sizeof(u32);
  167. u16 tlv_type, tlv_len;
  168. while (len >= sizeof(struct mwifiex_ie_types_header)) {
  169. tlv = (struct mwifiex_ie_types_header *)cur_ptr;
  170. tlv_len = le16_to_cpu(tlv->len);
  171. tlv_type = le16_to_cpu(tlv->type);
  172. if ((tlv_len + sizeof(struct mwifiex_ie_types_header)) > len)
  173. break;
  174. switch (tlv_type) {
  175. case TLV_BTCOEX_WL_AGGR_WINSIZE:
  176. winsizetlv =
  177. (struct mwifiex_ie_types_btcoex_aggr_win_size *)tlv;
  178. adapter->coex_win_size = winsizetlv->coex_win_size;
  179. adapter->coex_tx_win_size =
  180. winsizetlv->tx_win_size;
  181. adapter->coex_rx_win_size =
  182. winsizetlv->rx_win_size;
  183. mwifiex_coex_ampdu_rxwinsize(adapter);
  184. mwifiex_update_ampdu_txwinsize(adapter);
  185. break;
  186. case TLV_BTCOEX_WL_SCANTIME:
  187. scantlv =
  188. (struct mwifiex_ie_types_btcoex_scan_time *)tlv;
  189. adapter->coex_scan = scantlv->coex_scan;
  190. adapter->coex_min_scan_time = scantlv->min_scan_time;
  191. adapter->coex_max_scan_time = scantlv->max_scan_time;
  192. break;
  193. default:
  194. break;
  195. }
  196. len -= tlv_len + sizeof(struct mwifiex_ie_types_header);
  197. cur_ptr += tlv_len +
  198. sizeof(struct mwifiex_ie_types_header);
  199. }
  200. dev_dbg(adapter->dev, "coex_scan=%d min_scan=%d coex_win=%d, tx_win=%d rx_win=%d\n",
  201. adapter->coex_scan, adapter->coex_min_scan_time,
  202. adapter->coex_win_size, adapter->coex_tx_win_size,
  203. adapter->coex_rx_win_size);
  204. }
  205. /*
  206. * This function handles events generated by firmware.
  207. *
  208. * This is a generic function and handles all events.
  209. *
  210. * Event specific routines are called by this function based
  211. * upon the generated event cause.
  212. *
  213. * For the following events, the function just forwards them to upper
  214. * layers, optionally recording the change -
  215. * - EVENT_LINK_SENSED
  216. * - EVENT_MIC_ERR_UNICAST
  217. * - EVENT_MIC_ERR_MULTICAST
  218. * - EVENT_PORT_RELEASE
  219. * - EVENT_RSSI_LOW
  220. * - EVENT_SNR_LOW
  221. * - EVENT_MAX_FAIL
  222. * - EVENT_RSSI_HIGH
  223. * - EVENT_SNR_HIGH
  224. * - EVENT_DATA_RSSI_LOW
  225. * - EVENT_DATA_SNR_LOW
  226. * - EVENT_DATA_RSSI_HIGH
  227. * - EVENT_DATA_SNR_HIGH
  228. * - EVENT_LINK_QUALITY
  229. * - EVENT_PRE_BEACON_LOST
  230. * - EVENT_IBSS_COALESCED
  231. * - EVENT_WEP_ICV_ERR
  232. * - EVENT_BW_CHANGE
  233. * - EVENT_HOSTWAKE_STAIE
  234. *
  235. * For the following events, no action is taken -
  236. * - EVENT_MIB_CHANGED
  237. * - EVENT_INIT_DONE
  238. * - EVENT_DUMMY_HOST_WAKEUP_SIGNAL
  239. *
  240. * Rest of the supported events requires driver handling -
  241. * - EVENT_DEAUTHENTICATED
  242. * - EVENT_DISASSOCIATED
  243. * - EVENT_LINK_LOST
  244. * - EVENT_PS_SLEEP
  245. * - EVENT_PS_AWAKE
  246. * - EVENT_DEEP_SLEEP_AWAKE
  247. * - EVENT_HS_ACT_REQ
  248. * - EVENT_ADHOC_BCN_LOST
  249. * - EVENT_BG_SCAN_REPORT
  250. * - EVENT_WMM_STATUS_CHANGE
  251. * - EVENT_ADDBA
  252. * - EVENT_DELBA
  253. * - EVENT_BA_STREAM_TIEMOUT
  254. * - EVENT_AMSDU_AGGR_CTRL
  255. */
  256. int mwifiex_process_sta_event(struct mwifiex_private *priv)
  257. {
  258. struct mwifiex_adapter *adapter = priv->adapter;
  259. int ret = 0;
  260. u32 eventcause = adapter->event_cause;
  261. u16 ctrl, reason_code;
  262. switch (eventcause) {
  263. case EVENT_DUMMY_HOST_WAKEUP_SIGNAL:
  264. mwifiex_dbg(adapter, ERROR,
  265. "invalid EVENT: DUMMY_HOST_WAKEUP_SIGNAL, ignore it\n");
  266. break;
  267. case EVENT_LINK_SENSED:
  268. mwifiex_dbg(adapter, EVENT, "event: LINK_SENSED\n");
  269. if (!netif_carrier_ok(priv->netdev))
  270. netif_carrier_on(priv->netdev);
  271. mwifiex_wake_up_net_dev_queue(priv->netdev, adapter);
  272. break;
  273. case EVENT_DEAUTHENTICATED:
  274. mwifiex_dbg(adapter, EVENT, "event: Deauthenticated\n");
  275. if (priv->wps.session_enable) {
  276. mwifiex_dbg(adapter, INFO,
  277. "info: receive deauth event in wps session\n");
  278. break;
  279. }
  280. adapter->dbg.num_event_deauth++;
  281. if (priv->media_connected) {
  282. reason_code =
  283. le16_to_cpu(*(__le16 *)adapter->event_body);
  284. mwifiex_reset_connect_state(priv, reason_code);
  285. }
  286. break;
  287. case EVENT_DISASSOCIATED:
  288. mwifiex_dbg(adapter, EVENT, "event: Disassociated\n");
  289. if (priv->wps.session_enable) {
  290. mwifiex_dbg(adapter, INFO,
  291. "info: receive disassoc event in wps session\n");
  292. break;
  293. }
  294. adapter->dbg.num_event_disassoc++;
  295. if (priv->media_connected) {
  296. reason_code =
  297. le16_to_cpu(*(__le16 *)adapter->event_body);
  298. mwifiex_reset_connect_state(priv, reason_code);
  299. }
  300. break;
  301. case EVENT_LINK_LOST:
  302. mwifiex_dbg(adapter, EVENT, "event: Link lost\n");
  303. adapter->dbg.num_event_link_lost++;
  304. if (priv->media_connected) {
  305. reason_code =
  306. le16_to_cpu(*(__le16 *)adapter->event_body);
  307. mwifiex_reset_connect_state(priv, reason_code);
  308. }
  309. break;
  310. case EVENT_PS_SLEEP:
  311. mwifiex_dbg(adapter, EVENT, "info: EVENT: SLEEP\n");
  312. adapter->ps_state = PS_STATE_PRE_SLEEP;
  313. mwifiex_check_ps_cond(adapter);
  314. break;
  315. case EVENT_PS_AWAKE:
  316. mwifiex_dbg(adapter, EVENT, "info: EVENT: AWAKE\n");
  317. if (!adapter->pps_uapsd_mode &&
  318. priv->media_connected && adapter->sleep_period.period) {
  319. adapter->pps_uapsd_mode = true;
  320. mwifiex_dbg(adapter, EVENT,
  321. "event: PPS/UAPSD mode activated\n");
  322. }
  323. adapter->tx_lock_flag = false;
  324. if (adapter->pps_uapsd_mode && adapter->gen_null_pkt) {
  325. if (mwifiex_check_last_packet_indication(priv)) {
  326. if (adapter->data_sent) {
  327. adapter->ps_state = PS_STATE_AWAKE;
  328. adapter->pm_wakeup_card_req = false;
  329. adapter->pm_wakeup_fw_try = false;
  330. del_timer(&adapter->wakeup_timer);
  331. break;
  332. }
  333. if (!mwifiex_send_null_packet
  334. (priv,
  335. MWIFIEX_TxPD_POWER_MGMT_NULL_PACKET |
  336. MWIFIEX_TxPD_POWER_MGMT_LAST_PACKET))
  337. adapter->ps_state =
  338. PS_STATE_SLEEP;
  339. return 0;
  340. }
  341. }
  342. adapter->ps_state = PS_STATE_AWAKE;
  343. adapter->pm_wakeup_card_req = false;
  344. adapter->pm_wakeup_fw_try = false;
  345. del_timer(&adapter->wakeup_timer);
  346. break;
  347. case EVENT_DEEP_SLEEP_AWAKE:
  348. adapter->if_ops.wakeup_complete(adapter);
  349. mwifiex_dbg(adapter, EVENT, "event: DS_AWAKE\n");
  350. if (adapter->is_deep_sleep)
  351. adapter->is_deep_sleep = false;
  352. break;
  353. case EVENT_HS_ACT_REQ:
  354. mwifiex_dbg(adapter, EVENT, "event: HS_ACT_REQ\n");
  355. ret = mwifiex_send_cmd(priv, HostCmd_CMD_802_11_HS_CFG_ENH,
  356. 0, 0, NULL, false);
  357. break;
  358. case EVENT_MIC_ERR_UNICAST:
  359. mwifiex_dbg(adapter, EVENT, "event: UNICAST MIC ERROR\n");
  360. cfg80211_michael_mic_failure(priv->netdev, priv->cfg_bssid,
  361. NL80211_KEYTYPE_PAIRWISE,
  362. -1, NULL, GFP_KERNEL);
  363. break;
  364. case EVENT_MIC_ERR_MULTICAST:
  365. mwifiex_dbg(adapter, EVENT, "event: MULTICAST MIC ERROR\n");
  366. cfg80211_michael_mic_failure(priv->netdev, priv->cfg_bssid,
  367. NL80211_KEYTYPE_GROUP,
  368. -1, NULL, GFP_KERNEL);
  369. break;
  370. case EVENT_MIB_CHANGED:
  371. case EVENT_INIT_DONE:
  372. break;
  373. case EVENT_ADHOC_BCN_LOST:
  374. mwifiex_dbg(adapter, EVENT, "event: ADHOC_BCN_LOST\n");
  375. priv->adhoc_is_link_sensed = false;
  376. mwifiex_clean_txrx(priv);
  377. mwifiex_stop_net_dev_queue(priv->netdev, adapter);
  378. if (netif_carrier_ok(priv->netdev))
  379. netif_carrier_off(priv->netdev);
  380. break;
  381. case EVENT_BG_SCAN_REPORT:
  382. mwifiex_dbg(adapter, EVENT, "event: BGS_REPORT\n");
  383. ret = mwifiex_send_cmd(priv, HostCmd_CMD_802_11_BG_SCAN_QUERY,
  384. HostCmd_ACT_GEN_GET, 0, NULL, false);
  385. break;
  386. case EVENT_PORT_RELEASE:
  387. mwifiex_dbg(adapter, EVENT, "event: PORT RELEASE\n");
  388. break;
  389. case EVENT_EXT_SCAN_REPORT:
  390. mwifiex_dbg(adapter, EVENT, "event: EXT_SCAN Report\n");
  391. if (adapter->ext_scan)
  392. ret = mwifiex_handle_event_ext_scan_report(priv,
  393. adapter->event_skb->data);
  394. break;
  395. case EVENT_WMM_STATUS_CHANGE:
  396. mwifiex_dbg(adapter, EVENT, "event: WMM status changed\n");
  397. ret = mwifiex_send_cmd(priv, HostCmd_CMD_WMM_GET_STATUS,
  398. 0, 0, NULL, false);
  399. break;
  400. case EVENT_RSSI_LOW:
  401. cfg80211_cqm_rssi_notify(priv->netdev,
  402. NL80211_CQM_RSSI_THRESHOLD_EVENT_LOW,
  403. GFP_KERNEL);
  404. mwifiex_send_cmd(priv, HostCmd_CMD_RSSI_INFO,
  405. HostCmd_ACT_GEN_GET, 0, NULL, false);
  406. priv->subsc_evt_rssi_state = RSSI_LOW_RECVD;
  407. mwifiex_dbg(adapter, EVENT, "event: Beacon RSSI_LOW\n");
  408. break;
  409. case EVENT_SNR_LOW:
  410. mwifiex_dbg(adapter, EVENT, "event: Beacon SNR_LOW\n");
  411. break;
  412. case EVENT_MAX_FAIL:
  413. mwifiex_dbg(adapter, EVENT, "event: MAX_FAIL\n");
  414. break;
  415. case EVENT_RSSI_HIGH:
  416. cfg80211_cqm_rssi_notify(priv->netdev,
  417. NL80211_CQM_RSSI_THRESHOLD_EVENT_HIGH,
  418. GFP_KERNEL);
  419. mwifiex_send_cmd(priv, HostCmd_CMD_RSSI_INFO,
  420. HostCmd_ACT_GEN_GET, 0, NULL, false);
  421. priv->subsc_evt_rssi_state = RSSI_HIGH_RECVD;
  422. mwifiex_dbg(adapter, EVENT, "event: Beacon RSSI_HIGH\n");
  423. break;
  424. case EVENT_SNR_HIGH:
  425. mwifiex_dbg(adapter, EVENT, "event: Beacon SNR_HIGH\n");
  426. break;
  427. case EVENT_DATA_RSSI_LOW:
  428. mwifiex_dbg(adapter, EVENT, "event: Data RSSI_LOW\n");
  429. break;
  430. case EVENT_DATA_SNR_LOW:
  431. mwifiex_dbg(adapter, EVENT, "event: Data SNR_LOW\n");
  432. break;
  433. case EVENT_DATA_RSSI_HIGH:
  434. mwifiex_dbg(adapter, EVENT, "event: Data RSSI_HIGH\n");
  435. break;
  436. case EVENT_DATA_SNR_HIGH:
  437. mwifiex_dbg(adapter, EVENT, "event: Data SNR_HIGH\n");
  438. break;
  439. case EVENT_LINK_QUALITY:
  440. mwifiex_dbg(adapter, EVENT, "event: Link Quality\n");
  441. break;
  442. case EVENT_PRE_BEACON_LOST:
  443. mwifiex_dbg(adapter, EVENT, "event: Pre-Beacon Lost\n");
  444. break;
  445. case EVENT_IBSS_COALESCED:
  446. mwifiex_dbg(adapter, EVENT, "event: IBSS_COALESCED\n");
  447. ret = mwifiex_send_cmd(priv,
  448. HostCmd_CMD_802_11_IBSS_COALESCING_STATUS,
  449. HostCmd_ACT_GEN_GET, 0, NULL, false);
  450. break;
  451. case EVENT_ADDBA:
  452. mwifiex_dbg(adapter, EVENT, "event: ADDBA Request\n");
  453. mwifiex_send_cmd(priv, HostCmd_CMD_11N_ADDBA_RSP,
  454. HostCmd_ACT_GEN_SET, 0,
  455. adapter->event_body, false);
  456. break;
  457. case EVENT_DELBA:
  458. mwifiex_dbg(adapter, EVENT, "event: DELBA Request\n");
  459. mwifiex_11n_delete_ba_stream(priv, adapter->event_body);
  460. break;
  461. case EVENT_BA_STREAM_TIEMOUT:
  462. mwifiex_dbg(adapter, EVENT, "event: BA Stream timeout\n");
  463. mwifiex_11n_ba_stream_timeout(priv,
  464. (struct host_cmd_ds_11n_batimeout
  465. *)
  466. adapter->event_body);
  467. break;
  468. case EVENT_AMSDU_AGGR_CTRL:
  469. ctrl = le16_to_cpu(*(__le16 *)adapter->event_body);
  470. mwifiex_dbg(adapter, EVENT,
  471. "event: AMSDU_AGGR_CTRL %d\n", ctrl);
  472. adapter->tx_buf_size =
  473. min_t(u16, adapter->curr_tx_buf_size, ctrl);
  474. mwifiex_dbg(adapter, EVENT, "event: tx_buf_size %d\n",
  475. adapter->tx_buf_size);
  476. break;
  477. case EVENT_WEP_ICV_ERR:
  478. mwifiex_dbg(adapter, EVENT, "event: WEP ICV error\n");
  479. break;
  480. case EVENT_BW_CHANGE:
  481. mwifiex_dbg(adapter, EVENT, "event: BW Change\n");
  482. break;
  483. case EVENT_HOSTWAKE_STAIE:
  484. mwifiex_dbg(adapter, EVENT,
  485. "event: HOSTWAKE_STAIE %d\n", eventcause);
  486. break;
  487. case EVENT_REMAIN_ON_CHAN_EXPIRED:
  488. mwifiex_dbg(adapter, EVENT,
  489. "event: Remain on channel expired\n");
  490. cfg80211_remain_on_channel_expired(&priv->wdev,
  491. priv->roc_cfg.cookie,
  492. &priv->roc_cfg.chan,
  493. GFP_ATOMIC);
  494. memset(&priv->roc_cfg, 0x00, sizeof(struct mwifiex_roc_cfg));
  495. break;
  496. case EVENT_CHANNEL_SWITCH_ANN:
  497. mwifiex_dbg(adapter, EVENT, "event: Channel Switch Announcement\n");
  498. priv->csa_expire_time =
  499. jiffies + msecs_to_jiffies(DFS_CHAN_MOVE_TIME);
  500. priv->csa_chan = priv->curr_bss_params.bss_descriptor.channel;
  501. ret = mwifiex_send_cmd(priv, HostCmd_CMD_802_11_DEAUTHENTICATE,
  502. HostCmd_ACT_GEN_SET, 0,
  503. priv->curr_bss_params.bss_descriptor.mac_address,
  504. false);
  505. break;
  506. case EVENT_TDLS_GENERIC_EVENT:
  507. ret = mwifiex_parse_tdls_event(priv, adapter->event_skb);
  508. break;
  509. case EVENT_TX_STATUS_REPORT:
  510. mwifiex_dbg(adapter, EVENT, "event: TX_STATUS Report\n");
  511. mwifiex_parse_tx_status_event(priv, adapter->event_body);
  512. break;
  513. case EVENT_CHANNEL_REPORT_RDY:
  514. mwifiex_dbg(adapter, EVENT, "event: Channel Report\n");
  515. ret = mwifiex_11h_handle_chanrpt_ready(priv,
  516. adapter->event_skb);
  517. break;
  518. case EVENT_RADAR_DETECTED:
  519. mwifiex_dbg(adapter, EVENT, "event: Radar detected\n");
  520. ret = mwifiex_11h_handle_radar_detected(priv,
  521. adapter->event_skb);
  522. break;
  523. case EVENT_BT_COEX_WLAN_PARA_CHANGE:
  524. dev_dbg(adapter->dev, "EVENT: BT coex wlan param update\n");
  525. mwifiex_bt_coex_wlan_param_update_event(priv,
  526. adapter->event_skb);
  527. break;
  528. default:
  529. mwifiex_dbg(adapter, ERROR, "event: unknown event id: %#x\n",
  530. eventcause);
  531. break;
  532. }
  533. return ret;
  534. }