blob: 24523e4015cba11a9fe02ee449ad462f557e1642 [file] [log] [blame]
Bing Zhao5e6e3a92011-03-21 18:00:50 -07001/*
2 * Marvell Wireless LAN device driver: station command response handling
3 *
4 * Copyright (C) 2011, 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
20#include "decl.h"
21#include "ioctl.h"
22#include "util.h"
23#include "fw.h"
24#include "main.h"
25#include "wmm.h"
26#include "11n.h"
Yogesh Ashok Powara5f39052013-02-15 21:44:30 -080027#include "11ac.h"
Bing Zhao5e6e3a92011-03-21 18:00:50 -070028
29
30/*
31 * This function handles the command response error case.
32 *
33 * For scan response error, the function cancels all the pending
34 * scan commands and generates an event to inform the applications
35 * of the scan completion.
36 *
37 * For Power Save command failure, we do not retry enter PS
38 * command in case of Ad-hoc mode.
39 *
40 * For all other response errors, the current command buffer is freed
41 * and returned to the free command queue.
42 */
43static void
44mwifiex_process_cmdresp_error(struct mwifiex_private *priv,
Amitkumar Karwar600f5d92011-04-13 17:27:06 -070045 struct host_cmd_ds_command *resp)
Bing Zhao5e6e3a92011-03-21 18:00:50 -070046{
Yogesh Ashok Powar270e58e2011-05-03 20:11:46 -070047 struct cmd_ctrl_node *cmd_node = NULL, *tmp_node;
Bing Zhao5e6e3a92011-03-21 18:00:50 -070048 struct mwifiex_adapter *adapter = priv->adapter;
Marc Yang2b06bdb2011-03-30 18:12:44 -070049 struct host_cmd_ds_802_11_ps_mode_enh *pm;
Bing Zhao5e6e3a92011-03-21 18:00:50 -070050 unsigned long flags;
51
52 dev_err(adapter->dev, "CMD_RESP: cmd %#x error, result=%#x\n",
Yogesh Ashok Powar9c05fd72012-03-13 19:22:40 -070053 resp->command, resp->result);
Amitkumar Karwar600f5d92011-04-13 17:27:06 -070054
55 if (adapter->curr_cmd->wait_q_enabled)
56 adapter->cmd_wait_q.status = -1;
Bing Zhao5e6e3a92011-03-21 18:00:50 -070057
58 switch (le16_to_cpu(resp->command)) {
59 case HostCmd_CMD_802_11_PS_MODE_ENH:
Marc Yang2b06bdb2011-03-30 18:12:44 -070060 pm = &resp->params.psmode_enh;
Yogesh Ashok Powar9c05fd72012-03-13 19:22:40 -070061 dev_err(adapter->dev,
62 "PS_MODE_ENH cmd failed: result=0x%x action=0x%X\n",
63 resp->result, le16_to_cpu(pm->action));
Marc Yang2b06bdb2011-03-30 18:12:44 -070064 /* We do not re-try enter-ps command in ad-hoc mode. */
65 if (le16_to_cpu(pm->action) == EN_AUTO_PS &&
Yogesh Ashok Powar9c05fd72012-03-13 19:22:40 -070066 (le16_to_cpu(pm->params.ps_bitmap) & BITMAP_STA_PS) &&
67 priv->bss_mode == NL80211_IFTYPE_ADHOC)
Marc Yang2b06bdb2011-03-30 18:12:44 -070068 adapter->ps_mode = MWIFIEX_802_11_POWER_MODE_CAM;
69
Bing Zhao5e6e3a92011-03-21 18:00:50 -070070 break;
71 case HostCmd_CMD_802_11_SCAN:
72 /* Cancel all pending scan command */
73 spin_lock_irqsave(&adapter->scan_pending_q_lock, flags);
74 list_for_each_entry_safe(cmd_node, tmp_node,
75 &adapter->scan_pending_q, list) {
76 list_del(&cmd_node->list);
77 spin_unlock_irqrestore(&adapter->scan_pending_q_lock,
78 flags);
79 mwifiex_insert_cmd_to_free_q(adapter, cmd_node);
80 spin_lock_irqsave(&adapter->scan_pending_q_lock, flags);
81 }
82 spin_unlock_irqrestore(&adapter->scan_pending_q_lock, flags);
83
84 spin_lock_irqsave(&adapter->mwifiex_cmd_lock, flags);
85 adapter->scan_processing = false;
86 spin_unlock_irqrestore(&adapter->mwifiex_cmd_lock, flags);
87 if (priv->report_scan_result)
88 priv->report_scan_result = false;
Bing Zhao5e6e3a92011-03-21 18:00:50 -070089 break;
90
91 case HostCmd_CMD_MAC_CONTROL:
92 break;
93
94 default:
95 break;
96 }
97 /* Handling errors here */
Bing Zhao9908b072013-04-01 12:44:46 -070098 mwifiex_recycle_cmd_node(adapter, adapter->curr_cmd);
Bing Zhao5e6e3a92011-03-21 18:00:50 -070099
100 spin_lock_irqsave(&adapter->mwifiex_cmd_lock, flags);
101 adapter->curr_cmd = NULL;
102 spin_unlock_irqrestore(&adapter->mwifiex_cmd_lock, flags);
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700103}
104
105/*
106 * This function handles the command response of get RSSI info.
107 *
108 * Handling includes changing the header fields into CPU format
109 * and saving the following parameters in driver -
110 * - Last data and beacon RSSI value
111 * - Average data and beacon RSSI value
112 * - Last data and beacon NF value
113 * - Average data and beacon NF value
114 *
115 * The parameters are send to the application as well, along with
116 * calculated SNR values.
117 */
118static int mwifiex_ret_802_11_rssi_info(struct mwifiex_private *priv,
Amitkumar Karwar958a4a82012-03-15 20:51:49 -0700119 struct host_cmd_ds_command *resp)
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700120{
121 struct host_cmd_ds_802_11_rssi_info_rsp *rssi_info_rsp =
Yogesh Ashok Powar9c05fd72012-03-13 19:22:40 -0700122 &resp->params.rssi_info_rsp;
Jeff Disher908fe112012-08-30 18:20:55 -0700123 struct mwifiex_ds_misc_subsc_evt *subsc_evt =
124 &priv->async_subsc_evt_storage;
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700125
126 priv->data_rssi_last = le16_to_cpu(rssi_info_rsp->data_rssi_last);
127 priv->data_nf_last = le16_to_cpu(rssi_info_rsp->data_nf_last);
128
129 priv->data_rssi_avg = le16_to_cpu(rssi_info_rsp->data_rssi_avg);
130 priv->data_nf_avg = le16_to_cpu(rssi_info_rsp->data_nf_avg);
131
132 priv->bcn_rssi_last = le16_to_cpu(rssi_info_rsp->bcn_rssi_last);
133 priv->bcn_nf_last = le16_to_cpu(rssi_info_rsp->bcn_nf_last);
134
135 priv->bcn_rssi_avg = le16_to_cpu(rssi_info_rsp->bcn_rssi_avg);
136 priv->bcn_nf_avg = le16_to_cpu(rssi_info_rsp->bcn_nf_avg);
137
Amitkumar Karwarfa444bf2012-03-15 20:51:51 -0700138 if (priv->subsc_evt_rssi_state == EVENT_HANDLED)
139 return 0;
140
Jeff Disher908fe112012-08-30 18:20:55 -0700141 memset(subsc_evt, 0x00, sizeof(struct mwifiex_ds_misc_subsc_evt));
142
Amitkumar Karwarfa444bf2012-03-15 20:51:51 -0700143 /* Resubscribe low and high rssi events with new thresholds */
Jeff Disher908fe112012-08-30 18:20:55 -0700144 subsc_evt->events = BITMASK_BCN_RSSI_LOW | BITMASK_BCN_RSSI_HIGH;
145 subsc_evt->action = HostCmd_ACT_BITWISE_SET;
Amitkumar Karwarfa444bf2012-03-15 20:51:51 -0700146 if (priv->subsc_evt_rssi_state == RSSI_LOW_RECVD) {
Jeff Disher908fe112012-08-30 18:20:55 -0700147 subsc_evt->bcn_l_rssi_cfg.abs_value = abs(priv->bcn_rssi_avg -
Amitkumar Karwarfa444bf2012-03-15 20:51:51 -0700148 priv->cqm_rssi_hyst);
Jeff Disher908fe112012-08-30 18:20:55 -0700149 subsc_evt->bcn_h_rssi_cfg.abs_value = abs(priv->cqm_rssi_thold);
Amitkumar Karwarfa444bf2012-03-15 20:51:51 -0700150 } else if (priv->subsc_evt_rssi_state == RSSI_HIGH_RECVD) {
Jeff Disher908fe112012-08-30 18:20:55 -0700151 subsc_evt->bcn_l_rssi_cfg.abs_value = abs(priv->cqm_rssi_thold);
152 subsc_evt->bcn_h_rssi_cfg.abs_value = abs(priv->bcn_rssi_avg +
Amitkumar Karwarfa444bf2012-03-15 20:51:51 -0700153 priv->cqm_rssi_hyst);
154 }
Jeff Disher908fe112012-08-30 18:20:55 -0700155 subsc_evt->bcn_l_rssi_cfg.evt_freq = 1;
156 subsc_evt->bcn_h_rssi_cfg.evt_freq = 1;
Amitkumar Karwarfa444bf2012-03-15 20:51:51 -0700157
158 priv->subsc_evt_rssi_state = EVENT_HANDLED;
159
160 mwifiex_send_cmd_async(priv, HostCmd_CMD_802_11_SUBSCRIBE_EVENT,
Jeff Disher908fe112012-08-30 18:20:55 -0700161 0, 0, subsc_evt);
Amitkumar Karwarfa444bf2012-03-15 20:51:51 -0700162
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700163 return 0;
164}
165
166/*
167 * This function handles the command response of set/get SNMP
168 * MIB parameters.
169 *
170 * Handling includes changing the header fields into CPU format
171 * and saving the parameter in driver.
172 *
173 * The following parameters are supported -
174 * - Fragmentation threshold
175 * - RTS threshold
176 * - Short retry limit
177 */
178static int mwifiex_ret_802_11_snmp_mib(struct mwifiex_private *priv,
179 struct host_cmd_ds_command *resp,
Dan Carpentera5e5aa62011-06-24 16:33:35 +0300180 u32 *data_buf)
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700181{
182 struct host_cmd_ds_802_11_snmp_mib *smib = &resp->params.smib;
183 u16 oid = le16_to_cpu(smib->oid);
184 u16 query_type = le16_to_cpu(smib->query_type);
Dan Carpentera5e5aa62011-06-24 16:33:35 +0300185 u32 ul_temp;
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700186
187 dev_dbg(priv->adapter->dev, "info: SNMP_RESP: oid value = %#x,"
Yogesh Ashok Powar9c05fd72012-03-13 19:22:40 -0700188 " query_type = %#x, buf size = %#x\n",
189 oid, query_type, le16_to_cpu(smib->buf_size));
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700190 if (query_type == HostCmd_ACT_GEN_GET) {
Dan Carpentera5e5aa62011-06-24 16:33:35 +0300191 ul_temp = le16_to_cpu(*((__le16 *) (smib->value)));
192 if (data_buf)
193 *data_buf = ul_temp;
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700194 switch (oid) {
195 case FRAG_THRESH_I:
196 dev_dbg(priv->adapter->dev,
Dan Carpentera5e5aa62011-06-24 16:33:35 +0300197 "info: SNMP_RESP: FragThsd =%u\n", ul_temp);
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700198 break;
199 case RTS_THRESH_I:
200 dev_dbg(priv->adapter->dev,
Dan Carpentera5e5aa62011-06-24 16:33:35 +0300201 "info: SNMP_RESP: RTSThsd =%u\n", ul_temp);
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700202 break;
203 case SHORT_RETRY_LIM_I:
204 dev_dbg(priv->adapter->dev,
Dan Carpentera5e5aa62011-06-24 16:33:35 +0300205 "info: SNMP_RESP: TxRetryCount=%u\n", ul_temp);
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700206 break;
Amitkumar Karwarcaf60a62012-02-02 20:48:58 -0800207 case DTIM_PERIOD_I:
208 dev_dbg(priv->adapter->dev,
209 "info: SNMP_RESP: DTIM period=%u\n", ul_temp);
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700210 default:
211 break;
212 }
213 }
214
215 return 0;
216}
217
218/*
219 * This function handles the command response of get log request
220 *
221 * Handling includes changing the header fields into CPU format
222 * and sending the received parameters to application.
223 */
224static int mwifiex_ret_get_log(struct mwifiex_private *priv,
225 struct host_cmd_ds_command *resp,
Amitkumar Karwara5ffddb2011-06-20 15:21:48 -0700226 struct mwifiex_ds_get_stats *stats)
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700227{
228 struct host_cmd_ds_802_11_get_log *get_log =
Joe Perches2c208892012-06-04 12:44:17 +0000229 &resp->params.get_log;
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700230
Amitkumar Karwara5ffddb2011-06-20 15:21:48 -0700231 if (stats) {
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700232 stats->mcast_tx_frame = le32_to_cpu(get_log->mcast_tx_frame);
233 stats->failed = le32_to_cpu(get_log->failed);
234 stats->retry = le32_to_cpu(get_log->retry);
235 stats->multi_retry = le32_to_cpu(get_log->multi_retry);
236 stats->frame_dup = le32_to_cpu(get_log->frame_dup);
237 stats->rts_success = le32_to_cpu(get_log->rts_success);
238 stats->rts_failure = le32_to_cpu(get_log->rts_failure);
239 stats->ack_failure = le32_to_cpu(get_log->ack_failure);
240 stats->rx_frag = le32_to_cpu(get_log->rx_frag);
241 stats->mcast_rx_frame = le32_to_cpu(get_log->mcast_rx_frame);
242 stats->fcs_error = le32_to_cpu(get_log->fcs_error);
243 stats->tx_frame = le32_to_cpu(get_log->tx_frame);
244 stats->wep_icv_error[0] =
245 le32_to_cpu(get_log->wep_icv_err_cnt[0]);
246 stats->wep_icv_error[1] =
247 le32_to_cpu(get_log->wep_icv_err_cnt[1]);
248 stats->wep_icv_error[2] =
249 le32_to_cpu(get_log->wep_icv_err_cnt[2]);
250 stats->wep_icv_error[3] =
251 le32_to_cpu(get_log->wep_icv_err_cnt[3]);
252 }
253
254 return 0;
255}
256
257/*
258 * This function handles the command response of set/get Tx rate
259 * configurations.
260 *
261 * Handling includes changing the header fields into CPU format
262 * and saving the following parameters in driver -
263 * - DSSS rate bitmap
264 * - OFDM rate bitmap
265 * - HT MCS rate bitmaps
266 *
267 * Based on the new rate bitmaps, the function re-evaluates if
268 * auto data rate has been activated. If not, it sends another
Amitkumar Karwar006606c2012-07-13 20:09:31 -0700269 * query to the firmware to get the current Tx data rate.
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700270 */
271static int mwifiex_ret_tx_rate_cfg(struct mwifiex_private *priv,
Amitkumar Karwar006606c2012-07-13 20:09:31 -0700272 struct host_cmd_ds_command *resp)
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700273{
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700274 struct host_cmd_ds_tx_rate_cfg *rate_cfg = &resp->params.tx_rate_cfg;
275 struct mwifiex_rate_scope *rate_scope;
Yogesh Ashok Powar270e58e2011-05-03 20:11:46 -0700276 struct mwifiex_ie_types_header *head;
Amitkumar Karwar2636c302013-10-22 15:24:45 -0700277 u16 tlv, tlv_buf_len, tlv_buf_left;
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700278 u8 *tlv_buf;
279 u32 i;
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700280
Amitkumar Karwar2636c302013-10-22 15:24:45 -0700281 tlv_buf = ((u8 *)rate_cfg) + sizeof(struct host_cmd_ds_tx_rate_cfg);
282 tlv_buf_left = le16_to_cpu(resp->size) - S_DS_GEN - sizeof(*rate_cfg);
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700283
Amitkumar Karwar2636c302013-10-22 15:24:45 -0700284 while (tlv_buf_left >= sizeof(*head)) {
285 head = (struct mwifiex_ie_types_header *)tlv_buf;
286 tlv = le16_to_cpu(head->type);
287 tlv_buf_len = le16_to_cpu(head->len);
288
289 if (tlv_buf_left < (sizeof(*head) + tlv_buf_len))
290 break;
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700291
292 switch (tlv) {
293 case TLV_TYPE_RATE_SCOPE:
294 rate_scope = (struct mwifiex_rate_scope *) tlv_buf;
295 priv->bitmap_rates[0] =
296 le16_to_cpu(rate_scope->hr_dsss_rate_bitmap);
297 priv->bitmap_rates[1] =
298 le16_to_cpu(rate_scope->ofdm_rate_bitmap);
299 for (i = 0;
300 i <
301 sizeof(rate_scope->ht_mcs_rate_bitmap) /
302 sizeof(u16); i++)
303 priv->bitmap_rates[2 + i] =
304 le16_to_cpu(rate_scope->
305 ht_mcs_rate_bitmap[i]);
306 break;
307 /* Add RATE_DROP tlv here */
308 }
309
Amitkumar Karwar2636c302013-10-22 15:24:45 -0700310 tlv_buf += (sizeof(*head) + tlv_buf_len);
311 tlv_buf_left -= (sizeof(*head) + tlv_buf_len);
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700312 }
313
314 priv->is_data_rate_auto = mwifiex_is_rate_auto(priv);
315
316 if (priv->is_data_rate_auto)
317 priv->data_rate = 0;
318 else
Amitkumar Karwar006606c2012-07-13 20:09:31 -0700319 return mwifiex_send_cmd_async(priv,
320 HostCmd_CMD_802_11_TX_RATE_QUERY,
321 HostCmd_ACT_GEN_GET, 0, NULL);
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700322
Amitkumar Karwar006606c2012-07-13 20:09:31 -0700323 return 0;
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700324}
325
326/*
327 * This function handles the command response of get Tx power level.
328 *
329 * Handling includes saving the maximum and minimum Tx power levels
330 * in driver, as well as sending the values to user.
331 */
332static int mwifiex_get_power_level(struct mwifiex_private *priv, void *data_buf)
333{
Yogesh Ashok Powar270e58e2011-05-03 20:11:46 -0700334 int length, max_power = -1, min_power = -1;
335 struct mwifiex_types_power_group *pg_tlv_hdr;
336 struct mwifiex_power_group *pg;
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700337
Yogesh Ashok Powarbb7de2b2012-03-12 19:35:12 -0700338 if (!data_buf)
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700339 return -1;
Yogesh Ashok Powarbb7de2b2012-03-12 19:35:12 -0700340
Amitkumar Karward8d13d32013-10-22 15:24:47 -0700341 pg_tlv_hdr = (struct mwifiex_types_power_group *)((u8 *)data_buf);
Yogesh Ashok Powarbb7de2b2012-03-12 19:35:12 -0700342 pg = (struct mwifiex_power_group *)
343 ((u8 *) pg_tlv_hdr + sizeof(struct mwifiex_types_power_group));
Amitkumar Karwar930fd352013-10-22 15:24:43 -0700344 length = le16_to_cpu(pg_tlv_hdr->length);
Amitkumar Karwarfe1c9a42013-10-22 15:24:44 -0700345
346 /* At least one structure required to update power */
347 if (length < sizeof(struct mwifiex_power_group))
348 return 0;
349
350 max_power = pg->power_max;
351 min_power = pg->power_min;
352 length -= sizeof(struct mwifiex_power_group);
353
354 while (length >= sizeof(struct mwifiex_power_group)) {
Yogesh Ashok Powarbb7de2b2012-03-12 19:35:12 -0700355 pg++;
356 if (max_power < pg->power_max)
357 max_power = pg->power_max;
358
359 if (min_power > pg->power_min)
360 min_power = pg->power_min;
361
362 length -= sizeof(struct mwifiex_power_group);
363 }
Amitkumar Karwarfe1c9a42013-10-22 15:24:44 -0700364 priv->min_tx_power_level = (u8) min_power;
365 priv->max_tx_power_level = (u8) max_power;
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700366
367 return 0;
368}
369
370/*
371 * This function handles the command response of set/get Tx power
372 * configurations.
373 *
374 * Handling includes changing the header fields into CPU format
375 * and saving the current Tx power level in driver.
376 */
377static int mwifiex_ret_tx_power_cfg(struct mwifiex_private *priv,
Amitkumar Karwara5ffddb2011-06-20 15:21:48 -0700378 struct host_cmd_ds_command *resp)
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700379{
380 struct mwifiex_adapter *adapter = priv->adapter;
381 struct host_cmd_ds_txpwr_cfg *txp_cfg = &resp->params.txp_cfg;
Yogesh Ashok Powar270e58e2011-05-03 20:11:46 -0700382 struct mwifiex_types_power_group *pg_tlv_hdr;
383 struct mwifiex_power_group *pg;
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700384 u16 action = le16_to_cpu(txp_cfg->action);
Amitkumar Karward8d13d32013-10-22 15:24:47 -0700385 u16 tlv_buf_left;
386
387 pg_tlv_hdr = (struct mwifiex_types_power_group *)
388 ((u8 *)txp_cfg +
389 sizeof(struct host_cmd_ds_txpwr_cfg));
390
391 pg = (struct mwifiex_power_group *)
392 ((u8 *)pg_tlv_hdr +
393 sizeof(struct mwifiex_types_power_group));
394
395 tlv_buf_left = le16_to_cpu(resp->size) - S_DS_GEN - sizeof(*txp_cfg);
396 if (tlv_buf_left <
397 le16_to_cpu(pg_tlv_hdr->length) + sizeof(*pg_tlv_hdr))
398 return 0;
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700399
400 switch (action) {
401 case HostCmd_ACT_GEN_GET:
Yogesh Ashok Powar985d68a2012-03-12 19:35:09 -0700402 if (adapter->hw_status == MWIFIEX_HW_STATUS_INITIALIZING)
Amitkumar Karward8d13d32013-10-22 15:24:47 -0700403 mwifiex_get_power_level(priv, pg_tlv_hdr);
Yogesh Ashok Powar985d68a2012-03-12 19:35:09 -0700404
405 priv->tx_power_level = (u16) pg->power_min;
406 break;
407
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700408 case HostCmd_ACT_GEN_SET:
Yogesh Ashok Powar985d68a2012-03-12 19:35:09 -0700409 if (!le32_to_cpu(txp_cfg->mode))
410 break;
411
Yogesh Ashok Powar985d68a2012-03-12 19:35:09 -0700412 if (pg->power_max == pg->power_min)
413 priv->tx_power_level = (u16) pg->power_min;
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700414 break;
415 default:
416 dev_err(adapter->dev, "CMD_RESP: unknown cmd action %d\n",
Yogesh Ashok Powar9c05fd72012-03-13 19:22:40 -0700417 action);
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700418 return 0;
419 }
420 dev_dbg(adapter->dev,
421 "info: Current TxPower Level = %d, Max Power=%d, Min Power=%d\n",
422 priv->tx_power_level, priv->max_tx_power_level,
423 priv->min_tx_power_level);
424
425 return 0;
426}
427
428/*
Amitkumar Karwarcaa89842012-06-27 19:57:57 -0700429 * This function handles the command response of get RF Tx power.
430 */
431static int mwifiex_ret_rf_tx_power(struct mwifiex_private *priv,
432 struct host_cmd_ds_command *resp)
433{
434 struct host_cmd_ds_rf_tx_pwr *txp = &resp->params.txp;
435 u16 action = le16_to_cpu(txp->action);
436
437 priv->tx_power_level = le16_to_cpu(txp->cur_level);
438
439 if (action == HostCmd_ACT_GEN_GET) {
440 priv->max_tx_power_level = txp->max_power;
441 priv->min_tx_power_level = txp->min_power;
442 }
443
444 dev_dbg(priv->adapter->dev,
445 "Current TxPower Level=%d, Max Power=%d, Min Power=%d\n",
446 priv->tx_power_level, priv->max_tx_power_level,
447 priv->min_tx_power_level);
448
449 return 0;
450}
451
452/*
Amitkumar Karwar8a279d52012-07-02 19:32:33 -0700453 * This function handles the command response of set rf antenna
454 */
455static int mwifiex_ret_rf_antenna(struct mwifiex_private *priv,
456 struct host_cmd_ds_command *resp)
457{
458 struct host_cmd_ds_rf_ant_mimo *ant_mimo = &resp->params.ant_mimo;
459 struct host_cmd_ds_rf_ant_siso *ant_siso = &resp->params.ant_siso;
460 struct mwifiex_adapter *adapter = priv->adapter;
461
462 if (adapter->hw_dev_mcs_support == HT_STREAM_2X2)
463 dev_dbg(adapter->dev,
464 "RF_ANT_RESP: Tx action = 0x%x, Tx Mode = 0x%04x"
465 " Rx action = 0x%x, Rx Mode = 0x%04x\n",
466 le16_to_cpu(ant_mimo->action_tx),
467 le16_to_cpu(ant_mimo->tx_ant_mode),
468 le16_to_cpu(ant_mimo->action_rx),
469 le16_to_cpu(ant_mimo->rx_ant_mode));
470 else
471 dev_dbg(adapter->dev,
472 "RF_ANT_RESP: action = 0x%x, Mode = 0x%04x\n",
473 le16_to_cpu(ant_siso->action),
474 le16_to_cpu(ant_siso->ant_mode));
475
476 return 0;
477}
478
479/*
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700480 * This function handles the command response of set/get MAC address.
481 *
482 * Handling includes saving the MAC address in driver.
483 */
484static int mwifiex_ret_802_11_mac_address(struct mwifiex_private *priv,
485 struct host_cmd_ds_command *resp)
486{
487 struct host_cmd_ds_802_11_mac_address *cmd_mac_addr =
Yogesh Ashok Powar9c05fd72012-03-13 19:22:40 -0700488 &resp->params.mac_addr;
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700489
490 memcpy(priv->curr_addr, cmd_mac_addr->mac_addr, ETH_ALEN);
491
492 dev_dbg(priv->adapter->dev,
493 "info: set mac address: %pM\n", priv->curr_addr);
494
495 return 0;
496}
497
498/*
499 * This function handles the command response of set/get MAC multicast
500 * address.
501 */
502static int mwifiex_ret_mac_multicast_adr(struct mwifiex_private *priv,
503 struct host_cmd_ds_command *resp)
504{
505 return 0;
506}
507
508/*
509 * This function handles the command response of get Tx rate query.
510 *
511 * Handling includes changing the header fields into CPU format
512 * and saving the Tx rate and HT information parameters in driver.
513 *
514 * Both rate configuration and current data rate can be retrieved
515 * with this request.
516 */
517static int mwifiex_ret_802_11_tx_rate_query(struct mwifiex_private *priv,
518 struct host_cmd_ds_command *resp)
519{
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700520 priv->tx_rate = resp->params.tx_rate.tx_rate;
521 priv->tx_htinfo = resp->params.tx_rate.ht_info;
522 if (!priv->is_data_rate_auto)
523 priv->data_rate =
Bing Zhaoe3bea1c2011-11-16 20:40:35 -0800524 mwifiex_index_to_data_rate(priv, priv->tx_rate,
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700525 priv->tx_htinfo);
526
527 return 0;
528}
529
530/*
531 * This function handles the command response of a deauthenticate
532 * command.
533 *
534 * If the deauthenticated MAC matches the current BSS MAC, the connection
535 * state is reset.
536 */
537static int mwifiex_ret_802_11_deauthenticate(struct mwifiex_private *priv,
538 struct host_cmd_ds_command *resp)
539{
540 struct mwifiex_adapter *adapter = priv->adapter;
541
542 adapter->dbg.num_cmd_deauth++;
543 if (!memcmp(resp->params.deauth.mac_addr,
544 &priv->curr_bss_params.bss_descriptor.mac_address,
545 sizeof(resp->params.deauth.mac_addr)))
Amitkumar Karwar8cc1d522012-10-05 20:21:43 -0700546 mwifiex_reset_connect_state(priv, WLAN_REASON_DEAUTH_LEAVING);
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700547
548 return 0;
549}
550
551/*
552 * This function handles the command response of ad-hoc stop.
553 *
554 * The function resets the connection state in driver.
555 */
556static int mwifiex_ret_802_11_ad_hoc_stop(struct mwifiex_private *priv,
557 struct host_cmd_ds_command *resp)
558{
Amitkumar Karwar8cc1d522012-10-05 20:21:43 -0700559 mwifiex_reset_connect_state(priv, WLAN_REASON_DEAUTH_LEAVING);
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700560 return 0;
561}
562
563/*
564 * This function handles the command response of set/get key material.
565 *
566 * Handling includes updating the driver parameters to reflect the
567 * changes.
568 */
569static int mwifiex_ret_802_11_key_material(struct mwifiex_private *priv,
570 struct host_cmd_ds_command *resp)
571{
572 struct host_cmd_ds_802_11_key_material *key =
Yogesh Ashok Powar9c05fd72012-03-13 19:22:40 -0700573 &resp->params.key_material;
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700574
575 if (le16_to_cpu(key->action) == HostCmd_ACT_GEN_SET) {
Yogesh Ashok Powar6a35a0a2011-04-06 16:46:56 -0700576 if ((le16_to_cpu(key->key_param_set.key_info) & KEY_MCAST)) {
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700577 dev_dbg(priv->adapter->dev, "info: key: GTK is set\n");
578 priv->wpa_is_gtk_set = true;
579 priv->scan_block = false;
580 }
581 }
582
583 memset(priv->aes_key.key_param_set.key, 0,
584 sizeof(key->key_param_set.key));
585 priv->aes_key.key_param_set.key_len = key->key_param_set.key_len;
586 memcpy(priv->aes_key.key_param_set.key, key->key_param_set.key,
587 le16_to_cpu(priv->aes_key.key_param_set.key_len));
588
589 return 0;
590}
591
592/*
593 * This function handles the command response of get 11d domain information.
594 */
595static int mwifiex_ret_802_11d_domain_info(struct mwifiex_private *priv,
596 struct host_cmd_ds_command *resp)
597{
598 struct host_cmd_ds_802_11d_domain_info_rsp *domain_info =
599 &resp->params.domain_info_resp;
600 struct mwifiex_ietypes_domain_param_set *domain = &domain_info->domain;
601 u16 action = le16_to_cpu(domain_info->action);
Yogesh Ashok Powar270e58e2011-05-03 20:11:46 -0700602 u8 no_of_triplet;
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700603
Yogesh Ashok Powar9c05fd72012-03-13 19:22:40 -0700604 no_of_triplet = (u8) ((le16_to_cpu(domain->header.len)
605 - IEEE80211_COUNTRY_STRING_LEN)
606 / sizeof(struct ieee80211_country_ie_triplet));
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700607
Yogesh Ashok Powar9c05fd72012-03-13 19:22:40 -0700608 dev_dbg(priv->adapter->dev,
609 "info: 11D Domain Info Resp: no_of_triplet=%d\n",
610 no_of_triplet);
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700611
612 if (no_of_triplet > MWIFIEX_MAX_TRIPLET_802_11D) {
613 dev_warn(priv->adapter->dev,
Yogesh Ashok Powar9c05fd72012-03-13 19:22:40 -0700614 "11D: invalid number of triplets %d returned\n",
615 no_of_triplet);
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700616 return -1;
617 }
618
619 switch (action) {
620 case HostCmd_ACT_GEN_SET: /* Proc Set Action */
621 break;
622 case HostCmd_ACT_GEN_GET:
623 break;
624 default:
625 dev_err(priv->adapter->dev,
626 "11D: invalid action:%d\n", domain_info->action);
627 return -1;
628 }
629
630 return 0;
631}
632
633/*
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700634 * This function handles the command response of get extended version.
635 *
636 * Handling includes forming the extended version string and sending it
637 * to application.
638 */
639static int mwifiex_ret_ver_ext(struct mwifiex_private *priv,
640 struct host_cmd_ds_command *resp,
Amitkumar Karwara5ffddb2011-06-20 15:21:48 -0700641 struct host_cmd_ds_version_ext *version_ext)
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700642{
643 struct host_cmd_ds_version_ext *ver_ext = &resp->params.verext;
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700644
Amitkumar Karwara5ffddb2011-06-20 15:21:48 -0700645 if (version_ext) {
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700646 version_ext->version_str_sel = ver_ext->version_str_sel;
647 memcpy(version_ext->version_str, ver_ext->version_str,
648 sizeof(char) * 128);
649 memcpy(priv->version_str, ver_ext->version_str, 128);
650 }
651 return 0;
652}
653
654/*
Stone Piao7feb4c42012-09-25 20:23:36 -0700655 * This function handles the command response of remain on channel.
656 */
657static int
658mwifiex_ret_remain_on_chan(struct mwifiex_private *priv,
659 struct host_cmd_ds_command *resp,
660 struct host_cmd_ds_remain_on_chan *roc_cfg)
661{
662 struct host_cmd_ds_remain_on_chan *resp_cfg = &resp->params.roc_cfg;
663
664 if (roc_cfg)
665 memcpy(roc_cfg, resp_cfg, sizeof(*roc_cfg));
666
667 return 0;
668}
669
670/*
Stone Piaoe1a2b7a2012-09-25 20:23:41 -0700671 * This function handles the command response of P2P mode cfg.
672 */
673static int
674mwifiex_ret_p2p_mode_cfg(struct mwifiex_private *priv,
675 struct host_cmd_ds_command *resp,
676 void *data_buf)
677{
678 struct host_cmd_ds_p2p_mode_cfg *mode_cfg = &resp->params.mode_cfg;
679
680 if (data_buf)
681 *((u16 *)data_buf) = le16_to_cpu(mode_cfg->mode);
682
683 return 0;
684}
685
686/*
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700687 * This function handles the command response of register access.
688 *
689 * The register value and offset are returned to the user. For EEPROM
690 * access, the byte count is also returned.
691 */
692static int mwifiex_ret_reg_access(u16 type, struct host_cmd_ds_command *resp,
693 void *data_buf)
694{
Yogesh Ashok Powar270e58e2011-05-03 20:11:46 -0700695 struct mwifiex_ds_reg_rw *reg_rw;
696 struct mwifiex_ds_read_eeprom *eeprom;
Yogesh Ashok Powar985d68a2012-03-12 19:35:09 -0700697 union reg {
698 struct host_cmd_ds_mac_reg_access *mac;
699 struct host_cmd_ds_bbp_reg_access *bbp;
700 struct host_cmd_ds_rf_reg_access *rf;
701 struct host_cmd_ds_pmic_reg_access *pmic;
702 struct host_cmd_ds_802_11_eeprom_access *eeprom;
703 } r;
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700704
Yogesh Ashok Powar985d68a2012-03-12 19:35:09 -0700705 if (!data_buf)
706 return 0;
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700707
Yogesh Ashok Powar985d68a2012-03-12 19:35:09 -0700708 reg_rw = data_buf;
709 eeprom = data_buf;
710 switch (type) {
711 case HostCmd_CMD_MAC_REG_ACCESS:
Joe Perches2c208892012-06-04 12:44:17 +0000712 r.mac = &resp->params.mac_reg;
Yogesh Ashok Powar985d68a2012-03-12 19:35:09 -0700713 reg_rw->offset = cpu_to_le32((u32) le16_to_cpu(r.mac->offset));
714 reg_rw->value = r.mac->value;
715 break;
716 case HostCmd_CMD_BBP_REG_ACCESS:
Joe Perches2c208892012-06-04 12:44:17 +0000717 r.bbp = &resp->params.bbp_reg;
Yogesh Ashok Powar985d68a2012-03-12 19:35:09 -0700718 reg_rw->offset = cpu_to_le32((u32) le16_to_cpu(r.bbp->offset));
719 reg_rw->value = cpu_to_le32((u32) r.bbp->value);
720 break;
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700721
Yogesh Ashok Powar985d68a2012-03-12 19:35:09 -0700722 case HostCmd_CMD_RF_REG_ACCESS:
Joe Perches2c208892012-06-04 12:44:17 +0000723 r.rf = &resp->params.rf_reg;
Yogesh Ashok Powar985d68a2012-03-12 19:35:09 -0700724 reg_rw->offset = cpu_to_le32((u32) le16_to_cpu(r.rf->offset));
725 reg_rw->value = cpu_to_le32((u32) r.bbp->value);
726 break;
727 case HostCmd_CMD_PMIC_REG_ACCESS:
Joe Perches2c208892012-06-04 12:44:17 +0000728 r.pmic = &resp->params.pmic_reg;
Yogesh Ashok Powar985d68a2012-03-12 19:35:09 -0700729 reg_rw->offset = cpu_to_le32((u32) le16_to_cpu(r.pmic->offset));
730 reg_rw->value = cpu_to_le32((u32) r.pmic->value);
731 break;
732 case HostCmd_CMD_CAU_REG_ACCESS:
Joe Perches2c208892012-06-04 12:44:17 +0000733 r.rf = &resp->params.rf_reg;
Yogesh Ashok Powar985d68a2012-03-12 19:35:09 -0700734 reg_rw->offset = cpu_to_le32((u32) le16_to_cpu(r.rf->offset));
735 reg_rw->value = cpu_to_le32((u32) r.rf->value);
736 break;
737 case HostCmd_CMD_802_11_EEPROM_ACCESS:
Joe Perches2c208892012-06-04 12:44:17 +0000738 r.eeprom = &resp->params.eeprom;
Yogesh Ashok Powar985d68a2012-03-12 19:35:09 -0700739 pr_debug("info: EEPROM read len=%x\n", r.eeprom->byte_count);
740 if (le16_to_cpu(eeprom->byte_count) <
741 le16_to_cpu(r.eeprom->byte_count)) {
742 eeprom->byte_count = cpu_to_le16(0);
743 pr_debug("info: EEPROM read length is too big\n");
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700744 return -1;
745 }
Yogesh Ashok Powar985d68a2012-03-12 19:35:09 -0700746 eeprom->offset = r.eeprom->offset;
747 eeprom->byte_count = r.eeprom->byte_count;
748 if (le16_to_cpu(eeprom->byte_count) > 0)
749 memcpy(&eeprom->value, &r.eeprom->value,
750 le16_to_cpu(r.eeprom->byte_count));
751
752 break;
753 default:
754 return -1;
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700755 }
756 return 0;
757}
758
759/*
760 * This function handles the command response of get IBSS coalescing status.
761 *
762 * If the received BSSID is different than the current one, the current BSSID,
763 * beacon interval, ATIM window and ERP information are updated, along with
764 * changing the ad-hoc state accordingly.
765 */
766static int mwifiex_ret_ibss_coalescing_status(struct mwifiex_private *priv,
767 struct host_cmd_ds_command *resp)
768{
769 struct host_cmd_ds_802_11_ibss_status *ibss_coal_resp =
Yogesh Ashok Powar9c05fd72012-03-13 19:22:40 -0700770 &(resp->params.ibss_coalescing);
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700771
772 if (le16_to_cpu(ibss_coal_resp->action) == HostCmd_ACT_GEN_SET)
773 return 0;
774
775 dev_dbg(priv->adapter->dev,
776 "info: new BSSID %pM\n", ibss_coal_resp->bssid);
777
778 /* If rsp has NULL BSSID, Just return..... No Action */
Wei Yongjun626a43d2012-08-24 13:27:10 +0800779 if (is_zero_ether_addr(ibss_coal_resp->bssid)) {
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700780 dev_warn(priv->adapter->dev, "new BSSID is NULL\n");
781 return 0;
782 }
783
784 /* If BSSID is diff, modify current BSS parameters */
dingtianhongfcad7662013-12-26 19:41:27 +0800785 if (!ether_addr_equal(priv->curr_bss_params.bss_descriptor.mac_address, ibss_coal_resp->bssid)) {
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700786 /* BSSID */
787 memcpy(priv->curr_bss_params.bss_descriptor.mac_address,
788 ibss_coal_resp->bssid, ETH_ALEN);
789
790 /* Beacon Interval */
791 priv->curr_bss_params.bss_descriptor.beacon_period
792 = le16_to_cpu(ibss_coal_resp->beacon_interval);
793
794 /* ERP Information */
795 priv->curr_bss_params.bss_descriptor.erp_flags =
796 (u8) le16_to_cpu(ibss_coal_resp->use_g_rate_protect);
797
798 priv->adhoc_state = ADHOC_COALESCED;
799 }
800
801 return 0;
802}
803
804/*
Amitkumar Karwarfa444bf2012-03-15 20:51:51 -0700805 * This function handles the command response for subscribe event command.
806 */
807static int mwifiex_ret_subsc_evt(struct mwifiex_private *priv,
Amitkumar Karware69d1ff2012-09-10 18:30:40 -0700808 struct host_cmd_ds_command *resp)
Amitkumar Karwarfa444bf2012-03-15 20:51:51 -0700809{
810 struct host_cmd_ds_802_11_subsc_evt *cmd_sub_event =
Joe Perches2c208892012-06-04 12:44:17 +0000811 &resp->params.subsc_evt;
Amitkumar Karwarfa444bf2012-03-15 20:51:51 -0700812
813 /* For every subscribe event command (Get/Set/Clear), FW reports the
814 * current set of subscribed events*/
815 dev_dbg(priv->adapter->dev, "Bitmap of currently subscribed events: %16x\n",
816 le16_to_cpu(cmd_sub_event->events));
817
Amitkumar Karwarfa444bf2012-03-15 20:51:51 -0700818 return 0;
819}
820
Amitkumar Karwar388ec382013-05-17 17:50:25 -0700821/* This function handles the command response of set_cfg_data */
822static int mwifiex_ret_cfg_data(struct mwifiex_private *priv,
823 struct host_cmd_ds_command *resp)
824{
825 if (resp->result != HostCmd_RESULT_OK) {
826 dev_err(priv->adapter->dev, "Cal data cmd resp failed\n");
827 return -1;
828 }
829
830 return 0;
831}
832
Amitkumar Karwarfa444bf2012-03-15 20:51:51 -0700833/*
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700834 * This function handles the command responses.
835 *
836 * This is a generic function, which calls command specific
837 * response handlers based on the command ID.
838 */
Amitkumar Karwara5ffddb2011-06-20 15:21:48 -0700839int mwifiex_process_sta_cmdresp(struct mwifiex_private *priv, u16 cmdresp_no,
840 struct host_cmd_ds_command *resp)
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700841{
842 int ret = 0;
843 struct mwifiex_adapter *adapter = priv->adapter;
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700844 void *data_buf = adapter->curr_cmd->data_buf;
845
846 /* If the command is not successful, cleanup and return failure */
847 if (resp->result != HostCmd_RESULT_OK) {
Amitkumar Karwar600f5d92011-04-13 17:27:06 -0700848 mwifiex_process_cmdresp_error(priv, resp);
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700849 return -1;
850 }
851 /* Command successful, handle response */
852 switch (cmdresp_no) {
853 case HostCmd_CMD_GET_HW_SPEC:
854 ret = mwifiex_ret_get_hw_spec(priv, resp);
855 break;
Amitkumar Karwar388ec382013-05-17 17:50:25 -0700856 case HostCmd_CMD_CFG_DATA:
857 ret = mwifiex_ret_cfg_data(priv, resp);
858 break;
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700859 case HostCmd_CMD_MAC_CONTROL:
860 break;
861 case HostCmd_CMD_802_11_MAC_ADDRESS:
862 ret = mwifiex_ret_802_11_mac_address(priv, resp);
863 break;
864 case HostCmd_CMD_MAC_MULTICAST_ADR:
865 ret = mwifiex_ret_mac_multicast_adr(priv, resp);
866 break;
867 case HostCmd_CMD_TX_RATE_CFG:
Amitkumar Karwar006606c2012-07-13 20:09:31 -0700868 ret = mwifiex_ret_tx_rate_cfg(priv, resp);
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700869 break;
870 case HostCmd_CMD_802_11_SCAN:
Amitkumar Karwar600f5d92011-04-13 17:27:06 -0700871 ret = mwifiex_ret_802_11_scan(priv, resp);
872 adapter->curr_cmd->wait_q_enabled = false;
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700873 break;
874 case HostCmd_CMD_802_11_BG_SCAN_QUERY:
Amitkumar Karwar600f5d92011-04-13 17:27:06 -0700875 ret = mwifiex_ret_802_11_scan(priv, resp);
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700876 dev_dbg(adapter->dev,
877 "info: CMD_RESP: BG_SCAN result is ready!\n");
878 break;
879 case HostCmd_CMD_TXPWR_CFG:
Amitkumar Karwara5ffddb2011-06-20 15:21:48 -0700880 ret = mwifiex_ret_tx_power_cfg(priv, resp);
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700881 break;
Amitkumar Karwarcaa89842012-06-27 19:57:57 -0700882 case HostCmd_CMD_RF_TX_PWR:
883 ret = mwifiex_ret_rf_tx_power(priv, resp);
884 break;
Amitkumar Karwar8a279d52012-07-02 19:32:33 -0700885 case HostCmd_CMD_RF_ANTENNA:
886 ret = mwifiex_ret_rf_antenna(priv, resp);
887 break;
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700888 case HostCmd_CMD_802_11_PS_MODE_ENH:
889 ret = mwifiex_ret_enh_power_mode(priv, resp, data_buf);
890 break;
891 case HostCmd_CMD_802_11_HS_CFG_ENH:
892 ret = mwifiex_ret_802_11_hs_cfg(priv, resp);
893 break;
894 case HostCmd_CMD_802_11_ASSOCIATE:
Amitkumar Karwar600f5d92011-04-13 17:27:06 -0700895 ret = mwifiex_ret_802_11_associate(priv, resp);
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700896 break;
897 case HostCmd_CMD_802_11_DEAUTHENTICATE:
898 ret = mwifiex_ret_802_11_deauthenticate(priv, resp);
899 break;
900 case HostCmd_CMD_802_11_AD_HOC_START:
901 case HostCmd_CMD_802_11_AD_HOC_JOIN:
Amitkumar Karwar600f5d92011-04-13 17:27:06 -0700902 ret = mwifiex_ret_802_11_ad_hoc(priv, resp);
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700903 break;
904 case HostCmd_CMD_802_11_AD_HOC_STOP:
905 ret = mwifiex_ret_802_11_ad_hoc_stop(priv, resp);
906 break;
907 case HostCmd_CMD_802_11_GET_LOG:
908 ret = mwifiex_ret_get_log(priv, resp, data_buf);
909 break;
910 case HostCmd_CMD_RSSI_INFO:
Amitkumar Karwar958a4a82012-03-15 20:51:49 -0700911 ret = mwifiex_ret_802_11_rssi_info(priv, resp);
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700912 break;
913 case HostCmd_CMD_802_11_SNMP_MIB:
914 ret = mwifiex_ret_802_11_snmp_mib(priv, resp, data_buf);
915 break;
916 case HostCmd_CMD_802_11_TX_RATE_QUERY:
917 ret = mwifiex_ret_802_11_tx_rate_query(priv, resp);
918 break;
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700919 case HostCmd_CMD_VERSION_EXT:
920 ret = mwifiex_ret_ver_ext(priv, resp, data_buf);
921 break;
Stone Piao7feb4c42012-09-25 20:23:36 -0700922 case HostCmd_CMD_REMAIN_ON_CHAN:
923 ret = mwifiex_ret_remain_on_chan(priv, resp, data_buf);
924 break;
Yogesh Ashok Powar83c78da2013-03-18 20:06:03 -0700925 case HostCmd_CMD_11AC_CFG:
926 break;
Stone Piaoe1a2b7a2012-09-25 20:23:41 -0700927 case HostCmd_CMD_P2P_MODE_CFG:
928 ret = mwifiex_ret_p2p_mode_cfg(priv, resp, data_buf);
929 break;
Stone Piao3cec6872012-09-25 20:23:34 -0700930 case HostCmd_CMD_MGMT_FRAME_REG:
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700931 case HostCmd_CMD_FUNC_INIT:
932 case HostCmd_CMD_FUNC_SHUTDOWN:
933 break;
934 case HostCmd_CMD_802_11_KEY_MATERIAL:
935 ret = mwifiex_ret_802_11_key_material(priv, resp);
936 break;
937 case HostCmd_CMD_802_11D_DOMAIN_INFO:
938 ret = mwifiex_ret_802_11d_domain_info(priv, resp);
939 break;
940 case HostCmd_CMD_11N_ADDBA_REQ:
941 ret = mwifiex_ret_11n_addba_req(priv, resp);
942 break;
943 case HostCmd_CMD_11N_DELBA:
944 ret = mwifiex_ret_11n_delba(priv, resp);
945 break;
946 case HostCmd_CMD_11N_ADDBA_RSP:
947 ret = mwifiex_ret_11n_addba_resp(priv, resp);
948 break;
949 case HostCmd_CMD_RECONFIGURE_TX_BUFF:
950 adapter->tx_buf_size = (u16) le16_to_cpu(resp->params.
951 tx_buf.buff_size);
Yogesh Ashok Powar9c05fd72012-03-13 19:22:40 -0700952 adapter->tx_buf_size = (adapter->tx_buf_size
953 / MWIFIEX_SDIO_BLOCK_SIZE)
954 * MWIFIEX_SDIO_BLOCK_SIZE;
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700955 adapter->curr_tx_buf_size = adapter->tx_buf_size;
Bing Zhao5e3175f2013-01-30 19:56:02 -0800956 dev_dbg(adapter->dev, "cmd: curr_tx_buf_size=%d\n",
957 adapter->curr_tx_buf_size);
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700958
959 if (adapter->if_ops.update_mp_end_port)
960 adapter->if_ops.update_mp_end_port(adapter,
Yogesh Ashok Powar9c05fd72012-03-13 19:22:40 -0700961 le16_to_cpu(resp->params.tx_buf.mp_end_port));
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700962 break;
963 case HostCmd_CMD_AMSDU_AGGR_CTRL:
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700964 break;
965 case HostCmd_CMD_WMM_GET_STATUS:
966 ret = mwifiex_ret_wmm_get_status(priv, resp);
967 break;
968 case HostCmd_CMD_802_11_IBSS_COALESCING_STATUS:
969 ret = mwifiex_ret_ibss_coalescing_status(priv, resp);
970 break;
971 case HostCmd_CMD_MAC_REG_ACCESS:
972 case HostCmd_CMD_BBP_REG_ACCESS:
973 case HostCmd_CMD_RF_REG_ACCESS:
974 case HostCmd_CMD_PMIC_REG_ACCESS:
975 case HostCmd_CMD_CAU_REG_ACCESS:
976 case HostCmd_CMD_802_11_EEPROM_ACCESS:
977 ret = mwifiex_ret_reg_access(cmdresp_no, resp, data_buf);
978 break;
979 case HostCmd_CMD_SET_BSS_MODE:
980 break;
981 case HostCmd_CMD_11N_CFG:
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700982 break;
Amitkumar Karward930fae2011-10-11 17:41:21 -0700983 case HostCmd_CMD_PCIE_DESC_DETAILS:
984 break;
Amitkumar Karwarfa444bf2012-03-15 20:51:51 -0700985 case HostCmd_CMD_802_11_SUBSCRIBE_EVENT:
Amitkumar Karware69d1ff2012-09-10 18:30:40 -0700986 ret = mwifiex_ret_subsc_evt(priv, resp);
Amitkumar Karwarfa444bf2012-03-15 20:51:51 -0700987 break;
Avinash Patil40d07032012-05-08 18:30:19 -0700988 case HostCmd_CMD_UAP_SYS_CONFIG:
989 break;
990 case HostCmd_CMD_UAP_BSS_START:
991 priv->bss_started = 1;
992 break;
993 case HostCmd_CMD_UAP_BSS_STOP:
994 priv->bss_started = 0;
995 break;
Avinash Patil0f9e9b82013-05-17 17:50:23 -0700996 case HostCmd_CMD_UAP_STA_DEAUTH:
997 break;
Amitkumar Karwar7da060c2013-03-04 16:27:59 -0800998 case HostCmd_CMD_MEF_CFG:
999 break;
Amitkumar Karwar562fc5b2013-08-05 18:52:00 -07001000 case HostCmd_CMD_COALESCE_CFG:
1001 break;
Bing Zhao5e6e3a92011-03-21 18:00:50 -07001002 default:
1003 dev_err(adapter->dev, "CMD_RESP: unknown cmd response %#x\n",
Yogesh Ashok Powar9c05fd72012-03-13 19:22:40 -07001004 resp->command);
Bing Zhao5e6e3a92011-03-21 18:00:50 -07001005 break;
1006 }
1007
1008 return ret;
1009}