aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/net/wireless/mwifiex/sta_cmd.c175
-rw-r--r--drivers/net/wireless/mwifiex/sta_cmdresp.c60
2 files changed, 114 insertions, 121 deletions
diff --git a/drivers/net/wireless/mwifiex/sta_cmd.c b/drivers/net/wireless/mwifiex/sta_cmd.c
index 324c651527cb..6c8e4594b48b 100644
--- a/drivers/net/wireless/mwifiex/sta_cmd.c
+++ b/drivers/net/wireless/mwifiex/sta_cmd.c
@@ -110,7 +110,7 @@ static int mwifiex_cmd_802_11_snmp_mib(struct mwifiex_private *priv,
110 dev_dbg(priv->adapter->dev, "cmd: SNMP_CMD: cmd_oid = 0x%x\n", cmd_oid); 110 dev_dbg(priv->adapter->dev, "cmd: SNMP_CMD: cmd_oid = 0x%x\n", cmd_oid);
111 cmd->command = cpu_to_le16(HostCmd_CMD_802_11_SNMP_MIB); 111 cmd->command = cpu_to_le16(HostCmd_CMD_802_11_SNMP_MIB);
112 cmd->size = cpu_to_le16(sizeof(struct host_cmd_ds_802_11_snmp_mib) 112 cmd->size = cpu_to_le16(sizeof(struct host_cmd_ds_802_11_snmp_mib)
113 - 1 + S_DS_GEN); 113 - 1 + S_DS_GEN);
114 114
115 snmp_mib->oid = cpu_to_le16((u16)cmd_oid); 115 snmp_mib->oid = cpu_to_le16((u16)cmd_oid);
116 if (cmd_action == HostCmd_ACT_GEN_GET) { 116 if (cmd_action == HostCmd_ACT_GEN_GET) {
@@ -127,8 +127,8 @@ static int mwifiex_cmd_802_11_snmp_mib(struct mwifiex_private *priv,
127 dev_dbg(priv->adapter->dev, 127 dev_dbg(priv->adapter->dev,
128 "cmd: SNMP_CMD: Action=0x%x, OID=0x%x, OIDSize=0x%x," 128 "cmd: SNMP_CMD: Action=0x%x, OID=0x%x, OIDSize=0x%x,"
129 " Value=0x%x\n", 129 " Value=0x%x\n",
130 cmd_action, cmd_oid, le16_to_cpu(snmp_mib->buf_size), 130 cmd_action, cmd_oid, le16_to_cpu(snmp_mib->buf_size),
131 le16_to_cpu(*(__le16 *) snmp_mib->value)); 131 le16_to_cpu(*(__le16 *) snmp_mib->value));
132 return 0; 132 return 0;
133} 133}
134 134
@@ -174,8 +174,8 @@ static int mwifiex_cmd_tx_rate_cfg(struct mwifiex_private *priv,
174 rate_scope = (struct mwifiex_rate_scope *) ((u8 *) rate_cfg + 174 rate_scope = (struct mwifiex_rate_scope *) ((u8 *) rate_cfg +
175 sizeof(struct host_cmd_ds_tx_rate_cfg)); 175 sizeof(struct host_cmd_ds_tx_rate_cfg));
176 rate_scope->type = cpu_to_le16(TLV_TYPE_RATE_SCOPE); 176 rate_scope->type = cpu_to_le16(TLV_TYPE_RATE_SCOPE);
177 rate_scope->length = cpu_to_le16(sizeof(struct mwifiex_rate_scope) - 177 rate_scope->length = cpu_to_le16
178 sizeof(struct mwifiex_ie_types_header)); 178 (sizeof(*rate_scope) - sizeof(struct mwifiex_ie_types_header));
179 if (pbitmap_rates != NULL) { 179 if (pbitmap_rates != NULL) {
180 rate_scope->hr_dsss_rate_bitmap = cpu_to_le16(pbitmap_rates[0]); 180 rate_scope->hr_dsss_rate_bitmap = cpu_to_le16(pbitmap_rates[0]);
181 rate_scope->ofdm_rate_bitmap = cpu_to_le16(pbitmap_rates[1]); 181 rate_scope->ofdm_rate_bitmap = cpu_to_le16(pbitmap_rates[1]);
@@ -197,7 +197,7 @@ static int mwifiex_cmd_tx_rate_cfg(struct mwifiex_private *priv,
197 } 197 }
198 198
199 rate_drop = (struct mwifiex_rate_drop_pattern *) ((u8 *) rate_scope + 199 rate_drop = (struct mwifiex_rate_drop_pattern *) ((u8 *) rate_scope +
200 sizeof(struct mwifiex_rate_scope)); 200 sizeof(struct mwifiex_rate_scope));
201 rate_drop->type = cpu_to_le16(TLV_TYPE_RATE_DROP_CONTROL); 201 rate_drop->type = cpu_to_le16(TLV_TYPE_RATE_DROP_CONTROL);
202 rate_drop->length = cpu_to_le16(sizeof(rate_drop->rate_drop_mode)); 202 rate_drop->length = cpu_to_le16(sizeof(rate_drop->rate_drop_mode));
203 rate_drop->rate_drop_mode = 0; 203 rate_drop->rate_drop_mode = 0;
@@ -284,22 +284,22 @@ mwifiex_cmd_802_11_hs_cfg(struct mwifiex_private *priv,
284 cmd->command = cpu_to_le16(HostCmd_CMD_802_11_HS_CFG_ENH); 284 cmd->command = cpu_to_le16(HostCmd_CMD_802_11_HS_CFG_ENH);
285 285
286 if (!hs_activate && 286 if (!hs_activate &&
287 (hscfg_param->conditions 287 (hscfg_param->conditions != cpu_to_le32(HOST_SLEEP_CFG_CANCEL)) &&
288 != cpu_to_le32(HOST_SLEEP_CFG_CANCEL)) 288 ((adapter->arp_filter_size > 0) &&
289 && ((adapter->arp_filter_size > 0) 289 (adapter->arp_filter_size <= ARP_FILTER_MAX_BUF_SIZE))) {
290 && (adapter->arp_filter_size <= ARP_FILTER_MAX_BUF_SIZE))) {
291 dev_dbg(adapter->dev, 290 dev_dbg(adapter->dev,
292 "cmd: Attach %d bytes ArpFilter to HSCfg cmd\n", 291 "cmd: Attach %d bytes ArpFilter to HSCfg cmd\n",
293 adapter->arp_filter_size); 292 adapter->arp_filter_size);
294 memcpy(((u8 *) hs_cfg) + 293 memcpy(((u8 *) hs_cfg) +
295 sizeof(struct host_cmd_ds_802_11_hs_cfg_enh), 294 sizeof(struct host_cmd_ds_802_11_hs_cfg_enh),
296 adapter->arp_filter, adapter->arp_filter_size); 295 adapter->arp_filter, adapter->arp_filter_size);
297 cmd->size = cpu_to_le16(adapter->arp_filter_size + 296 cmd->size = cpu_to_le16
298 sizeof(struct host_cmd_ds_802_11_hs_cfg_enh) 297 (adapter->arp_filter_size +
299 + S_DS_GEN); 298 sizeof(struct host_cmd_ds_802_11_hs_cfg_enh)
299 + S_DS_GEN);
300 } else { 300 } else {
301 cmd->size = cpu_to_le16(S_DS_GEN + sizeof(struct 301 cmd->size = cpu_to_le16(S_DS_GEN + sizeof(struct
302 host_cmd_ds_802_11_hs_cfg_enh)); 302 host_cmd_ds_802_11_hs_cfg_enh));
303 } 303 }
304 if (hs_activate) { 304 if (hs_activate) {
305 hs_cfg->action = cpu_to_le16(HS_ACTIVATE); 305 hs_cfg->action = cpu_to_le16(HS_ACTIVATE);
@@ -467,7 +467,7 @@ mwifiex_set_keyparamset_wep(struct mwifiex_private *priv,
467 key_param_set = 467 key_param_set =
468 (struct mwifiex_ie_type_key_param_set *) 468 (struct mwifiex_ie_type_key_param_set *)
469 ((u8 *)key_param_set + 469 ((u8 *)key_param_set +
470 cur_key_param_len); 470 cur_key_param_len);
471 } else if (!priv->wep_key[i].key_length) { 471 } else if (!priv->wep_key[i].key_length) {
472 continue; 472 continue;
473 } else { 473 } else {
@@ -527,13 +527,13 @@ mwifiex_cmd_802_11_key_material(struct mwifiex_private *priv,
527 if (enc_key->is_wapi_key) { 527 if (enc_key->is_wapi_key) {
528 dev_dbg(priv->adapter->dev, "info: Set WAPI Key\n"); 528 dev_dbg(priv->adapter->dev, "info: Set WAPI Key\n");
529 key_material->key_param_set.key_type_id = 529 key_material->key_param_set.key_type_id =
530 cpu_to_le16(KEY_TYPE_ID_WAPI); 530 cpu_to_le16(KEY_TYPE_ID_WAPI);
531 if (cmd_oid == KEY_INFO_ENABLED) 531 if (cmd_oid == KEY_INFO_ENABLED)
532 key_material->key_param_set.key_info = 532 key_material->key_param_set.key_info =
533 cpu_to_le16(KEY_ENABLED); 533 cpu_to_le16(KEY_ENABLED);
534 else 534 else
535 key_material->key_param_set.key_info = 535 key_material->key_param_set.key_info =
536 cpu_to_le16(!KEY_ENABLED); 536 cpu_to_le16(!KEY_ENABLED);
537 537
538 key_material->key_param_set.key[0] = enc_key->key_index; 538 key_material->key_param_set.key[0] = enc_key->key_index;
539 if (!priv->sec_info.wapi_key_on) 539 if (!priv->sec_info.wapi_key_on)
@@ -553,9 +553,9 @@ mwifiex_cmd_802_11_key_material(struct mwifiex_private *priv,
553 } 553 }
554 554
555 key_material->key_param_set.type = 555 key_material->key_param_set.type =
556 cpu_to_le16(TLV_TYPE_KEY_MATERIAL); 556 cpu_to_le16(TLV_TYPE_KEY_MATERIAL);
557 key_material->key_param_set.key_len = 557 key_material->key_param_set.key_len =
558 cpu_to_le16(WAPI_KEY_LEN); 558 cpu_to_le16(WAPI_KEY_LEN);
559 memcpy(&key_material->key_param_set.key[2], 559 memcpy(&key_material->key_param_set.key[2],
560 enc_key->key_material, enc_key->key_len); 560 enc_key->key_material, enc_key->key_len);
561 memcpy(&key_material->key_param_set.key[2 + enc_key->key_len], 561 memcpy(&key_material->key_param_set.key[2 + enc_key->key_len],
@@ -565,49 +565,49 @@ mwifiex_cmd_802_11_key_material(struct mwifiex_private *priv,
565 565
566 key_param_len = (WAPI_KEY_LEN + KEYPARAMSET_FIXED_LEN) + 566 key_param_len = (WAPI_KEY_LEN + KEYPARAMSET_FIXED_LEN) +
567 sizeof(struct mwifiex_ie_types_header); 567 sizeof(struct mwifiex_ie_types_header);
568 cmd->size = cpu_to_le16(key_param_len + 568 cmd->size = cpu_to_le16(sizeof(key_material->action)
569 sizeof(key_material->action) + S_DS_GEN); 569 + S_DS_GEN + key_param_len);
570 return ret; 570 return ret;
571 } 571 }
572 if (enc_key->key_len == WLAN_KEY_LEN_CCMP) { 572 if (enc_key->key_len == WLAN_KEY_LEN_CCMP) {
573 dev_dbg(priv->adapter->dev, "cmd: WPA_AES\n"); 573 dev_dbg(priv->adapter->dev, "cmd: WPA_AES\n");
574 key_material->key_param_set.key_type_id = 574 key_material->key_param_set.key_type_id =
575 cpu_to_le16(KEY_TYPE_ID_AES); 575 cpu_to_le16(KEY_TYPE_ID_AES);
576 if (cmd_oid == KEY_INFO_ENABLED) 576 if (cmd_oid == KEY_INFO_ENABLED)
577 key_material->key_param_set.key_info = 577 key_material->key_param_set.key_info =
578 cpu_to_le16(KEY_ENABLED); 578 cpu_to_le16(KEY_ENABLED);
579 else 579 else
580 key_material->key_param_set.key_info = 580 key_material->key_param_set.key_info =
581 cpu_to_le16(!KEY_ENABLED); 581 cpu_to_le16(!KEY_ENABLED);
582 582
583 if (enc_key->key_index & MWIFIEX_KEY_INDEX_UNICAST) 583 if (enc_key->key_index & MWIFIEX_KEY_INDEX_UNICAST)
584 /* AES pairwise key: unicast */ 584 /* AES pairwise key: unicast */
585 key_material->key_param_set.key_info |= 585 key_material->key_param_set.key_info |=
586 cpu_to_le16(KEY_UNICAST); 586 cpu_to_le16(KEY_UNICAST);
587 else /* AES group key: multicast */ 587 else /* AES group key: multicast */
588 key_material->key_param_set.key_info |= 588 key_material->key_param_set.key_info |=
589 cpu_to_le16(KEY_MCAST); 589 cpu_to_le16(KEY_MCAST);
590 } else if (enc_key->key_len == WLAN_KEY_LEN_TKIP) { 590 } else if (enc_key->key_len == WLAN_KEY_LEN_TKIP) {
591 dev_dbg(priv->adapter->dev, "cmd: WPA_TKIP\n"); 591 dev_dbg(priv->adapter->dev, "cmd: WPA_TKIP\n");
592 key_material->key_param_set.key_type_id = 592 key_material->key_param_set.key_type_id =
593 cpu_to_le16(KEY_TYPE_ID_TKIP); 593 cpu_to_le16(KEY_TYPE_ID_TKIP);
594 key_material->key_param_set.key_info = 594 key_material->key_param_set.key_info =
595 cpu_to_le16(KEY_ENABLED); 595 cpu_to_le16(KEY_ENABLED);
596 596
597 if (enc_key->key_index & MWIFIEX_KEY_INDEX_UNICAST) 597 if (enc_key->key_index & MWIFIEX_KEY_INDEX_UNICAST)
598 /* TKIP pairwise key: unicast */ 598 /* TKIP pairwise key: unicast */
599 key_material->key_param_set.key_info |= 599 key_material->key_param_set.key_info |=
600 cpu_to_le16(KEY_UNICAST); 600 cpu_to_le16(KEY_UNICAST);
601 else /* TKIP group key: multicast */ 601 else /* TKIP group key: multicast */
602 key_material->key_param_set.key_info |= 602 key_material->key_param_set.key_info |=
603 cpu_to_le16(KEY_MCAST); 603 cpu_to_le16(KEY_MCAST);
604 } 604 }
605 605
606 if (key_material->key_param_set.key_type_id) { 606 if (key_material->key_param_set.key_type_id) {
607 key_material->key_param_set.type = 607 key_material->key_param_set.type =
608 cpu_to_le16(TLV_TYPE_KEY_MATERIAL); 608 cpu_to_le16(TLV_TYPE_KEY_MATERIAL);
609 key_material->key_param_set.key_len = 609 key_material->key_param_set.key_len =
610 cpu_to_le16((u16) enc_key->key_len); 610 cpu_to_le16((u16) enc_key->key_len);
611 memcpy(key_material->key_param_set.key, enc_key->key_material, 611 memcpy(key_material->key_param_set.key, enc_key->key_material,
612 enc_key->key_len); 612 enc_key->key_len);
613 key_material->key_param_set.length = 613 key_material->key_param_set.length =
@@ -615,10 +615,10 @@ mwifiex_cmd_802_11_key_material(struct mwifiex_private *priv,
615 KEYPARAMSET_FIXED_LEN); 615 KEYPARAMSET_FIXED_LEN);
616 616
617 key_param_len = (u16) (enc_key->key_len + KEYPARAMSET_FIXED_LEN) 617 key_param_len = (u16) (enc_key->key_len + KEYPARAMSET_FIXED_LEN)
618 + sizeof(struct mwifiex_ie_types_header); 618 + sizeof(struct mwifiex_ie_types_header);
619 619
620 cmd->size = cpu_to_le16(key_param_len + 620 cmd->size = cpu_to_le16(sizeof(key_material->action) + S_DS_GEN
621 sizeof(key_material->action) + S_DS_GEN); 621 + key_param_len);
622 } 622 }
623 623
624 return ret; 624 return ret;
@@ -655,21 +655,22 @@ static int mwifiex_cmd_802_11d_domain_info(struct mwifiex_private *priv,
655 /* Set domain info fields */ 655 /* Set domain info fields */
656 domain->header.type = cpu_to_le16(WLAN_EID_COUNTRY); 656 domain->header.type = cpu_to_le16(WLAN_EID_COUNTRY);
657 memcpy(domain->country_code, adapter->domain_reg.country_code, 657 memcpy(domain->country_code, adapter->domain_reg.country_code,
658 sizeof(domain->country_code)); 658 sizeof(domain->country_code));
659 659
660 domain->header.len = cpu_to_le16((no_of_triplet * 660 domain->header.len =
661 sizeof(struct ieee80211_country_ie_triplet)) + 661 cpu_to_le16((no_of_triplet *
662 sizeof(domain->country_code)); 662 sizeof(struct ieee80211_country_ie_triplet))
663 + sizeof(domain->country_code));
663 664
664 if (no_of_triplet) { 665 if (no_of_triplet) {
665 memcpy(domain->triplet, adapter->domain_reg.triplet, 666 memcpy(domain->triplet, adapter->domain_reg.triplet,
666 no_of_triplet * 667 no_of_triplet * sizeof(struct
667 sizeof(struct ieee80211_country_ie_triplet)); 668 ieee80211_country_ie_triplet));
668 669
669 cmd->size = cpu_to_le16(sizeof(domain_info->action) + 670 cmd->size = cpu_to_le16(sizeof(domain_info->action) +
670 le16_to_cpu(domain->header.len) + 671 le16_to_cpu(domain->header.len) +
671 sizeof(struct mwifiex_ie_types_header) 672 sizeof(struct mwifiex_ie_types_header)
672 + S_DS_GEN); 673 + S_DS_GEN);
673 } else { 674 } else {
674 cmd->size = cpu_to_le16(sizeof(domain_info->action) + S_DS_GEN); 675 cmd->size = cpu_to_le16(sizeof(domain_info->action) + S_DS_GEN);
675 } 676 }
@@ -698,8 +699,8 @@ static int mwifiex_cmd_802_11_rf_channel(struct mwifiex_private *priv,
698 + S_DS_GEN); 699 + S_DS_GEN);
699 700
700 if (cmd_action == HostCmd_ACT_GEN_SET) { 701 if (cmd_action == HostCmd_ACT_GEN_SET) {
701 if ((priv->adapter->adhoc_start_band & BAND_A) 702 if ((priv->adapter->adhoc_start_band & BAND_A) ||
702 || (priv->adapter->adhoc_start_band & BAND_AN)) 703 (priv->adapter->adhoc_start_band & BAND_AN))
703 rf_chan->rf_type = 704 rf_chan->rf_type =
704 cpu_to_le16(HostCmd_SCAN_RADIO_TYPE_A); 705 cpu_to_le16(HostCmd_SCAN_RADIO_TYPE_A);
705 706
@@ -777,7 +778,7 @@ static int mwifiex_cmd_reg_access(struct host_cmd_ds_command *cmd,
777 778
778 cmd->size = cpu_to_le16(sizeof(*mac_reg) + S_DS_GEN); 779 cmd->size = cpu_to_le16(sizeof(*mac_reg) + S_DS_GEN);
779 mac_reg = (struct host_cmd_ds_mac_reg_access *) &cmd-> 780 mac_reg = (struct host_cmd_ds_mac_reg_access *) &cmd->
780 params.mac_reg; 781 params.mac_reg;
781 mac_reg->action = cpu_to_le16(cmd_action); 782 mac_reg->action = cpu_to_le16(cmd_action);
782 mac_reg->offset = 783 mac_reg->offset =
783 cpu_to_le16((u16) le32_to_cpu(reg_rw->offset)); 784 cpu_to_le16((u16) le32_to_cpu(reg_rw->offset));
@@ -789,8 +790,8 @@ static int mwifiex_cmd_reg_access(struct host_cmd_ds_command *cmd,
789 struct host_cmd_ds_bbp_reg_access *bbp_reg; 790 struct host_cmd_ds_bbp_reg_access *bbp_reg;
790 791
791 cmd->size = cpu_to_le16(sizeof(*bbp_reg) + S_DS_GEN); 792 cmd->size = cpu_to_le16(sizeof(*bbp_reg) + S_DS_GEN);
792 bbp_reg = (struct host_cmd_ds_bbp_reg_access *) &cmd-> 793 bbp_reg = (struct host_cmd_ds_bbp_reg_access *)
793 params.bbp_reg; 794 &cmd->params.bbp_reg;
794 bbp_reg->action = cpu_to_le16(cmd_action); 795 bbp_reg->action = cpu_to_le16(cmd_action);
795 bbp_reg->offset = 796 bbp_reg->offset =
796 cpu_to_le16((u16) le32_to_cpu(reg_rw->offset)); 797 cpu_to_le16((u16) le32_to_cpu(reg_rw->offset));
@@ -802,11 +803,10 @@ static int mwifiex_cmd_reg_access(struct host_cmd_ds_command *cmd,
802 struct host_cmd_ds_rf_reg_access *rf_reg; 803 struct host_cmd_ds_rf_reg_access *rf_reg;
803 804
804 cmd->size = cpu_to_le16(sizeof(*rf_reg) + S_DS_GEN); 805 cmd->size = cpu_to_le16(sizeof(*rf_reg) + S_DS_GEN);
805 rf_reg = (struct host_cmd_ds_rf_reg_access *) &cmd-> 806 rf_reg = (struct host_cmd_ds_rf_reg_access *)
806 params.rf_reg; 807 &cmd->params.rf_reg;
807 rf_reg->action = cpu_to_le16(cmd_action); 808 rf_reg->action = cpu_to_le16(cmd_action);
808 rf_reg->offset = 809 rf_reg->offset = cpu_to_le16((u16) le32_to_cpu(reg_rw->offset));
809 cpu_to_le16((u16) le32_to_cpu(reg_rw->offset));
810 rf_reg->value = (u8) le32_to_cpu(reg_rw->value); 810 rf_reg->value = (u8) le32_to_cpu(reg_rw->value);
811 break; 811 break;
812 } 812 }
@@ -819,7 +819,7 @@ static int mwifiex_cmd_reg_access(struct host_cmd_ds_command *cmd,
819 params.pmic_reg; 819 params.pmic_reg;
820 pmic_reg->action = cpu_to_le16(cmd_action); 820 pmic_reg->action = cpu_to_le16(cmd_action);
821 pmic_reg->offset = 821 pmic_reg->offset =
822 cpu_to_le16((u16) le32_to_cpu(reg_rw->offset)); 822 cpu_to_le16((u16) le32_to_cpu(reg_rw->offset));
823 pmic_reg->value = (u8) le32_to_cpu(reg_rw->value); 823 pmic_reg->value = (u8) le32_to_cpu(reg_rw->value);
824 break; 824 break;
825 } 825 }
@@ -828,11 +828,11 @@ static int mwifiex_cmd_reg_access(struct host_cmd_ds_command *cmd,
828 struct host_cmd_ds_rf_reg_access *cau_reg; 828 struct host_cmd_ds_rf_reg_access *cau_reg;
829 829
830 cmd->size = cpu_to_le16(sizeof(*cau_reg) + S_DS_GEN); 830 cmd->size = cpu_to_le16(sizeof(*cau_reg) + S_DS_GEN);
831 cau_reg = (struct host_cmd_ds_rf_reg_access *) &cmd-> 831 cau_reg = (struct host_cmd_ds_rf_reg_access *)
832 params.rf_reg; 832 &cmd->params.rf_reg;
833 cau_reg->action = cpu_to_le16(cmd_action); 833 cau_reg->action = cpu_to_le16(cmd_action);
834 cau_reg->offset = 834 cau_reg->offset =
835 cpu_to_le16((u16) le32_to_cpu(reg_rw->offset)); 835 cpu_to_le16((u16) le32_to_cpu(reg_rw->offset));
836 cau_reg->value = (u8) le32_to_cpu(reg_rw->value); 836 cau_reg->value = (u8) le32_to_cpu(reg_rw->value);
837 break; 837 break;
838 } 838 }
@@ -868,7 +868,7 @@ static int mwifiex_cmd_reg_access(struct host_cmd_ds_command *cmd,
868 */ 868 */
869static int 869static int
870mwifiex_cmd_pcie_host_spec(struct mwifiex_private *priv, 870mwifiex_cmd_pcie_host_spec(struct mwifiex_private *priv,
871 struct host_cmd_ds_command *cmd, u16 action) 871 struct host_cmd_ds_command *cmd, u16 action)
872{ 872{
873 struct host_cmd_ds_pcie_details *host_spec = 873 struct host_cmd_ds_pcie_details *host_spec =
874 &cmd->params.pcie_host_spec; 874 &cmd->params.pcie_host_spec;
@@ -882,29 +882,25 @@ mwifiex_cmd_pcie_host_spec(struct mwifiex_private *priv,
882 882
883 memset(host_spec, 0, sizeof(struct host_cmd_ds_pcie_details)); 883 memset(host_spec, 0, sizeof(struct host_cmd_ds_pcie_details));
884 884
885 if (action == HostCmd_ACT_GEN_SET) { 885 if (action != HostCmd_ACT_GEN_SET)
886 /* Send the ring base addresses and count to firmware */ 886 return 0;
887 host_spec->txbd_addr_lo = (u32)(card->txbd_ring_pbase); 887
888 host_spec->txbd_addr_hi = 888 /* Send the ring base addresses and count to firmware */
889 (u32)(((u64)card->txbd_ring_pbase)>>32); 889 host_spec->txbd_addr_lo = (u32)(card->txbd_ring_pbase);
890 host_spec->txbd_count = MWIFIEX_MAX_TXRX_BD; 890 host_spec->txbd_addr_hi = (u32)(((u64)card->txbd_ring_pbase)>>32);
891 host_spec->rxbd_addr_lo = (u32)(card->rxbd_ring_pbase); 891 host_spec->txbd_count = MWIFIEX_MAX_TXRX_BD;
892 host_spec->rxbd_addr_hi = 892 host_spec->rxbd_addr_lo = (u32)(card->rxbd_ring_pbase);
893 (u32)(((u64)card->rxbd_ring_pbase)>>32); 893 host_spec->rxbd_addr_hi = (u32)(((u64)card->rxbd_ring_pbase)>>32);
894 host_spec->rxbd_count = MWIFIEX_MAX_TXRX_BD; 894 host_spec->rxbd_count = MWIFIEX_MAX_TXRX_BD;
895 host_spec->evtbd_addr_lo = 895 host_spec->evtbd_addr_lo = (u32)(card->evtbd_ring_pbase);
896 (u32)(card->evtbd_ring_pbase); 896 host_spec->evtbd_addr_hi = (u32)(((u64)card->evtbd_ring_pbase)>>32);
897 host_spec->evtbd_addr_hi = 897 host_spec->evtbd_count = MWIFIEX_MAX_EVT_BD;
898 (u32)(((u64)card->evtbd_ring_pbase)>>32); 898 if (card->sleep_cookie) {
899 host_spec->evtbd_count = MWIFIEX_MAX_EVT_BD; 899 buf_pa = MWIFIEX_SKB_PACB(card->sleep_cookie);
900 if (card->sleep_cookie) { 900 host_spec->sleep_cookie_addr_lo = (u32) *buf_pa;
901 buf_pa = MWIFIEX_SKB_PACB(card->sleep_cookie); 901 host_spec->sleep_cookie_addr_hi = (u32) (((u64)*buf_pa) >> 32);
902 host_spec->sleep_cookie_addr_lo = (u32) *buf_pa; 902 dev_dbg(priv->adapter->dev, "sleep_cook_lo phy addr: 0x%x\n",
903 host_spec->sleep_cookie_addr_hi = 903 host_spec->sleep_cookie_addr_lo);
904 (u32) (((u64)*buf_pa) >> 32);
905 dev_dbg(priv->adapter->dev, "sleep_cook_lo phy addr: "
906 "0x%x\n", host_spec->sleep_cookie_addr_lo);
907 }
908 } 904 }
909 905
910 return 0; 906 return 0;
@@ -1036,12 +1032,12 @@ int mwifiex_sta_prepare_cmd(struct mwifiex_private *priv, uint16_t cmd_no,
1036 break; 1032 break;
1037 case HostCmd_CMD_802_11_KEY_MATERIAL: 1033 case HostCmd_CMD_802_11_KEY_MATERIAL:
1038 ret = mwifiex_cmd_802_11_key_material(priv, cmd_ptr, 1034 ret = mwifiex_cmd_802_11_key_material(priv, cmd_ptr,
1039 cmd_action, cmd_oid, 1035 cmd_action, cmd_oid,
1040 data_buf); 1036 data_buf);
1041 break; 1037 break;
1042 case HostCmd_CMD_802_11D_DOMAIN_INFO: 1038 case HostCmd_CMD_802_11D_DOMAIN_INFO:
1043 ret = mwifiex_cmd_802_11d_domain_info(priv, cmd_ptr, 1039 ret = mwifiex_cmd_802_11d_domain_info(priv, cmd_ptr,
1044 cmd_action); 1040 cmd_action);
1045 break; 1041 break;
1046 case HostCmd_CMD_RECONFIGURE_TX_BUFF: 1042 case HostCmd_CMD_RECONFIGURE_TX_BUFF:
1047 ret = mwifiex_cmd_recfg_tx_buf(priv, cmd_ptr, cmd_action, 1043 ret = mwifiex_cmd_recfg_tx_buf(priv, cmd_ptr, cmd_action,
@@ -1052,8 +1048,7 @@ int mwifiex_sta_prepare_cmd(struct mwifiex_private *priv, uint16_t cmd_no,
1052 data_buf); 1048 data_buf);
1053 break; 1049 break;
1054 case HostCmd_CMD_11N_CFG: 1050 case HostCmd_CMD_11N_CFG:
1055 ret = mwifiex_cmd_11n_cfg(cmd_ptr, cmd_action, 1051 ret = mwifiex_cmd_11n_cfg(cmd_ptr, cmd_action, data_buf);
1056 data_buf);
1057 break; 1052 break;
1058 case HostCmd_CMD_WMM_GET_STATUS: 1053 case HostCmd_CMD_WMM_GET_STATUS:
1059 dev_dbg(priv->adapter->dev, 1054 dev_dbg(priv->adapter->dev,
@@ -1131,8 +1126,8 @@ int mwifiex_sta_init_cmd(struct mwifiex_private *priv, u8 first_sta)
1131 if (first_sta) { 1126 if (first_sta) {
1132 if (priv->adapter->iface_type == MWIFIEX_PCIE) { 1127 if (priv->adapter->iface_type == MWIFIEX_PCIE) {
1133 ret = mwifiex_send_cmd_async(priv, 1128 ret = mwifiex_send_cmd_async(priv,
1134 HostCmd_CMD_PCIE_DESC_DETAILS, 1129 HostCmd_CMD_PCIE_DESC_DETAILS,
1135 HostCmd_ACT_GEN_SET, 0, NULL); 1130 HostCmd_ACT_GEN_SET, 0, NULL);
1136 if (ret) 1131 if (ret)
1137 return -1; 1132 return -1;
1138 } 1133 }
diff --git a/drivers/net/wireless/mwifiex/sta_cmdresp.c b/drivers/net/wireless/mwifiex/sta_cmdresp.c
index a2a9c513e26b..4da19ed0f078 100644
--- a/drivers/net/wireless/mwifiex/sta_cmdresp.c
+++ b/drivers/net/wireless/mwifiex/sta_cmdresp.c
@@ -49,7 +49,7 @@ mwifiex_process_cmdresp_error(struct mwifiex_private *priv,
49 unsigned long flags; 49 unsigned long flags;
50 50
51 dev_err(adapter->dev, "CMD_RESP: cmd %#x error, result=%#x\n", 51 dev_err(adapter->dev, "CMD_RESP: cmd %#x error, result=%#x\n",
52 resp->command, resp->result); 52 resp->command, resp->result);
53 53
54 if (adapter->curr_cmd->wait_q_enabled) 54 if (adapter->curr_cmd->wait_q_enabled)
55 adapter->cmd_wait_q.status = -1; 55 adapter->cmd_wait_q.status = -1;
@@ -57,13 +57,13 @@ mwifiex_process_cmdresp_error(struct mwifiex_private *priv,
57 switch (le16_to_cpu(resp->command)) { 57 switch (le16_to_cpu(resp->command)) {
58 case HostCmd_CMD_802_11_PS_MODE_ENH: 58 case HostCmd_CMD_802_11_PS_MODE_ENH:
59 pm = &resp->params.psmode_enh; 59 pm = &resp->params.psmode_enh;
60 dev_err(adapter->dev, "PS_MODE_ENH cmd failed: " 60 dev_err(adapter->dev,
61 "result=0x%x action=0x%X\n", 61 "PS_MODE_ENH cmd failed: result=0x%x action=0x%X\n",
62 resp->result, le16_to_cpu(pm->action)); 62 resp->result, le16_to_cpu(pm->action));
63 /* We do not re-try enter-ps command in ad-hoc mode. */ 63 /* We do not re-try enter-ps command in ad-hoc mode. */
64 if (le16_to_cpu(pm->action) == EN_AUTO_PS && 64 if (le16_to_cpu(pm->action) == EN_AUTO_PS &&
65 (le16_to_cpu(pm->params.ps_bitmap) & BITMAP_STA_PS) && 65 (le16_to_cpu(pm->params.ps_bitmap) & BITMAP_STA_PS) &&
66 priv->bss_mode == NL80211_IFTYPE_ADHOC) 66 priv->bss_mode == NL80211_IFTYPE_ADHOC)
67 adapter->ps_mode = MWIFIEX_802_11_POWER_MODE_CAM; 67 adapter->ps_mode = MWIFIEX_802_11_POWER_MODE_CAM;
68 68
69 break; 69 break;
@@ -123,7 +123,7 @@ static int mwifiex_ret_802_11_rssi_info(struct mwifiex_private *priv,
123 struct mwifiex_ds_get_signal *signal) 123 struct mwifiex_ds_get_signal *signal)
124{ 124{
125 struct host_cmd_ds_802_11_rssi_info_rsp *rssi_info_rsp = 125 struct host_cmd_ds_802_11_rssi_info_rsp *rssi_info_rsp =
126 &resp->params.rssi_info_rsp; 126 &resp->params.rssi_info_rsp;
127 127
128 priv->data_rssi_last = le16_to_cpu(rssi_info_rsp->data_rssi_last); 128 priv->data_rssi_last = le16_to_cpu(rssi_info_rsp->data_rssi_last);
129 priv->data_nf_last = le16_to_cpu(rssi_info_rsp->data_nf_last); 129 priv->data_nf_last = le16_to_cpu(rssi_info_rsp->data_nf_last);
@@ -191,8 +191,8 @@ static int mwifiex_ret_802_11_snmp_mib(struct mwifiex_private *priv,
191 u32 ul_temp; 191 u32 ul_temp;
192 192
193 dev_dbg(priv->adapter->dev, "info: SNMP_RESP: oid value = %#x," 193 dev_dbg(priv->adapter->dev, "info: SNMP_RESP: oid value = %#x,"
194 " query_type = %#x, buf size = %#x\n", 194 " query_type = %#x, buf size = %#x\n",
195 oid, query_type, le16_to_cpu(smib->buf_size)); 195 oid, query_type, le16_to_cpu(smib->buf_size));
196 if (query_type == HostCmd_ACT_GEN_GET) { 196 if (query_type == HostCmd_ACT_GEN_GET) {
197 ul_temp = le16_to_cpu(*((__le16 *) (smib->value))); 197 ul_temp = le16_to_cpu(*((__le16 *) (smib->value)));
198 if (data_buf) 198 if (data_buf)
@@ -444,7 +444,7 @@ static int mwifiex_ret_tx_power_cfg(struct mwifiex_private *priv,
444 break; 444 break;
445 default: 445 default:
446 dev_err(adapter->dev, "CMD_RESP: unknown cmd action %d\n", 446 dev_err(adapter->dev, "CMD_RESP: unknown cmd action %d\n",
447 action); 447 action);
448 return 0; 448 return 0;
449 } 449 }
450 dev_dbg(adapter->dev, 450 dev_dbg(adapter->dev,
@@ -464,7 +464,7 @@ static int mwifiex_ret_802_11_mac_address(struct mwifiex_private *priv,
464 struct host_cmd_ds_command *resp) 464 struct host_cmd_ds_command *resp)
465{ 465{
466 struct host_cmd_ds_802_11_mac_address *cmd_mac_addr = 466 struct host_cmd_ds_802_11_mac_address *cmd_mac_addr =
467 &resp->params.mac_addr; 467 &resp->params.mac_addr;
468 468
469 memcpy(priv->curr_addr, cmd_mac_addr->mac_addr, ETH_ALEN); 469 memcpy(priv->curr_addr, cmd_mac_addr->mac_addr, ETH_ALEN);
470 470
@@ -549,7 +549,7 @@ static int mwifiex_ret_802_11_key_material(struct mwifiex_private *priv,
549 struct host_cmd_ds_command *resp) 549 struct host_cmd_ds_command *resp)
550{ 550{
551 struct host_cmd_ds_802_11_key_material *key = 551 struct host_cmd_ds_802_11_key_material *key =
552 &resp->params.key_material; 552 &resp->params.key_material;
553 553
554 if (le16_to_cpu(key->action) == HostCmd_ACT_GEN_SET) { 554 if (le16_to_cpu(key->action) == HostCmd_ACT_GEN_SET) {
555 if ((le16_to_cpu(key->key_param_set.key_info) & KEY_MCAST)) { 555 if ((le16_to_cpu(key->key_param_set.key_info) & KEY_MCAST)) {
@@ -580,17 +580,18 @@ static int mwifiex_ret_802_11d_domain_info(struct mwifiex_private *priv,
580 u16 action = le16_to_cpu(domain_info->action); 580 u16 action = le16_to_cpu(domain_info->action);
581 u8 no_of_triplet; 581 u8 no_of_triplet;
582 582
583 no_of_triplet = (u8) ((le16_to_cpu(domain->header.len) - 583 no_of_triplet = (u8) ((le16_to_cpu(domain->header.len)
584 IEEE80211_COUNTRY_STRING_LEN) / 584 - IEEE80211_COUNTRY_STRING_LEN)
585 sizeof(struct ieee80211_country_ie_triplet)); 585 / sizeof(struct ieee80211_country_ie_triplet));
586 586
587 dev_dbg(priv->adapter->dev, "info: 11D Domain Info Resp:" 587 dev_dbg(priv->adapter->dev,
588 " no_of_triplet=%d\n", no_of_triplet); 588 "info: 11D Domain Info Resp: no_of_triplet=%d\n",
589 no_of_triplet);
589 590
590 if (no_of_triplet > MWIFIEX_MAX_TRIPLET_802_11D) { 591 if (no_of_triplet > MWIFIEX_MAX_TRIPLET_802_11D) {
591 dev_warn(priv->adapter->dev, 592 dev_warn(priv->adapter->dev,
592 "11D: invalid number of triplets %d " 593 "11D: invalid number of triplets %d returned\n",
593 "returned!!\n", no_of_triplet); 594 no_of_triplet);
594 return -1; 595 return -1;
595 } 596 }
596 597
@@ -624,8 +625,8 @@ static int mwifiex_ret_802_11_rf_channel(struct mwifiex_private *priv,
624 625
625 if (priv->curr_bss_params.bss_descriptor.channel != new_channel) { 626 if (priv->curr_bss_params.bss_descriptor.channel != new_channel) {
626 dev_dbg(priv->adapter->dev, "cmd: Channel Switch: %d to %d\n", 627 dev_dbg(priv->adapter->dev, "cmd: Channel Switch: %d to %d\n",
627 priv->curr_bss_params.bss_descriptor.channel, 628 priv->curr_bss_params.bss_descriptor.channel,
628 new_channel); 629 new_channel);
629 /* Update the channel again */ 630 /* Update the channel again */
630 priv->curr_bss_params.bss_descriptor.channel = new_channel; 631 priv->curr_bss_params.bss_descriptor.channel = new_channel;
631 } 632 }
@@ -747,7 +748,7 @@ static int mwifiex_ret_ibss_coalescing_status(struct mwifiex_private *priv,
747 struct host_cmd_ds_command *resp) 748 struct host_cmd_ds_command *resp)
748{ 749{
749 struct host_cmd_ds_802_11_ibss_status *ibss_coal_resp = 750 struct host_cmd_ds_802_11_ibss_status *ibss_coal_resp =
750 &(resp->params.ibss_coalescing); 751 &(resp->params.ibss_coalescing);
751 u8 zero_mac[ETH_ALEN] = { 0, 0, 0, 0, 0, 0 }; 752 u8 zero_mac[ETH_ALEN] = { 0, 0, 0, 0, 0, 0 };
752 753
753 if (le16_to_cpu(ibss_coal_resp->action) == HostCmd_ACT_GEN_SET) 754 if (le16_to_cpu(ibss_coal_resp->action) == HostCmd_ACT_GEN_SET)
@@ -887,20 +888,17 @@ int mwifiex_process_sta_cmdresp(struct mwifiex_private *priv, u16 cmdresp_no,
887 case HostCmd_CMD_RECONFIGURE_TX_BUFF: 888 case HostCmd_CMD_RECONFIGURE_TX_BUFF:
888 adapter->tx_buf_size = (u16) le16_to_cpu(resp->params. 889 adapter->tx_buf_size = (u16) le16_to_cpu(resp->params.
889 tx_buf.buff_size); 890 tx_buf.buff_size);
890 adapter->tx_buf_size = (adapter->tx_buf_size / 891 adapter->tx_buf_size = (adapter->tx_buf_size
891 MWIFIEX_SDIO_BLOCK_SIZE) * 892 / MWIFIEX_SDIO_BLOCK_SIZE)
892 MWIFIEX_SDIO_BLOCK_SIZE; 893 * MWIFIEX_SDIO_BLOCK_SIZE;
893 adapter->curr_tx_buf_size = adapter->tx_buf_size; 894 adapter->curr_tx_buf_size = adapter->tx_buf_size;
894 dev_dbg(adapter->dev, 895 dev_dbg(adapter->dev,
895 "cmd: max_tx_buf_size=%d, tx_buf_size=%d\n", 896 "cmd: max_tx_buf_size=%d, tx_buf_size=%d\n",
896 adapter->max_tx_buf_size, adapter->tx_buf_size); 897 adapter->max_tx_buf_size, adapter->tx_buf_size);
897 898
898 if (adapter->if_ops.update_mp_end_port) 899 if (adapter->if_ops.update_mp_end_port)
899 adapter->if_ops.update_mp_end_port(adapter, 900 adapter->if_ops.update_mp_end_port(adapter,
900 le16_to_cpu(resp-> 901 le16_to_cpu(resp->params.tx_buf.mp_end_port));
901 params.
902 tx_buf.
903 mp_end_port));
904 break; 902 break;
905 case HostCmd_CMD_AMSDU_AGGR_CTRL: 903 case HostCmd_CMD_AMSDU_AGGR_CTRL:
906 ret = mwifiex_ret_amsdu_aggr_ctrl(resp, data_buf); 904 ret = mwifiex_ret_amsdu_aggr_ctrl(resp, data_buf);
@@ -928,7 +926,7 @@ int mwifiex_process_sta_cmdresp(struct mwifiex_private *priv, u16 cmdresp_no,
928 break; 926 break;
929 default: 927 default:
930 dev_err(adapter->dev, "CMD_RESP: unknown cmd response %#x\n", 928 dev_err(adapter->dev, "CMD_RESP: unknown cmd response %#x\n",
931 resp->command); 929 resp->command);
932 break; 930 break;
933 } 931 }
934 932