blob: d1f53e39028fa1c79d0a3b5261e599a5d6103860 [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;
Jeff Disher908fe112012-08-30 18:20:55 -0700126 struct mwifiex_ds_misc_subsc_evt *subsc_evt =
127 &priv->async_subsc_evt_storage;
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700128
129 priv->data_rssi_last = le16_to_cpu(rssi_info_rsp->data_rssi_last);
130 priv->data_nf_last = le16_to_cpu(rssi_info_rsp->data_nf_last);
131
132 priv->data_rssi_avg = le16_to_cpu(rssi_info_rsp->data_rssi_avg);
133 priv->data_nf_avg = le16_to_cpu(rssi_info_rsp->data_nf_avg);
134
135 priv->bcn_rssi_last = le16_to_cpu(rssi_info_rsp->bcn_rssi_last);
136 priv->bcn_nf_last = le16_to_cpu(rssi_info_rsp->bcn_nf_last);
137
138 priv->bcn_rssi_avg = le16_to_cpu(rssi_info_rsp->bcn_rssi_avg);
139 priv->bcn_nf_avg = le16_to_cpu(rssi_info_rsp->bcn_nf_avg);
140
Amitkumar Karwarfa444bf2012-03-15 20:51:51 -0700141 if (priv->subsc_evt_rssi_state == EVENT_HANDLED)
142 return 0;
143
Jeff Disher908fe112012-08-30 18:20:55 -0700144 memset(subsc_evt, 0x00, sizeof(struct mwifiex_ds_misc_subsc_evt));
145
Amitkumar Karwarfa444bf2012-03-15 20:51:51 -0700146 /* Resubscribe low and high rssi events with new thresholds */
Jeff Disher908fe112012-08-30 18:20:55 -0700147 subsc_evt->events = BITMASK_BCN_RSSI_LOW | BITMASK_BCN_RSSI_HIGH;
148 subsc_evt->action = HostCmd_ACT_BITWISE_SET;
Amitkumar Karwarfa444bf2012-03-15 20:51:51 -0700149 if (priv->subsc_evt_rssi_state == RSSI_LOW_RECVD) {
Jeff Disher908fe112012-08-30 18:20:55 -0700150 subsc_evt->bcn_l_rssi_cfg.abs_value = abs(priv->bcn_rssi_avg -
Amitkumar Karwarfa444bf2012-03-15 20:51:51 -0700151 priv->cqm_rssi_hyst);
Jeff Disher908fe112012-08-30 18:20:55 -0700152 subsc_evt->bcn_h_rssi_cfg.abs_value = abs(priv->cqm_rssi_thold);
Amitkumar Karwarfa444bf2012-03-15 20:51:51 -0700153 } else if (priv->subsc_evt_rssi_state == RSSI_HIGH_RECVD) {
Jeff Disher908fe112012-08-30 18:20:55 -0700154 subsc_evt->bcn_l_rssi_cfg.abs_value = abs(priv->cqm_rssi_thold);
155 subsc_evt->bcn_h_rssi_cfg.abs_value = abs(priv->bcn_rssi_avg +
Amitkumar Karwarfa444bf2012-03-15 20:51:51 -0700156 priv->cqm_rssi_hyst);
157 }
Jeff Disher908fe112012-08-30 18:20:55 -0700158 subsc_evt->bcn_l_rssi_cfg.evt_freq = 1;
159 subsc_evt->bcn_h_rssi_cfg.evt_freq = 1;
Amitkumar Karwarfa444bf2012-03-15 20:51:51 -0700160
161 priv->subsc_evt_rssi_state = EVENT_HANDLED;
162
163 mwifiex_send_cmd_async(priv, HostCmd_CMD_802_11_SUBSCRIBE_EVENT,
Jeff Disher908fe112012-08-30 18:20:55 -0700164 0, 0, subsc_evt);
Amitkumar Karwarfa444bf2012-03-15 20:51:51 -0700165
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700166 return 0;
167}
168
169/*
170 * This function handles the command response of set/get SNMP
171 * MIB parameters.
172 *
173 * Handling includes changing the header fields into CPU format
174 * and saving the parameter in driver.
175 *
176 * The following parameters are supported -
177 * - Fragmentation threshold
178 * - RTS threshold
179 * - Short retry limit
180 */
181static int mwifiex_ret_802_11_snmp_mib(struct mwifiex_private *priv,
182 struct host_cmd_ds_command *resp,
Dan Carpentera5e5aa62011-06-24 16:33:35 +0300183 u32 *data_buf)
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700184{
185 struct host_cmd_ds_802_11_snmp_mib *smib = &resp->params.smib;
186 u16 oid = le16_to_cpu(smib->oid);
187 u16 query_type = le16_to_cpu(smib->query_type);
Dan Carpentera5e5aa62011-06-24 16:33:35 +0300188 u32 ul_temp;
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700189
190 dev_dbg(priv->adapter->dev, "info: SNMP_RESP: oid value = %#x,"
Yogesh Ashok Powar9c05fd72012-03-13 19:22:40 -0700191 " query_type = %#x, buf size = %#x\n",
192 oid, query_type, le16_to_cpu(smib->buf_size));
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700193 if (query_type == HostCmd_ACT_GEN_GET) {
Dan Carpentera5e5aa62011-06-24 16:33:35 +0300194 ul_temp = le16_to_cpu(*((__le16 *) (smib->value)));
195 if (data_buf)
196 *data_buf = ul_temp;
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700197 switch (oid) {
198 case FRAG_THRESH_I:
199 dev_dbg(priv->adapter->dev,
Dan Carpentera5e5aa62011-06-24 16:33:35 +0300200 "info: SNMP_RESP: FragThsd =%u\n", ul_temp);
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700201 break;
202 case RTS_THRESH_I:
203 dev_dbg(priv->adapter->dev,
Dan Carpentera5e5aa62011-06-24 16:33:35 +0300204 "info: SNMP_RESP: RTSThsd =%u\n", ul_temp);
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700205 break;
206 case SHORT_RETRY_LIM_I:
207 dev_dbg(priv->adapter->dev,
Dan Carpentera5e5aa62011-06-24 16:33:35 +0300208 "info: SNMP_RESP: TxRetryCount=%u\n", ul_temp);
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700209 break;
Amitkumar Karwarcaf60a62012-02-02 20:48:58 -0800210 case DTIM_PERIOD_I:
211 dev_dbg(priv->adapter->dev,
212 "info: SNMP_RESP: DTIM period=%u\n", ul_temp);
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700213 default:
214 break;
215 }
216 }
217
218 return 0;
219}
220
221/*
222 * This function handles the command response of get log request
223 *
224 * Handling includes changing the header fields into CPU format
225 * and sending the received parameters to application.
226 */
227static int mwifiex_ret_get_log(struct mwifiex_private *priv,
228 struct host_cmd_ds_command *resp,
Amitkumar Karwara5ffddb2011-06-20 15:21:48 -0700229 struct mwifiex_ds_get_stats *stats)
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700230{
231 struct host_cmd_ds_802_11_get_log *get_log =
Joe Perches2c208892012-06-04 12:44:17 +0000232 &resp->params.get_log;
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700233
Amitkumar Karwara5ffddb2011-06-20 15:21:48 -0700234 if (stats) {
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700235 stats->mcast_tx_frame = le32_to_cpu(get_log->mcast_tx_frame);
236 stats->failed = le32_to_cpu(get_log->failed);
237 stats->retry = le32_to_cpu(get_log->retry);
238 stats->multi_retry = le32_to_cpu(get_log->multi_retry);
239 stats->frame_dup = le32_to_cpu(get_log->frame_dup);
240 stats->rts_success = le32_to_cpu(get_log->rts_success);
241 stats->rts_failure = le32_to_cpu(get_log->rts_failure);
242 stats->ack_failure = le32_to_cpu(get_log->ack_failure);
243 stats->rx_frag = le32_to_cpu(get_log->rx_frag);
244 stats->mcast_rx_frame = le32_to_cpu(get_log->mcast_rx_frame);
245 stats->fcs_error = le32_to_cpu(get_log->fcs_error);
246 stats->tx_frame = le32_to_cpu(get_log->tx_frame);
247 stats->wep_icv_error[0] =
248 le32_to_cpu(get_log->wep_icv_err_cnt[0]);
249 stats->wep_icv_error[1] =
250 le32_to_cpu(get_log->wep_icv_err_cnt[1]);
251 stats->wep_icv_error[2] =
252 le32_to_cpu(get_log->wep_icv_err_cnt[2]);
253 stats->wep_icv_error[3] =
254 le32_to_cpu(get_log->wep_icv_err_cnt[3]);
255 }
256
257 return 0;
258}
259
260/*
261 * This function handles the command response of set/get Tx rate
262 * configurations.
263 *
264 * Handling includes changing the header fields into CPU format
265 * and saving the following parameters in driver -
266 * - DSSS rate bitmap
267 * - OFDM rate bitmap
268 * - HT MCS rate bitmaps
269 *
270 * Based on the new rate bitmaps, the function re-evaluates if
271 * auto data rate has been activated. If not, it sends another
Amitkumar Karwar006606c2012-07-13 20:09:31 -0700272 * query to the firmware to get the current Tx data rate.
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700273 */
274static int mwifiex_ret_tx_rate_cfg(struct mwifiex_private *priv,
Amitkumar Karwar006606c2012-07-13 20:09:31 -0700275 struct host_cmd_ds_command *resp)
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700276{
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700277 struct host_cmd_ds_tx_rate_cfg *rate_cfg = &resp->params.tx_rate_cfg;
278 struct mwifiex_rate_scope *rate_scope;
Yogesh Ashok Powar270e58e2011-05-03 20:11:46 -0700279 struct mwifiex_ie_types_header *head;
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700280 u16 tlv, tlv_buf_len;
281 u8 *tlv_buf;
282 u32 i;
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700283
Joe Perches2c208892012-06-04 12:44:17 +0000284 tlv_buf = ((u8 *)rate_cfg) +
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700285 sizeof(struct host_cmd_ds_tx_rate_cfg);
286 tlv_buf_len = *(u16 *) (tlv_buf + sizeof(u16));
287
288 while (tlv_buf && tlv_buf_len > 0) {
289 tlv = (*tlv_buf);
290 tlv = tlv | (*(tlv_buf + 1) << 8);
291
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
310 head = (struct mwifiex_ie_types_header *) tlv_buf;
311 tlv_buf += le16_to_cpu(head->len) + sizeof(*head);
312 tlv_buf_len -= le16_to_cpu(head->len);
313 }
314
315 priv->is_data_rate_auto = mwifiex_is_rate_auto(priv);
316
317 if (priv->is_data_rate_auto)
318 priv->data_rate = 0;
319 else
Amitkumar Karwar006606c2012-07-13 20:09:31 -0700320 return mwifiex_send_cmd_async(priv,
321 HostCmd_CMD_802_11_TX_RATE_QUERY,
322 HostCmd_ACT_GEN_GET, 0, NULL);
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700323
Amitkumar Karwar006606c2012-07-13 20:09:31 -0700324 return 0;
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700325}
326
327/*
328 * This function handles the command response of get Tx power level.
329 *
330 * Handling includes saving the maximum and minimum Tx power levels
331 * in driver, as well as sending the values to user.
332 */
333static int mwifiex_get_power_level(struct mwifiex_private *priv, void *data_buf)
334{
Yogesh Ashok Powar270e58e2011-05-03 20:11:46 -0700335 int length, max_power = -1, min_power = -1;
336 struct mwifiex_types_power_group *pg_tlv_hdr;
337 struct mwifiex_power_group *pg;
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700338
Yogesh Ashok Powarbb7de2b2012-03-12 19:35:12 -0700339 if (!data_buf)
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700340 return -1;
Yogesh Ashok Powarbb7de2b2012-03-12 19:35:12 -0700341
342 pg_tlv_hdr = (struct mwifiex_types_power_group *)
343 ((u8 *) data_buf + sizeof(struct host_cmd_ds_txpwr_cfg));
344 pg = (struct mwifiex_power_group *)
345 ((u8 *) pg_tlv_hdr + sizeof(struct mwifiex_types_power_group));
346 length = pg_tlv_hdr->length;
347 if (length > 0) {
348 max_power = pg->power_max;
349 min_power = pg->power_min;
350 length -= sizeof(struct mwifiex_power_group);
351 }
352 while (length) {
353 pg++;
354 if (max_power < pg->power_max)
355 max_power = pg->power_max;
356
357 if (min_power > pg->power_min)
358 min_power = pg->power_min;
359
360 length -= sizeof(struct mwifiex_power_group);
361 }
362 if (pg_tlv_hdr->length > 0) {
363 priv->min_tx_power_level = (u8) min_power;
364 priv->max_tx_power_level = (u8) max_power;
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700365 }
366
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);
385
386 switch (action) {
387 case HostCmd_ACT_GEN_GET:
Yogesh Ashok Powar985d68a2012-03-12 19:35:09 -0700388 pg_tlv_hdr = (struct mwifiex_types_power_group *)
389 ((u8 *) txp_cfg +
390 sizeof(struct host_cmd_ds_txpwr_cfg));
391
392 pg = (struct mwifiex_power_group *)
393 ((u8 *) pg_tlv_hdr +
394 sizeof(struct mwifiex_types_power_group));
395
396 if (adapter->hw_status == MWIFIEX_HW_STATUS_INITIALIZING)
397 mwifiex_get_power_level(priv, txp_cfg);
398
399 priv->tx_power_level = (u16) pg->power_min;
400 break;
401
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700402 case HostCmd_ACT_GEN_SET:
Yogesh Ashok Powar985d68a2012-03-12 19:35:09 -0700403 if (!le32_to_cpu(txp_cfg->mode))
404 break;
405
406 pg_tlv_hdr = (struct mwifiex_types_power_group *)
407 ((u8 *) txp_cfg +
408 sizeof(struct host_cmd_ds_txpwr_cfg));
409
410 pg = (struct mwifiex_power_group *)
411 ((u8 *) pg_tlv_hdr +
412 sizeof(struct mwifiex_types_power_group));
413
414 if (pg->power_max == pg->power_min)
415 priv->tx_power_level = (u16) pg->power_min;
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700416 break;
417 default:
418 dev_err(adapter->dev, "CMD_RESP: unknown cmd action %d\n",
Yogesh Ashok Powar9c05fd72012-03-13 19:22:40 -0700419 action);
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700420 return 0;
421 }
422 dev_dbg(adapter->dev,
423 "info: Current TxPower Level = %d, Max Power=%d, Min Power=%d\n",
424 priv->tx_power_level, priv->max_tx_power_level,
425 priv->min_tx_power_level);
426
427 return 0;
428}
429
430/*
Amitkumar Karwarcaa89842012-06-27 19:57:57 -0700431 * This function handles the command response of get RF Tx power.
432 */
433static int mwifiex_ret_rf_tx_power(struct mwifiex_private *priv,
434 struct host_cmd_ds_command *resp)
435{
436 struct host_cmd_ds_rf_tx_pwr *txp = &resp->params.txp;
437 u16 action = le16_to_cpu(txp->action);
438
439 priv->tx_power_level = le16_to_cpu(txp->cur_level);
440
441 if (action == HostCmd_ACT_GEN_GET) {
442 priv->max_tx_power_level = txp->max_power;
443 priv->min_tx_power_level = txp->min_power;
444 }
445
446 dev_dbg(priv->adapter->dev,
447 "Current TxPower Level=%d, Max Power=%d, Min Power=%d\n",
448 priv->tx_power_level, priv->max_tx_power_level,
449 priv->min_tx_power_level);
450
451 return 0;
452}
453
454/*
Amitkumar Karwar8a279d52012-07-02 19:32:33 -0700455 * This function handles the command response of set rf antenna
456 */
457static int mwifiex_ret_rf_antenna(struct mwifiex_private *priv,
458 struct host_cmd_ds_command *resp)
459{
460 struct host_cmd_ds_rf_ant_mimo *ant_mimo = &resp->params.ant_mimo;
461 struct host_cmd_ds_rf_ant_siso *ant_siso = &resp->params.ant_siso;
462 struct mwifiex_adapter *adapter = priv->adapter;
463
464 if (adapter->hw_dev_mcs_support == HT_STREAM_2X2)
465 dev_dbg(adapter->dev,
466 "RF_ANT_RESP: Tx action = 0x%x, Tx Mode = 0x%04x"
467 " Rx action = 0x%x, Rx Mode = 0x%04x\n",
468 le16_to_cpu(ant_mimo->action_tx),
469 le16_to_cpu(ant_mimo->tx_ant_mode),
470 le16_to_cpu(ant_mimo->action_rx),
471 le16_to_cpu(ant_mimo->rx_ant_mode));
472 else
473 dev_dbg(adapter->dev,
474 "RF_ANT_RESP: action = 0x%x, Mode = 0x%04x\n",
475 le16_to_cpu(ant_siso->action),
476 le16_to_cpu(ant_siso->ant_mode));
477
478 return 0;
479}
480
481/*
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700482 * This function handles the command response of set/get MAC address.
483 *
484 * Handling includes saving the MAC address in driver.
485 */
486static int mwifiex_ret_802_11_mac_address(struct mwifiex_private *priv,
487 struct host_cmd_ds_command *resp)
488{
489 struct host_cmd_ds_802_11_mac_address *cmd_mac_addr =
Yogesh Ashok Powar9c05fd72012-03-13 19:22:40 -0700490 &resp->params.mac_addr;
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700491
492 memcpy(priv->curr_addr, cmd_mac_addr->mac_addr, ETH_ALEN);
493
494 dev_dbg(priv->adapter->dev,
495 "info: set mac address: %pM\n", priv->curr_addr);
496
497 return 0;
498}
499
500/*
501 * This function handles the command response of set/get MAC multicast
502 * address.
503 */
504static int mwifiex_ret_mac_multicast_adr(struct mwifiex_private *priv,
505 struct host_cmd_ds_command *resp)
506{
507 return 0;
508}
509
510/*
511 * This function handles the command response of get Tx rate query.
512 *
513 * Handling includes changing the header fields into CPU format
514 * and saving the Tx rate and HT information parameters in driver.
515 *
516 * Both rate configuration and current data rate can be retrieved
517 * with this request.
518 */
519static int mwifiex_ret_802_11_tx_rate_query(struct mwifiex_private *priv,
520 struct host_cmd_ds_command *resp)
521{
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700522 priv->tx_rate = resp->params.tx_rate.tx_rate;
523 priv->tx_htinfo = resp->params.tx_rate.ht_info;
524 if (!priv->is_data_rate_auto)
525 priv->data_rate =
Bing Zhaoe3bea1c2011-11-16 20:40:35 -0800526 mwifiex_index_to_data_rate(priv, priv->tx_rate,
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700527 priv->tx_htinfo);
528
529 return 0;
530}
531
532/*
533 * This function handles the command response of a deauthenticate
534 * command.
535 *
536 * If the deauthenticated MAC matches the current BSS MAC, the connection
537 * state is reset.
538 */
539static int mwifiex_ret_802_11_deauthenticate(struct mwifiex_private *priv,
540 struct host_cmd_ds_command *resp)
541{
542 struct mwifiex_adapter *adapter = priv->adapter;
543
544 adapter->dbg.num_cmd_deauth++;
545 if (!memcmp(resp->params.deauth.mac_addr,
546 &priv->curr_bss_params.bss_descriptor.mac_address,
547 sizeof(resp->params.deauth.mac_addr)))
548 mwifiex_reset_connect_state(priv);
549
550 return 0;
551}
552
553/*
554 * This function handles the command response of ad-hoc stop.
555 *
556 * The function resets the connection state in driver.
557 */
558static int mwifiex_ret_802_11_ad_hoc_stop(struct mwifiex_private *priv,
559 struct host_cmd_ds_command *resp)
560{
561 mwifiex_reset_connect_state(priv);
562 return 0;
563}
564
565/*
566 * This function handles the command response of set/get key material.
567 *
568 * Handling includes updating the driver parameters to reflect the
569 * changes.
570 */
571static int mwifiex_ret_802_11_key_material(struct mwifiex_private *priv,
572 struct host_cmd_ds_command *resp)
573{
574 struct host_cmd_ds_802_11_key_material *key =
Yogesh Ashok Powar9c05fd72012-03-13 19:22:40 -0700575 &resp->params.key_material;
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700576
577 if (le16_to_cpu(key->action) == HostCmd_ACT_GEN_SET) {
Yogesh Ashok Powar6a35a0a2011-04-06 16:46:56 -0700578 if ((le16_to_cpu(key->key_param_set.key_info) & KEY_MCAST)) {
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700579 dev_dbg(priv->adapter->dev, "info: key: GTK is set\n");
580 priv->wpa_is_gtk_set = true;
581 priv->scan_block = false;
582 }
583 }
584
585 memset(priv->aes_key.key_param_set.key, 0,
586 sizeof(key->key_param_set.key));
587 priv->aes_key.key_param_set.key_len = key->key_param_set.key_len;
588 memcpy(priv->aes_key.key_param_set.key, key->key_param_set.key,
589 le16_to_cpu(priv->aes_key.key_param_set.key_len));
590
591 return 0;
592}
593
594/*
595 * This function handles the command response of get 11d domain information.
596 */
597static int mwifiex_ret_802_11d_domain_info(struct mwifiex_private *priv,
598 struct host_cmd_ds_command *resp)
599{
600 struct host_cmd_ds_802_11d_domain_info_rsp *domain_info =
601 &resp->params.domain_info_resp;
602 struct mwifiex_ietypes_domain_param_set *domain = &domain_info->domain;
603 u16 action = le16_to_cpu(domain_info->action);
Yogesh Ashok Powar270e58e2011-05-03 20:11:46 -0700604 u8 no_of_triplet;
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700605
Yogesh Ashok Powar9c05fd72012-03-13 19:22:40 -0700606 no_of_triplet = (u8) ((le16_to_cpu(domain->header.len)
607 - IEEE80211_COUNTRY_STRING_LEN)
608 / sizeof(struct ieee80211_country_ie_triplet));
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700609
Yogesh Ashok Powar9c05fd72012-03-13 19:22:40 -0700610 dev_dbg(priv->adapter->dev,
611 "info: 11D Domain Info Resp: no_of_triplet=%d\n",
612 no_of_triplet);
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700613
614 if (no_of_triplet > MWIFIEX_MAX_TRIPLET_802_11D) {
615 dev_warn(priv->adapter->dev,
Yogesh Ashok Powar9c05fd72012-03-13 19:22:40 -0700616 "11D: invalid number of triplets %d returned\n",
617 no_of_triplet);
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700618 return -1;
619 }
620
621 switch (action) {
622 case HostCmd_ACT_GEN_SET: /* Proc Set Action */
623 break;
624 case HostCmd_ACT_GEN_GET:
625 break;
626 default:
627 dev_err(priv->adapter->dev,
628 "11D: invalid action:%d\n", domain_info->action);
629 return -1;
630 }
631
632 return 0;
633}
634
635/*
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700636 * This function handles the command response of get extended version.
637 *
638 * Handling includes forming the extended version string and sending it
639 * to application.
640 */
641static int mwifiex_ret_ver_ext(struct mwifiex_private *priv,
642 struct host_cmd_ds_command *resp,
Amitkumar Karwara5ffddb2011-06-20 15:21:48 -0700643 struct host_cmd_ds_version_ext *version_ext)
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700644{
645 struct host_cmd_ds_version_ext *ver_ext = &resp->params.verext;
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700646
Amitkumar Karwara5ffddb2011-06-20 15:21:48 -0700647 if (version_ext) {
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700648 version_ext->version_str_sel = ver_ext->version_str_sel;
649 memcpy(version_ext->version_str, ver_ext->version_str,
650 sizeof(char) * 128);
651 memcpy(priv->version_str, ver_ext->version_str, 128);
652 }
653 return 0;
654}
655
656/*
657 * This function handles the command response of register access.
658 *
659 * The register value and offset are returned to the user. For EEPROM
660 * access, the byte count is also returned.
661 */
662static int mwifiex_ret_reg_access(u16 type, struct host_cmd_ds_command *resp,
663 void *data_buf)
664{
Yogesh Ashok Powar270e58e2011-05-03 20:11:46 -0700665 struct mwifiex_ds_reg_rw *reg_rw;
666 struct mwifiex_ds_read_eeprom *eeprom;
Yogesh Ashok Powar985d68a2012-03-12 19:35:09 -0700667 union reg {
668 struct host_cmd_ds_mac_reg_access *mac;
669 struct host_cmd_ds_bbp_reg_access *bbp;
670 struct host_cmd_ds_rf_reg_access *rf;
671 struct host_cmd_ds_pmic_reg_access *pmic;
672 struct host_cmd_ds_802_11_eeprom_access *eeprom;
673 } r;
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700674
Yogesh Ashok Powar985d68a2012-03-12 19:35:09 -0700675 if (!data_buf)
676 return 0;
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700677
Yogesh Ashok Powar985d68a2012-03-12 19:35:09 -0700678 reg_rw = data_buf;
679 eeprom = data_buf;
680 switch (type) {
681 case HostCmd_CMD_MAC_REG_ACCESS:
Joe Perches2c208892012-06-04 12:44:17 +0000682 r.mac = &resp->params.mac_reg;
Yogesh Ashok Powar985d68a2012-03-12 19:35:09 -0700683 reg_rw->offset = cpu_to_le32((u32) le16_to_cpu(r.mac->offset));
684 reg_rw->value = r.mac->value;
685 break;
686 case HostCmd_CMD_BBP_REG_ACCESS:
Joe Perches2c208892012-06-04 12:44:17 +0000687 r.bbp = &resp->params.bbp_reg;
Yogesh Ashok Powar985d68a2012-03-12 19:35:09 -0700688 reg_rw->offset = cpu_to_le32((u32) le16_to_cpu(r.bbp->offset));
689 reg_rw->value = cpu_to_le32((u32) r.bbp->value);
690 break;
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700691
Yogesh Ashok Powar985d68a2012-03-12 19:35:09 -0700692 case HostCmd_CMD_RF_REG_ACCESS:
Joe Perches2c208892012-06-04 12:44:17 +0000693 r.rf = &resp->params.rf_reg;
Yogesh Ashok Powar985d68a2012-03-12 19:35:09 -0700694 reg_rw->offset = cpu_to_le32((u32) le16_to_cpu(r.rf->offset));
695 reg_rw->value = cpu_to_le32((u32) r.bbp->value);
696 break;
697 case HostCmd_CMD_PMIC_REG_ACCESS:
Joe Perches2c208892012-06-04 12:44:17 +0000698 r.pmic = &resp->params.pmic_reg;
Yogesh Ashok Powar985d68a2012-03-12 19:35:09 -0700699 reg_rw->offset = cpu_to_le32((u32) le16_to_cpu(r.pmic->offset));
700 reg_rw->value = cpu_to_le32((u32) r.pmic->value);
701 break;
702 case HostCmd_CMD_CAU_REG_ACCESS:
Joe Perches2c208892012-06-04 12:44:17 +0000703 r.rf = &resp->params.rf_reg;
Yogesh Ashok Powar985d68a2012-03-12 19:35:09 -0700704 reg_rw->offset = cpu_to_le32((u32) le16_to_cpu(r.rf->offset));
705 reg_rw->value = cpu_to_le32((u32) r.rf->value);
706 break;
707 case HostCmd_CMD_802_11_EEPROM_ACCESS:
Joe Perches2c208892012-06-04 12:44:17 +0000708 r.eeprom = &resp->params.eeprom;
Yogesh Ashok Powar985d68a2012-03-12 19:35:09 -0700709 pr_debug("info: EEPROM read len=%x\n", r.eeprom->byte_count);
710 if (le16_to_cpu(eeprom->byte_count) <
711 le16_to_cpu(r.eeprom->byte_count)) {
712 eeprom->byte_count = cpu_to_le16(0);
713 pr_debug("info: EEPROM read length is too big\n");
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700714 return -1;
715 }
Yogesh Ashok Powar985d68a2012-03-12 19:35:09 -0700716 eeprom->offset = r.eeprom->offset;
717 eeprom->byte_count = r.eeprom->byte_count;
718 if (le16_to_cpu(eeprom->byte_count) > 0)
719 memcpy(&eeprom->value, &r.eeprom->value,
720 le16_to_cpu(r.eeprom->byte_count));
721
722 break;
723 default:
724 return -1;
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700725 }
726 return 0;
727}
728
729/*
730 * This function handles the command response of get IBSS coalescing status.
731 *
732 * If the received BSSID is different than the current one, the current BSSID,
733 * beacon interval, ATIM window and ERP information are updated, along with
734 * changing the ad-hoc state accordingly.
735 */
736static int mwifiex_ret_ibss_coalescing_status(struct mwifiex_private *priv,
737 struct host_cmd_ds_command *resp)
738{
739 struct host_cmd_ds_802_11_ibss_status *ibss_coal_resp =
Yogesh Ashok Powar9c05fd72012-03-13 19:22:40 -0700740 &(resp->params.ibss_coalescing);
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700741
742 if (le16_to_cpu(ibss_coal_resp->action) == HostCmd_ACT_GEN_SET)
743 return 0;
744
745 dev_dbg(priv->adapter->dev,
746 "info: new BSSID %pM\n", ibss_coal_resp->bssid);
747
748 /* If rsp has NULL BSSID, Just return..... No Action */
Wei Yongjun626a43d2012-08-24 13:27:10 +0800749 if (is_zero_ether_addr(ibss_coal_resp->bssid)) {
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700750 dev_warn(priv->adapter->dev, "new BSSID is NULL\n");
751 return 0;
752 }
753
754 /* If BSSID is diff, modify current BSS parameters */
755 if (memcmp(priv->curr_bss_params.bss_descriptor.mac_address,
756 ibss_coal_resp->bssid, ETH_ALEN)) {
757 /* BSSID */
758 memcpy(priv->curr_bss_params.bss_descriptor.mac_address,
759 ibss_coal_resp->bssid, ETH_ALEN);
760
761 /* Beacon Interval */
762 priv->curr_bss_params.bss_descriptor.beacon_period
763 = le16_to_cpu(ibss_coal_resp->beacon_interval);
764
765 /* ERP Information */
766 priv->curr_bss_params.bss_descriptor.erp_flags =
767 (u8) le16_to_cpu(ibss_coal_resp->use_g_rate_protect);
768
769 priv->adhoc_state = ADHOC_COALESCED;
770 }
771
772 return 0;
773}
774
775/*
Amitkumar Karwarfa444bf2012-03-15 20:51:51 -0700776 * This function handles the command response for subscribe event command.
777 */
778static int mwifiex_ret_subsc_evt(struct mwifiex_private *priv,
Amitkumar Karware69d1ff2012-09-10 18:30:40 -0700779 struct host_cmd_ds_command *resp)
Amitkumar Karwarfa444bf2012-03-15 20:51:51 -0700780{
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
Amitkumar Karwarfa444bf2012-03-15 20:51:51 -0700789 return 0;
790}
791
792/*
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700793 * This function handles the command responses.
794 *
795 * This is a generic function, which calls command specific
796 * response handlers based on the command ID.
797 */
Amitkumar Karwara5ffddb2011-06-20 15:21:48 -0700798int mwifiex_process_sta_cmdresp(struct mwifiex_private *priv, u16 cmdresp_no,
799 struct host_cmd_ds_command *resp)
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700800{
801 int ret = 0;
802 struct mwifiex_adapter *adapter = priv->adapter;
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700803 void *data_buf = adapter->curr_cmd->data_buf;
804
805 /* If the command is not successful, cleanup and return failure */
806 if (resp->result != HostCmd_RESULT_OK) {
Amitkumar Karwar600f5d92011-04-13 17:27:06 -0700807 mwifiex_process_cmdresp_error(priv, resp);
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700808 return -1;
809 }
810 /* Command successful, handle response */
811 switch (cmdresp_no) {
812 case HostCmd_CMD_GET_HW_SPEC:
813 ret = mwifiex_ret_get_hw_spec(priv, resp);
814 break;
815 case HostCmd_CMD_MAC_CONTROL:
816 break;
817 case HostCmd_CMD_802_11_MAC_ADDRESS:
818 ret = mwifiex_ret_802_11_mac_address(priv, resp);
819 break;
820 case HostCmd_CMD_MAC_MULTICAST_ADR:
821 ret = mwifiex_ret_mac_multicast_adr(priv, resp);
822 break;
823 case HostCmd_CMD_TX_RATE_CFG:
Amitkumar Karwar006606c2012-07-13 20:09:31 -0700824 ret = mwifiex_ret_tx_rate_cfg(priv, resp);
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700825 break;
826 case HostCmd_CMD_802_11_SCAN:
Amitkumar Karwar600f5d92011-04-13 17:27:06 -0700827 ret = mwifiex_ret_802_11_scan(priv, resp);
828 adapter->curr_cmd->wait_q_enabled = false;
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700829 break;
830 case HostCmd_CMD_802_11_BG_SCAN_QUERY:
Amitkumar Karwar600f5d92011-04-13 17:27:06 -0700831 ret = mwifiex_ret_802_11_scan(priv, resp);
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700832 dev_dbg(adapter->dev,
833 "info: CMD_RESP: BG_SCAN result is ready!\n");
834 break;
835 case HostCmd_CMD_TXPWR_CFG:
Amitkumar Karwara5ffddb2011-06-20 15:21:48 -0700836 ret = mwifiex_ret_tx_power_cfg(priv, resp);
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700837 break;
Amitkumar Karwarcaa89842012-06-27 19:57:57 -0700838 case HostCmd_CMD_RF_TX_PWR:
839 ret = mwifiex_ret_rf_tx_power(priv, resp);
840 break;
Amitkumar Karwar8a279d52012-07-02 19:32:33 -0700841 case HostCmd_CMD_RF_ANTENNA:
842 ret = mwifiex_ret_rf_antenna(priv, resp);
843 break;
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700844 case HostCmd_CMD_802_11_PS_MODE_ENH:
845 ret = mwifiex_ret_enh_power_mode(priv, resp, data_buf);
846 break;
847 case HostCmd_CMD_802_11_HS_CFG_ENH:
848 ret = mwifiex_ret_802_11_hs_cfg(priv, resp);
849 break;
850 case HostCmd_CMD_802_11_ASSOCIATE:
Amitkumar Karwar600f5d92011-04-13 17:27:06 -0700851 ret = mwifiex_ret_802_11_associate(priv, resp);
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700852 break;
853 case HostCmd_CMD_802_11_DEAUTHENTICATE:
854 ret = mwifiex_ret_802_11_deauthenticate(priv, resp);
855 break;
856 case HostCmd_CMD_802_11_AD_HOC_START:
857 case HostCmd_CMD_802_11_AD_HOC_JOIN:
Amitkumar Karwar600f5d92011-04-13 17:27:06 -0700858 ret = mwifiex_ret_802_11_ad_hoc(priv, resp);
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700859 break;
860 case HostCmd_CMD_802_11_AD_HOC_STOP:
861 ret = mwifiex_ret_802_11_ad_hoc_stop(priv, resp);
862 break;
863 case HostCmd_CMD_802_11_GET_LOG:
864 ret = mwifiex_ret_get_log(priv, resp, data_buf);
865 break;
866 case HostCmd_CMD_RSSI_INFO:
Amitkumar Karwar958a4a82012-03-15 20:51:49 -0700867 ret = mwifiex_ret_802_11_rssi_info(priv, resp);
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700868 break;
869 case HostCmd_CMD_802_11_SNMP_MIB:
870 ret = mwifiex_ret_802_11_snmp_mib(priv, resp, data_buf);
871 break;
872 case HostCmd_CMD_802_11_TX_RATE_QUERY:
873 ret = mwifiex_ret_802_11_tx_rate_query(priv, resp);
874 break;
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700875 case HostCmd_CMD_VERSION_EXT:
876 ret = mwifiex_ret_ver_ext(priv, resp, data_buf);
877 break;
Stone Piao3cec6872012-09-25 20:23:34 -0700878 case HostCmd_CMD_MGMT_FRAME_REG:
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700879 case HostCmd_CMD_FUNC_INIT:
880 case HostCmd_CMD_FUNC_SHUTDOWN:
881 break;
882 case HostCmd_CMD_802_11_KEY_MATERIAL:
883 ret = mwifiex_ret_802_11_key_material(priv, resp);
884 break;
885 case HostCmd_CMD_802_11D_DOMAIN_INFO:
886 ret = mwifiex_ret_802_11d_domain_info(priv, resp);
887 break;
888 case HostCmd_CMD_11N_ADDBA_REQ:
889 ret = mwifiex_ret_11n_addba_req(priv, resp);
890 break;
891 case HostCmd_CMD_11N_DELBA:
892 ret = mwifiex_ret_11n_delba(priv, resp);
893 break;
894 case HostCmd_CMD_11N_ADDBA_RSP:
895 ret = mwifiex_ret_11n_addba_resp(priv, resp);
896 break;
897 case HostCmd_CMD_RECONFIGURE_TX_BUFF:
898 adapter->tx_buf_size = (u16) le16_to_cpu(resp->params.
899 tx_buf.buff_size);
Yogesh Ashok Powar9c05fd72012-03-13 19:22:40 -0700900 adapter->tx_buf_size = (adapter->tx_buf_size
901 / MWIFIEX_SDIO_BLOCK_SIZE)
902 * MWIFIEX_SDIO_BLOCK_SIZE;
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700903 adapter->curr_tx_buf_size = adapter->tx_buf_size;
904 dev_dbg(adapter->dev,
905 "cmd: max_tx_buf_size=%d, tx_buf_size=%d\n",
Yogesh Ashok Powar9c05fd72012-03-13 19:22:40 -0700906 adapter->max_tx_buf_size, adapter->tx_buf_size);
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700907
908 if (adapter->if_ops.update_mp_end_port)
909 adapter->if_ops.update_mp_end_port(adapter,
Yogesh Ashok Powar9c05fd72012-03-13 19:22:40 -0700910 le16_to_cpu(resp->params.tx_buf.mp_end_port));
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700911 break;
912 case HostCmd_CMD_AMSDU_AGGR_CTRL:
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700913 break;
914 case HostCmd_CMD_WMM_GET_STATUS:
915 ret = mwifiex_ret_wmm_get_status(priv, resp);
916 break;
917 case HostCmd_CMD_802_11_IBSS_COALESCING_STATUS:
918 ret = mwifiex_ret_ibss_coalescing_status(priv, resp);
919 break;
920 case HostCmd_CMD_MAC_REG_ACCESS:
921 case HostCmd_CMD_BBP_REG_ACCESS:
922 case HostCmd_CMD_RF_REG_ACCESS:
923 case HostCmd_CMD_PMIC_REG_ACCESS:
924 case HostCmd_CMD_CAU_REG_ACCESS:
925 case HostCmd_CMD_802_11_EEPROM_ACCESS:
926 ret = mwifiex_ret_reg_access(cmdresp_no, resp, data_buf);
927 break;
928 case HostCmd_CMD_SET_BSS_MODE:
929 break;
930 case HostCmd_CMD_11N_CFG:
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700931 break;
Amitkumar Karward930fae2011-10-11 17:41:21 -0700932 case HostCmd_CMD_PCIE_DESC_DETAILS:
933 break;
Amitkumar Karwarfa444bf2012-03-15 20:51:51 -0700934 case HostCmd_CMD_802_11_SUBSCRIBE_EVENT:
Amitkumar Karware69d1ff2012-09-10 18:30:40 -0700935 ret = mwifiex_ret_subsc_evt(priv, resp);
Amitkumar Karwarfa444bf2012-03-15 20:51:51 -0700936 break;
Avinash Patil40d07032012-05-08 18:30:19 -0700937 case HostCmd_CMD_UAP_SYS_CONFIG:
938 break;
939 case HostCmd_CMD_UAP_BSS_START:
940 priv->bss_started = 1;
941 break;
942 case HostCmd_CMD_UAP_BSS_STOP:
943 priv->bss_started = 0;
944 break;
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700945 default:
946 dev_err(adapter->dev, "CMD_RESP: unknown cmd response %#x\n",
Yogesh Ashok Powar9c05fd72012-03-13 19:22:40 -0700947 resp->command);
Bing Zhao5e6e3a92011-03-21 18:00:50 -0700948 break;
949 }
950
951 return ret;
952}