sta_cmdresp.c 33 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127
  1. /*
  2. * Marvell Wireless LAN device driver: station command response 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. #include "11ac.h"
  27. /*
  28. * This function handles the command response error case.
  29. *
  30. * For scan response error, the function cancels all the pending
  31. * scan commands and generates an event to inform the applications
  32. * of the scan completion.
  33. *
  34. * For Power Save command failure, we do not retry enter PS
  35. * command in case of Ad-hoc mode.
  36. *
  37. * For all other response errors, the current command buffer is freed
  38. * and returned to the free command queue.
  39. */
  40. static void
  41. mwifiex_process_cmdresp_error(struct mwifiex_private *priv,
  42. struct host_cmd_ds_command *resp)
  43. {
  44. struct cmd_ctrl_node *cmd_node = NULL, *tmp_node;
  45. struct mwifiex_adapter *adapter = priv->adapter;
  46. struct host_cmd_ds_802_11_ps_mode_enh *pm;
  47. unsigned long flags;
  48. dev_err(adapter->dev, "CMD_RESP: cmd %#x error, result=%#x\n",
  49. resp->command, resp->result);
  50. if (adapter->curr_cmd->wait_q_enabled)
  51. adapter->cmd_wait_q.status = -1;
  52. switch (le16_to_cpu(resp->command)) {
  53. case HostCmd_CMD_802_11_PS_MODE_ENH:
  54. pm = &resp->params.psmode_enh;
  55. dev_err(adapter->dev,
  56. "PS_MODE_ENH cmd failed: result=0x%x action=0x%X\n",
  57. resp->result, le16_to_cpu(pm->action));
  58. /* We do not re-try enter-ps command in ad-hoc mode. */
  59. if (le16_to_cpu(pm->action) == EN_AUTO_PS &&
  60. (le16_to_cpu(pm->params.ps_bitmap) & BITMAP_STA_PS) &&
  61. priv->bss_mode == NL80211_IFTYPE_ADHOC)
  62. adapter->ps_mode = MWIFIEX_802_11_POWER_MODE_CAM;
  63. break;
  64. case HostCmd_CMD_802_11_SCAN:
  65. case HostCmd_CMD_802_11_SCAN_EXT:
  66. /* Cancel all pending scan command */
  67. spin_lock_irqsave(&adapter->scan_pending_q_lock, flags);
  68. list_for_each_entry_safe(cmd_node, tmp_node,
  69. &adapter->scan_pending_q, list) {
  70. list_del(&cmd_node->list);
  71. spin_unlock_irqrestore(&adapter->scan_pending_q_lock,
  72. flags);
  73. mwifiex_insert_cmd_to_free_q(adapter, cmd_node);
  74. spin_lock_irqsave(&adapter->scan_pending_q_lock, flags);
  75. }
  76. spin_unlock_irqrestore(&adapter->scan_pending_q_lock, flags);
  77. spin_lock_irqsave(&adapter->mwifiex_cmd_lock, flags);
  78. adapter->scan_processing = false;
  79. spin_unlock_irqrestore(&adapter->mwifiex_cmd_lock, flags);
  80. break;
  81. case HostCmd_CMD_MAC_CONTROL:
  82. break;
  83. default:
  84. break;
  85. }
  86. /* Handling errors here */
  87. mwifiex_recycle_cmd_node(adapter, adapter->curr_cmd);
  88. spin_lock_irqsave(&adapter->mwifiex_cmd_lock, flags);
  89. adapter->curr_cmd = NULL;
  90. spin_unlock_irqrestore(&adapter->mwifiex_cmd_lock, flags);
  91. }
  92. /*
  93. * This function handles the command response of get RSSI info.
  94. *
  95. * Handling includes changing the header fields into CPU format
  96. * and saving the following parameters in driver -
  97. * - Last data and beacon RSSI value
  98. * - Average data and beacon RSSI value
  99. * - Last data and beacon NF value
  100. * - Average data and beacon NF value
  101. *
  102. * The parameters are send to the application as well, along with
  103. * calculated SNR values.
  104. */
  105. static int mwifiex_ret_802_11_rssi_info(struct mwifiex_private *priv,
  106. struct host_cmd_ds_command *resp)
  107. {
  108. struct host_cmd_ds_802_11_rssi_info_rsp *rssi_info_rsp =
  109. &resp->params.rssi_info_rsp;
  110. struct mwifiex_ds_misc_subsc_evt *subsc_evt =
  111. &priv->async_subsc_evt_storage;
  112. priv->data_rssi_last = le16_to_cpu(rssi_info_rsp->data_rssi_last);
  113. priv->data_nf_last = le16_to_cpu(rssi_info_rsp->data_nf_last);
  114. priv->data_rssi_avg = le16_to_cpu(rssi_info_rsp->data_rssi_avg);
  115. priv->data_nf_avg = le16_to_cpu(rssi_info_rsp->data_nf_avg);
  116. priv->bcn_rssi_last = le16_to_cpu(rssi_info_rsp->bcn_rssi_last);
  117. priv->bcn_nf_last = le16_to_cpu(rssi_info_rsp->bcn_nf_last);
  118. priv->bcn_rssi_avg = le16_to_cpu(rssi_info_rsp->bcn_rssi_avg);
  119. priv->bcn_nf_avg = le16_to_cpu(rssi_info_rsp->bcn_nf_avg);
  120. if (priv->subsc_evt_rssi_state == EVENT_HANDLED)
  121. return 0;
  122. memset(subsc_evt, 0x00, sizeof(struct mwifiex_ds_misc_subsc_evt));
  123. /* Resubscribe low and high rssi events with new thresholds */
  124. subsc_evt->events = BITMASK_BCN_RSSI_LOW | BITMASK_BCN_RSSI_HIGH;
  125. subsc_evt->action = HostCmd_ACT_BITWISE_SET;
  126. if (priv->subsc_evt_rssi_state == RSSI_LOW_RECVD) {
  127. subsc_evt->bcn_l_rssi_cfg.abs_value = abs(priv->bcn_rssi_avg -
  128. priv->cqm_rssi_hyst);
  129. subsc_evt->bcn_h_rssi_cfg.abs_value = abs(priv->cqm_rssi_thold);
  130. } else if (priv->subsc_evt_rssi_state == RSSI_HIGH_RECVD) {
  131. subsc_evt->bcn_l_rssi_cfg.abs_value = abs(priv->cqm_rssi_thold);
  132. subsc_evt->bcn_h_rssi_cfg.abs_value = abs(priv->bcn_rssi_avg +
  133. priv->cqm_rssi_hyst);
  134. }
  135. subsc_evt->bcn_l_rssi_cfg.evt_freq = 1;
  136. subsc_evt->bcn_h_rssi_cfg.evt_freq = 1;
  137. priv->subsc_evt_rssi_state = EVENT_HANDLED;
  138. mwifiex_send_cmd(priv, HostCmd_CMD_802_11_SUBSCRIBE_EVENT,
  139. 0, 0, subsc_evt, false);
  140. return 0;
  141. }
  142. /*
  143. * This function handles the command response of set/get SNMP
  144. * MIB parameters.
  145. *
  146. * Handling includes changing the header fields into CPU format
  147. * and saving the parameter in driver.
  148. *
  149. * The following parameters are supported -
  150. * - Fragmentation threshold
  151. * - RTS threshold
  152. * - Short retry limit
  153. */
  154. static int mwifiex_ret_802_11_snmp_mib(struct mwifiex_private *priv,
  155. struct host_cmd_ds_command *resp,
  156. u32 *data_buf)
  157. {
  158. struct host_cmd_ds_802_11_snmp_mib *smib = &resp->params.smib;
  159. u16 oid = le16_to_cpu(smib->oid);
  160. u16 query_type = le16_to_cpu(smib->query_type);
  161. u32 ul_temp;
  162. dev_dbg(priv->adapter->dev, "info: SNMP_RESP: oid value = %#x,"
  163. " query_type = %#x, buf size = %#x\n",
  164. oid, query_type, le16_to_cpu(smib->buf_size));
  165. if (query_type == HostCmd_ACT_GEN_GET) {
  166. ul_temp = le16_to_cpu(*((__le16 *) (smib->value)));
  167. if (data_buf)
  168. *data_buf = ul_temp;
  169. switch (oid) {
  170. case FRAG_THRESH_I:
  171. dev_dbg(priv->adapter->dev,
  172. "info: SNMP_RESP: FragThsd =%u\n", ul_temp);
  173. break;
  174. case RTS_THRESH_I:
  175. dev_dbg(priv->adapter->dev,
  176. "info: SNMP_RESP: RTSThsd =%u\n", ul_temp);
  177. break;
  178. case SHORT_RETRY_LIM_I:
  179. dev_dbg(priv->adapter->dev,
  180. "info: SNMP_RESP: TxRetryCount=%u\n", ul_temp);
  181. break;
  182. case DTIM_PERIOD_I:
  183. dev_dbg(priv->adapter->dev,
  184. "info: SNMP_RESP: DTIM period=%u\n", ul_temp);
  185. default:
  186. break;
  187. }
  188. }
  189. return 0;
  190. }
  191. /*
  192. * This function handles the command response of get log request
  193. *
  194. * Handling includes changing the header fields into CPU format
  195. * and sending the received parameters to application.
  196. */
  197. static int mwifiex_ret_get_log(struct mwifiex_private *priv,
  198. struct host_cmd_ds_command *resp,
  199. struct mwifiex_ds_get_stats *stats)
  200. {
  201. struct host_cmd_ds_802_11_get_log *get_log =
  202. &resp->params.get_log;
  203. if (stats) {
  204. stats->mcast_tx_frame = le32_to_cpu(get_log->mcast_tx_frame);
  205. stats->failed = le32_to_cpu(get_log->failed);
  206. stats->retry = le32_to_cpu(get_log->retry);
  207. stats->multi_retry = le32_to_cpu(get_log->multi_retry);
  208. stats->frame_dup = le32_to_cpu(get_log->frame_dup);
  209. stats->rts_success = le32_to_cpu(get_log->rts_success);
  210. stats->rts_failure = le32_to_cpu(get_log->rts_failure);
  211. stats->ack_failure = le32_to_cpu(get_log->ack_failure);
  212. stats->rx_frag = le32_to_cpu(get_log->rx_frag);
  213. stats->mcast_rx_frame = le32_to_cpu(get_log->mcast_rx_frame);
  214. stats->fcs_error = le32_to_cpu(get_log->fcs_error);
  215. stats->tx_frame = le32_to_cpu(get_log->tx_frame);
  216. stats->wep_icv_error[0] =
  217. le32_to_cpu(get_log->wep_icv_err_cnt[0]);
  218. stats->wep_icv_error[1] =
  219. le32_to_cpu(get_log->wep_icv_err_cnt[1]);
  220. stats->wep_icv_error[2] =
  221. le32_to_cpu(get_log->wep_icv_err_cnt[2]);
  222. stats->wep_icv_error[3] =
  223. le32_to_cpu(get_log->wep_icv_err_cnt[3]);
  224. }
  225. return 0;
  226. }
  227. /*
  228. * This function handles the command response of set/get Tx rate
  229. * configurations.
  230. *
  231. * Handling includes changing the header fields into CPU format
  232. * and saving the following parameters in driver -
  233. * - DSSS rate bitmap
  234. * - OFDM rate bitmap
  235. * - HT MCS rate bitmaps
  236. *
  237. * Based on the new rate bitmaps, the function re-evaluates if
  238. * auto data rate has been activated. If not, it sends another
  239. * query to the firmware to get the current Tx data rate.
  240. */
  241. static int mwifiex_ret_tx_rate_cfg(struct mwifiex_private *priv,
  242. struct host_cmd_ds_command *resp)
  243. {
  244. struct host_cmd_ds_tx_rate_cfg *rate_cfg = &resp->params.tx_rate_cfg;
  245. struct mwifiex_rate_scope *rate_scope;
  246. struct mwifiex_ie_types_header *head;
  247. u16 tlv, tlv_buf_len, tlv_buf_left;
  248. u8 *tlv_buf;
  249. u32 i;
  250. tlv_buf = ((u8 *)rate_cfg) + sizeof(struct host_cmd_ds_tx_rate_cfg);
  251. tlv_buf_left = le16_to_cpu(resp->size) - S_DS_GEN - sizeof(*rate_cfg);
  252. while (tlv_buf_left >= sizeof(*head)) {
  253. head = (struct mwifiex_ie_types_header *)tlv_buf;
  254. tlv = le16_to_cpu(head->type);
  255. tlv_buf_len = le16_to_cpu(head->len);
  256. if (tlv_buf_left < (sizeof(*head) + tlv_buf_len))
  257. break;
  258. switch (tlv) {
  259. case TLV_TYPE_RATE_SCOPE:
  260. rate_scope = (struct mwifiex_rate_scope *) tlv_buf;
  261. priv->bitmap_rates[0] =
  262. le16_to_cpu(rate_scope->hr_dsss_rate_bitmap);
  263. priv->bitmap_rates[1] =
  264. le16_to_cpu(rate_scope->ofdm_rate_bitmap);
  265. for (i = 0;
  266. i <
  267. sizeof(rate_scope->ht_mcs_rate_bitmap) /
  268. sizeof(u16); i++)
  269. priv->bitmap_rates[2 + i] =
  270. le16_to_cpu(rate_scope->
  271. ht_mcs_rate_bitmap[i]);
  272. if (priv->adapter->fw_api_ver == MWIFIEX_FW_V15) {
  273. for (i = 0; i < ARRAY_SIZE(rate_scope->
  274. vht_mcs_rate_bitmap);
  275. i++)
  276. priv->bitmap_rates[10 + i] =
  277. le16_to_cpu(rate_scope->
  278. vht_mcs_rate_bitmap[i]);
  279. }
  280. break;
  281. /* Add RATE_DROP tlv here */
  282. }
  283. tlv_buf += (sizeof(*head) + tlv_buf_len);
  284. tlv_buf_left -= (sizeof(*head) + tlv_buf_len);
  285. }
  286. priv->is_data_rate_auto = mwifiex_is_rate_auto(priv);
  287. if (priv->is_data_rate_auto)
  288. priv->data_rate = 0;
  289. else
  290. return mwifiex_send_cmd(priv, HostCmd_CMD_802_11_TX_RATE_QUERY,
  291. HostCmd_ACT_GEN_GET, 0, NULL, false);
  292. return 0;
  293. }
  294. /*
  295. * This function handles the command response of get Tx power level.
  296. *
  297. * Handling includes saving the maximum and minimum Tx power levels
  298. * in driver, as well as sending the values to user.
  299. */
  300. static int mwifiex_get_power_level(struct mwifiex_private *priv, void *data_buf)
  301. {
  302. int length, max_power = -1, min_power = -1;
  303. struct mwifiex_types_power_group *pg_tlv_hdr;
  304. struct mwifiex_power_group *pg;
  305. if (!data_buf)
  306. return -1;
  307. pg_tlv_hdr = (struct mwifiex_types_power_group *)((u8 *)data_buf);
  308. pg = (struct mwifiex_power_group *)
  309. ((u8 *) pg_tlv_hdr + sizeof(struct mwifiex_types_power_group));
  310. length = le16_to_cpu(pg_tlv_hdr->length);
  311. /* At least one structure required to update power */
  312. if (length < sizeof(struct mwifiex_power_group))
  313. return 0;
  314. max_power = pg->power_max;
  315. min_power = pg->power_min;
  316. length -= sizeof(struct mwifiex_power_group);
  317. while (length >= sizeof(struct mwifiex_power_group)) {
  318. pg++;
  319. if (max_power < pg->power_max)
  320. max_power = pg->power_max;
  321. if (min_power > pg->power_min)
  322. min_power = pg->power_min;
  323. length -= sizeof(struct mwifiex_power_group);
  324. }
  325. priv->min_tx_power_level = (u8) min_power;
  326. priv->max_tx_power_level = (u8) max_power;
  327. return 0;
  328. }
  329. /*
  330. * This function handles the command response of set/get Tx power
  331. * configurations.
  332. *
  333. * Handling includes changing the header fields into CPU format
  334. * and saving the current Tx power level in driver.
  335. */
  336. static int mwifiex_ret_tx_power_cfg(struct mwifiex_private *priv,
  337. struct host_cmd_ds_command *resp)
  338. {
  339. struct mwifiex_adapter *adapter = priv->adapter;
  340. struct host_cmd_ds_txpwr_cfg *txp_cfg = &resp->params.txp_cfg;
  341. struct mwifiex_types_power_group *pg_tlv_hdr;
  342. struct mwifiex_power_group *pg;
  343. u16 action = le16_to_cpu(txp_cfg->action);
  344. u16 tlv_buf_left;
  345. pg_tlv_hdr = (struct mwifiex_types_power_group *)
  346. ((u8 *)txp_cfg +
  347. sizeof(struct host_cmd_ds_txpwr_cfg));
  348. pg = (struct mwifiex_power_group *)
  349. ((u8 *)pg_tlv_hdr +
  350. sizeof(struct mwifiex_types_power_group));
  351. tlv_buf_left = le16_to_cpu(resp->size) - S_DS_GEN - sizeof(*txp_cfg);
  352. if (tlv_buf_left <
  353. le16_to_cpu(pg_tlv_hdr->length) + sizeof(*pg_tlv_hdr))
  354. return 0;
  355. switch (action) {
  356. case HostCmd_ACT_GEN_GET:
  357. if (adapter->hw_status == MWIFIEX_HW_STATUS_INITIALIZING)
  358. mwifiex_get_power_level(priv, pg_tlv_hdr);
  359. priv->tx_power_level = (u16) pg->power_min;
  360. break;
  361. case HostCmd_ACT_GEN_SET:
  362. if (!le32_to_cpu(txp_cfg->mode))
  363. break;
  364. if (pg->power_max == pg->power_min)
  365. priv->tx_power_level = (u16) pg->power_min;
  366. break;
  367. default:
  368. dev_err(adapter->dev, "CMD_RESP: unknown cmd action %d\n",
  369. action);
  370. return 0;
  371. }
  372. dev_dbg(adapter->dev,
  373. "info: Current TxPower Level = %d, Max Power=%d, Min Power=%d\n",
  374. priv->tx_power_level, priv->max_tx_power_level,
  375. priv->min_tx_power_level);
  376. return 0;
  377. }
  378. /*
  379. * This function handles the command response of get RF Tx power.
  380. */
  381. static int mwifiex_ret_rf_tx_power(struct mwifiex_private *priv,
  382. struct host_cmd_ds_command *resp)
  383. {
  384. struct host_cmd_ds_rf_tx_pwr *txp = &resp->params.txp;
  385. u16 action = le16_to_cpu(txp->action);
  386. priv->tx_power_level = le16_to_cpu(txp->cur_level);
  387. if (action == HostCmd_ACT_GEN_GET) {
  388. priv->max_tx_power_level = txp->max_power;
  389. priv->min_tx_power_level = txp->min_power;
  390. }
  391. dev_dbg(priv->adapter->dev,
  392. "Current TxPower Level=%d, Max Power=%d, Min Power=%d\n",
  393. priv->tx_power_level, priv->max_tx_power_level,
  394. priv->min_tx_power_level);
  395. return 0;
  396. }
  397. /*
  398. * This function handles the command response of set rf antenna
  399. */
  400. static int mwifiex_ret_rf_antenna(struct mwifiex_private *priv,
  401. struct host_cmd_ds_command *resp)
  402. {
  403. struct host_cmd_ds_rf_ant_mimo *ant_mimo = &resp->params.ant_mimo;
  404. struct host_cmd_ds_rf_ant_siso *ant_siso = &resp->params.ant_siso;
  405. struct mwifiex_adapter *adapter = priv->adapter;
  406. if (adapter->hw_dev_mcs_support == HT_STREAM_2X2)
  407. dev_dbg(adapter->dev,
  408. "RF_ANT_RESP: Tx action = 0x%x, Tx Mode = 0x%04x"
  409. " Rx action = 0x%x, Rx Mode = 0x%04x\n",
  410. le16_to_cpu(ant_mimo->action_tx),
  411. le16_to_cpu(ant_mimo->tx_ant_mode),
  412. le16_to_cpu(ant_mimo->action_rx),
  413. le16_to_cpu(ant_mimo->rx_ant_mode));
  414. else
  415. dev_dbg(adapter->dev,
  416. "RF_ANT_RESP: action = 0x%x, Mode = 0x%04x\n",
  417. le16_to_cpu(ant_siso->action),
  418. le16_to_cpu(ant_siso->ant_mode));
  419. return 0;
  420. }
  421. /*
  422. * This function handles the command response of set/get MAC address.
  423. *
  424. * Handling includes saving the MAC address in driver.
  425. */
  426. static int mwifiex_ret_802_11_mac_address(struct mwifiex_private *priv,
  427. struct host_cmd_ds_command *resp)
  428. {
  429. struct host_cmd_ds_802_11_mac_address *cmd_mac_addr =
  430. &resp->params.mac_addr;
  431. memcpy(priv->curr_addr, cmd_mac_addr->mac_addr, ETH_ALEN);
  432. dev_dbg(priv->adapter->dev,
  433. "info: set mac address: %pM\n", priv->curr_addr);
  434. return 0;
  435. }
  436. /*
  437. * This function handles the command response of set/get MAC multicast
  438. * address.
  439. */
  440. static int mwifiex_ret_mac_multicast_adr(struct mwifiex_private *priv,
  441. struct host_cmd_ds_command *resp)
  442. {
  443. return 0;
  444. }
  445. /*
  446. * This function handles the command response of get Tx rate query.
  447. *
  448. * Handling includes changing the header fields into CPU format
  449. * and saving the Tx rate and HT information parameters in driver.
  450. *
  451. * Both rate configuration and current data rate can be retrieved
  452. * with this request.
  453. */
  454. static int mwifiex_ret_802_11_tx_rate_query(struct mwifiex_private *priv,
  455. struct host_cmd_ds_command *resp)
  456. {
  457. priv->tx_rate = resp->params.tx_rate.tx_rate;
  458. priv->tx_htinfo = resp->params.tx_rate.ht_info;
  459. if (!priv->is_data_rate_auto)
  460. priv->data_rate =
  461. mwifiex_index_to_data_rate(priv, priv->tx_rate,
  462. priv->tx_htinfo);
  463. return 0;
  464. }
  465. /*
  466. * This function handles the command response of a deauthenticate
  467. * command.
  468. *
  469. * If the deauthenticated MAC matches the current BSS MAC, the connection
  470. * state is reset.
  471. */
  472. static int mwifiex_ret_802_11_deauthenticate(struct mwifiex_private *priv,
  473. struct host_cmd_ds_command *resp)
  474. {
  475. struct mwifiex_adapter *adapter = priv->adapter;
  476. adapter->dbg.num_cmd_deauth++;
  477. if (!memcmp(resp->params.deauth.mac_addr,
  478. &priv->curr_bss_params.bss_descriptor.mac_address,
  479. sizeof(resp->params.deauth.mac_addr)))
  480. mwifiex_reset_connect_state(priv, WLAN_REASON_DEAUTH_LEAVING);
  481. return 0;
  482. }
  483. /*
  484. * This function handles the command response of ad-hoc stop.
  485. *
  486. * The function resets the connection state in driver.
  487. */
  488. static int mwifiex_ret_802_11_ad_hoc_stop(struct mwifiex_private *priv,
  489. struct host_cmd_ds_command *resp)
  490. {
  491. mwifiex_reset_connect_state(priv, WLAN_REASON_DEAUTH_LEAVING);
  492. return 0;
  493. }
  494. /*
  495. * This function handles the command response of set/get v1 key material.
  496. *
  497. * Handling includes updating the driver parameters to reflect the
  498. * changes.
  499. */
  500. static int mwifiex_ret_802_11_key_material_v1(struct mwifiex_private *priv,
  501. struct host_cmd_ds_command *resp)
  502. {
  503. struct host_cmd_ds_802_11_key_material *key =
  504. &resp->params.key_material;
  505. if (le16_to_cpu(key->action) == HostCmd_ACT_GEN_SET) {
  506. if ((le16_to_cpu(key->key_param_set.key_info) & KEY_MCAST)) {
  507. dev_dbg(priv->adapter->dev, "info: key: GTK is set\n");
  508. priv->wpa_is_gtk_set = true;
  509. priv->scan_block = false;
  510. }
  511. }
  512. memset(priv->aes_key.key_param_set.key, 0,
  513. sizeof(key->key_param_set.key));
  514. priv->aes_key.key_param_set.key_len = key->key_param_set.key_len;
  515. memcpy(priv->aes_key.key_param_set.key, key->key_param_set.key,
  516. le16_to_cpu(priv->aes_key.key_param_set.key_len));
  517. return 0;
  518. }
  519. /*
  520. * This function handles the command response of set/get v2 key material.
  521. *
  522. * Handling includes updating the driver parameters to reflect the
  523. * changes.
  524. */
  525. static int mwifiex_ret_802_11_key_material_v2(struct mwifiex_private *priv,
  526. struct host_cmd_ds_command *resp)
  527. {
  528. struct host_cmd_ds_802_11_key_material_v2 *key_v2;
  529. __le16 len;
  530. key_v2 = &resp->params.key_material_v2;
  531. if (le16_to_cpu(key_v2->action) == HostCmd_ACT_GEN_SET) {
  532. if ((le16_to_cpu(key_v2->key_param_set.key_info) & KEY_MCAST)) {
  533. dev_dbg(priv->adapter->dev, "info: key: GTK is set\n");
  534. priv->wpa_is_gtk_set = true;
  535. priv->scan_block = false;
  536. }
  537. }
  538. if (key_v2->key_param_set.key_type != KEY_TYPE_ID_AES)
  539. return 0;
  540. memset(priv->aes_key_v2.key_param_set.key_params.aes.key, 0,
  541. WLAN_KEY_LEN_CCMP);
  542. priv->aes_key_v2.key_param_set.key_params.aes.key_len =
  543. key_v2->key_param_set.key_params.aes.key_len;
  544. len = priv->aes_key_v2.key_param_set.key_params.aes.key_len;
  545. memcpy(priv->aes_key_v2.key_param_set.key_params.aes.key,
  546. key_v2->key_param_set.key_params.aes.key, le16_to_cpu(len));
  547. return 0;
  548. }
  549. /* Wrapper function for processing response of key material command */
  550. static int mwifiex_ret_802_11_key_material(struct mwifiex_private *priv,
  551. struct host_cmd_ds_command *resp)
  552. {
  553. if (priv->adapter->key_api_major_ver == KEY_API_VER_MAJOR_V2)
  554. return mwifiex_ret_802_11_key_material_v2(priv, resp);
  555. else
  556. return mwifiex_ret_802_11_key_material_v1(priv, resp);
  557. }
  558. /*
  559. * This function handles the command response of get 11d domain information.
  560. */
  561. static int mwifiex_ret_802_11d_domain_info(struct mwifiex_private *priv,
  562. struct host_cmd_ds_command *resp)
  563. {
  564. struct host_cmd_ds_802_11d_domain_info_rsp *domain_info =
  565. &resp->params.domain_info_resp;
  566. struct mwifiex_ietypes_domain_param_set *domain = &domain_info->domain;
  567. u16 action = le16_to_cpu(domain_info->action);
  568. u8 no_of_triplet;
  569. no_of_triplet = (u8) ((le16_to_cpu(domain->header.len)
  570. - IEEE80211_COUNTRY_STRING_LEN)
  571. / sizeof(struct ieee80211_country_ie_triplet));
  572. dev_dbg(priv->adapter->dev,
  573. "info: 11D Domain Info Resp: no_of_triplet=%d\n",
  574. no_of_triplet);
  575. if (no_of_triplet > MWIFIEX_MAX_TRIPLET_802_11D) {
  576. dev_warn(priv->adapter->dev,
  577. "11D: invalid number of triplets %d returned\n",
  578. no_of_triplet);
  579. return -1;
  580. }
  581. switch (action) {
  582. case HostCmd_ACT_GEN_SET: /* Proc Set Action */
  583. break;
  584. case HostCmd_ACT_GEN_GET:
  585. break;
  586. default:
  587. dev_err(priv->adapter->dev,
  588. "11D: invalid action:%d\n", domain_info->action);
  589. return -1;
  590. }
  591. return 0;
  592. }
  593. /*
  594. * This function handles the command response of get extended version.
  595. *
  596. * Handling includes forming the extended version string and sending it
  597. * to application.
  598. */
  599. static int mwifiex_ret_ver_ext(struct mwifiex_private *priv,
  600. struct host_cmd_ds_command *resp,
  601. struct host_cmd_ds_version_ext *version_ext)
  602. {
  603. struct host_cmd_ds_version_ext *ver_ext = &resp->params.verext;
  604. if (version_ext) {
  605. version_ext->version_str_sel = ver_ext->version_str_sel;
  606. memcpy(version_ext->version_str, ver_ext->version_str,
  607. sizeof(char) * 128);
  608. memcpy(priv->version_str, ver_ext->version_str, 128);
  609. }
  610. return 0;
  611. }
  612. /*
  613. * This function handles the command response of remain on channel.
  614. */
  615. static int
  616. mwifiex_ret_remain_on_chan(struct mwifiex_private *priv,
  617. struct host_cmd_ds_command *resp,
  618. struct host_cmd_ds_remain_on_chan *roc_cfg)
  619. {
  620. struct host_cmd_ds_remain_on_chan *resp_cfg = &resp->params.roc_cfg;
  621. if (roc_cfg)
  622. memcpy(roc_cfg, resp_cfg, sizeof(*roc_cfg));
  623. return 0;
  624. }
  625. /*
  626. * This function handles the command response of P2P mode cfg.
  627. */
  628. static int
  629. mwifiex_ret_p2p_mode_cfg(struct mwifiex_private *priv,
  630. struct host_cmd_ds_command *resp,
  631. void *data_buf)
  632. {
  633. struct host_cmd_ds_p2p_mode_cfg *mode_cfg = &resp->params.mode_cfg;
  634. if (data_buf)
  635. *((u16 *)data_buf) = le16_to_cpu(mode_cfg->mode);
  636. return 0;
  637. }
  638. /*
  639. * This function handles the command response of register access.
  640. *
  641. * The register value and offset are returned to the user. For EEPROM
  642. * access, the byte count is also returned.
  643. */
  644. static int mwifiex_ret_reg_access(u16 type, struct host_cmd_ds_command *resp,
  645. void *data_buf)
  646. {
  647. struct mwifiex_ds_reg_rw *reg_rw;
  648. struct mwifiex_ds_read_eeprom *eeprom;
  649. union reg {
  650. struct host_cmd_ds_mac_reg_access *mac;
  651. struct host_cmd_ds_bbp_reg_access *bbp;
  652. struct host_cmd_ds_rf_reg_access *rf;
  653. struct host_cmd_ds_pmic_reg_access *pmic;
  654. struct host_cmd_ds_802_11_eeprom_access *eeprom;
  655. } r;
  656. if (!data_buf)
  657. return 0;
  658. reg_rw = data_buf;
  659. eeprom = data_buf;
  660. switch (type) {
  661. case HostCmd_CMD_MAC_REG_ACCESS:
  662. r.mac = &resp->params.mac_reg;
  663. reg_rw->offset = cpu_to_le32((u32) le16_to_cpu(r.mac->offset));
  664. reg_rw->value = r.mac->value;
  665. break;
  666. case HostCmd_CMD_BBP_REG_ACCESS:
  667. r.bbp = &resp->params.bbp_reg;
  668. reg_rw->offset = cpu_to_le32((u32) le16_to_cpu(r.bbp->offset));
  669. reg_rw->value = cpu_to_le32((u32) r.bbp->value);
  670. break;
  671. case HostCmd_CMD_RF_REG_ACCESS:
  672. r.rf = &resp->params.rf_reg;
  673. reg_rw->offset = cpu_to_le32((u32) le16_to_cpu(r.rf->offset));
  674. reg_rw->value = cpu_to_le32((u32) r.bbp->value);
  675. break;
  676. case HostCmd_CMD_PMIC_REG_ACCESS:
  677. r.pmic = &resp->params.pmic_reg;
  678. reg_rw->offset = cpu_to_le32((u32) le16_to_cpu(r.pmic->offset));
  679. reg_rw->value = cpu_to_le32((u32) r.pmic->value);
  680. break;
  681. case HostCmd_CMD_CAU_REG_ACCESS:
  682. r.rf = &resp->params.rf_reg;
  683. reg_rw->offset = cpu_to_le32((u32) le16_to_cpu(r.rf->offset));
  684. reg_rw->value = cpu_to_le32((u32) r.rf->value);
  685. break;
  686. case HostCmd_CMD_802_11_EEPROM_ACCESS:
  687. r.eeprom = &resp->params.eeprom;
  688. pr_debug("info: EEPROM read len=%x\n", r.eeprom->byte_count);
  689. if (le16_to_cpu(eeprom->byte_count) <
  690. le16_to_cpu(r.eeprom->byte_count)) {
  691. eeprom->byte_count = cpu_to_le16(0);
  692. pr_debug("info: EEPROM read length is too big\n");
  693. return -1;
  694. }
  695. eeprom->offset = r.eeprom->offset;
  696. eeprom->byte_count = r.eeprom->byte_count;
  697. if (le16_to_cpu(eeprom->byte_count) > 0)
  698. memcpy(&eeprom->value, &r.eeprom->value,
  699. le16_to_cpu(r.eeprom->byte_count));
  700. break;
  701. default:
  702. return -1;
  703. }
  704. return 0;
  705. }
  706. /*
  707. * This function handles the command response of get IBSS coalescing status.
  708. *
  709. * If the received BSSID is different than the current one, the current BSSID,
  710. * beacon interval, ATIM window and ERP information are updated, along with
  711. * changing the ad-hoc state accordingly.
  712. */
  713. static int mwifiex_ret_ibss_coalescing_status(struct mwifiex_private *priv,
  714. struct host_cmd_ds_command *resp)
  715. {
  716. struct host_cmd_ds_802_11_ibss_status *ibss_coal_resp =
  717. &(resp->params.ibss_coalescing);
  718. if (le16_to_cpu(ibss_coal_resp->action) == HostCmd_ACT_GEN_SET)
  719. return 0;
  720. dev_dbg(priv->adapter->dev,
  721. "info: new BSSID %pM\n", ibss_coal_resp->bssid);
  722. /* If rsp has NULL BSSID, Just return..... No Action */
  723. if (is_zero_ether_addr(ibss_coal_resp->bssid)) {
  724. dev_warn(priv->adapter->dev, "new BSSID is NULL\n");
  725. return 0;
  726. }
  727. /* If BSSID is diff, modify current BSS parameters */
  728. if (!ether_addr_equal(priv->curr_bss_params.bss_descriptor.mac_address, ibss_coal_resp->bssid)) {
  729. /* BSSID */
  730. memcpy(priv->curr_bss_params.bss_descriptor.mac_address,
  731. ibss_coal_resp->bssid, ETH_ALEN);
  732. /* Beacon Interval */
  733. priv->curr_bss_params.bss_descriptor.beacon_period
  734. = le16_to_cpu(ibss_coal_resp->beacon_interval);
  735. /* ERP Information */
  736. priv->curr_bss_params.bss_descriptor.erp_flags =
  737. (u8) le16_to_cpu(ibss_coal_resp->use_g_rate_protect);
  738. priv->adhoc_state = ADHOC_COALESCED;
  739. }
  740. return 0;
  741. }
  742. static int mwifiex_ret_tdls_oper(struct mwifiex_private *priv,
  743. struct host_cmd_ds_command *resp)
  744. {
  745. struct host_cmd_ds_tdls_oper *cmd_tdls_oper = &resp->params.tdls_oper;
  746. u16 reason = le16_to_cpu(cmd_tdls_oper->reason);
  747. u16 action = le16_to_cpu(cmd_tdls_oper->tdls_action);
  748. struct mwifiex_sta_node *node =
  749. mwifiex_get_sta_entry(priv, cmd_tdls_oper->peer_mac);
  750. switch (action) {
  751. case ACT_TDLS_DELETE:
  752. if (reason) {
  753. if (!node || reason == TDLS_ERR_LINK_NONEXISTENT)
  754. dev_dbg(priv->adapter->dev,
  755. "TDLS link delete for %pM failed: reason %d\n",
  756. cmd_tdls_oper->peer_mac, reason);
  757. else
  758. dev_err(priv->adapter->dev,
  759. "TDLS link delete for %pM failed: reason %d\n",
  760. cmd_tdls_oper->peer_mac, reason);
  761. } else {
  762. dev_dbg(priv->adapter->dev,
  763. "TDLS link delete for %pM successful\n",
  764. cmd_tdls_oper->peer_mac);
  765. }
  766. break;
  767. case ACT_TDLS_CREATE:
  768. if (reason) {
  769. dev_err(priv->adapter->dev,
  770. "TDLS link creation for %pM failed: reason %d",
  771. cmd_tdls_oper->peer_mac, reason);
  772. if (node && reason != TDLS_ERR_LINK_EXISTS)
  773. node->tdls_status = TDLS_SETUP_FAILURE;
  774. } else {
  775. dev_dbg(priv->adapter->dev,
  776. "TDLS link creation for %pM successful",
  777. cmd_tdls_oper->peer_mac);
  778. }
  779. break;
  780. case ACT_TDLS_CONFIG:
  781. if (reason) {
  782. dev_err(priv->adapter->dev,
  783. "TDLS link config for %pM failed, reason %d\n",
  784. cmd_tdls_oper->peer_mac, reason);
  785. if (node)
  786. node->tdls_status = TDLS_SETUP_FAILURE;
  787. } else {
  788. dev_dbg(priv->adapter->dev,
  789. "TDLS link config for %pM successful\n",
  790. cmd_tdls_oper->peer_mac);
  791. }
  792. break;
  793. default:
  794. dev_err(priv->adapter->dev,
  795. "Unknown TDLS command action response %d", action);
  796. return -1;
  797. }
  798. return 0;
  799. }
  800. /*
  801. * This function handles the command response for subscribe event command.
  802. */
  803. static int mwifiex_ret_subsc_evt(struct mwifiex_private *priv,
  804. struct host_cmd_ds_command *resp)
  805. {
  806. struct host_cmd_ds_802_11_subsc_evt *cmd_sub_event =
  807. &resp->params.subsc_evt;
  808. /* For every subscribe event command (Get/Set/Clear), FW reports the
  809. * current set of subscribed events*/
  810. dev_dbg(priv->adapter->dev, "Bitmap of currently subscribed events: %16x\n",
  811. le16_to_cpu(cmd_sub_event->events));
  812. return 0;
  813. }
  814. /* This function handles the command response of set_cfg_data */
  815. static int mwifiex_ret_cfg_data(struct mwifiex_private *priv,
  816. struct host_cmd_ds_command *resp)
  817. {
  818. if (resp->result != HostCmd_RESULT_OK) {
  819. dev_err(priv->adapter->dev, "Cal data cmd resp failed\n");
  820. return -1;
  821. }
  822. return 0;
  823. }
  824. /*
  825. * This function handles the command responses.
  826. *
  827. * This is a generic function, which calls command specific
  828. * response handlers based on the command ID.
  829. */
  830. int mwifiex_process_sta_cmdresp(struct mwifiex_private *priv, u16 cmdresp_no,
  831. struct host_cmd_ds_command *resp)
  832. {
  833. int ret = 0;
  834. struct mwifiex_adapter *adapter = priv->adapter;
  835. void *data_buf = adapter->curr_cmd->data_buf;
  836. /* If the command is not successful, cleanup and return failure */
  837. if (resp->result != HostCmd_RESULT_OK) {
  838. mwifiex_process_cmdresp_error(priv, resp);
  839. return -1;
  840. }
  841. /* Command successful, handle response */
  842. switch (cmdresp_no) {
  843. case HostCmd_CMD_GET_HW_SPEC:
  844. ret = mwifiex_ret_get_hw_spec(priv, resp);
  845. break;
  846. case HostCmd_CMD_CFG_DATA:
  847. ret = mwifiex_ret_cfg_data(priv, resp);
  848. break;
  849. case HostCmd_CMD_MAC_CONTROL:
  850. break;
  851. case HostCmd_CMD_802_11_MAC_ADDRESS:
  852. ret = mwifiex_ret_802_11_mac_address(priv, resp);
  853. break;
  854. case HostCmd_CMD_MAC_MULTICAST_ADR:
  855. ret = mwifiex_ret_mac_multicast_adr(priv, resp);
  856. break;
  857. case HostCmd_CMD_TX_RATE_CFG:
  858. ret = mwifiex_ret_tx_rate_cfg(priv, resp);
  859. break;
  860. case HostCmd_CMD_802_11_SCAN:
  861. ret = mwifiex_ret_802_11_scan(priv, resp);
  862. adapter->curr_cmd->wait_q_enabled = false;
  863. break;
  864. case HostCmd_CMD_802_11_SCAN_EXT:
  865. ret = mwifiex_ret_802_11_scan_ext(priv, resp);
  866. adapter->curr_cmd->wait_q_enabled = false;
  867. break;
  868. case HostCmd_CMD_802_11_BG_SCAN_QUERY:
  869. ret = mwifiex_ret_802_11_scan(priv, resp);
  870. dev_dbg(adapter->dev,
  871. "info: CMD_RESP: BG_SCAN result is ready!\n");
  872. break;
  873. case HostCmd_CMD_TXPWR_CFG:
  874. ret = mwifiex_ret_tx_power_cfg(priv, resp);
  875. break;
  876. case HostCmd_CMD_RF_TX_PWR:
  877. ret = mwifiex_ret_rf_tx_power(priv, resp);
  878. break;
  879. case HostCmd_CMD_RF_ANTENNA:
  880. ret = mwifiex_ret_rf_antenna(priv, resp);
  881. break;
  882. case HostCmd_CMD_802_11_PS_MODE_ENH:
  883. ret = mwifiex_ret_enh_power_mode(priv, resp, data_buf);
  884. break;
  885. case HostCmd_CMD_802_11_HS_CFG_ENH:
  886. ret = mwifiex_ret_802_11_hs_cfg(priv, resp);
  887. break;
  888. case HostCmd_CMD_802_11_ASSOCIATE:
  889. ret = mwifiex_ret_802_11_associate(priv, resp);
  890. break;
  891. case HostCmd_CMD_802_11_DEAUTHENTICATE:
  892. ret = mwifiex_ret_802_11_deauthenticate(priv, resp);
  893. break;
  894. case HostCmd_CMD_802_11_AD_HOC_START:
  895. case HostCmd_CMD_802_11_AD_HOC_JOIN:
  896. ret = mwifiex_ret_802_11_ad_hoc(priv, resp);
  897. break;
  898. case HostCmd_CMD_802_11_AD_HOC_STOP:
  899. ret = mwifiex_ret_802_11_ad_hoc_stop(priv, resp);
  900. break;
  901. case HostCmd_CMD_802_11_GET_LOG:
  902. ret = mwifiex_ret_get_log(priv, resp, data_buf);
  903. break;
  904. case HostCmd_CMD_RSSI_INFO:
  905. ret = mwifiex_ret_802_11_rssi_info(priv, resp);
  906. break;
  907. case HostCmd_CMD_802_11_SNMP_MIB:
  908. ret = mwifiex_ret_802_11_snmp_mib(priv, resp, data_buf);
  909. break;
  910. case HostCmd_CMD_802_11_TX_RATE_QUERY:
  911. ret = mwifiex_ret_802_11_tx_rate_query(priv, resp);
  912. break;
  913. case HostCmd_CMD_VERSION_EXT:
  914. ret = mwifiex_ret_ver_ext(priv, resp, data_buf);
  915. break;
  916. case HostCmd_CMD_REMAIN_ON_CHAN:
  917. ret = mwifiex_ret_remain_on_chan(priv, resp, data_buf);
  918. break;
  919. case HostCmd_CMD_11AC_CFG:
  920. break;
  921. case HostCmd_CMD_P2P_MODE_CFG:
  922. ret = mwifiex_ret_p2p_mode_cfg(priv, resp, data_buf);
  923. break;
  924. case HostCmd_CMD_MGMT_FRAME_REG:
  925. case HostCmd_CMD_FUNC_INIT:
  926. case HostCmd_CMD_FUNC_SHUTDOWN:
  927. break;
  928. case HostCmd_CMD_802_11_KEY_MATERIAL:
  929. ret = mwifiex_ret_802_11_key_material(priv, resp);
  930. break;
  931. case HostCmd_CMD_802_11D_DOMAIN_INFO:
  932. ret = mwifiex_ret_802_11d_domain_info(priv, resp);
  933. break;
  934. case HostCmd_CMD_11N_ADDBA_REQ:
  935. ret = mwifiex_ret_11n_addba_req(priv, resp);
  936. break;
  937. case HostCmd_CMD_11N_DELBA:
  938. ret = mwifiex_ret_11n_delba(priv, resp);
  939. break;
  940. case HostCmd_CMD_11N_ADDBA_RSP:
  941. ret = mwifiex_ret_11n_addba_resp(priv, resp);
  942. break;
  943. case HostCmd_CMD_RECONFIGURE_TX_BUFF:
  944. adapter->tx_buf_size = (u16) le16_to_cpu(resp->params.
  945. tx_buf.buff_size);
  946. adapter->tx_buf_size = (adapter->tx_buf_size
  947. / MWIFIEX_SDIO_BLOCK_SIZE)
  948. * MWIFIEX_SDIO_BLOCK_SIZE;
  949. adapter->curr_tx_buf_size = adapter->tx_buf_size;
  950. dev_dbg(adapter->dev, "cmd: curr_tx_buf_size=%d\n",
  951. adapter->curr_tx_buf_size);
  952. if (adapter->if_ops.update_mp_end_port)
  953. adapter->if_ops.update_mp_end_port(adapter,
  954. le16_to_cpu(resp->params.tx_buf.mp_end_port));
  955. break;
  956. case HostCmd_CMD_AMSDU_AGGR_CTRL:
  957. break;
  958. case HostCmd_CMD_WMM_GET_STATUS:
  959. ret = mwifiex_ret_wmm_get_status(priv, resp);
  960. break;
  961. case HostCmd_CMD_802_11_IBSS_COALESCING_STATUS:
  962. ret = mwifiex_ret_ibss_coalescing_status(priv, resp);
  963. break;
  964. case HostCmd_CMD_MAC_REG_ACCESS:
  965. case HostCmd_CMD_BBP_REG_ACCESS:
  966. case HostCmd_CMD_RF_REG_ACCESS:
  967. case HostCmd_CMD_PMIC_REG_ACCESS:
  968. case HostCmd_CMD_CAU_REG_ACCESS:
  969. case HostCmd_CMD_802_11_EEPROM_ACCESS:
  970. ret = mwifiex_ret_reg_access(cmdresp_no, resp, data_buf);
  971. break;
  972. case HostCmd_CMD_SET_BSS_MODE:
  973. break;
  974. case HostCmd_CMD_11N_CFG:
  975. break;
  976. case HostCmd_CMD_PCIE_DESC_DETAILS:
  977. break;
  978. case HostCmd_CMD_802_11_SUBSCRIBE_EVENT:
  979. ret = mwifiex_ret_subsc_evt(priv, resp);
  980. break;
  981. case HostCmd_CMD_UAP_SYS_CONFIG:
  982. break;
  983. case HostCmd_CMD_UAP_BSS_START:
  984. priv->bss_started = 1;
  985. break;
  986. case HostCmd_CMD_UAP_BSS_STOP:
  987. priv->bss_started = 0;
  988. break;
  989. case HostCmd_CMD_UAP_STA_DEAUTH:
  990. break;
  991. case HostCmd_CMD_MEF_CFG:
  992. break;
  993. case HostCmd_CMD_COALESCE_CFG:
  994. break;
  995. case HostCmd_CMD_TDLS_OPER:
  996. ret = mwifiex_ret_tdls_oper(priv, resp);
  997. break;
  998. default:
  999. dev_err(adapter->dev, "CMD_RESP: unknown cmd response %#x\n",
  1000. resp->command);
  1001. break;
  1002. }
  1003. return ret;
  1004. }