blob: 0b09004ebb25a3eebf6f5fe8f85bfd9c196f351c [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"
27
28
29/*
30 * This function handles the command response error case.
31 *
32 * For scan response error, the function cancels all the pending
33 * scan commands and generates an event to inform the applications
34 * of the scan completion.
35 *
36 * For Power Save command failure, we do not retry enter PS
37 * command in case of Ad-hoc mode.
38 *
39 * For all other response errors, the current command buffer is freed
40 * and returned to the free command queue.
41 */
42static void
43mwifiex_process_cmdresp_error(struct mwifiex_private *priv,
Amitkumar Karwar600f5d92011-04-13 17:27:06 -070044 struct host_cmd_ds_command *resp)
Bing Zhao5e6e3a92011-03-21 18:00:50 -070045{
Yogesh Ashok Powar270e58e2011-05-03 20:11:46 -070046 struct cmd_ctrl_node *cmd_node = NULL, *tmp_node;
Bing Zhao5e6e3a92011-03-21 18:00:50 -070047 struct mwifiex_adapter *adapter = priv->adapter;
Marc Yang2b06bdb2011-03-30 18:12:44 -070048 struct host_cmd_ds_802_11_ps_mode_enh *pm;
Bing Zhao5e6e3a92011-03-21 18:00:50 -070049 unsigned long flags;
50
51 dev_err(adapter->dev, "CMD_RESP: cmd %#x error, result=%#x\n",
Yogesh Ashok Powar9c05fd72012-03-13 19:22:40 -070052 resp->command, resp->result);
Amitkumar Karwar600f5d92011-04-13 17:27:06 -070053
54 if (adapter->curr_cmd->wait_q_enabled)
55 adapter->cmd_wait_q.status = -1;
Bing Zhao5e6e3a92011-03-21 18:00:50 -070056
57 switch (le16_to_cpu(resp->command)) {
58 case HostCmd_CMD_802_11_PS_MODE_ENH:
Marc Yang2b06bdb2011-03-30 18:12:44 -070059 pm = &resp->params.psmode_enh;
Yogesh Ashok Powar9c05fd72012-03-13 19:22:40 -070060 dev_err(adapter->dev,
61 "PS_MODE_ENH cmd failed: result=0x%x action=0x%X\n",
62 resp->result, le16_to_cpu(pm->action));
Marc Yang2b06bdb2011-03-30 18:12:44 -070063 /* We do not re-try enter-ps command in ad-hoc mode. */
64 if (le16_to_cpu(pm->action) == EN_AUTO_PS &&
Yogesh Ashok Powar9c05fd72012-03-13 19:22:40 -070065 (le16_to_cpu(pm->params.ps_bitmap) & BITMAP_STA_PS) &&
66 priv->bss_mode == NL80211_IFTYPE_ADHOC)
Marc Yang2b06bdb2011-03-30 18:12:44 -070067 adapter->ps_mode = MWIFIEX_802_11_POWER_MODE_CAM;
68
Bing Zhao5e6e3a92011-03-21 18:00:50 -070069 break;
70 case HostCmd_CMD_802_11_SCAN:
71 /* Cancel all pending scan command */
72 spin_lock_irqsave(&adapter->scan_pending_q_lock, flags);
73 list_for_each_entry_safe(cmd_node, tmp_node,
74 &adapter->scan_pending_q, list) {
75 list_del(&cmd_node->list);
76 spin_unlock_irqrestore(&adapter->scan_pending_q_lock,
77 flags);
78 mwifiex_insert_cmd_to_free_q(adapter, cmd_node);
79 spin_lock_irqsave(&adapter->scan_pending_q_lock, flags);
80 }
81 spin_unlock_irqrestore(&adapter->scan_pending_q_lock, flags);
82
83 spin_lock_irqsave(&adapter->mwifiex_cmd_lock, flags);
84 adapter->scan_processing = false;
85 spin_unlock_irqrestore(&adapter->mwifiex_cmd_lock, flags);
86 if (priv->report_scan_result)
87 priv->report_scan_result = false;
88 if (priv->scan_pending_on_block) {
89 priv->scan_pending_on_block = false;
90 up(&priv->async_sem);
91 }
92 break;
93
94 case HostCmd_CMD_MAC_CONTROL:
95 break;
96
97 default:
98 break;
99 }
100 /* Handling errors here */
101 mwifiex_insert_cmd_to_free_q(adapter, adapter->curr_cmd);
102
103 spin_lock_irqsave(&adapter->mwifiex_cmd_lock, flags);
104 adapter->curr_cmd = NULL;
105 spin_unlock_irqrestore(&adapter->mwifiex_cmd_lock, flags);
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700106}
107
108/*
109 * This function handles the command response of get RSSI info.
110 *
111 * Handling includes changing the header fields into CPU format
112 * and saving the following parameters in driver -
113 * - Last data and beacon RSSI value
114 * - Average data and beacon RSSI value
115 * - Last data and beacon NF value
116 * - Average data and beacon NF value
117 *
118 * The parameters are send to the application as well, along with
119 * calculated SNR values.
120 */
121static int mwifiex_ret_802_11_rssi_info(struct mwifiex_private *priv,
Amitkumar Karwar958a4a82012-03-15 20:51:49 -0700122 struct host_cmd_ds_command *resp)
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700123{
124 struct host_cmd_ds_802_11_rssi_info_rsp *rssi_info_rsp =
Yogesh Ashok Powar9c05fd72012-03-13 19:22:40 -0700125 &resp->params.rssi_info_rsp;
Amitkumar Karwarfa444bf2012-03-15 20:51:51 -0700126 struct mwifiex_ds_misc_subsc_evt subsc_evt;
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700127
128 priv->data_rssi_last = le16_to_cpu(rssi_info_rsp->data_rssi_last);
129 priv->data_nf_last = le16_to_cpu(rssi_info_rsp->data_nf_last);
130
131 priv->data_rssi_avg = le16_to_cpu(rssi_info_rsp->data_rssi_avg);
132 priv->data_nf_avg = le16_to_cpu(rssi_info_rsp->data_nf_avg);
133
134 priv->bcn_rssi_last = le16_to_cpu(rssi_info_rsp->bcn_rssi_last);
135 priv->bcn_nf_last = le16_to_cpu(rssi_info_rsp->bcn_nf_last);
136
137 priv->bcn_rssi_avg = le16_to_cpu(rssi_info_rsp->bcn_rssi_avg);
138 priv->bcn_nf_avg = le16_to_cpu(rssi_info_rsp->bcn_nf_avg);
139
Amitkumar Karwarfa444bf2012-03-15 20:51:51 -0700140 if (priv->subsc_evt_rssi_state == EVENT_HANDLED)
141 return 0;
142
143 /* Resubscribe low and high rssi events with new thresholds */
144 memset(&subsc_evt, 0x00, sizeof(struct mwifiex_ds_misc_subsc_evt));
145 subsc_evt.events = BITMASK_BCN_RSSI_LOW | BITMASK_BCN_RSSI_HIGH;
146 subsc_evt.action = HostCmd_ACT_BITWISE_SET;
147 if (priv->subsc_evt_rssi_state == RSSI_LOW_RECVD) {
148 subsc_evt.bcn_l_rssi_cfg.abs_value = abs(priv->bcn_rssi_avg -
149 priv->cqm_rssi_hyst);
150 subsc_evt.bcn_h_rssi_cfg.abs_value = abs(priv->cqm_rssi_thold);
151 } else if (priv->subsc_evt_rssi_state == RSSI_HIGH_RECVD) {
152 subsc_evt.bcn_l_rssi_cfg.abs_value = abs(priv->cqm_rssi_thold);
153 subsc_evt.bcn_h_rssi_cfg.abs_value = abs(priv->bcn_rssi_avg +
154 priv->cqm_rssi_hyst);
155 }
156 subsc_evt.bcn_l_rssi_cfg.evt_freq = 1;
157 subsc_evt.bcn_h_rssi_cfg.evt_freq = 1;
158
159 priv->subsc_evt_rssi_state = EVENT_HANDLED;
160
161 mwifiex_send_cmd_async(priv, HostCmd_CMD_802_11_SUBSCRIBE_EVENT,
162 0, 0, &subsc_evt);
163
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700164 return 0;
165}
166
167/*
168 * This function handles the command response of set/get SNMP
169 * MIB parameters.
170 *
171 * Handling includes changing the header fields into CPU format
172 * and saving the parameter in driver.
173 *
174 * The following parameters are supported -
175 * - Fragmentation threshold
176 * - RTS threshold
177 * - Short retry limit
178 */
179static int mwifiex_ret_802_11_snmp_mib(struct mwifiex_private *priv,
180 struct host_cmd_ds_command *resp,
Dan Carpentera5e5aa62011-06-24 16:33:35 +0300181 u32 *data_buf)
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700182{
183 struct host_cmd_ds_802_11_snmp_mib *smib = &resp->params.smib;
184 u16 oid = le16_to_cpu(smib->oid);
185 u16 query_type = le16_to_cpu(smib->query_type);
Dan Carpentera5e5aa62011-06-24 16:33:35 +0300186 u32 ul_temp;
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700187
188 dev_dbg(priv->adapter->dev, "info: SNMP_RESP: oid value = %#x,"
Yogesh Ashok Powar9c05fd72012-03-13 19:22:40 -0700189 " query_type = %#x, buf size = %#x\n",
190 oid, query_type, le16_to_cpu(smib->buf_size));
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700191 if (query_type == HostCmd_ACT_GEN_GET) {
Dan Carpentera5e5aa62011-06-24 16:33:35 +0300192 ul_temp = le16_to_cpu(*((__le16 *) (smib->value)));
193 if (data_buf)
194 *data_buf = ul_temp;
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700195 switch (oid) {
196 case FRAG_THRESH_I:
197 dev_dbg(priv->adapter->dev,
Dan Carpentera5e5aa62011-06-24 16:33:35 +0300198 "info: SNMP_RESP: FragThsd =%u\n", ul_temp);
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700199 break;
200 case RTS_THRESH_I:
201 dev_dbg(priv->adapter->dev,
Dan Carpentera5e5aa62011-06-24 16:33:35 +0300202 "info: SNMP_RESP: RTSThsd =%u\n", ul_temp);
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700203 break;
204 case SHORT_RETRY_LIM_I:
205 dev_dbg(priv->adapter->dev,
Dan Carpentera5e5aa62011-06-24 16:33:35 +0300206 "info: SNMP_RESP: TxRetryCount=%u\n", ul_temp);
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700207 break;
Amitkumar Karwarcaf60a62012-02-02 20:48:58 -0800208 case DTIM_PERIOD_I:
209 dev_dbg(priv->adapter->dev,
210 "info: SNMP_RESP: DTIM period=%u\n", ul_temp);
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700211 default:
212 break;
213 }
214 }
215
216 return 0;
217}
218
219/*
220 * This function handles the command response of get log request
221 *
222 * Handling includes changing the header fields into CPU format
223 * and sending the received parameters to application.
224 */
225static int mwifiex_ret_get_log(struct mwifiex_private *priv,
226 struct host_cmd_ds_command *resp,
Amitkumar Karwara5ffddb2011-06-20 15:21:48 -0700227 struct mwifiex_ds_get_stats *stats)
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700228{
229 struct host_cmd_ds_802_11_get_log *get_log =
Joe Perches2c208892012-06-04 12:44:17 +0000230 &resp->params.get_log;
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700231
Amitkumar Karwara5ffddb2011-06-20 15:21:48 -0700232 if (stats) {
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700233 stats->mcast_tx_frame = le32_to_cpu(get_log->mcast_tx_frame);
234 stats->failed = le32_to_cpu(get_log->failed);
235 stats->retry = le32_to_cpu(get_log->retry);
236 stats->multi_retry = le32_to_cpu(get_log->multi_retry);
237 stats->frame_dup = le32_to_cpu(get_log->frame_dup);
238 stats->rts_success = le32_to_cpu(get_log->rts_success);
239 stats->rts_failure = le32_to_cpu(get_log->rts_failure);
240 stats->ack_failure = le32_to_cpu(get_log->ack_failure);
241 stats->rx_frag = le32_to_cpu(get_log->rx_frag);
242 stats->mcast_rx_frame = le32_to_cpu(get_log->mcast_rx_frame);
243 stats->fcs_error = le32_to_cpu(get_log->fcs_error);
244 stats->tx_frame = le32_to_cpu(get_log->tx_frame);
245 stats->wep_icv_error[0] =
246 le32_to_cpu(get_log->wep_icv_err_cnt[0]);
247 stats->wep_icv_error[1] =
248 le32_to_cpu(get_log->wep_icv_err_cnt[1]);
249 stats->wep_icv_error[2] =
250 le32_to_cpu(get_log->wep_icv_err_cnt[2]);
251 stats->wep_icv_error[3] =
252 le32_to_cpu(get_log->wep_icv_err_cnt[3]);
253 }
254
255 return 0;
256}
257
258/*
259 * This function handles the command response of set/get Tx rate
260 * configurations.
261 *
262 * Handling includes changing the header fields into CPU format
263 * and saving the following parameters in driver -
264 * - DSSS rate bitmap
265 * - OFDM rate bitmap
266 * - HT MCS rate bitmaps
267 *
268 * Based on the new rate bitmaps, the function re-evaluates if
269 * auto data rate has been activated. If not, it sends another
Amitkumar Karwar006606c2012-07-13 20:09:31 -0700270 * query to the firmware to get the current Tx data rate.
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700271 */
272static int mwifiex_ret_tx_rate_cfg(struct mwifiex_private *priv,
Amitkumar Karwar006606c2012-07-13 20:09:31 -0700273 struct host_cmd_ds_command *resp)
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700274{
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700275 struct host_cmd_ds_tx_rate_cfg *rate_cfg = &resp->params.tx_rate_cfg;
276 struct mwifiex_rate_scope *rate_scope;
Yogesh Ashok Powar270e58e2011-05-03 20:11:46 -0700277 struct mwifiex_ie_types_header *head;
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700278 u16 tlv, tlv_buf_len;
279 u8 *tlv_buf;
280 u32 i;
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700281
Joe Perches2c208892012-06-04 12:44:17 +0000282 tlv_buf = ((u8 *)rate_cfg) +
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700283 sizeof(struct host_cmd_ds_tx_rate_cfg);
284 tlv_buf_len = *(u16 *) (tlv_buf + sizeof(u16));
285
286 while (tlv_buf && tlv_buf_len > 0) {
287 tlv = (*tlv_buf);
288 tlv = tlv | (*(tlv_buf + 1) << 8);
289
290 switch (tlv) {
291 case TLV_TYPE_RATE_SCOPE:
292 rate_scope = (struct mwifiex_rate_scope *) tlv_buf;
293 priv->bitmap_rates[0] =
294 le16_to_cpu(rate_scope->hr_dsss_rate_bitmap);
295 priv->bitmap_rates[1] =
296 le16_to_cpu(rate_scope->ofdm_rate_bitmap);
297 for (i = 0;
298 i <
299 sizeof(rate_scope->ht_mcs_rate_bitmap) /
300 sizeof(u16); i++)
301 priv->bitmap_rates[2 + i] =
302 le16_to_cpu(rate_scope->
303 ht_mcs_rate_bitmap[i]);
304 break;
305 /* Add RATE_DROP tlv here */
306 }
307
308 head = (struct mwifiex_ie_types_header *) tlv_buf;
309 tlv_buf += le16_to_cpu(head->len) + sizeof(*head);
310 tlv_buf_len -= le16_to_cpu(head->len);
311 }
312
313 priv->is_data_rate_auto = mwifiex_is_rate_auto(priv);
314
315 if (priv->is_data_rate_auto)
316 priv->data_rate = 0;
317 else
Amitkumar Karwar006606c2012-07-13 20:09:31 -0700318 return mwifiex_send_cmd_async(priv,
319 HostCmd_CMD_802_11_TX_RATE_QUERY,
320 HostCmd_ACT_GEN_GET, 0, NULL);
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700321
Amitkumar Karwar006606c2012-07-13 20:09:31 -0700322 return 0;
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700323}
324
325/*
326 * This function handles the command response of get Tx power level.
327 *
328 * Handling includes saving the maximum and minimum Tx power levels
329 * in driver, as well as sending the values to user.
330 */
331static int mwifiex_get_power_level(struct mwifiex_private *priv, void *data_buf)
332{
Yogesh Ashok Powar270e58e2011-05-03 20:11:46 -0700333 int length, max_power = -1, min_power = -1;
334 struct mwifiex_types_power_group *pg_tlv_hdr;
335 struct mwifiex_power_group *pg;
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700336
Yogesh Ashok Powarbb7de2b2012-03-12 19:35:12 -0700337 if (!data_buf)
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700338 return -1;
Yogesh Ashok Powarbb7de2b2012-03-12 19:35:12 -0700339
340 pg_tlv_hdr = (struct mwifiex_types_power_group *)
341 ((u8 *) data_buf + sizeof(struct host_cmd_ds_txpwr_cfg));
342 pg = (struct mwifiex_power_group *)
343 ((u8 *) pg_tlv_hdr + sizeof(struct mwifiex_types_power_group));
344 length = pg_tlv_hdr->length;
345 if (length > 0) {
346 max_power = pg->power_max;
347 min_power = pg->power_min;
348 length -= sizeof(struct mwifiex_power_group);
349 }
350 while (length) {
351 pg++;
352 if (max_power < pg->power_max)
353 max_power = pg->power_max;
354
355 if (min_power > pg->power_min)
356 min_power = pg->power_min;
357
358 length -= sizeof(struct mwifiex_power_group);
359 }
360 if (pg_tlv_hdr->length > 0) {
361 priv->min_tx_power_level = (u8) min_power;
362 priv->max_tx_power_level = (u8) max_power;
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700363 }
364
365 return 0;
366}
367
368/*
369 * This function handles the command response of set/get Tx power
370 * configurations.
371 *
372 * Handling includes changing the header fields into CPU format
373 * and saving the current Tx power level in driver.
374 */
375static int mwifiex_ret_tx_power_cfg(struct mwifiex_private *priv,
Amitkumar Karwara5ffddb2011-06-20 15:21:48 -0700376 struct host_cmd_ds_command *resp)
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700377{
378 struct mwifiex_adapter *adapter = priv->adapter;
379 struct host_cmd_ds_txpwr_cfg *txp_cfg = &resp->params.txp_cfg;
Yogesh Ashok Powar270e58e2011-05-03 20:11:46 -0700380 struct mwifiex_types_power_group *pg_tlv_hdr;
381 struct mwifiex_power_group *pg;
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700382 u16 action = le16_to_cpu(txp_cfg->action);
383
384 switch (action) {
385 case HostCmd_ACT_GEN_GET:
Yogesh Ashok Powar985d68a2012-03-12 19:35:09 -0700386 pg_tlv_hdr = (struct mwifiex_types_power_group *)
387 ((u8 *) txp_cfg +
388 sizeof(struct host_cmd_ds_txpwr_cfg));
389
390 pg = (struct mwifiex_power_group *)
391 ((u8 *) pg_tlv_hdr +
392 sizeof(struct mwifiex_types_power_group));
393
394 if (adapter->hw_status == MWIFIEX_HW_STATUS_INITIALIZING)
395 mwifiex_get_power_level(priv, txp_cfg);
396
397 priv->tx_power_level = (u16) pg->power_min;
398 break;
399
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700400 case HostCmd_ACT_GEN_SET:
Yogesh Ashok Powar985d68a2012-03-12 19:35:09 -0700401 if (!le32_to_cpu(txp_cfg->mode))
402 break;
403
404 pg_tlv_hdr = (struct mwifiex_types_power_group *)
405 ((u8 *) txp_cfg +
406 sizeof(struct host_cmd_ds_txpwr_cfg));
407
408 pg = (struct mwifiex_power_group *)
409 ((u8 *) pg_tlv_hdr +
410 sizeof(struct mwifiex_types_power_group));
411
412 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)))
546 mwifiex_reset_connect_state(priv);
547
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{
559 mwifiex_reset_connect_state(priv);
560 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/*
655 * This function handles the command response of register access.
656 *
657 * The register value and offset are returned to the user. For EEPROM
658 * access, the byte count is also returned.
659 */
660static int mwifiex_ret_reg_access(u16 type, struct host_cmd_ds_command *resp,
661 void *data_buf)
662{
Yogesh Ashok Powar270e58e2011-05-03 20:11:46 -0700663 struct mwifiex_ds_reg_rw *reg_rw;
664 struct mwifiex_ds_read_eeprom *eeprom;
Yogesh Ashok Powar985d68a2012-03-12 19:35:09 -0700665 union reg {
666 struct host_cmd_ds_mac_reg_access *mac;
667 struct host_cmd_ds_bbp_reg_access *bbp;
668 struct host_cmd_ds_rf_reg_access *rf;
669 struct host_cmd_ds_pmic_reg_access *pmic;
670 struct host_cmd_ds_802_11_eeprom_access *eeprom;
671 } r;
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700672
Yogesh Ashok Powar985d68a2012-03-12 19:35:09 -0700673 if (!data_buf)
674 return 0;
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700675
Yogesh Ashok Powar985d68a2012-03-12 19:35:09 -0700676 reg_rw = data_buf;
677 eeprom = data_buf;
678 switch (type) {
679 case HostCmd_CMD_MAC_REG_ACCESS:
Joe Perches2c208892012-06-04 12:44:17 +0000680 r.mac = &resp->params.mac_reg;
Yogesh Ashok Powar985d68a2012-03-12 19:35:09 -0700681 reg_rw->offset = cpu_to_le32((u32) le16_to_cpu(r.mac->offset));
682 reg_rw->value = r.mac->value;
683 break;
684 case HostCmd_CMD_BBP_REG_ACCESS:
Joe Perches2c208892012-06-04 12:44:17 +0000685 r.bbp = &resp->params.bbp_reg;
Yogesh Ashok Powar985d68a2012-03-12 19:35:09 -0700686 reg_rw->offset = cpu_to_le32((u32) le16_to_cpu(r.bbp->offset));
687 reg_rw->value = cpu_to_le32((u32) r.bbp->value);
688 break;
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700689
Yogesh Ashok Powar985d68a2012-03-12 19:35:09 -0700690 case HostCmd_CMD_RF_REG_ACCESS:
Joe Perches2c208892012-06-04 12:44:17 +0000691 r.rf = &resp->params.rf_reg;
Yogesh Ashok Powar985d68a2012-03-12 19:35:09 -0700692 reg_rw->offset = cpu_to_le32((u32) le16_to_cpu(r.rf->offset));
693 reg_rw->value = cpu_to_le32((u32) r.bbp->value);
694 break;
695 case HostCmd_CMD_PMIC_REG_ACCESS:
Joe Perches2c208892012-06-04 12:44:17 +0000696 r.pmic = &resp->params.pmic_reg;
Yogesh Ashok Powar985d68a2012-03-12 19:35:09 -0700697 reg_rw->offset = cpu_to_le32((u32) le16_to_cpu(r.pmic->offset));
698 reg_rw->value = cpu_to_le32((u32) r.pmic->value);
699 break;
700 case HostCmd_CMD_CAU_REG_ACCESS:
Joe Perches2c208892012-06-04 12:44:17 +0000701 r.rf = &resp->params.rf_reg;
Yogesh Ashok Powar985d68a2012-03-12 19:35:09 -0700702 reg_rw->offset = cpu_to_le32((u32) le16_to_cpu(r.rf->offset));
703 reg_rw->value = cpu_to_le32((u32) r.rf->value);
704 break;
705 case HostCmd_CMD_802_11_EEPROM_ACCESS:
Joe Perches2c208892012-06-04 12:44:17 +0000706 r.eeprom = &resp->params.eeprom;
Yogesh Ashok Powar985d68a2012-03-12 19:35:09 -0700707 pr_debug("info: EEPROM read len=%x\n", r.eeprom->byte_count);
708 if (le16_to_cpu(eeprom->byte_count) <
709 le16_to_cpu(r.eeprom->byte_count)) {
710 eeprom->byte_count = cpu_to_le16(0);
711 pr_debug("info: EEPROM read length is too big\n");
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700712 return -1;
713 }
Yogesh Ashok Powar985d68a2012-03-12 19:35:09 -0700714 eeprom->offset = r.eeprom->offset;
715 eeprom->byte_count = r.eeprom->byte_count;
716 if (le16_to_cpu(eeprom->byte_count) > 0)
717 memcpy(&eeprom->value, &r.eeprom->value,
718 le16_to_cpu(r.eeprom->byte_count));
719
720 break;
721 default:
722 return -1;
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700723 }
724 return 0;
725}
726
727/*
728 * This function handles the command response of get IBSS coalescing status.
729 *
730 * If the received BSSID is different than the current one, the current BSSID,
731 * beacon interval, ATIM window and ERP information are updated, along with
732 * changing the ad-hoc state accordingly.
733 */
734static int mwifiex_ret_ibss_coalescing_status(struct mwifiex_private *priv,
735 struct host_cmd_ds_command *resp)
736{
737 struct host_cmd_ds_802_11_ibss_status *ibss_coal_resp =
Yogesh Ashok Powar9c05fd72012-03-13 19:22:40 -0700738 &(resp->params.ibss_coalescing);
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700739 u8 zero_mac[ETH_ALEN] = { 0, 0, 0, 0, 0, 0 };
740
741 if (le16_to_cpu(ibss_coal_resp->action) == HostCmd_ACT_GEN_SET)
742 return 0;
743
744 dev_dbg(priv->adapter->dev,
745 "info: new BSSID %pM\n", ibss_coal_resp->bssid);
746
747 /* If rsp has NULL BSSID, Just return..... No Action */
748 if (!memcmp(ibss_coal_resp->bssid, zero_mac, ETH_ALEN)) {
749 dev_warn(priv->adapter->dev, "new BSSID is NULL\n");
750 return 0;
751 }
752
753 /* If BSSID is diff, modify current BSS parameters */
754 if (memcmp(priv->curr_bss_params.bss_descriptor.mac_address,
755 ibss_coal_resp->bssid, ETH_ALEN)) {
756 /* BSSID */
757 memcpy(priv->curr_bss_params.bss_descriptor.mac_address,
758 ibss_coal_resp->bssid, ETH_ALEN);
759
760 /* Beacon Interval */
761 priv->curr_bss_params.bss_descriptor.beacon_period
762 = le16_to_cpu(ibss_coal_resp->beacon_interval);
763
764 /* ERP Information */
765 priv->curr_bss_params.bss_descriptor.erp_flags =
766 (u8) le16_to_cpu(ibss_coal_resp->use_g_rate_protect);
767
768 priv->adhoc_state = ADHOC_COALESCED;
769 }
770
771 return 0;
772}
773
774/*
Amitkumar Karwarfa444bf2012-03-15 20:51:51 -0700775 * This function handles the command response for subscribe event command.
776 */
777static int mwifiex_ret_subsc_evt(struct mwifiex_private *priv,
778 struct host_cmd_ds_command *resp,
779 struct mwifiex_ds_misc_subsc_evt *sub_event)
780{
781 struct host_cmd_ds_802_11_subsc_evt *cmd_sub_event =
Joe Perches2c208892012-06-04 12:44:17 +0000782 &resp->params.subsc_evt;
Amitkumar Karwarfa444bf2012-03-15 20:51:51 -0700783
784 /* For every subscribe event command (Get/Set/Clear), FW reports the
785 * current set of subscribed events*/
786 dev_dbg(priv->adapter->dev, "Bitmap of currently subscribed events: %16x\n",
787 le16_to_cpu(cmd_sub_event->events));
788
789 /*Return the subscribed event info for a Get request*/
790 if (sub_event)
791 sub_event->events = le16_to_cpu(cmd_sub_event->events);
792
793 return 0;
794}
795
796/*
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700797 * This function handles the command responses.
798 *
799 * This is a generic function, which calls command specific
800 * response handlers based on the command ID.
801 */
Amitkumar Karwara5ffddb2011-06-20 15:21:48 -0700802int mwifiex_process_sta_cmdresp(struct mwifiex_private *priv, u16 cmdresp_no,
803 struct host_cmd_ds_command *resp)
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700804{
805 int ret = 0;
806 struct mwifiex_adapter *adapter = priv->adapter;
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700807 void *data_buf = adapter->curr_cmd->data_buf;
808
809 /* If the command is not successful, cleanup and return failure */
810 if (resp->result != HostCmd_RESULT_OK) {
Amitkumar Karwar600f5d92011-04-13 17:27:06 -0700811 mwifiex_process_cmdresp_error(priv, resp);
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700812 return -1;
813 }
814 /* Command successful, handle response */
815 switch (cmdresp_no) {
816 case HostCmd_CMD_GET_HW_SPEC:
817 ret = mwifiex_ret_get_hw_spec(priv, resp);
818 break;
819 case HostCmd_CMD_MAC_CONTROL:
820 break;
821 case HostCmd_CMD_802_11_MAC_ADDRESS:
822 ret = mwifiex_ret_802_11_mac_address(priv, resp);
823 break;
824 case HostCmd_CMD_MAC_MULTICAST_ADR:
825 ret = mwifiex_ret_mac_multicast_adr(priv, resp);
826 break;
827 case HostCmd_CMD_TX_RATE_CFG:
Amitkumar Karwar006606c2012-07-13 20:09:31 -0700828 ret = mwifiex_ret_tx_rate_cfg(priv, resp);
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700829 break;
830 case HostCmd_CMD_802_11_SCAN:
Amitkumar Karwar600f5d92011-04-13 17:27:06 -0700831 ret = mwifiex_ret_802_11_scan(priv, resp);
832 adapter->curr_cmd->wait_q_enabled = false;
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700833 break;
834 case HostCmd_CMD_802_11_BG_SCAN_QUERY:
Amitkumar Karwar600f5d92011-04-13 17:27:06 -0700835 ret = mwifiex_ret_802_11_scan(priv, resp);
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700836 dev_dbg(adapter->dev,
837 "info: CMD_RESP: BG_SCAN result is ready!\n");
838 break;
839 case HostCmd_CMD_TXPWR_CFG:
Amitkumar Karwara5ffddb2011-06-20 15:21:48 -0700840 ret = mwifiex_ret_tx_power_cfg(priv, resp);
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700841 break;
Amitkumar Karwarcaa89842012-06-27 19:57:57 -0700842 case HostCmd_CMD_RF_TX_PWR:
843 ret = mwifiex_ret_rf_tx_power(priv, resp);
844 break;
Amitkumar Karwar8a279d52012-07-02 19:32:33 -0700845 case HostCmd_CMD_RF_ANTENNA:
846 ret = mwifiex_ret_rf_antenna(priv, resp);
847 break;
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700848 case HostCmd_CMD_802_11_PS_MODE_ENH:
849 ret = mwifiex_ret_enh_power_mode(priv, resp, data_buf);
850 break;
851 case HostCmd_CMD_802_11_HS_CFG_ENH:
852 ret = mwifiex_ret_802_11_hs_cfg(priv, resp);
853 break;
854 case HostCmd_CMD_802_11_ASSOCIATE:
Amitkumar Karwar600f5d92011-04-13 17:27:06 -0700855 ret = mwifiex_ret_802_11_associate(priv, resp);
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700856 break;
857 case HostCmd_CMD_802_11_DEAUTHENTICATE:
858 ret = mwifiex_ret_802_11_deauthenticate(priv, resp);
859 break;
860 case HostCmd_CMD_802_11_AD_HOC_START:
861 case HostCmd_CMD_802_11_AD_HOC_JOIN:
Amitkumar Karwar600f5d92011-04-13 17:27:06 -0700862 ret = mwifiex_ret_802_11_ad_hoc(priv, resp);
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700863 break;
864 case HostCmd_CMD_802_11_AD_HOC_STOP:
865 ret = mwifiex_ret_802_11_ad_hoc_stop(priv, resp);
866 break;
867 case HostCmd_CMD_802_11_GET_LOG:
868 ret = mwifiex_ret_get_log(priv, resp, data_buf);
869 break;
870 case HostCmd_CMD_RSSI_INFO:
Amitkumar Karwar958a4a82012-03-15 20:51:49 -0700871 ret = mwifiex_ret_802_11_rssi_info(priv, resp);
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700872 break;
873 case HostCmd_CMD_802_11_SNMP_MIB:
874 ret = mwifiex_ret_802_11_snmp_mib(priv, resp, data_buf);
875 break;
876 case HostCmd_CMD_802_11_TX_RATE_QUERY:
877 ret = mwifiex_ret_802_11_tx_rate_query(priv, resp);
878 break;
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700879 case HostCmd_CMD_VERSION_EXT:
880 ret = mwifiex_ret_ver_ext(priv, resp, data_buf);
881 break;
882 case HostCmd_CMD_FUNC_INIT:
883 case HostCmd_CMD_FUNC_SHUTDOWN:
884 break;
885 case HostCmd_CMD_802_11_KEY_MATERIAL:
886 ret = mwifiex_ret_802_11_key_material(priv, resp);
887 break;
888 case HostCmd_CMD_802_11D_DOMAIN_INFO:
889 ret = mwifiex_ret_802_11d_domain_info(priv, resp);
890 break;
891 case HostCmd_CMD_11N_ADDBA_REQ:
892 ret = mwifiex_ret_11n_addba_req(priv, resp);
893 break;
894 case HostCmd_CMD_11N_DELBA:
895 ret = mwifiex_ret_11n_delba(priv, resp);
896 break;
897 case HostCmd_CMD_11N_ADDBA_RSP:
898 ret = mwifiex_ret_11n_addba_resp(priv, resp);
899 break;
900 case HostCmd_CMD_RECONFIGURE_TX_BUFF:
901 adapter->tx_buf_size = (u16) le16_to_cpu(resp->params.
902 tx_buf.buff_size);
Yogesh Ashok Powar9c05fd72012-03-13 19:22:40 -0700903 adapter->tx_buf_size = (adapter->tx_buf_size
904 / MWIFIEX_SDIO_BLOCK_SIZE)
905 * MWIFIEX_SDIO_BLOCK_SIZE;
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700906 adapter->curr_tx_buf_size = adapter->tx_buf_size;
907 dev_dbg(adapter->dev,
908 "cmd: max_tx_buf_size=%d, tx_buf_size=%d\n",
Yogesh Ashok Powar9c05fd72012-03-13 19:22:40 -0700909 adapter->max_tx_buf_size, adapter->tx_buf_size);
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700910
911 if (adapter->if_ops.update_mp_end_port)
912 adapter->if_ops.update_mp_end_port(adapter,
Yogesh Ashok Powar9c05fd72012-03-13 19:22:40 -0700913 le16_to_cpu(resp->params.tx_buf.mp_end_port));
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700914 break;
915 case HostCmd_CMD_AMSDU_AGGR_CTRL:
Amitkumar Karwar572e8f32011-04-13 17:27:08 -0700916 ret = mwifiex_ret_amsdu_aggr_ctrl(resp, data_buf);
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700917 break;
918 case HostCmd_CMD_WMM_GET_STATUS:
919 ret = mwifiex_ret_wmm_get_status(priv, resp);
920 break;
921 case HostCmd_CMD_802_11_IBSS_COALESCING_STATUS:
922 ret = mwifiex_ret_ibss_coalescing_status(priv, resp);
923 break;
924 case HostCmd_CMD_MAC_REG_ACCESS:
925 case HostCmd_CMD_BBP_REG_ACCESS:
926 case HostCmd_CMD_RF_REG_ACCESS:
927 case HostCmd_CMD_PMIC_REG_ACCESS:
928 case HostCmd_CMD_CAU_REG_ACCESS:
929 case HostCmd_CMD_802_11_EEPROM_ACCESS:
930 ret = mwifiex_ret_reg_access(cmdresp_no, resp, data_buf);
931 break;
932 case HostCmd_CMD_SET_BSS_MODE:
933 break;
934 case HostCmd_CMD_11N_CFG:
Amitkumar Karwar572e8f32011-04-13 17:27:08 -0700935 ret = mwifiex_ret_11n_cfg(resp, data_buf);
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700936 break;
Amitkumar Karward930fae2011-10-11 17:41:21 -0700937 case HostCmd_CMD_PCIE_DESC_DETAILS:
938 break;
Amitkumar Karwarfa444bf2012-03-15 20:51:51 -0700939 case HostCmd_CMD_802_11_SUBSCRIBE_EVENT:
940 ret = mwifiex_ret_subsc_evt(priv, resp, data_buf);
941 break;
Avinash Patil40d07032012-05-08 18:30:19 -0700942 case HostCmd_CMD_UAP_SYS_CONFIG:
943 break;
944 case HostCmd_CMD_UAP_BSS_START:
945 priv->bss_started = 1;
946 break;
947 case HostCmd_CMD_UAP_BSS_STOP:
948 priv->bss_started = 0;
949 break;
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700950 default:
951 dev_err(adapter->dev, "CMD_RESP: unknown cmd response %#x\n",
Yogesh Ashok Powar9c05fd72012-03-13 19:22:40 -0700952 resp->command);
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700953 break;
954 }
955
956 return ret;
957}