1 /* 2 * Marvell Wireless LAN device driver: station command response handling 3 * 4 * Copyright (C) 2011-2014, Marvell International Ltd. 5 * 6 * This software file (the "File") is distributed by Marvell International 7 * Ltd. under the terms of the GNU General Public License Version 2, June 1991 8 * (the "License"). You may use, redistribute and/or modify this File in 9 * accordance with the terms and conditions of the License, a copy of which 10 * is available by writing to the Free Software Foundation, Inc., 11 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or on the 12 * worldwide web at http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt. 13 * 14 * THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE 15 * IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE 16 * ARE EXPRESSLY DISCLAIMED. The License provides additional details about 17 * this warranty disclaimer. 18 */ 19 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 * This function handles the command response error case. 32 * 33 * For scan response error, the function cancels all the pending 34 * scan commands and generates an event to inform the applications 35 * of the scan completion. 36 * 37 * For Power Save command failure, we do not retry enter PS 38 * command in case of Ad-hoc mode. 39 * 40 * For all other response errors, the current command buffer is freed 41 * and returned to the free command queue. 42 */ 43 static void 44 mwifiex_process_cmdresp_error(struct mwifiex_private *priv, 45 struct host_cmd_ds_command *resp) 46 { 47 struct cmd_ctrl_node *cmd_node = NULL, *tmp_node; 48 struct mwifiex_adapter *adapter = priv->adapter; 49 struct host_cmd_ds_802_11_ps_mode_enh *pm; 50 unsigned long flags; 51 52 mwifiex_dbg(adapter, ERROR, 53 "CMD_RESP: cmd %#x error, result=%#x\n", 54 resp->command, resp->result); 55 56 if (adapter->curr_cmd->wait_q_enabled) 57 adapter->cmd_wait_q.status = -1; 58 59 switch (le16_to_cpu(resp->command)) { 60 case HostCmd_CMD_802_11_PS_MODE_ENH: 61 pm = &resp->params.psmode_enh; 62 mwifiex_dbg(adapter, ERROR, 63 "PS_MODE_ENH cmd failed: result=0x%x action=0x%X\n", 64 resp->result, le16_to_cpu(pm->action)); 65 /* We do not re-try enter-ps command in ad-hoc mode. */ 66 if (le16_to_cpu(pm->action) == EN_AUTO_PS && 67 (le16_to_cpu(pm->params.ps_bitmap) & BITMAP_STA_PS) && 68 priv->bss_mode == NL80211_IFTYPE_ADHOC) 69 adapter->ps_mode = MWIFIEX_802_11_POWER_MODE_CAM; 70 71 break; 72 case HostCmd_CMD_802_11_SCAN: 73 case HostCmd_CMD_802_11_SCAN_EXT: 74 /* Cancel all pending scan command */ 75 spin_lock_irqsave(&adapter->scan_pending_q_lock, flags); 76 list_for_each_entry_safe(cmd_node, tmp_node, 77 &adapter->scan_pending_q, list) { 78 list_del(&cmd_node->list); 79 spin_unlock_irqrestore(&adapter->scan_pending_q_lock, 80 flags); 81 mwifiex_insert_cmd_to_free_q(adapter, cmd_node); 82 spin_lock_irqsave(&adapter->scan_pending_q_lock, flags); 83 } 84 spin_unlock_irqrestore(&adapter->scan_pending_q_lock, flags); 85 86 spin_lock_irqsave(&adapter->mwifiex_cmd_lock, flags); 87 adapter->scan_processing = false; 88 spin_unlock_irqrestore(&adapter->mwifiex_cmd_lock, flags); 89 break; 90 91 case HostCmd_CMD_MAC_CONTROL: 92 break; 93 94 case HostCmd_CMD_SDIO_SP_RX_AGGR_CFG: 95 mwifiex_dbg(adapter, MSG, 96 "SDIO RX single-port aggregation Not support\n"); 97 break; 98 99 default: 100 break; 101 } 102 /* Handling errors here */ 103 mwifiex_recycle_cmd_node(adapter, adapter->curr_cmd); 104 105 spin_lock_irqsave(&adapter->mwifiex_cmd_lock, flags); 106 adapter->curr_cmd = NULL; 107 spin_unlock_irqrestore(&adapter->mwifiex_cmd_lock, flags); 108 } 109 110 /* 111 * This function handles the command response of get RSSI info. 112 * 113 * Handling includes changing the header fields into CPU format 114 * and saving the following parameters in driver - 115 * - Last data and beacon RSSI value 116 * - Average data and beacon RSSI value 117 * - Last data and beacon NF value 118 * - Average data and beacon NF value 119 * 120 * The parameters are send to the application as well, along with 121 * calculated SNR values. 122 */ 123 static int mwifiex_ret_802_11_rssi_info(struct mwifiex_private *priv, 124 struct host_cmd_ds_command *resp) 125 { 126 struct host_cmd_ds_802_11_rssi_info_rsp *rssi_info_rsp = 127 &resp->params.rssi_info_rsp; 128 struct mwifiex_ds_misc_subsc_evt *subsc_evt = 129 &priv->async_subsc_evt_storage; 130 131 priv->data_rssi_last = le16_to_cpu(rssi_info_rsp->data_rssi_last); 132 priv->data_nf_last = le16_to_cpu(rssi_info_rsp->data_nf_last); 133 134 priv->data_rssi_avg = le16_to_cpu(rssi_info_rsp->data_rssi_avg); 135 priv->data_nf_avg = le16_to_cpu(rssi_info_rsp->data_nf_avg); 136 137 priv->bcn_rssi_last = le16_to_cpu(rssi_info_rsp->bcn_rssi_last); 138 priv->bcn_nf_last = le16_to_cpu(rssi_info_rsp->bcn_nf_last); 139 140 priv->bcn_rssi_avg = le16_to_cpu(rssi_info_rsp->bcn_rssi_avg); 141 priv->bcn_nf_avg = le16_to_cpu(rssi_info_rsp->bcn_nf_avg); 142 143 if (priv->subsc_evt_rssi_state == EVENT_HANDLED) 144 return 0; 145 146 memset(subsc_evt, 0x00, sizeof(struct mwifiex_ds_misc_subsc_evt)); 147 148 /* Resubscribe low and high rssi events with new thresholds */ 149 subsc_evt->events = BITMASK_BCN_RSSI_LOW | BITMASK_BCN_RSSI_HIGH; 150 subsc_evt->action = HostCmd_ACT_BITWISE_SET; 151 if (priv->subsc_evt_rssi_state == RSSI_LOW_RECVD) { 152 subsc_evt->bcn_l_rssi_cfg.abs_value = abs(priv->bcn_rssi_avg - 153 priv->cqm_rssi_hyst); 154 subsc_evt->bcn_h_rssi_cfg.abs_value = abs(priv->cqm_rssi_thold); 155 } else if (priv->subsc_evt_rssi_state == RSSI_HIGH_RECVD) { 156 subsc_evt->bcn_l_rssi_cfg.abs_value = abs(priv->cqm_rssi_thold); 157 subsc_evt->bcn_h_rssi_cfg.abs_value = abs(priv->bcn_rssi_avg + 158 priv->cqm_rssi_hyst); 159 } 160 subsc_evt->bcn_l_rssi_cfg.evt_freq = 1; 161 subsc_evt->bcn_h_rssi_cfg.evt_freq = 1; 162 163 priv->subsc_evt_rssi_state = EVENT_HANDLED; 164 165 mwifiex_send_cmd(priv, HostCmd_CMD_802_11_SUBSCRIBE_EVENT, 166 0, 0, subsc_evt, false); 167 168 return 0; 169 } 170 171 /* 172 * This function handles the command response of set/get SNMP 173 * MIB parameters. 174 * 175 * Handling includes changing the header fields into CPU format 176 * and saving the parameter in driver. 177 * 178 * The following parameters are supported - 179 * - Fragmentation threshold 180 * - RTS threshold 181 * - Short retry limit 182 */ 183 static int mwifiex_ret_802_11_snmp_mib(struct mwifiex_private *priv, 184 struct host_cmd_ds_command *resp, 185 u32 *data_buf) 186 { 187 struct host_cmd_ds_802_11_snmp_mib *smib = &resp->params.smib; 188 u16 oid = le16_to_cpu(smib->oid); 189 u16 query_type = le16_to_cpu(smib->query_type); 190 u32 ul_temp; 191 192 mwifiex_dbg(priv->adapter, INFO, 193 "info: SNMP_RESP: oid value = %#x,\t" 194 "query_type = %#x, buf size = %#x\n", 195 oid, query_type, le16_to_cpu(smib->buf_size)); 196 if (query_type == HostCmd_ACT_GEN_GET) { 197 ul_temp = le16_to_cpu(*((__le16 *) (smib->value))); 198 if (data_buf) 199 *data_buf = ul_temp; 200 switch (oid) { 201 case FRAG_THRESH_I: 202 mwifiex_dbg(priv->adapter, INFO, 203 "info: SNMP_RESP: FragThsd =%u\n", 204 ul_temp); 205 break; 206 case RTS_THRESH_I: 207 mwifiex_dbg(priv->adapter, INFO, 208 "info: SNMP_RESP: RTSThsd =%u\n", 209 ul_temp); 210 break; 211 case SHORT_RETRY_LIM_I: 212 mwifiex_dbg(priv->adapter, INFO, 213 "info: SNMP_RESP: TxRetryCount=%u\n", 214 ul_temp); 215 break; 216 case DTIM_PERIOD_I: 217 mwifiex_dbg(priv->adapter, INFO, 218 "info: SNMP_RESP: DTIM period=%u\n", 219 ul_temp); 220 default: 221 break; 222 } 223 } 224 225 return 0; 226 } 227 228 /* 229 * This function handles the command response of get log request 230 * 231 * Handling includes changing the header fields into CPU format 232 * and sending the received parameters to application. 233 */ 234 static int mwifiex_ret_get_log(struct mwifiex_private *priv, 235 struct host_cmd_ds_command *resp, 236 struct mwifiex_ds_get_stats *stats) 237 { 238 struct host_cmd_ds_802_11_get_log *get_log = 239 &resp->params.get_log; 240 241 if (stats) { 242 stats->mcast_tx_frame = le32_to_cpu(get_log->mcast_tx_frame); 243 stats->failed = le32_to_cpu(get_log->failed); 244 stats->retry = le32_to_cpu(get_log->retry); 245 stats->multi_retry = le32_to_cpu(get_log->multi_retry); 246 stats->frame_dup = le32_to_cpu(get_log->frame_dup); 247 stats->rts_success = le32_to_cpu(get_log->rts_success); 248 stats->rts_failure = le32_to_cpu(get_log->rts_failure); 249 stats->ack_failure = le32_to_cpu(get_log->ack_failure); 250 stats->rx_frag = le32_to_cpu(get_log->rx_frag); 251 stats->mcast_rx_frame = le32_to_cpu(get_log->mcast_rx_frame); 252 stats->fcs_error = le32_to_cpu(get_log->fcs_error); 253 stats->tx_frame = le32_to_cpu(get_log->tx_frame); 254 stats->wep_icv_error[0] = 255 le32_to_cpu(get_log->wep_icv_err_cnt[0]); 256 stats->wep_icv_error[1] = 257 le32_to_cpu(get_log->wep_icv_err_cnt[1]); 258 stats->wep_icv_error[2] = 259 le32_to_cpu(get_log->wep_icv_err_cnt[2]); 260 stats->wep_icv_error[3] = 261 le32_to_cpu(get_log->wep_icv_err_cnt[3]); 262 stats->bcn_rcv_cnt = le32_to_cpu(get_log->bcn_rcv_cnt); 263 stats->bcn_miss_cnt = le32_to_cpu(get_log->bcn_miss_cnt); 264 } 265 266 return 0; 267 } 268 269 /* 270 * This function handles the command response of set/get Tx rate 271 * configurations. 272 * 273 * Handling includes changing the header fields into CPU format 274 * and saving the following parameters in driver - 275 * - DSSS rate bitmap 276 * - OFDM rate bitmap 277 * - HT MCS rate bitmaps 278 * 279 * Based on the new rate bitmaps, the function re-evaluates if 280 * auto data rate has been activated. If not, it sends another 281 * query to the firmware to get the current Tx data rate. 282 */ 283 static int mwifiex_ret_tx_rate_cfg(struct mwifiex_private *priv, 284 struct host_cmd_ds_command *resp) 285 { 286 struct host_cmd_ds_tx_rate_cfg *rate_cfg = &resp->params.tx_rate_cfg; 287 struct mwifiex_rate_scope *rate_scope; 288 struct mwifiex_ie_types_header *head; 289 u16 tlv, tlv_buf_len, tlv_buf_left; 290 u8 *tlv_buf; 291 u32 i; 292 293 tlv_buf = ((u8 *)rate_cfg) + sizeof(struct host_cmd_ds_tx_rate_cfg); 294 tlv_buf_left = le16_to_cpu(resp->size) - S_DS_GEN - sizeof(*rate_cfg); 295 296 while (tlv_buf_left >= sizeof(*head)) { 297 head = (struct mwifiex_ie_types_header *)tlv_buf; 298 tlv = le16_to_cpu(head->type); 299 tlv_buf_len = le16_to_cpu(head->len); 300 301 if (tlv_buf_left < (sizeof(*head) + tlv_buf_len)) 302 break; 303 304 switch (tlv) { 305 case TLV_TYPE_RATE_SCOPE: 306 rate_scope = (struct mwifiex_rate_scope *) tlv_buf; 307 priv->bitmap_rates[0] = 308 le16_to_cpu(rate_scope->hr_dsss_rate_bitmap); 309 priv->bitmap_rates[1] = 310 le16_to_cpu(rate_scope->ofdm_rate_bitmap); 311 for (i = 0; 312 i < 313 sizeof(rate_scope->ht_mcs_rate_bitmap) / 314 sizeof(u16); i++) 315 priv->bitmap_rates[2 + i] = 316 le16_to_cpu(rate_scope-> 317 ht_mcs_rate_bitmap[i]); 318 319 if (priv->adapter->fw_api_ver == MWIFIEX_FW_V15) { 320 for (i = 0; i < ARRAY_SIZE(rate_scope-> 321 vht_mcs_rate_bitmap); 322 i++) 323 priv->bitmap_rates[10 + i] = 324 le16_to_cpu(rate_scope-> 325 vht_mcs_rate_bitmap[i]); 326 } 327 break; 328 /* Add RATE_DROP tlv here */ 329 } 330 331 tlv_buf += (sizeof(*head) + tlv_buf_len); 332 tlv_buf_left -= (sizeof(*head) + tlv_buf_len); 333 } 334 335 priv->is_data_rate_auto = mwifiex_is_rate_auto(priv); 336 337 if (priv->is_data_rate_auto) 338 priv->data_rate = 0; 339 else 340 return mwifiex_send_cmd(priv, HostCmd_CMD_802_11_TX_RATE_QUERY, 341 HostCmd_ACT_GEN_GET, 0, NULL, false); 342 343 return 0; 344 } 345 346 /* 347 * This function handles the command response of get Tx power level. 348 * 349 * Handling includes saving the maximum and minimum Tx power levels 350 * in driver, as well as sending the values to user. 351 */ 352 static int mwifiex_get_power_level(struct mwifiex_private *priv, void *data_buf) 353 { 354 int length, max_power = -1, min_power = -1; 355 struct mwifiex_types_power_group *pg_tlv_hdr; 356 struct mwifiex_power_group *pg; 357 358 if (!data_buf) 359 return -1; 360 361 pg_tlv_hdr = (struct mwifiex_types_power_group *)((u8 *)data_buf); 362 pg = (struct mwifiex_power_group *) 363 ((u8 *) pg_tlv_hdr + sizeof(struct mwifiex_types_power_group)); 364 length = le16_to_cpu(pg_tlv_hdr->length); 365 366 /* At least one structure required to update power */ 367 if (length < sizeof(struct mwifiex_power_group)) 368 return 0; 369 370 max_power = pg->power_max; 371 min_power = pg->power_min; 372 length -= sizeof(struct mwifiex_power_group); 373 374 while (length >= sizeof(struct mwifiex_power_group)) { 375 pg++; 376 if (max_power < pg->power_max) 377 max_power = pg->power_max; 378 379 if (min_power > pg->power_min) 380 min_power = pg->power_min; 381 382 length -= sizeof(struct mwifiex_power_group); 383 } 384 priv->min_tx_power_level = (u8) min_power; 385 priv->max_tx_power_level = (u8) max_power; 386 387 return 0; 388 } 389 390 /* 391 * This function handles the command response of set/get Tx power 392 * configurations. 393 * 394 * Handling includes changing the header fields into CPU format 395 * and saving the current Tx power level in driver. 396 */ 397 static int mwifiex_ret_tx_power_cfg(struct mwifiex_private *priv, 398 struct host_cmd_ds_command *resp) 399 { 400 struct mwifiex_adapter *adapter = priv->adapter; 401 struct host_cmd_ds_txpwr_cfg *txp_cfg = &resp->params.txp_cfg; 402 struct mwifiex_types_power_group *pg_tlv_hdr; 403 struct mwifiex_power_group *pg; 404 u16 action = le16_to_cpu(txp_cfg->action); 405 u16 tlv_buf_left; 406 407 pg_tlv_hdr = (struct mwifiex_types_power_group *) 408 ((u8 *)txp_cfg + 409 sizeof(struct host_cmd_ds_txpwr_cfg)); 410 411 pg = (struct mwifiex_power_group *) 412 ((u8 *)pg_tlv_hdr + 413 sizeof(struct mwifiex_types_power_group)); 414 415 tlv_buf_left = le16_to_cpu(resp->size) - S_DS_GEN - sizeof(*txp_cfg); 416 if (tlv_buf_left < 417 le16_to_cpu(pg_tlv_hdr->length) + sizeof(*pg_tlv_hdr)) 418 return 0; 419 420 switch (action) { 421 case HostCmd_ACT_GEN_GET: 422 if (adapter->hw_status == MWIFIEX_HW_STATUS_INITIALIZING) 423 mwifiex_get_power_level(priv, pg_tlv_hdr); 424 425 priv->tx_power_level = (u16) pg->power_min; 426 break; 427 428 case HostCmd_ACT_GEN_SET: 429 if (!le32_to_cpu(txp_cfg->mode)) 430 break; 431 432 if (pg->power_max == pg->power_min) 433 priv->tx_power_level = (u16) pg->power_min; 434 break; 435 default: 436 mwifiex_dbg(adapter, ERROR, 437 "CMD_RESP: unknown cmd action %d\n", 438 action); 439 return 0; 440 } 441 mwifiex_dbg(adapter, INFO, 442 "info: Current TxPower Level = %d, Max Power=%d, Min Power=%d\n", 443 priv->tx_power_level, priv->max_tx_power_level, 444 priv->min_tx_power_level); 445 446 return 0; 447 } 448 449 /* 450 * This function handles the command response of get RF Tx power. 451 */ 452 static int mwifiex_ret_rf_tx_power(struct mwifiex_private *priv, 453 struct host_cmd_ds_command *resp) 454 { 455 struct host_cmd_ds_rf_tx_pwr *txp = &resp->params.txp; 456 u16 action = le16_to_cpu(txp->action); 457 458 priv->tx_power_level = le16_to_cpu(txp->cur_level); 459 460 if (action == HostCmd_ACT_GEN_GET) { 461 priv->max_tx_power_level = txp->max_power; 462 priv->min_tx_power_level = txp->min_power; 463 } 464 465 mwifiex_dbg(priv->adapter, INFO, 466 "Current TxPower Level=%d, Max Power=%d, Min Power=%d\n", 467 priv->tx_power_level, priv->max_tx_power_level, 468 priv->min_tx_power_level); 469 470 return 0; 471 } 472 473 /* 474 * This function handles the command response of set rf antenna 475 */ 476 static int mwifiex_ret_rf_antenna(struct mwifiex_private *priv, 477 struct host_cmd_ds_command *resp) 478 { 479 struct host_cmd_ds_rf_ant_mimo *ant_mimo = &resp->params.ant_mimo; 480 struct host_cmd_ds_rf_ant_siso *ant_siso = &resp->params.ant_siso; 481 struct mwifiex_adapter *adapter = priv->adapter; 482 483 if (adapter->hw_dev_mcs_support == HT_STREAM_2X2) 484 mwifiex_dbg(adapter, INFO, 485 "RF_ANT_RESP: Tx action = 0x%x, Tx Mode = 0x%04x\t" 486 "Rx action = 0x%x, Rx Mode = 0x%04x\n", 487 le16_to_cpu(ant_mimo->action_tx), 488 le16_to_cpu(ant_mimo->tx_ant_mode), 489 le16_to_cpu(ant_mimo->action_rx), 490 le16_to_cpu(ant_mimo->rx_ant_mode)); 491 else 492 mwifiex_dbg(adapter, INFO, 493 "RF_ANT_RESP: action = 0x%x, Mode = 0x%04x\n", 494 le16_to_cpu(ant_siso->action), 495 le16_to_cpu(ant_siso->ant_mode)); 496 497 return 0; 498 } 499 500 /* 501 * This function handles the command response of set/get MAC address. 502 * 503 * Handling includes saving the MAC address in driver. 504 */ 505 static int mwifiex_ret_802_11_mac_address(struct mwifiex_private *priv, 506 struct host_cmd_ds_command *resp) 507 { 508 struct host_cmd_ds_802_11_mac_address *cmd_mac_addr = 509 &resp->params.mac_addr; 510 511 memcpy(priv->curr_addr, cmd_mac_addr->mac_addr, ETH_ALEN); 512 513 mwifiex_dbg(priv->adapter, INFO, 514 "info: set mac address: %pM\n", priv->curr_addr); 515 516 return 0; 517 } 518 519 /* 520 * This function handles the command response of set/get MAC multicast 521 * address. 522 */ 523 static int mwifiex_ret_mac_multicast_adr(struct mwifiex_private *priv, 524 struct host_cmd_ds_command *resp) 525 { 526 return 0; 527 } 528 529 /* 530 * This function handles the command response of get Tx rate query. 531 * 532 * Handling includes changing the header fields into CPU format 533 * and saving the Tx rate and HT information parameters in driver. 534 * 535 * Both rate configuration and current data rate can be retrieved 536 * with this request. 537 */ 538 static int mwifiex_ret_802_11_tx_rate_query(struct mwifiex_private *priv, 539 struct host_cmd_ds_command *resp) 540 { 541 priv->tx_rate = resp->params.tx_rate.tx_rate; 542 priv->tx_htinfo = resp->params.tx_rate.ht_info; 543 if (!priv->is_data_rate_auto) 544 priv->data_rate = 545 mwifiex_index_to_data_rate(priv, priv->tx_rate, 546 priv->tx_htinfo); 547 548 return 0; 549 } 550 551 /* 552 * This function handles the command response of a deauthenticate 553 * command. 554 * 555 * If the deauthenticated MAC matches the current BSS MAC, the connection 556 * state is reset. 557 */ 558 static int mwifiex_ret_802_11_deauthenticate(struct mwifiex_private *priv, 559 struct host_cmd_ds_command *resp) 560 { 561 struct mwifiex_adapter *adapter = priv->adapter; 562 563 adapter->dbg.num_cmd_deauth++; 564 if (!memcmp(resp->params.deauth.mac_addr, 565 &priv->curr_bss_params.bss_descriptor.mac_address, 566 sizeof(resp->params.deauth.mac_addr))) 567 mwifiex_reset_connect_state(priv, WLAN_REASON_DEAUTH_LEAVING); 568 569 return 0; 570 } 571 572 /* 573 * This function handles the command response of ad-hoc stop. 574 * 575 * The function resets the connection state in driver. 576 */ 577 static int mwifiex_ret_802_11_ad_hoc_stop(struct mwifiex_private *priv, 578 struct host_cmd_ds_command *resp) 579 { 580 mwifiex_reset_connect_state(priv, WLAN_REASON_DEAUTH_LEAVING); 581 return 0; 582 } 583 584 /* 585 * This function handles the command response of set/get v1 key material. 586 * 587 * Handling includes updating the driver parameters to reflect the 588 * changes. 589 */ 590 static int mwifiex_ret_802_11_key_material_v1(struct mwifiex_private *priv, 591 struct host_cmd_ds_command *resp) 592 { 593 struct host_cmd_ds_802_11_key_material *key = 594 &resp->params.key_material; 595 596 if (le16_to_cpu(key->action) == HostCmd_ACT_GEN_SET) { 597 if ((le16_to_cpu(key->key_param_set.key_info) & KEY_MCAST)) { 598 mwifiex_dbg(priv->adapter, INFO, 599 "info: key: GTK is set\n"); 600 priv->wpa_is_gtk_set = true; 601 priv->scan_block = false; 602 priv->port_open = true; 603 } 604 } 605 606 memset(priv->aes_key.key_param_set.key, 0, 607 sizeof(key->key_param_set.key)); 608 priv->aes_key.key_param_set.key_len = key->key_param_set.key_len; 609 memcpy(priv->aes_key.key_param_set.key, key->key_param_set.key, 610 le16_to_cpu(priv->aes_key.key_param_set.key_len)); 611 612 return 0; 613 } 614 615 /* 616 * This function handles the command response of set/get v2 key material. 617 * 618 * Handling includes updating the driver parameters to reflect the 619 * changes. 620 */ 621 static int mwifiex_ret_802_11_key_material_v2(struct mwifiex_private *priv, 622 struct host_cmd_ds_command *resp) 623 { 624 struct host_cmd_ds_802_11_key_material_v2 *key_v2; 625 __le16 len; 626 627 key_v2 = &resp->params.key_material_v2; 628 if (le16_to_cpu(key_v2->action) == HostCmd_ACT_GEN_SET) { 629 if ((le16_to_cpu(key_v2->key_param_set.key_info) & KEY_MCAST)) { 630 mwifiex_dbg(priv->adapter, INFO, "info: key: GTK is set\n"); 631 priv->wpa_is_gtk_set = true; 632 priv->scan_block = false; 633 priv->port_open = true; 634 } 635 } 636 637 if (key_v2->key_param_set.key_type != KEY_TYPE_ID_AES) 638 return 0; 639 640 memset(priv->aes_key_v2.key_param_set.key_params.aes.key, 0, 641 WLAN_KEY_LEN_CCMP); 642 priv->aes_key_v2.key_param_set.key_params.aes.key_len = 643 key_v2->key_param_set.key_params.aes.key_len; 644 len = priv->aes_key_v2.key_param_set.key_params.aes.key_len; 645 memcpy(priv->aes_key_v2.key_param_set.key_params.aes.key, 646 key_v2->key_param_set.key_params.aes.key, le16_to_cpu(len)); 647 648 return 0; 649 } 650 651 /* Wrapper function for processing response of key material command */ 652 static int mwifiex_ret_802_11_key_material(struct mwifiex_private *priv, 653 struct host_cmd_ds_command *resp) 654 { 655 if (priv->adapter->key_api_major_ver == KEY_API_VER_MAJOR_V2) 656 return mwifiex_ret_802_11_key_material_v2(priv, resp); 657 else 658 return mwifiex_ret_802_11_key_material_v1(priv, resp); 659 } 660 661 /* 662 * This function handles the command response of get 11d domain information. 663 */ 664 static int mwifiex_ret_802_11d_domain_info(struct mwifiex_private *priv, 665 struct host_cmd_ds_command *resp) 666 { 667 struct host_cmd_ds_802_11d_domain_info_rsp *domain_info = 668 &resp->params.domain_info_resp; 669 struct mwifiex_ietypes_domain_param_set *domain = &domain_info->domain; 670 u16 action = le16_to_cpu(domain_info->action); 671 u8 no_of_triplet; 672 673 no_of_triplet = (u8) ((le16_to_cpu(domain->header.len) 674 - IEEE80211_COUNTRY_STRING_LEN) 675 / sizeof(struct ieee80211_country_ie_triplet)); 676 677 mwifiex_dbg(priv->adapter, INFO, 678 "info: 11D Domain Info Resp: no_of_triplet=%d\n", 679 no_of_triplet); 680 681 if (no_of_triplet > MWIFIEX_MAX_TRIPLET_802_11D) { 682 mwifiex_dbg(priv->adapter, FATAL, 683 "11D: invalid number of triplets %d returned\n", 684 no_of_triplet); 685 return -1; 686 } 687 688 switch (action) { 689 case HostCmd_ACT_GEN_SET: /* Proc Set Action */ 690 break; 691 case HostCmd_ACT_GEN_GET: 692 break; 693 default: 694 mwifiex_dbg(priv->adapter, ERROR, 695 "11D: invalid action:%d\n", domain_info->action); 696 return -1; 697 } 698 699 return 0; 700 } 701 702 /* 703 * This function handles the command response of get extended version. 704 * 705 * Handling includes forming the extended version string and sending it 706 * to application. 707 */ 708 static int mwifiex_ret_ver_ext(struct mwifiex_private *priv, 709 struct host_cmd_ds_command *resp, 710 struct host_cmd_ds_version_ext *version_ext) 711 { 712 struct host_cmd_ds_version_ext *ver_ext = &resp->params.verext; 713 714 if (version_ext) { 715 version_ext->version_str_sel = ver_ext->version_str_sel; 716 memcpy(version_ext->version_str, ver_ext->version_str, 717 sizeof(char) * 128); 718 memcpy(priv->version_str, ver_ext->version_str, 128); 719 } 720 return 0; 721 } 722 723 /* 724 * This function handles the command response of remain on channel. 725 */ 726 static int 727 mwifiex_ret_remain_on_chan(struct mwifiex_private *priv, 728 struct host_cmd_ds_command *resp, 729 struct host_cmd_ds_remain_on_chan *roc_cfg) 730 { 731 struct host_cmd_ds_remain_on_chan *resp_cfg = &resp->params.roc_cfg; 732 733 if (roc_cfg) 734 memcpy(roc_cfg, resp_cfg, sizeof(*roc_cfg)); 735 736 return 0; 737 } 738 739 /* 740 * This function handles the command response of P2P mode cfg. 741 */ 742 static int 743 mwifiex_ret_p2p_mode_cfg(struct mwifiex_private *priv, 744 struct host_cmd_ds_command *resp, 745 void *data_buf) 746 { 747 struct host_cmd_ds_p2p_mode_cfg *mode_cfg = &resp->params.mode_cfg; 748 749 if (data_buf) 750 *((u16 *)data_buf) = le16_to_cpu(mode_cfg->mode); 751 752 return 0; 753 } 754 755 /* This function handles the command response of mem_access command 756 */ 757 static int 758 mwifiex_ret_mem_access(struct mwifiex_private *priv, 759 struct host_cmd_ds_command *resp, void *pioctl_buf) 760 { 761 struct host_cmd_ds_mem_access *mem = (void *)&resp->params.mem; 762 763 priv->mem_rw.addr = le32_to_cpu(mem->addr); 764 priv->mem_rw.value = le32_to_cpu(mem->value); 765 766 return 0; 767 } 768 /* 769 * This function handles the command response of register access. 770 * 771 * The register value and offset are returned to the user. For EEPROM 772 * access, the byte count is also returned. 773 */ 774 static int mwifiex_ret_reg_access(u16 type, struct host_cmd_ds_command *resp, 775 void *data_buf) 776 { 777 struct mwifiex_ds_reg_rw *reg_rw; 778 struct mwifiex_ds_read_eeprom *eeprom; 779 union reg { 780 struct host_cmd_ds_mac_reg_access *mac; 781 struct host_cmd_ds_bbp_reg_access *bbp; 782 struct host_cmd_ds_rf_reg_access *rf; 783 struct host_cmd_ds_pmic_reg_access *pmic; 784 struct host_cmd_ds_802_11_eeprom_access *eeprom; 785 } r; 786 787 if (!data_buf) 788 return 0; 789 790 reg_rw = data_buf; 791 eeprom = data_buf; 792 switch (type) { 793 case HostCmd_CMD_MAC_REG_ACCESS: 794 r.mac = &resp->params.mac_reg; 795 reg_rw->offset = cpu_to_le32((u32) le16_to_cpu(r.mac->offset)); 796 reg_rw->value = r.mac->value; 797 break; 798 case HostCmd_CMD_BBP_REG_ACCESS: 799 r.bbp = &resp->params.bbp_reg; 800 reg_rw->offset = cpu_to_le32((u32) le16_to_cpu(r.bbp->offset)); 801 reg_rw->value = cpu_to_le32((u32) r.bbp->value); 802 break; 803 804 case HostCmd_CMD_RF_REG_ACCESS: 805 r.rf = &resp->params.rf_reg; 806 reg_rw->offset = cpu_to_le32((u32) le16_to_cpu(r.rf->offset)); 807 reg_rw->value = cpu_to_le32((u32) r.bbp->value); 808 break; 809 case HostCmd_CMD_PMIC_REG_ACCESS: 810 r.pmic = &resp->params.pmic_reg; 811 reg_rw->offset = cpu_to_le32((u32) le16_to_cpu(r.pmic->offset)); 812 reg_rw->value = cpu_to_le32((u32) r.pmic->value); 813 break; 814 case HostCmd_CMD_CAU_REG_ACCESS: 815 r.rf = &resp->params.rf_reg; 816 reg_rw->offset = cpu_to_le32((u32) le16_to_cpu(r.rf->offset)); 817 reg_rw->value = cpu_to_le32((u32) r.rf->value); 818 break; 819 case HostCmd_CMD_802_11_EEPROM_ACCESS: 820 r.eeprom = &resp->params.eeprom; 821 pr_debug("info: EEPROM read len=%x\n", r.eeprom->byte_count); 822 if (le16_to_cpu(eeprom->byte_count) < 823 le16_to_cpu(r.eeprom->byte_count)) { 824 eeprom->byte_count = cpu_to_le16(0); 825 pr_debug("info: EEPROM read length is too big\n"); 826 return -1; 827 } 828 eeprom->offset = r.eeprom->offset; 829 eeprom->byte_count = r.eeprom->byte_count; 830 if (le16_to_cpu(eeprom->byte_count) > 0) 831 memcpy(&eeprom->value, &r.eeprom->value, 832 le16_to_cpu(r.eeprom->byte_count)); 833 834 break; 835 default: 836 return -1; 837 } 838 return 0; 839 } 840 841 /* 842 * This function handles the command response of get IBSS coalescing status. 843 * 844 * If the received BSSID is different than the current one, the current BSSID, 845 * beacon interval, ATIM window and ERP information are updated, along with 846 * changing the ad-hoc state accordingly. 847 */ 848 static int mwifiex_ret_ibss_coalescing_status(struct mwifiex_private *priv, 849 struct host_cmd_ds_command *resp) 850 { 851 struct host_cmd_ds_802_11_ibss_status *ibss_coal_resp = 852 &(resp->params.ibss_coalescing); 853 854 if (le16_to_cpu(ibss_coal_resp->action) == HostCmd_ACT_GEN_SET) 855 return 0; 856 857 mwifiex_dbg(priv->adapter, INFO, 858 "info: new BSSID %pM\n", ibss_coal_resp->bssid); 859 860 /* If rsp has NULL BSSID, Just return..... No Action */ 861 if (is_zero_ether_addr(ibss_coal_resp->bssid)) { 862 mwifiex_dbg(priv->adapter, FATAL, "new BSSID is NULL\n"); 863 return 0; 864 } 865 866 /* If BSSID is diff, modify current BSS parameters */ 867 if (!ether_addr_equal(priv->curr_bss_params.bss_descriptor.mac_address, ibss_coal_resp->bssid)) { 868 /* BSSID */ 869 memcpy(priv->curr_bss_params.bss_descriptor.mac_address, 870 ibss_coal_resp->bssid, ETH_ALEN); 871 872 /* Beacon Interval */ 873 priv->curr_bss_params.bss_descriptor.beacon_period 874 = le16_to_cpu(ibss_coal_resp->beacon_interval); 875 876 /* ERP Information */ 877 priv->curr_bss_params.bss_descriptor.erp_flags = 878 (u8) le16_to_cpu(ibss_coal_resp->use_g_rate_protect); 879 880 priv->adhoc_state = ADHOC_COALESCED; 881 } 882 883 return 0; 884 } 885 static int mwifiex_ret_tdls_oper(struct mwifiex_private *priv, 886 struct host_cmd_ds_command *resp) 887 { 888 struct host_cmd_ds_tdls_oper *cmd_tdls_oper = &resp->params.tdls_oper; 889 u16 reason = le16_to_cpu(cmd_tdls_oper->reason); 890 u16 action = le16_to_cpu(cmd_tdls_oper->tdls_action); 891 struct mwifiex_sta_node *node = 892 mwifiex_get_sta_entry(priv, cmd_tdls_oper->peer_mac); 893 894 switch (action) { 895 case ACT_TDLS_DELETE: 896 if (reason) { 897 if (!node || reason == TDLS_ERR_LINK_NONEXISTENT) 898 mwifiex_dbg(priv->adapter, MSG, 899 "TDLS link delete for %pM failed: reason %d\n", 900 cmd_tdls_oper->peer_mac, reason); 901 else 902 mwifiex_dbg(priv->adapter, ERROR, 903 "TDLS link delete for %pM failed: reason %d\n", 904 cmd_tdls_oper->peer_mac, reason); 905 } else { 906 mwifiex_dbg(priv->adapter, MSG, 907 "TDLS link delete for %pM successful\n", 908 cmd_tdls_oper->peer_mac); 909 } 910 break; 911 case ACT_TDLS_CREATE: 912 if (reason) { 913 mwifiex_dbg(priv->adapter, ERROR, 914 "TDLS link creation for %pM failed: reason %d", 915 cmd_tdls_oper->peer_mac, reason); 916 if (node && reason != TDLS_ERR_LINK_EXISTS) 917 node->tdls_status = TDLS_SETUP_FAILURE; 918 } else { 919 mwifiex_dbg(priv->adapter, MSG, 920 "TDLS link creation for %pM successful", 921 cmd_tdls_oper->peer_mac); 922 } 923 break; 924 case ACT_TDLS_CONFIG: 925 if (reason) { 926 mwifiex_dbg(priv->adapter, ERROR, 927 "TDLS link config for %pM failed, reason %d\n", 928 cmd_tdls_oper->peer_mac, reason); 929 if (node) 930 node->tdls_status = TDLS_SETUP_FAILURE; 931 } else { 932 mwifiex_dbg(priv->adapter, MSG, 933 "TDLS link config for %pM successful\n", 934 cmd_tdls_oper->peer_mac); 935 } 936 break; 937 default: 938 mwifiex_dbg(priv->adapter, ERROR, 939 "Unknown TDLS command action response %d", action); 940 return -1; 941 } 942 943 return 0; 944 } 945 /* 946 * This function handles the command response for subscribe event command. 947 */ 948 static int mwifiex_ret_subsc_evt(struct mwifiex_private *priv, 949 struct host_cmd_ds_command *resp) 950 { 951 struct host_cmd_ds_802_11_subsc_evt *cmd_sub_event = 952 &resp->params.subsc_evt; 953 954 /* For every subscribe event command (Get/Set/Clear), FW reports the 955 * current set of subscribed events*/ 956 mwifiex_dbg(priv->adapter, EVENT, 957 "Bitmap of currently subscribed events: %16x\n", 958 le16_to_cpu(cmd_sub_event->events)); 959 960 return 0; 961 } 962 963 static int mwifiex_ret_uap_sta_list(struct mwifiex_private *priv, 964 struct host_cmd_ds_command *resp) 965 { 966 struct host_cmd_ds_sta_list *sta_list = 967 &resp->params.sta_list; 968 struct mwifiex_ie_types_sta_info *sta_info = (void *)&sta_list->tlv; 969 int i; 970 struct mwifiex_sta_node *sta_node; 971 972 for (i = 0; i < sta_list->sta_count; i++) { 973 sta_node = mwifiex_get_sta_entry(priv, sta_info->mac); 974 if (unlikely(!sta_node)) 975 continue; 976 977 sta_node->stats.rssi = sta_info->rssi; 978 sta_info++; 979 } 980 981 return 0; 982 } 983 984 /* This function handles the command response of set_cfg_data */ 985 static int mwifiex_ret_cfg_data(struct mwifiex_private *priv, 986 struct host_cmd_ds_command *resp) 987 { 988 if (resp->result != HostCmd_RESULT_OK) { 989 mwifiex_dbg(priv->adapter, ERROR, "Cal data cmd resp failed\n"); 990 return -1; 991 } 992 993 return 0; 994 } 995 996 /** This Function handles the command response of sdio rx aggr */ 997 static int mwifiex_ret_sdio_rx_aggr_cfg(struct mwifiex_private *priv, 998 struct host_cmd_ds_command *resp) 999 { 1000 struct mwifiex_adapter *adapter = priv->adapter; 1001 struct host_cmd_sdio_sp_rx_aggr_cfg *cfg = 1002 &resp->params.sdio_rx_aggr_cfg; 1003 1004 adapter->sdio_rx_aggr_enable = cfg->enable; 1005 adapter->sdio_rx_block_size = le16_to_cpu(cfg->block_size); 1006 1007 return 0; 1008 } 1009 1010 static int mwifiex_ret_robust_coex(struct mwifiex_private *priv, 1011 struct host_cmd_ds_command *resp, 1012 bool *is_timeshare) 1013 { 1014 struct host_cmd_ds_robust_coex *coex = &resp->params.coex; 1015 struct mwifiex_ie_types_robust_coex *coex_tlv; 1016 u16 action = le16_to_cpu(coex->action); 1017 u32 mode; 1018 1019 coex_tlv = (struct mwifiex_ie_types_robust_coex 1020 *)((u8 *)coex + sizeof(struct host_cmd_ds_robust_coex)); 1021 if (action == HostCmd_ACT_GEN_GET) { 1022 mode = le32_to_cpu(coex_tlv->mode); 1023 if (mode == MWIFIEX_COEX_MODE_TIMESHARE) 1024 *is_timeshare = true; 1025 else 1026 *is_timeshare = false; 1027 } 1028 1029 return 0; 1030 } 1031 1032 /* 1033 * This function handles the command responses. 1034 * 1035 * This is a generic function, which calls command specific 1036 * response handlers based on the command ID. 1037 */ 1038 int mwifiex_process_sta_cmdresp(struct mwifiex_private *priv, u16 cmdresp_no, 1039 struct host_cmd_ds_command *resp) 1040 { 1041 int ret = 0; 1042 struct mwifiex_adapter *adapter = priv->adapter; 1043 void *data_buf = adapter->curr_cmd->data_buf; 1044 1045 /* If the command is not successful, cleanup and return failure */ 1046 if (resp->result != HostCmd_RESULT_OK) { 1047 mwifiex_process_cmdresp_error(priv, resp); 1048 return -1; 1049 } 1050 /* Command successful, handle response */ 1051 switch (cmdresp_no) { 1052 case HostCmd_CMD_GET_HW_SPEC: 1053 ret = mwifiex_ret_get_hw_spec(priv, resp); 1054 break; 1055 case HostCmd_CMD_CFG_DATA: 1056 ret = mwifiex_ret_cfg_data(priv, resp); 1057 break; 1058 case HostCmd_CMD_MAC_CONTROL: 1059 break; 1060 case HostCmd_CMD_802_11_MAC_ADDRESS: 1061 ret = mwifiex_ret_802_11_mac_address(priv, resp); 1062 break; 1063 case HostCmd_CMD_MAC_MULTICAST_ADR: 1064 ret = mwifiex_ret_mac_multicast_adr(priv, resp); 1065 break; 1066 case HostCmd_CMD_TX_RATE_CFG: 1067 ret = mwifiex_ret_tx_rate_cfg(priv, resp); 1068 break; 1069 case HostCmd_CMD_802_11_SCAN: 1070 ret = mwifiex_ret_802_11_scan(priv, resp); 1071 adapter->curr_cmd->wait_q_enabled = false; 1072 break; 1073 case HostCmd_CMD_802_11_SCAN_EXT: 1074 ret = mwifiex_ret_802_11_scan_ext(priv, resp); 1075 adapter->curr_cmd->wait_q_enabled = false; 1076 break; 1077 case HostCmd_CMD_802_11_BG_SCAN_QUERY: 1078 ret = mwifiex_ret_802_11_scan(priv, resp); 1079 cfg80211_sched_scan_results(priv->wdev.wiphy); 1080 mwifiex_dbg(adapter, CMD, 1081 "info: CMD_RESP: BG_SCAN result is ready!\n"); 1082 break; 1083 case HostCmd_CMD_802_11_BG_SCAN_CONFIG: 1084 break; 1085 case HostCmd_CMD_TXPWR_CFG: 1086 ret = mwifiex_ret_tx_power_cfg(priv, resp); 1087 break; 1088 case HostCmd_CMD_RF_TX_PWR: 1089 ret = mwifiex_ret_rf_tx_power(priv, resp); 1090 break; 1091 case HostCmd_CMD_RF_ANTENNA: 1092 ret = mwifiex_ret_rf_antenna(priv, resp); 1093 break; 1094 case HostCmd_CMD_802_11_PS_MODE_ENH: 1095 ret = mwifiex_ret_enh_power_mode(priv, resp, data_buf); 1096 break; 1097 case HostCmd_CMD_802_11_HS_CFG_ENH: 1098 ret = mwifiex_ret_802_11_hs_cfg(priv, resp); 1099 break; 1100 case HostCmd_CMD_802_11_ASSOCIATE: 1101 ret = mwifiex_ret_802_11_associate(priv, resp); 1102 break; 1103 case HostCmd_CMD_802_11_DEAUTHENTICATE: 1104 ret = mwifiex_ret_802_11_deauthenticate(priv, resp); 1105 break; 1106 case HostCmd_CMD_802_11_AD_HOC_START: 1107 case HostCmd_CMD_802_11_AD_HOC_JOIN: 1108 ret = mwifiex_ret_802_11_ad_hoc(priv, resp); 1109 break; 1110 case HostCmd_CMD_802_11_AD_HOC_STOP: 1111 ret = mwifiex_ret_802_11_ad_hoc_stop(priv, resp); 1112 break; 1113 case HostCmd_CMD_802_11_GET_LOG: 1114 ret = mwifiex_ret_get_log(priv, resp, data_buf); 1115 break; 1116 case HostCmd_CMD_RSSI_INFO: 1117 ret = mwifiex_ret_802_11_rssi_info(priv, resp); 1118 break; 1119 case HostCmd_CMD_802_11_SNMP_MIB: 1120 ret = mwifiex_ret_802_11_snmp_mib(priv, resp, data_buf); 1121 break; 1122 case HostCmd_CMD_802_11_TX_RATE_QUERY: 1123 ret = mwifiex_ret_802_11_tx_rate_query(priv, resp); 1124 break; 1125 case HostCmd_CMD_VERSION_EXT: 1126 ret = mwifiex_ret_ver_ext(priv, resp, data_buf); 1127 break; 1128 case HostCmd_CMD_REMAIN_ON_CHAN: 1129 ret = mwifiex_ret_remain_on_chan(priv, resp, data_buf); 1130 break; 1131 case HostCmd_CMD_11AC_CFG: 1132 break; 1133 case HostCmd_CMD_P2P_MODE_CFG: 1134 ret = mwifiex_ret_p2p_mode_cfg(priv, resp, data_buf); 1135 break; 1136 case HostCmd_CMD_MGMT_FRAME_REG: 1137 case HostCmd_CMD_FUNC_INIT: 1138 case HostCmd_CMD_FUNC_SHUTDOWN: 1139 break; 1140 case HostCmd_CMD_802_11_KEY_MATERIAL: 1141 ret = mwifiex_ret_802_11_key_material(priv, resp); 1142 break; 1143 case HostCmd_CMD_802_11D_DOMAIN_INFO: 1144 ret = mwifiex_ret_802_11d_domain_info(priv, resp); 1145 break; 1146 case HostCmd_CMD_11N_ADDBA_REQ: 1147 ret = mwifiex_ret_11n_addba_req(priv, resp); 1148 break; 1149 case HostCmd_CMD_11N_DELBA: 1150 ret = mwifiex_ret_11n_delba(priv, resp); 1151 break; 1152 case HostCmd_CMD_11N_ADDBA_RSP: 1153 ret = mwifiex_ret_11n_addba_resp(priv, resp); 1154 break; 1155 case HostCmd_CMD_RECONFIGURE_TX_BUFF: 1156 if (0xffff == (u16)le16_to_cpu(resp->params.tx_buf.buff_size)) { 1157 if (adapter->iface_type == MWIFIEX_USB && 1158 adapter->usb_mc_setup) { 1159 if (adapter->if_ops.multi_port_resync) 1160 adapter->if_ops. 1161 multi_port_resync(adapter); 1162 adapter->usb_mc_setup = false; 1163 adapter->tx_lock_flag = false; 1164 } 1165 break; 1166 } 1167 adapter->tx_buf_size = (u16) le16_to_cpu(resp->params. 1168 tx_buf.buff_size); 1169 adapter->tx_buf_size = (adapter->tx_buf_size 1170 / MWIFIEX_SDIO_BLOCK_SIZE) 1171 * MWIFIEX_SDIO_BLOCK_SIZE; 1172 adapter->curr_tx_buf_size = adapter->tx_buf_size; 1173 mwifiex_dbg(adapter, CMD, "cmd: curr_tx_buf_size=%d\n", 1174 adapter->curr_tx_buf_size); 1175 1176 if (adapter->if_ops.update_mp_end_port) 1177 adapter->if_ops.update_mp_end_port(adapter, 1178 le16_to_cpu(resp->params.tx_buf.mp_end_port)); 1179 break; 1180 case HostCmd_CMD_AMSDU_AGGR_CTRL: 1181 break; 1182 case HostCmd_CMD_WMM_GET_STATUS: 1183 ret = mwifiex_ret_wmm_get_status(priv, resp); 1184 break; 1185 case HostCmd_CMD_802_11_IBSS_COALESCING_STATUS: 1186 ret = mwifiex_ret_ibss_coalescing_status(priv, resp); 1187 break; 1188 case HostCmd_CMD_MEM_ACCESS: 1189 ret = mwifiex_ret_mem_access(priv, resp, data_buf); 1190 break; 1191 case HostCmd_CMD_MAC_REG_ACCESS: 1192 case HostCmd_CMD_BBP_REG_ACCESS: 1193 case HostCmd_CMD_RF_REG_ACCESS: 1194 case HostCmd_CMD_PMIC_REG_ACCESS: 1195 case HostCmd_CMD_CAU_REG_ACCESS: 1196 case HostCmd_CMD_802_11_EEPROM_ACCESS: 1197 ret = mwifiex_ret_reg_access(cmdresp_no, resp, data_buf); 1198 break; 1199 case HostCmd_CMD_SET_BSS_MODE: 1200 break; 1201 case HostCmd_CMD_11N_CFG: 1202 break; 1203 case HostCmd_CMD_PCIE_DESC_DETAILS: 1204 break; 1205 case HostCmd_CMD_802_11_SUBSCRIBE_EVENT: 1206 ret = mwifiex_ret_subsc_evt(priv, resp); 1207 break; 1208 case HostCmd_CMD_UAP_SYS_CONFIG: 1209 break; 1210 case HOST_CMD_APCMD_STA_LIST: 1211 ret = mwifiex_ret_uap_sta_list(priv, resp); 1212 break; 1213 case HostCmd_CMD_UAP_BSS_START: 1214 adapter->tx_lock_flag = false; 1215 adapter->pps_uapsd_mode = false; 1216 adapter->delay_null_pkt = false; 1217 priv->bss_started = 1; 1218 break; 1219 case HostCmd_CMD_UAP_BSS_STOP: 1220 priv->bss_started = 0; 1221 break; 1222 case HostCmd_CMD_UAP_STA_DEAUTH: 1223 break; 1224 case HOST_CMD_APCMD_SYS_RESET: 1225 break; 1226 case HostCmd_CMD_MEF_CFG: 1227 break; 1228 case HostCmd_CMD_COALESCE_CFG: 1229 break; 1230 case HostCmd_CMD_TDLS_OPER: 1231 ret = mwifiex_ret_tdls_oper(priv, resp); 1232 case HostCmd_CMD_MC_POLICY: 1233 break; 1234 case HostCmd_CMD_CHAN_REPORT_REQUEST: 1235 break; 1236 case HostCmd_CMD_SDIO_SP_RX_AGGR_CFG: 1237 ret = mwifiex_ret_sdio_rx_aggr_cfg(priv, resp); 1238 break; 1239 case HostCmd_CMD_HS_WAKEUP_REASON: 1240 ret = mwifiex_ret_wakeup_reason(priv, resp, data_buf); 1241 break; 1242 case HostCmd_CMD_TDLS_CONFIG: 1243 break; 1244 case HostCmd_CMD_ROBUST_COEX: 1245 ret = mwifiex_ret_robust_coex(priv, resp, data_buf); 1246 break; 1247 default: 1248 mwifiex_dbg(adapter, ERROR, 1249 "CMD_RESP: unknown cmd response %#x\n", 1250 resp->command); 1251 break; 1252 } 1253 1254 return ret; 1255 } 1256