1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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#include "11ac.h"
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43static void
44mwifiex_process_cmdresp_error(struct mwifiex_private *priv,
45 struct host_cmd_ds_command *resp)
46{
47 struct mwifiex_adapter *adapter = priv->adapter;
48 struct host_cmd_ds_802_11_ps_mode_enh *pm;
49 unsigned long flags;
50
51 mwifiex_dbg(adapter, ERROR,
52 "CMD_RESP: cmd %#x error, result=%#x\n",
53 resp->command, resp->result);
54
55 if (adapter->curr_cmd->wait_q_enabled)
56 adapter->cmd_wait_q.status = -1;
57
58 switch (le16_to_cpu(resp->command)) {
59 case HostCmd_CMD_802_11_PS_MODE_ENH:
60 pm = &resp->params.psmode_enh;
61 mwifiex_dbg(adapter, ERROR,
62 "PS_MODE_ENH cmd failed: result=0x%x action=0x%X\n",
63 resp->result, le16_to_cpu(pm->action));
64
65 if (le16_to_cpu(pm->action) == EN_AUTO_PS &&
66 (le16_to_cpu(pm->params.ps_bitmap) & BITMAP_STA_PS) &&
67 priv->bss_mode == NL80211_IFTYPE_ADHOC)
68 adapter->ps_mode = MWIFIEX_802_11_POWER_MODE_CAM;
69
70 break;
71 case HostCmd_CMD_802_11_SCAN:
72 case HostCmd_CMD_802_11_SCAN_EXT:
73 mwifiex_cancel_pending_scan_cmd(adapter);
74
75 spin_lock_irqsave(&adapter->mwifiex_cmd_lock, flags);
76 adapter->scan_processing = false;
77 spin_unlock_irqrestore(&adapter->mwifiex_cmd_lock, flags);
78 break;
79
80 case HostCmd_CMD_MAC_CONTROL:
81 break;
82
83 case HostCmd_CMD_SDIO_SP_RX_AGGR_CFG:
84 mwifiex_dbg(adapter, MSG,
85 "SDIO RX single-port aggregation Not support\n");
86 break;
87
88 default:
89 break;
90 }
91
92 mwifiex_recycle_cmd_node(adapter, adapter->curr_cmd);
93
94 spin_lock_irqsave(&adapter->mwifiex_cmd_lock, flags);
95 adapter->curr_cmd = NULL;
96 spin_unlock_irqrestore(&adapter->mwifiex_cmd_lock, flags);
97}
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112static int mwifiex_ret_802_11_rssi_info(struct mwifiex_private *priv,
113 struct host_cmd_ds_command *resp)
114{
115 struct host_cmd_ds_802_11_rssi_info_rsp *rssi_info_rsp =
116 &resp->params.rssi_info_rsp;
117 struct mwifiex_ds_misc_subsc_evt *subsc_evt =
118 &priv->async_subsc_evt_storage;
119
120 priv->data_rssi_last = le16_to_cpu(rssi_info_rsp->data_rssi_last);
121 priv->data_nf_last = le16_to_cpu(rssi_info_rsp->data_nf_last);
122
123 priv->data_rssi_avg = le16_to_cpu(rssi_info_rsp->data_rssi_avg);
124 priv->data_nf_avg = le16_to_cpu(rssi_info_rsp->data_nf_avg);
125
126 priv->bcn_rssi_last = le16_to_cpu(rssi_info_rsp->bcn_rssi_last);
127 priv->bcn_nf_last = le16_to_cpu(rssi_info_rsp->bcn_nf_last);
128
129 priv->bcn_rssi_avg = le16_to_cpu(rssi_info_rsp->bcn_rssi_avg);
130 priv->bcn_nf_avg = le16_to_cpu(rssi_info_rsp->bcn_nf_avg);
131
132 if (priv->subsc_evt_rssi_state == EVENT_HANDLED)
133 return 0;
134
135 memset(subsc_evt, 0x00, sizeof(struct mwifiex_ds_misc_subsc_evt));
136
137
138 subsc_evt->events = BITMASK_BCN_RSSI_LOW | BITMASK_BCN_RSSI_HIGH;
139 subsc_evt->action = HostCmd_ACT_BITWISE_SET;
140 if (priv->subsc_evt_rssi_state == RSSI_LOW_RECVD) {
141 subsc_evt->bcn_l_rssi_cfg.abs_value = abs(priv->bcn_rssi_avg -
142 priv->cqm_rssi_hyst);
143 subsc_evt->bcn_h_rssi_cfg.abs_value = abs(priv->cqm_rssi_thold);
144 } else if (priv->subsc_evt_rssi_state == RSSI_HIGH_RECVD) {
145 subsc_evt->bcn_l_rssi_cfg.abs_value = abs(priv->cqm_rssi_thold);
146 subsc_evt->bcn_h_rssi_cfg.abs_value = abs(priv->bcn_rssi_avg +
147 priv->cqm_rssi_hyst);
148 }
149 subsc_evt->bcn_l_rssi_cfg.evt_freq = 1;
150 subsc_evt->bcn_h_rssi_cfg.evt_freq = 1;
151
152 priv->subsc_evt_rssi_state = EVENT_HANDLED;
153
154 mwifiex_send_cmd(priv, HostCmd_CMD_802_11_SUBSCRIBE_EVENT,
155 0, 0, subsc_evt, false);
156
157 return 0;
158}
159
160
161
162
163
164
165
166
167
168
169
170
171
172static int mwifiex_ret_802_11_snmp_mib(struct mwifiex_private *priv,
173 struct host_cmd_ds_command *resp,
174 u32 *data_buf)
175{
176 struct host_cmd_ds_802_11_snmp_mib *smib = &resp->params.smib;
177 u16 oid = le16_to_cpu(smib->oid);
178 u16 query_type = le16_to_cpu(smib->query_type);
179 u32 ul_temp;
180
181 mwifiex_dbg(priv->adapter, INFO,
182 "info: SNMP_RESP: oid value = %#x,\t"
183 "query_type = %#x, buf size = %#x\n",
184 oid, query_type, le16_to_cpu(smib->buf_size));
185 if (query_type == HostCmd_ACT_GEN_GET) {
186 ul_temp = get_unaligned_le16(smib->value);
187 if (data_buf)
188 *data_buf = ul_temp;
189 switch (oid) {
190 case FRAG_THRESH_I:
191 mwifiex_dbg(priv->adapter, INFO,
192 "info: SNMP_RESP: FragThsd =%u\n",
193 ul_temp);
194 break;
195 case RTS_THRESH_I:
196 mwifiex_dbg(priv->adapter, INFO,
197 "info: SNMP_RESP: RTSThsd =%u\n",
198 ul_temp);
199 break;
200 case SHORT_RETRY_LIM_I:
201 mwifiex_dbg(priv->adapter, INFO,
202 "info: SNMP_RESP: TxRetryCount=%u\n",
203 ul_temp);
204 break;
205 case DTIM_PERIOD_I:
206 mwifiex_dbg(priv->adapter, INFO,
207 "info: SNMP_RESP: DTIM period=%u\n",
208 ul_temp);
209 default:
210 break;
211 }
212 }
213
214 return 0;
215}
216
217
218
219
220
221
222
223static int mwifiex_ret_get_log(struct mwifiex_private *priv,
224 struct host_cmd_ds_command *resp,
225 struct mwifiex_ds_get_stats *stats)
226{
227 struct host_cmd_ds_802_11_get_log *get_log =
228 &resp->params.get_log;
229
230 if (stats) {
231 stats->mcast_tx_frame = le32_to_cpu(get_log->mcast_tx_frame);
232 stats->failed = le32_to_cpu(get_log->failed);
233 stats->retry = le32_to_cpu(get_log->retry);
234 stats->multi_retry = le32_to_cpu(get_log->multi_retry);
235 stats->frame_dup = le32_to_cpu(get_log->frame_dup);
236 stats->rts_success = le32_to_cpu(get_log->rts_success);
237 stats->rts_failure = le32_to_cpu(get_log->rts_failure);
238 stats->ack_failure = le32_to_cpu(get_log->ack_failure);
239 stats->rx_frag = le32_to_cpu(get_log->rx_frag);
240 stats->mcast_rx_frame = le32_to_cpu(get_log->mcast_rx_frame);
241 stats->fcs_error = le32_to_cpu(get_log->fcs_error);
242 stats->tx_frame = le32_to_cpu(get_log->tx_frame);
243 stats->wep_icv_error[0] =
244 le32_to_cpu(get_log->wep_icv_err_cnt[0]);
245 stats->wep_icv_error[1] =
246 le32_to_cpu(get_log->wep_icv_err_cnt[1]);
247 stats->wep_icv_error[2] =
248 le32_to_cpu(get_log->wep_icv_err_cnt[2]);
249 stats->wep_icv_error[3] =
250 le32_to_cpu(get_log->wep_icv_err_cnt[3]);
251 stats->bcn_rcv_cnt = le32_to_cpu(get_log->bcn_rcv_cnt);
252 stats->bcn_miss_cnt = le32_to_cpu(get_log->bcn_miss_cnt);
253 }
254
255 return 0;
256}
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272static int mwifiex_ret_tx_rate_cfg(struct mwifiex_private *priv,
273 struct host_cmd_ds_command *resp)
274{
275 struct host_cmd_ds_tx_rate_cfg *rate_cfg = &resp->params.tx_rate_cfg;
276 struct mwifiex_rate_scope *rate_scope;
277 struct mwifiex_ie_types_header *head;
278 u16 tlv, tlv_buf_len, tlv_buf_left;
279 u8 *tlv_buf;
280 u32 i;
281
282 tlv_buf = ((u8 *)rate_cfg) + sizeof(struct host_cmd_ds_tx_rate_cfg);
283 tlv_buf_left = le16_to_cpu(resp->size) - S_DS_GEN - sizeof(*rate_cfg);
284
285 while (tlv_buf_left >= sizeof(*head)) {
286 head = (struct mwifiex_ie_types_header *)tlv_buf;
287 tlv = le16_to_cpu(head->type);
288 tlv_buf_len = le16_to_cpu(head->len);
289
290 if (tlv_buf_left < (sizeof(*head) + tlv_buf_len))
291 break;
292
293 switch (tlv) {
294 case TLV_TYPE_RATE_SCOPE:
295 rate_scope = (struct mwifiex_rate_scope *) tlv_buf;
296 priv->bitmap_rates[0] =
297 le16_to_cpu(rate_scope->hr_dsss_rate_bitmap);
298 priv->bitmap_rates[1] =
299 le16_to_cpu(rate_scope->ofdm_rate_bitmap);
300 for (i = 0;
301 i < ARRAY_SIZE(rate_scope->ht_mcs_rate_bitmap);
302 i++)
303 priv->bitmap_rates[2 + i] =
304 le16_to_cpu(rate_scope->
305 ht_mcs_rate_bitmap[i]);
306
307 if (priv->adapter->fw_api_ver == MWIFIEX_FW_V15) {
308 for (i = 0; i < ARRAY_SIZE(rate_scope->
309 vht_mcs_rate_bitmap);
310 i++)
311 priv->bitmap_rates[10 + i] =
312 le16_to_cpu(rate_scope->
313 vht_mcs_rate_bitmap[i]);
314 }
315 break;
316
317 }
318
319 tlv_buf += (sizeof(*head) + tlv_buf_len);
320 tlv_buf_left -= (sizeof(*head) + tlv_buf_len);
321 }
322
323 priv->is_data_rate_auto = mwifiex_is_rate_auto(priv);
324
325 if (priv->is_data_rate_auto)
326 priv->data_rate = 0;
327 else
328 return mwifiex_send_cmd(priv, HostCmd_CMD_802_11_TX_RATE_QUERY,
329 HostCmd_ACT_GEN_GET, 0, NULL, false);
330
331 return 0;
332}
333
334
335
336
337
338
339
340static int mwifiex_get_power_level(struct mwifiex_private *priv, void *data_buf)
341{
342 int length, max_power = -1, min_power = -1;
343 struct mwifiex_types_power_group *pg_tlv_hdr;
344 struct mwifiex_power_group *pg;
345
346 if (!data_buf)
347 return -1;
348
349 pg_tlv_hdr = (struct mwifiex_types_power_group *)((u8 *)data_buf);
350 pg = (struct mwifiex_power_group *)
351 ((u8 *) pg_tlv_hdr + sizeof(struct mwifiex_types_power_group));
352 length = le16_to_cpu(pg_tlv_hdr->length);
353
354
355 if (length < sizeof(struct mwifiex_power_group))
356 return 0;
357
358 max_power = pg->power_max;
359 min_power = pg->power_min;
360 length -= sizeof(struct mwifiex_power_group);
361
362 while (length >= sizeof(struct mwifiex_power_group)) {
363 pg++;
364 if (max_power < pg->power_max)
365 max_power = pg->power_max;
366
367 if (min_power > pg->power_min)
368 min_power = pg->power_min;
369
370 length -= sizeof(struct mwifiex_power_group);
371 }
372 priv->min_tx_power_level = (u8) min_power;
373 priv->max_tx_power_level = (u8) max_power;
374
375 return 0;
376}
377
378
379
380
381
382
383
384
385static int mwifiex_ret_tx_power_cfg(struct mwifiex_private *priv,
386 struct host_cmd_ds_command *resp)
387{
388 struct mwifiex_adapter *adapter = priv->adapter;
389 struct host_cmd_ds_txpwr_cfg *txp_cfg = &resp->params.txp_cfg;
390 struct mwifiex_types_power_group *pg_tlv_hdr;
391 struct mwifiex_power_group *pg;
392 u16 action = le16_to_cpu(txp_cfg->action);
393 u16 tlv_buf_left;
394
395 pg_tlv_hdr = (struct mwifiex_types_power_group *)
396 ((u8 *)txp_cfg +
397 sizeof(struct host_cmd_ds_txpwr_cfg));
398
399 pg = (struct mwifiex_power_group *)
400 ((u8 *)pg_tlv_hdr +
401 sizeof(struct mwifiex_types_power_group));
402
403 tlv_buf_left = le16_to_cpu(resp->size) - S_DS_GEN - sizeof(*txp_cfg);
404 if (tlv_buf_left <
405 le16_to_cpu(pg_tlv_hdr->length) + sizeof(*pg_tlv_hdr))
406 return 0;
407
408 switch (action) {
409 case HostCmd_ACT_GEN_GET:
410 if (adapter->hw_status == MWIFIEX_HW_STATUS_INITIALIZING)
411 mwifiex_get_power_level(priv, pg_tlv_hdr);
412
413 priv->tx_power_level = (u16) pg->power_min;
414 break;
415
416 case HostCmd_ACT_GEN_SET:
417 if (!le32_to_cpu(txp_cfg->mode))
418 break;
419
420 if (pg->power_max == pg->power_min)
421 priv->tx_power_level = (u16) pg->power_min;
422 break;
423 default:
424 mwifiex_dbg(adapter, ERROR,
425 "CMD_RESP: unknown cmd action %d\n",
426 action);
427 return 0;
428 }
429 mwifiex_dbg(adapter, INFO,
430 "info: Current TxPower Level = %d, Max Power=%d, Min Power=%d\n",
431 priv->tx_power_level, priv->max_tx_power_level,
432 priv->min_tx_power_level);
433
434 return 0;
435}
436
437
438
439
440static int mwifiex_ret_rf_tx_power(struct mwifiex_private *priv,
441 struct host_cmd_ds_command *resp)
442{
443 struct host_cmd_ds_rf_tx_pwr *txp = &resp->params.txp;
444 u16 action = le16_to_cpu(txp->action);
445
446 priv->tx_power_level = le16_to_cpu(txp->cur_level);
447
448 if (action == HostCmd_ACT_GEN_GET) {
449 priv->max_tx_power_level = txp->max_power;
450 priv->min_tx_power_level = txp->min_power;
451 }
452
453 mwifiex_dbg(priv->adapter, INFO,
454 "Current TxPower Level=%d, Max Power=%d, Min Power=%d\n",
455 priv->tx_power_level, priv->max_tx_power_level,
456 priv->min_tx_power_level);
457
458 return 0;
459}
460
461
462
463
464static int mwifiex_ret_rf_antenna(struct mwifiex_private *priv,
465 struct host_cmd_ds_command *resp)
466{
467 struct host_cmd_ds_rf_ant_mimo *ant_mimo = &resp->params.ant_mimo;
468 struct host_cmd_ds_rf_ant_siso *ant_siso = &resp->params.ant_siso;
469 struct mwifiex_adapter *adapter = priv->adapter;
470
471 if (adapter->hw_dev_mcs_support == HT_STREAM_2X2) {
472 priv->tx_ant = le16_to_cpu(ant_mimo->tx_ant_mode);
473 priv->rx_ant = le16_to_cpu(ant_mimo->rx_ant_mode);
474 mwifiex_dbg(adapter, INFO,
475 "RF_ANT_RESP: Tx action = 0x%x, Tx Mode = 0x%04x\t"
476 "Rx action = 0x%x, Rx Mode = 0x%04x\n",
477 le16_to_cpu(ant_mimo->action_tx),
478 le16_to_cpu(ant_mimo->tx_ant_mode),
479 le16_to_cpu(ant_mimo->action_rx),
480 le16_to_cpu(ant_mimo->rx_ant_mode));
481 } else {
482 priv->tx_ant = le16_to_cpu(ant_siso->ant_mode);
483 priv->rx_ant = le16_to_cpu(ant_siso->ant_mode);
484 mwifiex_dbg(adapter, INFO,
485 "RF_ANT_RESP: action = 0x%x, Mode = 0x%04x\n",
486 le16_to_cpu(ant_siso->action),
487 le16_to_cpu(ant_siso->ant_mode));
488 }
489 return 0;
490}
491
492
493
494
495
496
497static int mwifiex_ret_802_11_mac_address(struct mwifiex_private *priv,
498 struct host_cmd_ds_command *resp)
499{
500 struct host_cmd_ds_802_11_mac_address *cmd_mac_addr =
501 &resp->params.mac_addr;
502
503 memcpy(priv->curr_addr, cmd_mac_addr->mac_addr, ETH_ALEN);
504
505 mwifiex_dbg(priv->adapter, INFO,
506 "info: set mac address: %pM\n", priv->curr_addr);
507
508 return 0;
509}
510
511
512
513
514
515static int mwifiex_ret_mac_multicast_adr(struct mwifiex_private *priv,
516 struct host_cmd_ds_command *resp)
517{
518 return 0;
519}
520
521
522
523
524
525
526
527
528
529
530static int mwifiex_ret_802_11_tx_rate_query(struct mwifiex_private *priv,
531 struct host_cmd_ds_command *resp)
532{
533 priv->tx_rate = resp->params.tx_rate.tx_rate;
534 priv->tx_htinfo = resp->params.tx_rate.ht_info;
535 if (!priv->is_data_rate_auto)
536 priv->data_rate =
537 mwifiex_index_to_data_rate(priv, priv->tx_rate,
538 priv->tx_htinfo);
539
540 return 0;
541}
542
543
544
545
546
547
548
549
550static int mwifiex_ret_802_11_deauthenticate(struct mwifiex_private *priv,
551 struct host_cmd_ds_command *resp)
552{
553 struct mwifiex_adapter *adapter = priv->adapter;
554
555 adapter->dbg.num_cmd_deauth++;
556 if (!memcmp(resp->params.deauth.mac_addr,
557 &priv->curr_bss_params.bss_descriptor.mac_address,
558 sizeof(resp->params.deauth.mac_addr)))
559 mwifiex_reset_connect_state(priv, WLAN_REASON_DEAUTH_LEAVING,
560 false);
561
562 return 0;
563}
564
565
566
567
568
569
570static int mwifiex_ret_802_11_ad_hoc_stop(struct mwifiex_private *priv,
571 struct host_cmd_ds_command *resp)
572{
573 mwifiex_reset_connect_state(priv, WLAN_REASON_DEAUTH_LEAVING, false);
574 return 0;
575}
576
577
578
579
580
581
582
583static int mwifiex_ret_802_11_key_material_v1(struct mwifiex_private *priv,
584 struct host_cmd_ds_command *resp)
585{
586 struct host_cmd_ds_802_11_key_material *key =
587 &resp->params.key_material;
588
589 if (le16_to_cpu(key->action) == HostCmd_ACT_GEN_SET) {
590 if ((le16_to_cpu(key->key_param_set.key_info) & KEY_MCAST)) {
591 mwifiex_dbg(priv->adapter, INFO,
592 "info: key: GTK is set\n");
593 priv->wpa_is_gtk_set = true;
594 priv->scan_block = false;
595 priv->port_open = true;
596 }
597 }
598
599 memset(priv->aes_key.key_param_set.key, 0,
600 sizeof(key->key_param_set.key));
601 priv->aes_key.key_param_set.key_len = key->key_param_set.key_len;
602 memcpy(priv->aes_key.key_param_set.key, key->key_param_set.key,
603 le16_to_cpu(priv->aes_key.key_param_set.key_len));
604
605 return 0;
606}
607
608
609
610
611
612
613
614static int mwifiex_ret_802_11_key_material_v2(struct mwifiex_private *priv,
615 struct host_cmd_ds_command *resp)
616{
617 struct host_cmd_ds_802_11_key_material_v2 *key_v2;
618 __le16 len;
619
620 key_v2 = &resp->params.key_material_v2;
621 if (le16_to_cpu(key_v2->action) == HostCmd_ACT_GEN_SET) {
622 if ((le16_to_cpu(key_v2->key_param_set.key_info) & KEY_MCAST)) {
623 mwifiex_dbg(priv->adapter, INFO, "info: key: GTK is set\n");
624 priv->wpa_is_gtk_set = true;
625 priv->scan_block = false;
626 priv->port_open = true;
627 }
628 }
629
630 if (key_v2->key_param_set.key_type != KEY_TYPE_ID_AES)
631 return 0;
632
633 memset(priv->aes_key_v2.key_param_set.key_params.aes.key, 0,
634 WLAN_KEY_LEN_CCMP);
635 priv->aes_key_v2.key_param_set.key_params.aes.key_len =
636 key_v2->key_param_set.key_params.aes.key_len;
637 len = priv->aes_key_v2.key_param_set.key_params.aes.key_len;
638 memcpy(priv->aes_key_v2.key_param_set.key_params.aes.key,
639 key_v2->key_param_set.key_params.aes.key, le16_to_cpu(len));
640
641 return 0;
642}
643
644
645static int mwifiex_ret_802_11_key_material(struct mwifiex_private *priv,
646 struct host_cmd_ds_command *resp)
647{
648 if (priv->adapter->key_api_major_ver == KEY_API_VER_MAJOR_V2)
649 return mwifiex_ret_802_11_key_material_v2(priv, resp);
650 else
651 return mwifiex_ret_802_11_key_material_v1(priv, resp);
652}
653
654
655
656
657static int mwifiex_ret_802_11d_domain_info(struct mwifiex_private *priv,
658 struct host_cmd_ds_command *resp)
659{
660 struct host_cmd_ds_802_11d_domain_info_rsp *domain_info =
661 &resp->params.domain_info_resp;
662 struct mwifiex_ietypes_domain_param_set *domain = &domain_info->domain;
663 u16 action = le16_to_cpu(domain_info->action);
664 u8 no_of_triplet;
665
666 no_of_triplet = (u8) ((le16_to_cpu(domain->header.len)
667 - IEEE80211_COUNTRY_STRING_LEN)
668 / sizeof(struct ieee80211_country_ie_triplet));
669
670 mwifiex_dbg(priv->adapter, INFO,
671 "info: 11D Domain Info Resp: no_of_triplet=%d\n",
672 no_of_triplet);
673
674 if (no_of_triplet > MWIFIEX_MAX_TRIPLET_802_11D) {
675 mwifiex_dbg(priv->adapter, FATAL,
676 "11D: invalid number of triplets %d returned\n",
677 no_of_triplet);
678 return -1;
679 }
680
681 switch (action) {
682 case HostCmd_ACT_GEN_SET:
683 break;
684 case HostCmd_ACT_GEN_GET:
685 break;
686 default:
687 mwifiex_dbg(priv->adapter, ERROR,
688 "11D: invalid action:%d\n", domain_info->action);
689 return -1;
690 }
691
692 return 0;
693}
694
695
696
697
698
699
700
701static int mwifiex_ret_ver_ext(struct mwifiex_private *priv,
702 struct host_cmd_ds_command *resp,
703 struct host_cmd_ds_version_ext *version_ext)
704{
705 struct host_cmd_ds_version_ext *ver_ext = &resp->params.verext;
706
707 if (version_ext) {
708 version_ext->version_str_sel = ver_ext->version_str_sel;
709 memcpy(version_ext->version_str, ver_ext->version_str,
710 sizeof(char) * 128);
711 memcpy(priv->version_str, ver_ext->version_str, 128);
712 }
713 return 0;
714}
715
716
717
718
719static int
720mwifiex_ret_remain_on_chan(struct mwifiex_private *priv,
721 struct host_cmd_ds_command *resp,
722 struct host_cmd_ds_remain_on_chan *roc_cfg)
723{
724 struct host_cmd_ds_remain_on_chan *resp_cfg = &resp->params.roc_cfg;
725
726 if (roc_cfg)
727 memcpy(roc_cfg, resp_cfg, sizeof(*roc_cfg));
728
729 return 0;
730}
731
732
733
734
735static int
736mwifiex_ret_p2p_mode_cfg(struct mwifiex_private *priv,
737 struct host_cmd_ds_command *resp,
738 void *data_buf)
739{
740 struct host_cmd_ds_p2p_mode_cfg *mode_cfg = &resp->params.mode_cfg;
741
742 if (data_buf)
743 put_unaligned_le16(le16_to_cpu(mode_cfg->mode), data_buf);
744
745 return 0;
746}
747
748
749
750static int
751mwifiex_ret_mem_access(struct mwifiex_private *priv,
752 struct host_cmd_ds_command *resp, void *pioctl_buf)
753{
754 struct host_cmd_ds_mem_access *mem = (void *)&resp->params.mem;
755
756 priv->mem_rw.addr = le32_to_cpu(mem->addr);
757 priv->mem_rw.value = le32_to_cpu(mem->value);
758
759 return 0;
760}
761
762
763
764
765
766
767static int mwifiex_ret_reg_access(u16 type, struct host_cmd_ds_command *resp,
768 void *data_buf)
769{
770 struct mwifiex_ds_reg_rw *reg_rw;
771 struct mwifiex_ds_read_eeprom *eeprom;
772 union reg {
773 struct host_cmd_ds_mac_reg_access *mac;
774 struct host_cmd_ds_bbp_reg_access *bbp;
775 struct host_cmd_ds_rf_reg_access *rf;
776 struct host_cmd_ds_pmic_reg_access *pmic;
777 struct host_cmd_ds_802_11_eeprom_access *eeprom;
778 } r;
779
780 if (!data_buf)
781 return 0;
782
783 reg_rw = data_buf;
784 eeprom = data_buf;
785 switch (type) {
786 case HostCmd_CMD_MAC_REG_ACCESS:
787 r.mac = &resp->params.mac_reg;
788 reg_rw->offset = (u32) le16_to_cpu(r.mac->offset);
789 reg_rw->value = le32_to_cpu(r.mac->value);
790 break;
791 case HostCmd_CMD_BBP_REG_ACCESS:
792 r.bbp = &resp->params.bbp_reg;
793 reg_rw->offset = (u32) le16_to_cpu(r.bbp->offset);
794 reg_rw->value = (u32) r.bbp->value;
795 break;
796
797 case HostCmd_CMD_RF_REG_ACCESS:
798 r.rf = &resp->params.rf_reg;
799 reg_rw->offset = (u32) le16_to_cpu(r.rf->offset);
800 reg_rw->value = (u32) r.bbp->value;
801 break;
802 case HostCmd_CMD_PMIC_REG_ACCESS:
803 r.pmic = &resp->params.pmic_reg;
804 reg_rw->offset = (u32) le16_to_cpu(r.pmic->offset);
805 reg_rw->value = (u32) r.pmic->value;
806 break;
807 case HostCmd_CMD_CAU_REG_ACCESS:
808 r.rf = &resp->params.rf_reg;
809 reg_rw->offset = (u32) le16_to_cpu(r.rf->offset);
810 reg_rw->value = (u32) r.rf->value;
811 break;
812 case HostCmd_CMD_802_11_EEPROM_ACCESS:
813 r.eeprom = &resp->params.eeprom;
814 pr_debug("info: EEPROM read len=%x\n",
815 le16_to_cpu(r.eeprom->byte_count));
816 if (eeprom->byte_count < le16_to_cpu(r.eeprom->byte_count)) {
817 eeprom->byte_count = 0;
818 pr_debug("info: EEPROM read length is too big\n");
819 return -1;
820 }
821 eeprom->offset = le16_to_cpu(r.eeprom->offset);
822 eeprom->byte_count = le16_to_cpu(r.eeprom->byte_count);
823 if (eeprom->byte_count > 0)
824 memcpy(&eeprom->value, &r.eeprom->value,
825 min((u16)MAX_EEPROM_DATA, eeprom->byte_count));
826 break;
827 default:
828 return -1;
829 }
830 return 0;
831}
832
833
834
835
836
837
838
839
840static int mwifiex_ret_ibss_coalescing_status(struct mwifiex_private *priv,
841 struct host_cmd_ds_command *resp)
842{
843 struct host_cmd_ds_802_11_ibss_status *ibss_coal_resp =
844 &(resp->params.ibss_coalescing);
845
846 if (le16_to_cpu(ibss_coal_resp->action) == HostCmd_ACT_GEN_SET)
847 return 0;
848
849 mwifiex_dbg(priv->adapter, INFO,
850 "info: new BSSID %pM\n", ibss_coal_resp->bssid);
851
852
853 if (is_zero_ether_addr(ibss_coal_resp->bssid)) {
854 mwifiex_dbg(priv->adapter, FATAL, "new BSSID is NULL\n");
855 return 0;
856 }
857
858
859 if (!ether_addr_equal(priv->curr_bss_params.bss_descriptor.mac_address, ibss_coal_resp->bssid)) {
860
861 memcpy(priv->curr_bss_params.bss_descriptor.mac_address,
862 ibss_coal_resp->bssid, ETH_ALEN);
863
864
865 priv->curr_bss_params.bss_descriptor.beacon_period
866 = le16_to_cpu(ibss_coal_resp->beacon_interval);
867
868
869 priv->curr_bss_params.bss_descriptor.erp_flags =
870 (u8) le16_to_cpu(ibss_coal_resp->use_g_rate_protect);
871
872 priv->adhoc_state = ADHOC_COALESCED;
873 }
874
875 return 0;
876}
877static int mwifiex_ret_tdls_oper(struct mwifiex_private *priv,
878 struct host_cmd_ds_command *resp)
879{
880 struct host_cmd_ds_tdls_oper *cmd_tdls_oper = &resp->params.tdls_oper;
881 u16 reason = le16_to_cpu(cmd_tdls_oper->reason);
882 u16 action = le16_to_cpu(cmd_tdls_oper->tdls_action);
883 struct mwifiex_sta_node *node =
884 mwifiex_get_sta_entry(priv, cmd_tdls_oper->peer_mac);
885
886 switch (action) {
887 case ACT_TDLS_DELETE:
888 if (reason) {
889 if (!node || reason == TDLS_ERR_LINK_NONEXISTENT)
890 mwifiex_dbg(priv->adapter, MSG,
891 "TDLS link delete for %pM failed: reason %d\n",
892 cmd_tdls_oper->peer_mac, reason);
893 else
894 mwifiex_dbg(priv->adapter, ERROR,
895 "TDLS link delete for %pM failed: reason %d\n",
896 cmd_tdls_oper->peer_mac, reason);
897 } else {
898 mwifiex_dbg(priv->adapter, MSG,
899 "TDLS link delete for %pM successful\n",
900 cmd_tdls_oper->peer_mac);
901 }
902 break;
903 case ACT_TDLS_CREATE:
904 if (reason) {
905 mwifiex_dbg(priv->adapter, ERROR,
906 "TDLS link creation for %pM failed: reason %d",
907 cmd_tdls_oper->peer_mac, reason);
908 if (node && reason != TDLS_ERR_LINK_EXISTS)
909 node->tdls_status = TDLS_SETUP_FAILURE;
910 } else {
911 mwifiex_dbg(priv->adapter, MSG,
912 "TDLS link creation for %pM successful",
913 cmd_tdls_oper->peer_mac);
914 }
915 break;
916 case ACT_TDLS_CONFIG:
917 if (reason) {
918 mwifiex_dbg(priv->adapter, ERROR,
919 "TDLS link config for %pM failed, reason %d\n",
920 cmd_tdls_oper->peer_mac, reason);
921 if (node)
922 node->tdls_status = TDLS_SETUP_FAILURE;
923 } else {
924 mwifiex_dbg(priv->adapter, MSG,
925 "TDLS link config for %pM successful\n",
926 cmd_tdls_oper->peer_mac);
927 }
928 break;
929 default:
930 mwifiex_dbg(priv->adapter, ERROR,
931 "Unknown TDLS command action response %d", action);
932 return -1;
933 }
934
935 return 0;
936}
937
938
939
940static int mwifiex_ret_subsc_evt(struct mwifiex_private *priv,
941 struct host_cmd_ds_command *resp)
942{
943 struct host_cmd_ds_802_11_subsc_evt *cmd_sub_event =
944 &resp->params.subsc_evt;
945
946
947
948 mwifiex_dbg(priv->adapter, EVENT,
949 "Bitmap of currently subscribed events: %16x\n",
950 le16_to_cpu(cmd_sub_event->events));
951
952 return 0;
953}
954
955static int mwifiex_ret_uap_sta_list(struct mwifiex_private *priv,
956 struct host_cmd_ds_command *resp)
957{
958 struct host_cmd_ds_sta_list *sta_list =
959 &resp->params.sta_list;
960 struct mwifiex_ie_types_sta_info *sta_info = (void *)&sta_list->tlv;
961 int i;
962 struct mwifiex_sta_node *sta_node;
963
964 for (i = 0; i < (le16_to_cpu(sta_list->sta_count)); i++) {
965 sta_node = mwifiex_get_sta_entry(priv, sta_info->mac);
966 if (unlikely(!sta_node))
967 continue;
968
969 sta_node->stats.rssi = sta_info->rssi;
970 sta_info++;
971 }
972
973 return 0;
974}
975
976
977static int mwifiex_ret_cfg_data(struct mwifiex_private *priv,
978 struct host_cmd_ds_command *resp)
979{
980 if (resp->result != HostCmd_RESULT_OK) {
981 mwifiex_dbg(priv->adapter, ERROR, "Cal data cmd resp failed\n");
982 return -1;
983 }
984
985 return 0;
986}
987
988
989static int mwifiex_ret_sdio_rx_aggr_cfg(struct mwifiex_private *priv,
990 struct host_cmd_ds_command *resp)
991{
992 struct mwifiex_adapter *adapter = priv->adapter;
993 struct host_cmd_sdio_sp_rx_aggr_cfg *cfg =
994 &resp->params.sdio_rx_aggr_cfg;
995
996 adapter->sdio_rx_aggr_enable = cfg->enable;
997 adapter->sdio_rx_block_size = le16_to_cpu(cfg->block_size);
998
999 return 0;
1000}
1001
1002static int mwifiex_ret_robust_coex(struct mwifiex_private *priv,
1003 struct host_cmd_ds_command *resp,
1004 bool *is_timeshare)
1005{
1006 struct host_cmd_ds_robust_coex *coex = &resp->params.coex;
1007 struct mwifiex_ie_types_robust_coex *coex_tlv;
1008 u16 action = le16_to_cpu(coex->action);
1009 u32 mode;
1010
1011 coex_tlv = (struct mwifiex_ie_types_robust_coex
1012 *)((u8 *)coex + sizeof(struct host_cmd_ds_robust_coex));
1013 if (action == HostCmd_ACT_GEN_GET) {
1014 mode = le32_to_cpu(coex_tlv->mode);
1015 if (mode == MWIFIEX_COEX_MODE_TIMESHARE)
1016 *is_timeshare = true;
1017 else
1018 *is_timeshare = false;
1019 }
1020
1021 return 0;
1022}
1023
1024static struct ieee80211_regdomain *
1025mwifiex_create_custom_regdomain(struct mwifiex_private *priv,
1026 u8 *buf, u16 buf_len)
1027{
1028 u16 num_chan = buf_len / 2;
1029 struct ieee80211_regdomain *regd;
1030 struct ieee80211_reg_rule *rule;
1031 bool new_rule;
1032 int regd_size, idx, freq, prev_freq = 0;
1033 u32 bw, prev_bw = 0;
1034 u8 chflags, prev_chflags = 0, valid_rules = 0;
1035
1036 if (WARN_ON_ONCE(num_chan > NL80211_MAX_SUPP_REG_RULES))
1037 return ERR_PTR(-EINVAL);
1038
1039 regd_size = sizeof(struct ieee80211_regdomain) +
1040 num_chan * sizeof(struct ieee80211_reg_rule);
1041
1042 regd = kzalloc(regd_size, GFP_KERNEL);
1043 if (!regd)
1044 return ERR_PTR(-ENOMEM);
1045
1046 for (idx = 0; idx < num_chan; idx++) {
1047 u8 chan;
1048 enum nl80211_band band;
1049
1050 chan = *buf++;
1051 if (!chan) {
1052 kfree(regd);
1053 return NULL;
1054 }
1055 chflags = *buf++;
1056 band = (chan <= 14) ? NL80211_BAND_2GHZ : NL80211_BAND_5GHZ;
1057 freq = ieee80211_channel_to_frequency(chan, band);
1058 new_rule = false;
1059
1060 if (chflags & MWIFIEX_CHANNEL_DISABLED)
1061 continue;
1062
1063 if (band == NL80211_BAND_5GHZ) {
1064 if (!(chflags & MWIFIEX_CHANNEL_NOHT80))
1065 bw = MHZ_TO_KHZ(80);
1066 else if (!(chflags & MWIFIEX_CHANNEL_NOHT40))
1067 bw = MHZ_TO_KHZ(40);
1068 else
1069 bw = MHZ_TO_KHZ(20);
1070 } else {
1071 if (!(chflags & MWIFIEX_CHANNEL_NOHT40))
1072 bw = MHZ_TO_KHZ(40);
1073 else
1074 bw = MHZ_TO_KHZ(20);
1075 }
1076
1077 if (idx == 0 || prev_chflags != chflags || prev_bw != bw ||
1078 freq - prev_freq > 20) {
1079 valid_rules++;
1080 new_rule = true;
1081 }
1082
1083 rule = ®d->reg_rules[valid_rules - 1];
1084
1085 rule->freq_range.end_freq_khz = MHZ_TO_KHZ(freq + 10);
1086
1087 prev_chflags = chflags;
1088 prev_freq = freq;
1089 prev_bw = bw;
1090
1091 if (!new_rule)
1092 continue;
1093
1094 rule->freq_range.start_freq_khz = MHZ_TO_KHZ(freq - 10);
1095 rule->power_rule.max_eirp = DBM_TO_MBM(19);
1096
1097 if (chflags & MWIFIEX_CHANNEL_PASSIVE)
1098 rule->flags = NL80211_RRF_NO_IR;
1099
1100 if (chflags & MWIFIEX_CHANNEL_DFS)
1101 rule->flags = NL80211_RRF_DFS;
1102
1103 rule->freq_range.max_bandwidth_khz = bw;
1104 }
1105
1106 regd->n_reg_rules = valid_rules;
1107 regd->alpha2[0] = '9';
1108 regd->alpha2[1] = '9';
1109
1110 return regd;
1111}
1112
1113static int mwifiex_ret_chan_region_cfg(struct mwifiex_private *priv,
1114 struct host_cmd_ds_command *resp)
1115{
1116 struct host_cmd_ds_chan_region_cfg *reg = &resp->params.reg_cfg;
1117 u16 action = le16_to_cpu(reg->action);
1118 u16 tlv, tlv_buf_len, tlv_buf_left;
1119 struct mwifiex_ie_types_header *head;
1120 struct ieee80211_regdomain *regd;
1121 u8 *tlv_buf;
1122
1123 if (action != HostCmd_ACT_GEN_GET)
1124 return 0;
1125
1126 tlv_buf = (u8 *)reg + sizeof(*reg);
1127 tlv_buf_left = le16_to_cpu(resp->size) - S_DS_GEN - sizeof(*reg);
1128
1129 while (tlv_buf_left >= sizeof(*head)) {
1130 head = (struct mwifiex_ie_types_header *)tlv_buf;
1131 tlv = le16_to_cpu(head->type);
1132 tlv_buf_len = le16_to_cpu(head->len);
1133
1134 if (tlv_buf_left < (sizeof(*head) + tlv_buf_len))
1135 break;
1136
1137 switch (tlv) {
1138 case TLV_TYPE_CHAN_ATTR_CFG:
1139 mwifiex_dbg_dump(priv->adapter, CMD_D, "CHAN:",
1140 (u8 *)head + sizeof(*head),
1141 tlv_buf_len);
1142 regd = mwifiex_create_custom_regdomain(priv,
1143 (u8 *)head + sizeof(*head), tlv_buf_len);
1144 if (!IS_ERR(regd))
1145 priv->adapter->regd = regd;
1146 break;
1147 }
1148
1149 tlv_buf += (sizeof(*head) + tlv_buf_len);
1150 tlv_buf_left -= (sizeof(*head) + tlv_buf_len);
1151 }
1152
1153 return 0;
1154}
1155
1156static int mwifiex_ret_pkt_aggr_ctrl(struct mwifiex_private *priv,
1157 struct host_cmd_ds_command *resp)
1158{
1159 struct host_cmd_ds_pkt_aggr_ctrl *pkt_aggr_ctrl =
1160 &resp->params.pkt_aggr_ctrl;
1161 struct mwifiex_adapter *adapter = priv->adapter;
1162
1163 adapter->bus_aggr.enable = le16_to_cpu(pkt_aggr_ctrl->enable);
1164 if (adapter->bus_aggr.enable)
1165 adapter->intf_hdr_len = INTF_HEADER_LEN;
1166 adapter->bus_aggr.mode = MWIFIEX_BUS_AGGR_MODE_LEN_V2;
1167 adapter->bus_aggr.tx_aggr_max_size =
1168 le16_to_cpu(pkt_aggr_ctrl->tx_aggr_max_size);
1169 adapter->bus_aggr.tx_aggr_max_num =
1170 le16_to_cpu(pkt_aggr_ctrl->tx_aggr_max_num);
1171 adapter->bus_aggr.tx_aggr_align =
1172 le16_to_cpu(pkt_aggr_ctrl->tx_aggr_align);
1173
1174 return 0;
1175}
1176
1177
1178
1179
1180
1181
1182
1183int mwifiex_process_sta_cmdresp(struct mwifiex_private *priv, u16 cmdresp_no,
1184 struct host_cmd_ds_command *resp)
1185{
1186 int ret = 0;
1187 struct mwifiex_adapter *adapter = priv->adapter;
1188 void *data_buf = adapter->curr_cmd->data_buf;
1189
1190
1191 if (resp->result != HostCmd_RESULT_OK) {
1192 mwifiex_process_cmdresp_error(priv, resp);
1193 return -1;
1194 }
1195
1196 switch (cmdresp_no) {
1197 case HostCmd_CMD_GET_HW_SPEC:
1198 ret = mwifiex_ret_get_hw_spec(priv, resp);
1199 break;
1200 case HostCmd_CMD_CFG_DATA:
1201 ret = mwifiex_ret_cfg_data(priv, resp);
1202 break;
1203 case HostCmd_CMD_MAC_CONTROL:
1204 break;
1205 case HostCmd_CMD_802_11_MAC_ADDRESS:
1206 ret = mwifiex_ret_802_11_mac_address(priv, resp);
1207 break;
1208 case HostCmd_CMD_MAC_MULTICAST_ADR:
1209 ret = mwifiex_ret_mac_multicast_adr(priv, resp);
1210 break;
1211 case HostCmd_CMD_TX_RATE_CFG:
1212 ret = mwifiex_ret_tx_rate_cfg(priv, resp);
1213 break;
1214 case HostCmd_CMD_802_11_SCAN:
1215 ret = mwifiex_ret_802_11_scan(priv, resp);
1216 adapter->curr_cmd->wait_q_enabled = false;
1217 break;
1218 case HostCmd_CMD_802_11_SCAN_EXT:
1219 ret = mwifiex_ret_802_11_scan_ext(priv, resp);
1220 adapter->curr_cmd->wait_q_enabled = false;
1221 break;
1222 case HostCmd_CMD_802_11_BG_SCAN_QUERY:
1223 ret = mwifiex_ret_802_11_scan(priv, resp);
1224 cfg80211_sched_scan_results(priv->wdev.wiphy, 0);
1225 mwifiex_dbg(adapter, CMD,
1226 "info: CMD_RESP: BG_SCAN result is ready!\n");
1227 break;
1228 case HostCmd_CMD_802_11_BG_SCAN_CONFIG:
1229 break;
1230 case HostCmd_CMD_TXPWR_CFG:
1231 ret = mwifiex_ret_tx_power_cfg(priv, resp);
1232 break;
1233 case HostCmd_CMD_RF_TX_PWR:
1234 ret = mwifiex_ret_rf_tx_power(priv, resp);
1235 break;
1236 case HostCmd_CMD_RF_ANTENNA:
1237 ret = mwifiex_ret_rf_antenna(priv, resp);
1238 break;
1239 case HostCmd_CMD_802_11_PS_MODE_ENH:
1240 ret = mwifiex_ret_enh_power_mode(priv, resp, data_buf);
1241 break;
1242 case HostCmd_CMD_802_11_HS_CFG_ENH:
1243 ret = mwifiex_ret_802_11_hs_cfg(priv, resp);
1244 break;
1245 case HostCmd_CMD_802_11_ASSOCIATE:
1246 ret = mwifiex_ret_802_11_associate(priv, resp);
1247 break;
1248 case HostCmd_CMD_802_11_DEAUTHENTICATE:
1249 ret = mwifiex_ret_802_11_deauthenticate(priv, resp);
1250 break;
1251 case HostCmd_CMD_802_11_AD_HOC_START:
1252 case HostCmd_CMD_802_11_AD_HOC_JOIN:
1253 ret = mwifiex_ret_802_11_ad_hoc(priv, resp);
1254 break;
1255 case HostCmd_CMD_802_11_AD_HOC_STOP:
1256 ret = mwifiex_ret_802_11_ad_hoc_stop(priv, resp);
1257 break;
1258 case HostCmd_CMD_802_11_GET_LOG:
1259 ret = mwifiex_ret_get_log(priv, resp, data_buf);
1260 break;
1261 case HostCmd_CMD_RSSI_INFO:
1262 ret = mwifiex_ret_802_11_rssi_info(priv, resp);
1263 break;
1264 case HostCmd_CMD_802_11_SNMP_MIB:
1265 ret = mwifiex_ret_802_11_snmp_mib(priv, resp, data_buf);
1266 break;
1267 case HostCmd_CMD_802_11_TX_RATE_QUERY:
1268 ret = mwifiex_ret_802_11_tx_rate_query(priv, resp);
1269 break;
1270 case HostCmd_CMD_VERSION_EXT:
1271 ret = mwifiex_ret_ver_ext(priv, resp, data_buf);
1272 break;
1273 case HostCmd_CMD_REMAIN_ON_CHAN:
1274 ret = mwifiex_ret_remain_on_chan(priv, resp, data_buf);
1275 break;
1276 case HostCmd_CMD_11AC_CFG:
1277 break;
1278 case HostCmd_CMD_PACKET_AGGR_CTRL:
1279 ret = mwifiex_ret_pkt_aggr_ctrl(priv, resp);
1280 break;
1281 case HostCmd_CMD_P2P_MODE_CFG:
1282 ret = mwifiex_ret_p2p_mode_cfg(priv, resp, data_buf);
1283 break;
1284 case HostCmd_CMD_MGMT_FRAME_REG:
1285 case HostCmd_CMD_FUNC_INIT:
1286 case HostCmd_CMD_FUNC_SHUTDOWN:
1287 break;
1288 case HostCmd_CMD_802_11_KEY_MATERIAL:
1289 ret = mwifiex_ret_802_11_key_material(priv, resp);
1290 break;
1291 case HostCmd_CMD_802_11D_DOMAIN_INFO:
1292 ret = mwifiex_ret_802_11d_domain_info(priv, resp);
1293 break;
1294 case HostCmd_CMD_11N_ADDBA_REQ:
1295 ret = mwifiex_ret_11n_addba_req(priv, resp);
1296 break;
1297 case HostCmd_CMD_11N_DELBA:
1298 ret = mwifiex_ret_11n_delba(priv, resp);
1299 break;
1300 case HostCmd_CMD_11N_ADDBA_RSP:
1301 ret = mwifiex_ret_11n_addba_resp(priv, resp);
1302 break;
1303 case HostCmd_CMD_RECONFIGURE_TX_BUFF:
1304 if (0xffff == (u16)le16_to_cpu(resp->params.tx_buf.buff_size)) {
1305 if (adapter->iface_type == MWIFIEX_USB &&
1306 adapter->usb_mc_setup) {
1307 if (adapter->if_ops.multi_port_resync)
1308 adapter->if_ops.
1309 multi_port_resync(adapter);
1310 adapter->usb_mc_setup = false;
1311 adapter->tx_lock_flag = false;
1312 }
1313 break;
1314 }
1315 adapter->tx_buf_size = (u16) le16_to_cpu(resp->params.
1316 tx_buf.buff_size);
1317 adapter->tx_buf_size = (adapter->tx_buf_size
1318 / MWIFIEX_SDIO_BLOCK_SIZE)
1319 * MWIFIEX_SDIO_BLOCK_SIZE;
1320 adapter->curr_tx_buf_size = adapter->tx_buf_size;
1321 mwifiex_dbg(adapter, CMD, "cmd: curr_tx_buf_size=%d\n",
1322 adapter->curr_tx_buf_size);
1323
1324 if (adapter->if_ops.update_mp_end_port)
1325 adapter->if_ops.update_mp_end_port(adapter,
1326 le16_to_cpu(resp->params.tx_buf.mp_end_port));
1327 break;
1328 case HostCmd_CMD_AMSDU_AGGR_CTRL:
1329 break;
1330 case HostCmd_CMD_WMM_GET_STATUS:
1331 ret = mwifiex_ret_wmm_get_status(priv, resp);
1332 break;
1333 case HostCmd_CMD_802_11_IBSS_COALESCING_STATUS:
1334 ret = mwifiex_ret_ibss_coalescing_status(priv, resp);
1335 break;
1336 case HostCmd_CMD_MEM_ACCESS:
1337 ret = mwifiex_ret_mem_access(priv, resp, data_buf);
1338 break;
1339 case HostCmd_CMD_MAC_REG_ACCESS:
1340 case HostCmd_CMD_BBP_REG_ACCESS:
1341 case HostCmd_CMD_RF_REG_ACCESS:
1342 case HostCmd_CMD_PMIC_REG_ACCESS:
1343 case HostCmd_CMD_CAU_REG_ACCESS:
1344 case HostCmd_CMD_802_11_EEPROM_ACCESS:
1345 ret = mwifiex_ret_reg_access(cmdresp_no, resp, data_buf);
1346 break;
1347 case HostCmd_CMD_SET_BSS_MODE:
1348 break;
1349 case HostCmd_CMD_11N_CFG:
1350 break;
1351 case HostCmd_CMD_PCIE_DESC_DETAILS:
1352 break;
1353 case HostCmd_CMD_802_11_SUBSCRIBE_EVENT:
1354 ret = mwifiex_ret_subsc_evt(priv, resp);
1355 break;
1356 case HostCmd_CMD_UAP_SYS_CONFIG:
1357 break;
1358 case HOST_CMD_APCMD_STA_LIST:
1359 ret = mwifiex_ret_uap_sta_list(priv, resp);
1360 break;
1361 case HostCmd_CMD_UAP_BSS_START:
1362 adapter->tx_lock_flag = false;
1363 adapter->pps_uapsd_mode = false;
1364 adapter->delay_null_pkt = false;
1365 priv->bss_started = 1;
1366 break;
1367 case HostCmd_CMD_UAP_BSS_STOP:
1368 priv->bss_started = 0;
1369 break;
1370 case HostCmd_CMD_UAP_STA_DEAUTH:
1371 break;
1372 case HOST_CMD_APCMD_SYS_RESET:
1373 break;
1374 case HostCmd_CMD_MEF_CFG:
1375 break;
1376 case HostCmd_CMD_COALESCE_CFG:
1377 break;
1378 case HostCmd_CMD_TDLS_OPER:
1379 ret = mwifiex_ret_tdls_oper(priv, resp);
1380 case HostCmd_CMD_MC_POLICY:
1381 break;
1382 case HostCmd_CMD_CHAN_REPORT_REQUEST:
1383 break;
1384 case HostCmd_CMD_SDIO_SP_RX_AGGR_CFG:
1385 ret = mwifiex_ret_sdio_rx_aggr_cfg(priv, resp);
1386 break;
1387 case HostCmd_CMD_HS_WAKEUP_REASON:
1388 ret = mwifiex_ret_wakeup_reason(priv, resp, data_buf);
1389 break;
1390 case HostCmd_CMD_TDLS_CONFIG:
1391 break;
1392 case HostCmd_CMD_ROBUST_COEX:
1393 ret = mwifiex_ret_robust_coex(priv, resp, data_buf);
1394 break;
1395 case HostCmd_CMD_GTK_REKEY_OFFLOAD_CFG:
1396 break;
1397 case HostCmd_CMD_CHAN_REGION_CFG:
1398 ret = mwifiex_ret_chan_region_cfg(priv, resp);
1399 break;
1400 default:
1401 mwifiex_dbg(adapter, ERROR,
1402 "CMD_RESP: unknown cmd response %#x\n",
1403 resp->command);
1404 break;
1405 }
1406
1407 return ret;
1408}
1409