sta_event.c 32 KB

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