aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/libertas/cmd.c
diff options
context:
space:
mode:
authorHolger Schurig <hs4233@mail.mn-solutions.de>2007-08-02 11:54:31 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2007-10-10 19:49:55 -0400
commit8ff12da121af175a14c4cedbba0fd16ff0cfc07a (patch)
treeca129a7be57e8e0e5d11ba9e0a82b27332cce1d8 /drivers/net/wireless/libertas/cmd.c
parenta6c8700f36cd8f217420bbe26721094824fab8de (diff)
[PATCH] libertas: use LBS_DEB_HOST for host-to-card communications
... and LBS_DEB_CMD for command execution. Also tidies misc comments to give a consistent output. Signed-off-by: Holger Schurig <hs4233@mail.mn-solutions.de> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/libertas/cmd.c')
-rw-r--r--drivers/net/wireless/libertas/cmd.c259
1 files changed, 136 insertions, 123 deletions
diff --git a/drivers/net/wireless/libertas/cmd.c b/drivers/net/wireless/libertas/cmd.c
index 8d2f9bad8680..d3402e1b760b 100644
--- a/drivers/net/wireless/libertas/cmd.c
+++ b/drivers/net/wireless/libertas/cmd.c
@@ -68,7 +68,7 @@ static int wlan_cmd_802_11_ps_mode(wlan_private * priv,
68 switch (cmd_action) { 68 switch (cmd_action) {
69 case CMD_SUBCMD_ENTER_PS: 69 case CMD_SUBCMD_ENTER_PS:
70 lbs_deb_cmd("PS command:" "SubCode- Enter PS\n"); 70 lbs_deb_cmd("PS command:" "SubCode- Enter PS\n");
71 lbs_deb_cmd("locallisteninterval = %d\n", 71 lbs_deb_cmd("locallisteninterval %d\n",
72 adapter->locallisteninterval); 72 adapter->locallisteninterval);
73 73
74 psm->locallisteninterval = 74 psm->locallisteninterval =
@@ -101,6 +101,8 @@ static int wlan_cmd_802_11_inactivity_timeout(wlan_private * priv,
101{ 101{
102 u16 *timeout = pdata_buf; 102 u16 *timeout = pdata_buf;
103 103
104 lbs_deb_enter(LBS_DEB_CMD);
105
104 cmd->command = cpu_to_le16(CMD_802_11_INACTIVITY_TIMEOUT); 106 cmd->command = cpu_to_le16(CMD_802_11_INACTIVITY_TIMEOUT);
105 cmd->size = 107 cmd->size =
106 cpu_to_le16(sizeof(struct cmd_ds_802_11_inactivity_timeout) 108 cpu_to_le16(sizeof(struct cmd_ds_802_11_inactivity_timeout)
@@ -113,6 +115,7 @@ static int wlan_cmd_802_11_inactivity_timeout(wlan_private * priv,
113 else 115 else
114 cmd->params.inactivity_timeout.timeout = 0; 116 cmd->params.inactivity_timeout.timeout = 0;
115 117
118 lbs_deb_leave(LBS_DEB_CMD);
116 return 0; 119 return 0;
117} 120}
118 121
@@ -177,8 +180,6 @@ static int wlan_cmd_802_11_set_wep(wlan_private * priv,
177 wep->keyindex = cpu_to_le16((u16)(assoc_req->wep_tx_keyidx & 180 wep->keyindex = cpu_to_le16((u16)(assoc_req->wep_tx_keyidx &
178 (u32)CMD_WEP_KEY_INDEX_MASK)); 181 (u32)CMD_WEP_KEY_INDEX_MASK));
179 182
180 lbs_deb_cmd("Tx key Index: %u\n", le16_to_cpu(wep->keyindex));
181
182 /* Copy key types and material to host command structure */ 183 /* Copy key types and material to host command structure */
183 for (i = 0; i < 4; i++) { 184 for (i = 0; i < 4; i++) {
184 struct enc_key * pkey = &assoc_req->wep_keys[i]; 185 struct enc_key * pkey = &assoc_req->wep_keys[i];
@@ -189,17 +190,19 @@ static int wlan_cmd_802_11_set_wep(wlan_private * priv,
189 cpu_to_le16(CMD_TYPE_WEP_40_BIT); 190 cpu_to_le16(CMD_TYPE_WEP_40_BIT);
190 memmove(&wep->keymaterial[i], pkey->key, 191 memmove(&wep->keymaterial[i], pkey->key,
191 pkey->len); 192 pkey->len);
193 lbs_deb_cmd("SET_WEP: add key %d (40 bit)\n", i);
192 break; 194 break;
193 case KEY_LEN_WEP_104: 195 case KEY_LEN_WEP_104:
194 wep->keytype[i] = 196 wep->keytype[i] =
195 cpu_to_le16(CMD_TYPE_WEP_104_BIT); 197 cpu_to_le16(CMD_TYPE_WEP_104_BIT);
196 memmove(&wep->keymaterial[i], pkey->key, 198 memmove(&wep->keymaterial[i], pkey->key,
197 pkey->len); 199 pkey->len);
200 lbs_deb_cmd("SET_WEP: add key %d (104 bit)\n", i);
198 break; 201 break;
199 case 0: 202 case 0:
200 break; 203 break;
201 default: 204 default:
202 lbs_deb_cmd("Invalid WEP key %d length of %d\n", 205 lbs_deb_cmd("SET_WEP: invalid key %d, length %d\n",
203 i, pkey->len); 206 i, pkey->len);
204 ret = -1; 207 ret = -1;
205 goto done; 208 goto done;
@@ -213,6 +216,7 @@ static int wlan_cmd_802_11_set_wep(wlan_private * priv,
213 /* default tx key index */ 216 /* default tx key index */
214 wep->keyindex = cpu_to_le16((u16)(adapter->wep_tx_keyidx & 217 wep->keyindex = cpu_to_le16((u16)(adapter->wep_tx_keyidx &
215 (u32)CMD_WEP_KEY_INDEX_MASK)); 218 (u32)CMD_WEP_KEY_INDEX_MASK));
219 lbs_deb_cmd("SET_WEP: remove key %d\n", adapter->wep_tx_keyidx);
216 } 220 }
217 221
218 ret = 0; 222 ret = 0;
@@ -241,6 +245,7 @@ static int wlan_cmd_802_11_enable_rsn(wlan_private * priv,
241 penableRSN->enable = cpu_to_le16(CMD_ENABLE_RSN); 245 penableRSN->enable = cpu_to_le16(CMD_ENABLE_RSN);
242 else 246 else
243 penableRSN->enable = cpu_to_le16(CMD_DISABLE_RSN); 247 penableRSN->enable = cpu_to_le16(CMD_DISABLE_RSN);
248 lbs_deb_cmd("ENABLE_RSN: %d\n", *enable);
244 } 249 }
245 250
246 lbs_deb_leave(LBS_DEB_CMD); 251 lbs_deb_leave(LBS_DEB_CMD);
@@ -251,6 +256,8 @@ static int wlan_cmd_802_11_enable_rsn(wlan_private * priv,
251static void set_one_wpa_key(struct MrvlIEtype_keyParamSet * pkeyparamset, 256static void set_one_wpa_key(struct MrvlIEtype_keyParamSet * pkeyparamset,
252 struct enc_key * pkey) 257 struct enc_key * pkey)
253{ 258{
259 lbs_deb_enter(LBS_DEB_CMD);
260
254 if (pkey->flags & KEY_INFO_WPA_ENABLED) { 261 if (pkey->flags & KEY_INFO_WPA_ENABLED) {
255 pkeyparamset->keyinfo |= cpu_to_le16(KEY_INFO_WPA_ENABLED); 262 pkeyparamset->keyinfo |= cpu_to_le16(KEY_INFO_WPA_ENABLED);
256 } 263 }
@@ -269,6 +276,7 @@ static void set_one_wpa_key(struct MrvlIEtype_keyParamSet * pkeyparamset,
269 + sizeof(pkeyparamset->keyinfo) 276 + sizeof(pkeyparamset->keyinfo)
270 + sizeof(pkeyparamset->keylen) 277 + sizeof(pkeyparamset->keylen)
271 + sizeof(pkeyparamset->key)); 278 + sizeof(pkeyparamset->key));
279 lbs_deb_leave(LBS_DEB_CMD);
272} 280}
273 281
274static int wlan_cmd_802_11_key_material(wlan_private * priv, 282static int wlan_cmd_802_11_key_material(wlan_private * priv,
@@ -323,30 +331,37 @@ static int wlan_cmd_802_11_reset(wlan_private * priv,
323{ 331{
324 struct cmd_ds_802_11_reset *reset = &cmd->params.reset; 332 struct cmd_ds_802_11_reset *reset = &cmd->params.reset;
325 333
334 lbs_deb_enter(LBS_DEB_CMD);
335
326 cmd->command = cpu_to_le16(CMD_802_11_RESET); 336 cmd->command = cpu_to_le16(CMD_802_11_RESET);
327 cmd->size = cpu_to_le16(sizeof(struct cmd_ds_802_11_reset) + S_DS_GEN); 337 cmd->size = cpu_to_le16(sizeof(struct cmd_ds_802_11_reset) + S_DS_GEN);
328 reset->action = cpu_to_le16(cmd_action); 338 reset->action = cpu_to_le16(cmd_action);
329 339
340 lbs_deb_leave(LBS_DEB_CMD);
330 return 0; 341 return 0;
331} 342}
332 343
333static int wlan_cmd_802_11_get_log(wlan_private * priv, 344static int wlan_cmd_802_11_get_log(wlan_private * priv,
334 struct cmd_ds_command *cmd) 345 struct cmd_ds_command *cmd)
335{ 346{
347 lbs_deb_enter(LBS_DEB_CMD);
336 cmd->command = cpu_to_le16(CMD_802_11_GET_LOG); 348 cmd->command = cpu_to_le16(CMD_802_11_GET_LOG);
337 cmd->size = 349 cmd->size =
338 cpu_to_le16(sizeof(struct cmd_ds_802_11_get_log) + S_DS_GEN); 350 cpu_to_le16(sizeof(struct cmd_ds_802_11_get_log) + S_DS_GEN);
339 351
352 lbs_deb_leave(LBS_DEB_CMD);
340 return 0; 353 return 0;
341} 354}
342 355
343static int wlan_cmd_802_11_get_stat(wlan_private * priv, 356static int wlan_cmd_802_11_get_stat(wlan_private * priv,
344 struct cmd_ds_command *cmd) 357 struct cmd_ds_command *cmd)
345{ 358{
359 lbs_deb_enter(LBS_DEB_CMD);
346 cmd->command = cpu_to_le16(CMD_802_11_GET_STAT); 360 cmd->command = cpu_to_le16(CMD_802_11_GET_STAT);
347 cmd->size = 361 cmd->size =
348 cpu_to_le16(sizeof(struct cmd_ds_802_11_get_stat) + S_DS_GEN); 362 cpu_to_le16(sizeof(struct cmd_ds_802_11_get_stat) + S_DS_GEN);
349 363
364 lbs_deb_leave(LBS_DEB_CMD);
350 return 0; 365 return 0;
351} 366}
352 367
@@ -462,7 +477,7 @@ static int wlan_cmd_802_11_snmp_mib(wlan_private * priv,
462 le16_to_cpu(cmd->seqnum), le16_to_cpu(cmd->result)); 477 le16_to_cpu(cmd->seqnum), le16_to_cpu(cmd->result));
463 478
464 lbs_deb_cmd( 479 lbs_deb_cmd(
465 "SNMP_CMD: action=0x%x, oid=0x%x, oidsize=0x%x, value=0x%x\n", 480 "SNMP_CMD: action 0x%x, oid 0x%x, oidsize 0x%x, value 0x%x\n",
466 le16_to_cpu(pSNMPMIB->querytype), le16_to_cpu(pSNMPMIB->oid), 481 le16_to_cpu(pSNMPMIB->querytype), le16_to_cpu(pSNMPMIB->oid),
467 le16_to_cpu(pSNMPMIB->bufsize), 482 le16_to_cpu(pSNMPMIB->bufsize),
468 le16_to_cpu(*(__le16 *) pSNMPMIB->value)); 483 le16_to_cpu(*(__le16 *) pSNMPMIB->value));
@@ -561,6 +576,7 @@ static int wlan_cmd_802_11_rf_antenna(wlan_private * priv,
561{ 576{
562 struct cmd_ds_802_11_rf_antenna *rant = &cmd->params.rant; 577 struct cmd_ds_802_11_rf_antenna *rant = &cmd->params.rant;
563 578
579 lbs_deb_enter(LBS_DEB_CMD);
564 cmd->command = cpu_to_le16(CMD_802_11_RF_ANTENNA); 580 cmd->command = cpu_to_le16(CMD_802_11_RF_ANTENNA);
565 cmd->size = cpu_to_le16(sizeof(struct cmd_ds_802_11_rf_antenna) + 581 cmd->size = cpu_to_le16(sizeof(struct cmd_ds_802_11_rf_antenna) +
566 S_DS_GEN); 582 S_DS_GEN);
@@ -570,6 +586,7 @@ static int wlan_cmd_802_11_rf_antenna(wlan_private * priv,
570 rant->antennamode = cpu_to_le16((u16) (*(u32 *) pdata_buf)); 586 rant->antennamode = cpu_to_le16((u16) (*(u32 *) pdata_buf));
571 } 587 }
572 588
589 lbs_deb_leave(LBS_DEB_CMD);
573 return 0; 590 return 0;
574} 591}
575 592
@@ -581,13 +598,12 @@ static int wlan_cmd_802_11_rate_adapt_rateset(wlan_private * priv,
581 *rateadapt = &cmd->params.rateset; 598 *rateadapt = &cmd->params.rateset;
582 wlan_adapter *adapter = priv->adapter; 599 wlan_adapter *adapter = priv->adapter;
583 600
601 lbs_deb_enter(LBS_DEB_CMD);
584 cmd->size = 602 cmd->size =
585 cpu_to_le16(sizeof(struct cmd_ds_802_11_rate_adapt_rateset) 603 cpu_to_le16(sizeof(struct cmd_ds_802_11_rate_adapt_rateset)
586 + S_DS_GEN); 604 + S_DS_GEN);
587 cmd->command = cpu_to_le16(CMD_802_11_RATE_ADAPT_RATESET); 605 cmd->command = cpu_to_le16(CMD_802_11_RATE_ADAPT_RATESET);
588 606
589 lbs_deb_enter(LBS_DEB_CMD);
590
591 rateadapt->action = cpu_to_le16(cmd_action); 607 rateadapt->action = cpu_to_le16(cmd_action);
592 rateadapt->enablehwauto = cpu_to_le16(adapter->enablehwauto); 608 rateadapt->enablehwauto = cpu_to_le16(adapter->enablehwauto);
593 rateadapt->bitmap = cpu_to_le16(adapter->ratebitmap); 609 rateadapt->bitmap = cpu_to_le16(adapter->ratebitmap);
@@ -613,10 +629,10 @@ static int wlan_cmd_802_11_data_rate(wlan_private * priv,
613 629
614 if (cmd_action == CMD_ACT_SET_TX_FIX_RATE) { 630 if (cmd_action == CMD_ACT_SET_TX_FIX_RATE) {
615 pdatarate->rates[0] = libertas_data_rate_to_fw_index(adapter->cur_rate); 631 pdatarate->rates[0] = libertas_data_rate_to_fw_index(adapter->cur_rate);
616 lbs_deb_cmd("Setting FW for fixed rate 0x%02X\n", 632 lbs_deb_cmd("DATA_RATE: set fixed 0x%02X\n",
617 adapter->cur_rate); 633 adapter->cur_rate);
618 } else if (cmd_action == CMD_ACT_SET_TX_AUTO) { 634 } else if (cmd_action == CMD_ACT_SET_TX_AUTO) {
619 lbs_deb_cmd("Setting FW for AUTO rate\n"); 635 lbs_deb_cmd("DATA_RATE: setting auto\n");
620 } 636 }
621 637
622 lbs_deb_leave(LBS_DEB_CMD); 638 lbs_deb_leave(LBS_DEB_CMD);
@@ -630,16 +646,19 @@ static int wlan_cmd_mac_multicast_adr(wlan_private * priv,
630 struct cmd_ds_mac_multicast_adr *pMCastAdr = &cmd->params.madr; 646 struct cmd_ds_mac_multicast_adr *pMCastAdr = &cmd->params.madr;
631 wlan_adapter *adapter = priv->adapter; 647 wlan_adapter *adapter = priv->adapter;
632 648
649 lbs_deb_enter(LBS_DEB_CMD);
633 cmd->size = cpu_to_le16(sizeof(struct cmd_ds_mac_multicast_adr) + 650 cmd->size = cpu_to_le16(sizeof(struct cmd_ds_mac_multicast_adr) +
634 S_DS_GEN); 651 S_DS_GEN);
635 cmd->command = cpu_to_le16(CMD_MAC_MULTICAST_ADR); 652 cmd->command = cpu_to_le16(CMD_MAC_MULTICAST_ADR);
636 653
654 lbs_deb_cmd("MULTICAST_ADR: setting %d addresses\n", pMCastAdr->nr_of_adrs);
637 pMCastAdr->action = cpu_to_le16(cmd_action); 655 pMCastAdr->action = cpu_to_le16(cmd_action);
638 pMCastAdr->nr_of_adrs = 656 pMCastAdr->nr_of_adrs =
639 cpu_to_le16((u16) adapter->nr_of_multicastmacaddr); 657 cpu_to_le16((u16) adapter->nr_of_multicastmacaddr);
640 memcpy(pMCastAdr->maclist, adapter->multicastlist, 658 memcpy(pMCastAdr->maclist, adapter->multicastlist,
641 adapter->nr_of_multicastmacaddr * ETH_ALEN); 659 adapter->nr_of_multicastmacaddr * ETH_ALEN);
642 660
661 lbs_deb_leave(LBS_DEB_CMD);
643 return 0; 662 return 0;
644} 663}
645 664
@@ -649,6 +668,7 @@ static int wlan_cmd_802_11_rf_channel(wlan_private * priv,
649{ 668{
650 struct cmd_ds_802_11_rf_channel *rfchan = &cmd->params.rfchannel; 669 struct cmd_ds_802_11_rf_channel *rfchan = &cmd->params.rfchannel;
651 670
671 lbs_deb_enter(LBS_DEB_CMD);
652 cmd->command = cpu_to_le16(CMD_802_11_RF_CHANNEL); 672 cmd->command = cpu_to_le16(CMD_802_11_RF_CHANNEL);
653 cmd->size = cpu_to_le16(sizeof(struct cmd_ds_802_11_rf_channel) + 673 cmd->size = cpu_to_le16(sizeof(struct cmd_ds_802_11_rf_channel) +
654 S_DS_GEN); 674 S_DS_GEN);
@@ -659,6 +679,7 @@ static int wlan_cmd_802_11_rf_channel(wlan_private * priv,
659 679
660 rfchan->action = cpu_to_le16(option); 680 rfchan->action = cpu_to_le16(option);
661 681
682 lbs_deb_leave(LBS_DEB_CMD);
662 return 0; 683 return 0;
663} 684}
664 685
@@ -667,6 +688,7 @@ static int wlan_cmd_802_11_rssi(wlan_private * priv,
667{ 688{
668 wlan_adapter *adapter = priv->adapter; 689 wlan_adapter *adapter = priv->adapter;
669 690
691 lbs_deb_enter(LBS_DEB_CMD);
670 cmd->command = cpu_to_le16(CMD_802_11_RSSI); 692 cmd->command = cpu_to_le16(CMD_802_11_RSSI);
671 cmd->size = cpu_to_le16(sizeof(struct cmd_ds_802_11_rssi) + S_DS_GEN); 693 cmd->size = cpu_to_le16(sizeof(struct cmd_ds_802_11_rssi) + S_DS_GEN);
672 cmd->params.rssi.N = cpu_to_le16(priv->adapter->bcn_avg_factor); 694 cmd->params.rssi.N = cpu_to_le16(priv->adapter->bcn_avg_factor);
@@ -679,6 +701,7 @@ static int wlan_cmd_802_11_rssi(wlan_private * priv,
679 adapter->RSSI[TYPE_BEACON][TYPE_NOAVG] = 0; 701 adapter->RSSI[TYPE_BEACON][TYPE_NOAVG] = 0;
680 adapter->RSSI[TYPE_BEACON][TYPE_AVG] = 0; 702 adapter->RSSI[TYPE_BEACON][TYPE_AVG] = 0;
681 703
704 lbs_deb_leave(LBS_DEB_CMD);
682 return 0; 705 return 0;
683} 706}
684 707
@@ -763,6 +786,7 @@ static int wlan_cmd_802_11_mac_address(wlan_private * priv,
763{ 786{
764 wlan_adapter *adapter = priv->adapter; 787 wlan_adapter *adapter = priv->adapter;
765 788
789 lbs_deb_enter(LBS_DEB_CMD);
766 cmd->command = cpu_to_le16(CMD_802_11_MAC_ADDRESS); 790 cmd->command = cpu_to_le16(CMD_802_11_MAC_ADDRESS);
767 cmd->size = cpu_to_le16(sizeof(struct cmd_ds_802_11_mac_address) + 791 cmd->size = cpu_to_le16(sizeof(struct cmd_ds_802_11_mac_address) +
768 S_DS_GEN); 792 S_DS_GEN);
@@ -776,6 +800,7 @@ static int wlan_cmd_802_11_mac_address(wlan_private * priv,
776 lbs_deb_hex(LBS_DEB_CMD, "SET_CMD: MAC addr", adapter->current_addr, 6); 800 lbs_deb_hex(LBS_DEB_CMD, "SET_CMD: MAC addr", adapter->current_addr, 6);
777 } 801 }
778 802
803 lbs_deb_leave(LBS_DEB_CMD);
779 return 0; 804 return 0;
780} 805}
781 806
@@ -797,6 +822,7 @@ static int wlan_cmd_802_11_eeprom_access(wlan_private * priv,
797 cmd->params.rdeeprom.bytecount = cpu_to_le16(ea->NOB); 822 cmd->params.rdeeprom.bytecount = cpu_to_le16(ea->NOB);
798 cmd->params.rdeeprom.value = 0; 823 cmd->params.rdeeprom.value = 0;
799 824
825 lbs_deb_leave(LBS_DEB_CMD);
800 return 0; 826 return 0;
801} 827}
802 828
@@ -805,7 +831,7 @@ static int wlan_cmd_bt_access(wlan_private * priv,
805 u16 cmd_action, void *pdata_buf) 831 u16 cmd_action, void *pdata_buf)
806{ 832{
807 struct cmd_ds_bt_access *bt_access = &cmd->params.bt; 833 struct cmd_ds_bt_access *bt_access = &cmd->params.bt;
808 lbs_deb_cmd("BT CMD(%d)\n", cmd_action); 834 lbs_deb_enter_args(LBS_DEB_CMD, "action %d", cmd_action);
809 835
810 cmd->command = cpu_to_le16(CMD_BT_ACCESS); 836 cmd->command = cpu_to_le16(CMD_BT_ACCESS);
811 cmd->size = cpu_to_le16(sizeof(struct cmd_ds_bt_access) + S_DS_GEN); 837 cmd->size = cpu_to_le16(sizeof(struct cmd_ds_bt_access) + S_DS_GEN);
@@ -834,6 +860,7 @@ static int wlan_cmd_bt_access(wlan_private * priv,
834 default: 860 default:
835 break; 861 break;
836 } 862 }
863 lbs_deb_leave(LBS_DEB_CMD);
837 return 0; 864 return 0;
838} 865}
839 866
@@ -842,7 +869,7 @@ static int wlan_cmd_fwt_access(wlan_private * priv,
842 u16 cmd_action, void *pdata_buf) 869 u16 cmd_action, void *pdata_buf)
843{ 870{
844 struct cmd_ds_fwt_access *fwt_access = &cmd->params.fwt; 871 struct cmd_ds_fwt_access *fwt_access = &cmd->params.fwt;
845 lbs_deb_cmd("FWT CMD(%d)\n", cmd_action); 872 lbs_deb_enter_args(LBS_DEB_CMD, "action %d", cmd_action);
846 873
847 cmd->command = cpu_to_le16(CMD_FWT_ACCESS); 874 cmd->command = cpu_to_le16(CMD_FWT_ACCESS);
848 cmd->size = cpu_to_le16(sizeof(struct cmd_ds_fwt_access) + S_DS_GEN); 875 cmd->size = cpu_to_le16(sizeof(struct cmd_ds_fwt_access) + S_DS_GEN);
@@ -855,6 +882,7 @@ static int wlan_cmd_fwt_access(wlan_private * priv,
855 882
856 fwt_access->action = cpu_to_le16(cmd_action); 883 fwt_access->action = cpu_to_le16(cmd_action);
857 884
885 lbs_deb_leave(LBS_DEB_CMD);
858 return 0; 886 return 0;
859} 887}
860 888
@@ -863,7 +891,7 @@ static int wlan_cmd_mesh_access(wlan_private * priv,
863 u16 cmd_action, void *pdata_buf) 891 u16 cmd_action, void *pdata_buf)
864{ 892{
865 struct cmd_ds_mesh_access *mesh_access = &cmd->params.mesh; 893 struct cmd_ds_mesh_access *mesh_access = &cmd->params.mesh;
866 lbs_deb_cmd("FWT CMD(%d)\n", cmd_action); 894 lbs_deb_enter_args(LBS_DEB_CMD, "action %d", cmd_action);
867 895
868 cmd->command = cpu_to_le16(CMD_MESH_ACCESS); 896 cmd->command = cpu_to_le16(CMD_MESH_ACCESS);
869 cmd->size = cpu_to_le16(sizeof(struct cmd_ds_mesh_access) + S_DS_GEN); 897 cmd->size = cpu_to_le16(sizeof(struct cmd_ds_mesh_access) + S_DS_GEN);
@@ -876,6 +904,7 @@ static int wlan_cmd_mesh_access(wlan_private * priv,
876 904
877 mesh_access->action = cpu_to_le16(cmd_action); 905 mesh_access->action = cpu_to_le16(cmd_action);
878 906
907 lbs_deb_leave(LBS_DEB_CMD);
879 return 0; 908 return 0;
880} 909}
881 910
@@ -884,16 +913,16 @@ void libertas_queue_cmd(wlan_adapter * adapter, struct cmd_ctrl_node *cmdnode, u
884 unsigned long flags; 913 unsigned long flags;
885 struct cmd_ds_command *cmdptr; 914 struct cmd_ds_command *cmdptr;
886 915
887 lbs_deb_enter(LBS_DEB_CMD); 916 lbs_deb_enter(LBS_DEB_HOST);
888 917
889 if (!cmdnode) { 918 if (!cmdnode) {
890 lbs_deb_cmd("QUEUE_CMD: cmdnode is NULL\n"); 919 lbs_deb_host("QUEUE_CMD: cmdnode is NULL\n");
891 goto done; 920 goto done;
892 } 921 }
893 922
894 cmdptr = (struct cmd_ds_command *)cmdnode->bufvirtualaddr; 923 cmdptr = (struct cmd_ds_command *)cmdnode->bufvirtualaddr;
895 if (!cmdptr) { 924 if (!cmdptr) {
896 lbs_deb_cmd("QUEUE_CMD: cmdptr is NULL\n"); 925 lbs_deb_host("QUEUE_CMD: cmdptr is NULL\n");
897 goto done; 926 goto done;
898 } 927 }
899 928
@@ -916,17 +945,16 @@ void libertas_queue_cmd(wlan_adapter * adapter, struct cmd_ctrl_node *cmdnode, u
916 945
917 spin_unlock_irqrestore(&adapter->driver_lock, flags); 946 spin_unlock_irqrestore(&adapter->driver_lock, flags);
918 947
919 lbs_deb_cmd("QUEUE_CMD: Inserted node=%p, cmd=0x%x in cmdpendingq\n", 948 lbs_deb_host("QUEUE_CMD: inserted command 0x%04x into cmdpendingq\n",
920 cmdnode,
921 le16_to_cpu(((struct cmd_ds_gen*)cmdnode->bufvirtualaddr)->command)); 949 le16_to_cpu(((struct cmd_ds_gen*)cmdnode->bufvirtualaddr)->command));
922 950
923done: 951done:
924 lbs_deb_leave(LBS_DEB_CMD); 952 lbs_deb_leave(LBS_DEB_HOST);
925} 953}
926 954
927/* 955/*
928 * TODO: Fix the issue when DownloadcommandToStation is being called the 956 * TODO: Fix the issue when DownloadcommandToStation is being called the
929 * second time when the command timesout. All the cmdptr->xxx are in little 957 * second time when the command times out. All the cmdptr->xxx are in little
930 * endian and therefore all the comparissions will fail. 958 * endian and therefore all the comparissions will fail.
931 * For now - we are not performing the endian conversion the second time - but 959 * For now - we are not performing the endian conversion the second time - but
932 * for PS and DEEP_SLEEP we need to worry 960 * for PS and DEEP_SLEEP we need to worry
@@ -941,11 +969,10 @@ static int DownloadcommandToStation(wlan_private * priv,
941 u16 cmdsize; 969 u16 cmdsize;
942 u16 command; 970 u16 command;
943 971
944 lbs_deb_enter(LBS_DEB_CMD); 972 lbs_deb_enter(LBS_DEB_HOST);
945 973
946 if (!adapter || !cmdnode) { 974 if (!adapter || !cmdnode) {
947 lbs_deb_cmd("DNLD_CMD: adapter = %p, cmdnode = %p\n", 975 lbs_deb_host("DNLD_CMD: adapter or cmdmode is NULL\n");
948 adapter, cmdnode);
949 if (cmdnode) { 976 if (cmdnode) {
950 spin_lock_irqsave(&adapter->driver_lock, flags); 977 spin_lock_irqsave(&adapter->driver_lock, flags);
951 __libertas_cleanup_and_insert_cmd(priv, cmdnode); 978 __libertas_cleanup_and_insert_cmd(priv, cmdnode);
@@ -957,11 +984,9 @@ static int DownloadcommandToStation(wlan_private * priv,
957 984
958 cmdptr = (struct cmd_ds_command *)cmdnode->bufvirtualaddr; 985 cmdptr = (struct cmd_ds_command *)cmdnode->bufvirtualaddr;
959 986
960
961 spin_lock_irqsave(&adapter->driver_lock, flags); 987 spin_lock_irqsave(&adapter->driver_lock, flags);
962 if (!cmdptr || !cmdptr->size) { 988 if (!cmdptr || !cmdptr->size) {
963 lbs_deb_cmd("DNLD_CMD: cmdptr is Null or cmd size is Zero, " 989 lbs_deb_host("DNLD_CMD: cmdptr is NULL or zero\n");
964 "Not sending\n");
965 __libertas_cleanup_and_insert_cmd(priv, cmdnode); 990 __libertas_cleanup_and_insert_cmd(priv, cmdnode);
966 spin_unlock_irqrestore(&adapter->driver_lock, flags); 991 spin_unlock_irqrestore(&adapter->driver_lock, flags);
967 ret = -1; 992 ret = -1;
@@ -971,20 +996,21 @@ static int DownloadcommandToStation(wlan_private * priv,
971 adapter->cur_cmd = cmdnode; 996 adapter->cur_cmd = cmdnode;
972 adapter->cur_cmd_retcode = 0; 997 adapter->cur_cmd_retcode = 0;
973 spin_unlock_irqrestore(&adapter->driver_lock, flags); 998 spin_unlock_irqrestore(&adapter->driver_lock, flags);
974 lbs_deb_cmd("DNLD_CMD:: Before download, size of cmd = %d\n",
975 le16_to_cpu(cmdptr->size));
976 999
977 cmdsize = cmdptr->size; 1000 cmdsize = cmdptr->size;
978
979 command = cpu_to_le16(cmdptr->command); 1001 command = cpu_to_le16(cmdptr->command);
980 1002
1003 lbs_deb_host("DNLD_CMD: command 0x%04x, size %d, jiffies %lu\n",
1004 command, le16_to_cpu(cmdptr->size), jiffies);
1005 lbs_deb_hex(LBS_DEB_HOST, "DNLD_CMD", cmdnode->bufvirtualaddr, cmdsize);
1006
981 cmdnode->cmdwaitqwoken = 0; 1007 cmdnode->cmdwaitqwoken = 0;
982 cmdsize = cpu_to_le16(cmdsize); 1008 cmdsize = cpu_to_le16(cmdsize);
983 1009
984 ret = priv->hw_host_to_card(priv, MVMS_CMD, (u8 *) cmdptr, cmdsize); 1010 ret = priv->hw_host_to_card(priv, MVMS_CMD, (u8 *) cmdptr, cmdsize);
985 1011
986 if (ret != 0) { 1012 if (ret != 0) {
987 lbs_deb_cmd("DNLD_CMD: Host to Card failed\n"); 1013 lbs_deb_host("DNLD_CMD: hw_host_to_card failed\n");
988 spin_lock_irqsave(&adapter->driver_lock, flags); 1014 spin_lock_irqsave(&adapter->driver_lock, flags);
989 __libertas_cleanup_and_insert_cmd(priv, adapter->cur_cmd); 1015 __libertas_cleanup_and_insert_cmd(priv, adapter->cur_cmd);
990 adapter->cur_cmd = NULL; 1016 adapter->cur_cmd = NULL;
@@ -993,8 +1019,7 @@ static int DownloadcommandToStation(wlan_private * priv,
993 goto done; 1019 goto done;
994 } 1020 }
995 1021
996 lbs_deb_cmd("DNLD_CMD: sent command 0x%x, jiffies %lu\n", command, jiffies); 1022 lbs_deb_cmd("DNLD_CMD: sent command 0x%04x, jiffies %lu\n", command, jiffies);
997 lbs_deb_hex(LBS_DEB_CMD, "command", cmdnode->bufvirtualaddr, cmdsize);
998 1023
999 /* Setup the timer after transmit command */ 1024 /* Setup the timer after transmit command */
1000 if (command == CMD_802_11_SCAN || command == CMD_802_11_AUTHENTICATE 1025 if (command == CMD_802_11_SCAN || command == CMD_802_11_AUTHENTICATE
@@ -1006,7 +1031,7 @@ static int DownloadcommandToStation(wlan_private * priv,
1006 ret = 0; 1031 ret = 0;
1007 1032
1008done: 1033done:
1009 lbs_deb_leave_args(LBS_DEB_CMD, "ret %d", ret); 1034 lbs_deb_leave_args(LBS_DEB_HOST, "ret %d", ret);
1010 return ret; 1035 return ret;
1011} 1036}
1012 1037
@@ -1021,7 +1046,7 @@ static int wlan_cmd_mac_control(wlan_private * priv,
1021 cmd->size = cpu_to_le16(sizeof(struct cmd_ds_mac_control) + S_DS_GEN); 1046 cmd->size = cpu_to_le16(sizeof(struct cmd_ds_mac_control) + S_DS_GEN);
1022 mac->action = cpu_to_le16(priv->adapter->currentpacketfilter); 1047 mac->action = cpu_to_le16(priv->adapter->currentpacketfilter);
1023 1048
1024 lbs_deb_cmd("wlan_cmd_mac_control(): action=0x%X size=%d\n", 1049 lbs_deb_cmd("MAC_CONTROL: action 0x%x, size %d\n",
1025 le16_to_cpu(mac->action), le16_to_cpu(cmd->size)); 1050 le16_to_cpu(mac->action), le16_to_cpu(cmd->size));
1026 1051
1027 lbs_deb_leave(LBS_DEB_CMD); 1052 lbs_deb_leave(LBS_DEB_CMD);
@@ -1037,12 +1062,10 @@ void __libertas_cleanup_and_insert_cmd(wlan_private * priv, struct cmd_ctrl_node
1037 wlan_adapter *adapter = priv->adapter; 1062 wlan_adapter *adapter = priv->adapter;
1038 1063
1039 if (!ptempcmd) 1064 if (!ptempcmd)
1040 goto done; 1065 return;
1041 1066
1042 cleanup_cmdnode(ptempcmd); 1067 cleanup_cmdnode(ptempcmd);
1043 list_add_tail((struct list_head *)ptempcmd, &adapter->cmdfreeq); 1068 list_add_tail((struct list_head *)ptempcmd, &adapter->cmdfreeq);
1044done:
1045 return;
1046} 1069}
1047 1070
1048static void libertas_cleanup_and_insert_cmd(wlan_private * priv, struct cmd_ctrl_node *ptempcmd) 1071static void libertas_cleanup_and_insert_cmd(wlan_private * priv, struct cmd_ctrl_node *ptempcmd)
@@ -1065,7 +1088,7 @@ int libertas_set_radio_control(wlan_private * priv)
1065 CMD_ACT_SET, 1088 CMD_ACT_SET,
1066 CMD_OPTION_WAITFORRSP, 0, NULL); 1089 CMD_OPTION_WAITFORRSP, 0, NULL);
1067 1090
1068 lbs_deb_cmd("RADIO_SET: on or off: 0x%X, preamble = 0x%X\n", 1091 lbs_deb_cmd("RADIO_SET: radio %d, preamble %d\n",
1069 priv->adapter->radioon, priv->adapter->preamble); 1092 priv->adapter->radioon, priv->adapter->preamble);
1070 1093
1071 lbs_deb_leave_args(LBS_DEB_CMD, "ret %d", ret); 1094 lbs_deb_leave_args(LBS_DEB_CMD, "ret %d", ret);
@@ -1078,9 +1101,6 @@ int libertas_set_mac_packet_filter(wlan_private * priv)
1078 1101
1079 lbs_deb_enter(LBS_DEB_CMD); 1102 lbs_deb_enter(LBS_DEB_CMD);
1080 1103
1081 lbs_deb_cmd("libertas_set_mac_packet_filter value = %x\n",
1082 priv->adapter->currentpacketfilter);
1083
1084 /* Send MAC control command to station */ 1104 /* Send MAC control command to station */
1085 ret = libertas_prepare_and_send_command(priv, 1105 ret = libertas_prepare_and_send_command(priv,
1086 CMD_MAC_CONTROL, 0, 0, 0, NULL); 1106 CMD_MAC_CONTROL, 0, 0, 0, NULL);
@@ -1111,16 +1131,16 @@ int libertas_prepare_and_send_command(wlan_private * priv,
1111 struct cmd_ds_command *cmdptr; 1131 struct cmd_ds_command *cmdptr;
1112 unsigned long flags; 1132 unsigned long flags;
1113 1133
1114 lbs_deb_enter(LBS_DEB_CMD); 1134 lbs_deb_enter(LBS_DEB_HOST);
1115 1135
1116 if (!adapter) { 1136 if (!adapter) {
1117 lbs_deb_cmd("PREP_CMD: adapter is Null\n"); 1137 lbs_deb_host("PREP_CMD: adapter is NULL\n");
1118 ret = -1; 1138 ret = -1;
1119 goto done; 1139 goto done;
1120 } 1140 }
1121 1141
1122 if (adapter->surpriseremoved) { 1142 if (adapter->surpriseremoved) {
1123 lbs_deb_cmd("PREP_CMD: Card is Removed\n"); 1143 lbs_deb_host("PREP_CMD: card removed\n");
1124 ret = -1; 1144 ret = -1;
1125 goto done; 1145 goto done;
1126 } 1146 }
@@ -1128,7 +1148,7 @@ int libertas_prepare_and_send_command(wlan_private * priv,
1128 cmdnode = libertas_get_free_cmd_ctrl_node(priv); 1148 cmdnode = libertas_get_free_cmd_ctrl_node(priv);
1129 1149
1130 if (cmdnode == NULL) { 1150 if (cmdnode == NULL) {
1131 lbs_deb_cmd("PREP_CMD: No free cmdnode\n"); 1151 lbs_deb_host("PREP_CMD: cmdnode is NULL\n");
1132 1152
1133 /* Wake up main thread to execute next command */ 1153 /* Wake up main thread to execute next command */
1134 wake_up_interruptible(&priv->waitq); 1154 wake_up_interruptible(&priv->waitq);
@@ -1140,11 +1160,10 @@ int libertas_prepare_and_send_command(wlan_private * priv,
1140 1160
1141 cmdptr = (struct cmd_ds_command *)cmdnode->bufvirtualaddr; 1161 cmdptr = (struct cmd_ds_command *)cmdnode->bufvirtualaddr;
1142 1162
1143 lbs_deb_cmd("PREP_CMD: Val of cmd ptr=%p, command=0x%X\n", 1163 lbs_deb_host("PREP_CMD: command 0x%04x\n", cmd_no);
1144 cmdptr, cmd_no);
1145 1164
1146 if (!cmdptr) { 1165 if (!cmdptr) {
1147 lbs_deb_cmd("PREP_CMD: bufvirtualaddr of cmdnode is NULL\n"); 1166 lbs_deb_host("PREP_CMD: cmdptr is NULL\n");
1148 libertas_cleanup_and_insert_cmd(priv, cmdnode); 1167 libertas_cleanup_and_insert_cmd(priv, cmdnode);
1149 ret = -1; 1168 ret = -1;
1150 goto done; 1169 goto done;
@@ -1382,14 +1401,14 @@ int libertas_prepare_and_send_command(wlan_private * priv,
1382 ret = 0; 1401 ret = 0;
1383 break; 1402 break;
1384 default: 1403 default:
1385 lbs_deb_cmd("PREP_CMD: unknown command- %#x\n", cmd_no); 1404 lbs_deb_host("PREP_CMD: unknown command 0x%04x\n", cmd_no);
1386 ret = -1; 1405 ret = -1;
1387 break; 1406 break;
1388 } 1407 }
1389 1408
1390 /* return error, since the command preparation failed */ 1409 /* return error, since the command preparation failed */
1391 if (ret != 0) { 1410 if (ret != 0) {
1392 lbs_deb_cmd("PREP_CMD: command preparation failed\n"); 1411 lbs_deb_host("PREP_CMD: command preparation failed\n");
1393 libertas_cleanup_and_insert_cmd(priv, cmdnode); 1412 libertas_cleanup_and_insert_cmd(priv, cmdnode);
1394 ret = -1; 1413 ret = -1;
1395 goto done; 1414 goto done;
@@ -1402,7 +1421,7 @@ int libertas_prepare_and_send_command(wlan_private * priv,
1402 wake_up_interruptible(&priv->waitq); 1421 wake_up_interruptible(&priv->waitq);
1403 1422
1404 if (wait_option & CMD_OPTION_WAITFORRSP) { 1423 if (wait_option & CMD_OPTION_WAITFORRSP) {
1405 lbs_deb_cmd("PREP_CMD: Wait for CMD response\n"); 1424 lbs_deb_host("PREP_CMD: wait for response\n");
1406 might_sleep(); 1425 might_sleep();
1407 wait_event_interruptible(cmdnode->cmdwait_q, 1426 wait_event_interruptible(cmdnode->cmdwait_q,
1408 cmdnode->cmdwaitqwoken); 1427 cmdnode->cmdwaitqwoken);
@@ -1410,7 +1429,7 @@ int libertas_prepare_and_send_command(wlan_private * priv,
1410 1429
1411 spin_lock_irqsave(&adapter->driver_lock, flags); 1430 spin_lock_irqsave(&adapter->driver_lock, flags);
1412 if (adapter->cur_cmd_retcode) { 1431 if (adapter->cur_cmd_retcode) {
1413 lbs_deb_cmd("PREP_CMD: command failed with return code=%d\n", 1432 lbs_deb_host("PREP_CMD: command failed with return code %d\n",
1414 adapter->cur_cmd_retcode); 1433 adapter->cur_cmd_retcode);
1415 adapter->cur_cmd_retcode = 0; 1434 adapter->cur_cmd_retcode = 0;
1416 ret = -1; 1435 ret = -1;
@@ -1418,7 +1437,7 @@ int libertas_prepare_and_send_command(wlan_private * priv,
1418 spin_unlock_irqrestore(&adapter->driver_lock, flags); 1437 spin_unlock_irqrestore(&adapter->driver_lock, flags);
1419 1438
1420done: 1439done:
1421 lbs_deb_leave_args(LBS_DEB_CMD, "ret %d", ret); 1440 lbs_deb_leave_args(LBS_DEB_HOST, "ret %d", ret);
1422 return ret; 1441 return ret;
1423} 1442}
1424EXPORT_SYMBOL_GPL(libertas_prepare_and_send_command); 1443EXPORT_SYMBOL_GPL(libertas_prepare_and_send_command);
@@ -1439,14 +1458,13 @@ int libertas_allocate_cmd_buffer(wlan_private * priv)
1439 u8 *ptempvirtualaddr; 1458 u8 *ptempvirtualaddr;
1440 wlan_adapter *adapter = priv->adapter; 1459 wlan_adapter *adapter = priv->adapter;
1441 1460
1442 lbs_deb_enter(LBS_DEB_CMD); 1461 lbs_deb_enter(LBS_DEB_HOST);
1443 1462
1444 /* Allocate and initialize cmdCtrlNode */ 1463 /* Allocate and initialize cmdCtrlNode */
1445 ulbufsize = sizeof(struct cmd_ctrl_node) * MRVDRV_NUM_OF_CMD_BUFFER; 1464 ulbufsize = sizeof(struct cmd_ctrl_node) * MRVDRV_NUM_OF_CMD_BUFFER;
1446 1465
1447 if (!(tempcmd_array = kzalloc(ulbufsize, GFP_KERNEL))) { 1466 if (!(tempcmd_array = kzalloc(ulbufsize, GFP_KERNEL))) {
1448 lbs_deb_cmd( 1467 lbs_deb_host("ALLOC_CMD_BUF: tempcmd_array is NULL\n");
1449 "ALLOC_CMD_BUF: failed to allocate tempcmd_array\n");
1450 ret = -1; 1468 ret = -1;
1451 goto done; 1469 goto done;
1452 } 1470 }
@@ -1456,8 +1474,7 @@ int libertas_allocate_cmd_buffer(wlan_private * priv)
1456 ulbufsize = MRVDRV_SIZE_OF_CMD_BUFFER; 1474 ulbufsize = MRVDRV_SIZE_OF_CMD_BUFFER;
1457 for (i = 0; i < MRVDRV_NUM_OF_CMD_BUFFER; i++) { 1475 for (i = 0; i < MRVDRV_NUM_OF_CMD_BUFFER; i++) {
1458 if (!(ptempvirtualaddr = kzalloc(ulbufsize, GFP_KERNEL))) { 1476 if (!(ptempvirtualaddr = kzalloc(ulbufsize, GFP_KERNEL))) {
1459 lbs_deb_cmd( 1477 lbs_deb_host("ALLOC_CMD_BUF: ptempvirtualaddr is NULL\n");
1460 "ALLOC_CMD_BUF: ptempvirtualaddr: out of memory\n");
1461 ret = -1; 1478 ret = -1;
1462 goto done; 1479 goto done;
1463 } 1480 }
@@ -1474,7 +1491,7 @@ int libertas_allocate_cmd_buffer(wlan_private * priv)
1474 ret = 0; 1491 ret = 0;
1475 1492
1476done: 1493done:
1477 lbs_deb_leave_args(LBS_DEB_CMD, "ret %d", ret); 1494 lbs_deb_leave_args(LBS_DEB_HOST, "ret %d", ret);
1478 return ret; 1495 return ret;
1479} 1496}
1480 1497
@@ -1491,11 +1508,11 @@ int libertas_free_cmd_buffer(wlan_private * priv)
1491 struct cmd_ctrl_node *tempcmd_array; 1508 struct cmd_ctrl_node *tempcmd_array;
1492 wlan_adapter *adapter = priv->adapter; 1509 wlan_adapter *adapter = priv->adapter;
1493 1510
1494 lbs_deb_enter(LBS_DEB_CMD); 1511 lbs_deb_enter(LBS_DEB_HOST);
1495 1512
1496 /* need to check if cmd array is allocated or not */ 1513 /* need to check if cmd array is allocated or not */
1497 if (adapter->cmd_array == NULL) { 1514 if (adapter->cmd_array == NULL) {
1498 lbs_deb_cmd("FREE_CMD_BUF: cmd_array is Null\n"); 1515 lbs_deb_host("FREE_CMD_BUF: cmd_array is NULL\n");
1499 goto done; 1516 goto done;
1500 } 1517 }
1501 1518
@@ -1505,7 +1522,6 @@ int libertas_free_cmd_buffer(wlan_private * priv)
1505 ulbufsize = MRVDRV_SIZE_OF_CMD_BUFFER; 1522 ulbufsize = MRVDRV_SIZE_OF_CMD_BUFFER;
1506 for (i = 0; i < MRVDRV_NUM_OF_CMD_BUFFER; i++) { 1523 for (i = 0; i < MRVDRV_NUM_OF_CMD_BUFFER; i++) {
1507 if (tempcmd_array[i].bufvirtualaddr) { 1524 if (tempcmd_array[i].bufvirtualaddr) {
1508 lbs_deb_cmd("Free all the array\n");
1509 kfree(tempcmd_array[i].bufvirtualaddr); 1525 kfree(tempcmd_array[i].bufvirtualaddr);
1510 tempcmd_array[i].bufvirtualaddr = NULL; 1526 tempcmd_array[i].bufvirtualaddr = NULL;
1511 } 1527 }
@@ -1513,13 +1529,12 @@ int libertas_free_cmd_buffer(wlan_private * priv)
1513 1529
1514 /* Release cmd_ctrl_node */ 1530 /* Release cmd_ctrl_node */
1515 if (adapter->cmd_array) { 1531 if (adapter->cmd_array) {
1516 lbs_deb_cmd("Free cmd_array\n");
1517 kfree(adapter->cmd_array); 1532 kfree(adapter->cmd_array);
1518 adapter->cmd_array = NULL; 1533 adapter->cmd_array = NULL;
1519 } 1534 }
1520 1535
1521done: 1536done:
1522 lbs_deb_leave(LBS_DEB_CMD); 1537 lbs_deb_leave(LBS_DEB_HOST);
1523 return 0; 1538 return 0;
1524} 1539}
1525 1540
@@ -1536,6 +1551,8 @@ struct cmd_ctrl_node *libertas_get_free_cmd_ctrl_node(wlan_private * priv)
1536 wlan_adapter *adapter = priv->adapter; 1551 wlan_adapter *adapter = priv->adapter;
1537 unsigned long flags; 1552 unsigned long flags;
1538 1553
1554 lbs_deb_enter(LBS_DEB_HOST);
1555
1539 if (!adapter) 1556 if (!adapter)
1540 return NULL; 1557 return NULL;
1541 1558
@@ -1545,21 +1562,16 @@ struct cmd_ctrl_node *libertas_get_free_cmd_ctrl_node(wlan_private * priv)
1545 tempnode = (struct cmd_ctrl_node *)adapter->cmdfreeq.next; 1562 tempnode = (struct cmd_ctrl_node *)adapter->cmdfreeq.next;
1546 list_del((struct list_head *)tempnode); 1563 list_del((struct list_head *)tempnode);
1547 } else { 1564 } else {
1548 lbs_deb_cmd("GET_CMD_NODE: cmd_ctrl_node is not available\n"); 1565 lbs_deb_host("GET_CMD_NODE: cmd_ctrl_node is not available\n");
1549 tempnode = NULL; 1566 tempnode = NULL;
1550 } 1567 }
1551 1568
1552 spin_unlock_irqrestore(&adapter->driver_lock, flags); 1569 spin_unlock_irqrestore(&adapter->driver_lock, flags);
1553 1570
1554 if (tempnode) { 1571 if (tempnode)
1555 /*
1556 lbs_pr_debug(3, "GET_CMD_NODE: cmdCtrlNode available\n");
1557 lbs_pr_debug(3, "GET_CMD_NODE: cmdCtrlNode Address = %p\n",
1558 tempnode);
1559 */
1560 cleanup_cmdnode(tempnode); 1572 cleanup_cmdnode(tempnode);
1561 }
1562 1573
1574 lbs_deb_leave(LBS_DEB_HOST);
1563 return tempnode; 1575 return tempnode;
1564} 1576}
1565 1577
@@ -1571,6 +1583,8 @@ struct cmd_ctrl_node *libertas_get_free_cmd_ctrl_node(wlan_private * priv)
1571 */ 1583 */
1572static void cleanup_cmdnode(struct cmd_ctrl_node *ptempnode) 1584static void cleanup_cmdnode(struct cmd_ctrl_node *ptempnode)
1573{ 1585{
1586 lbs_deb_enter(LBS_DEB_HOST);
1587
1574 if (!ptempnode) 1588 if (!ptempnode)
1575 return; 1589 return;
1576 ptempnode->cmdwaitqwoken = 1; 1590 ptempnode->cmdwaitqwoken = 1;
@@ -1582,7 +1596,8 @@ static void cleanup_cmdnode(struct cmd_ctrl_node *ptempnode)
1582 1596
1583 if (ptempnode->bufvirtualaddr != NULL) 1597 if (ptempnode->bufvirtualaddr != NULL)
1584 memset(ptempnode->bufvirtualaddr, 0, MRVDRV_SIZE_OF_CMD_BUFFER); 1598 memset(ptempnode->bufvirtualaddr, 0, MRVDRV_SIZE_OF_CMD_BUFFER);
1585 return; 1599
1600 lbs_deb_leave(LBS_DEB_HOST);
1586} 1601}
1587 1602
1588/** 1603/**
@@ -1599,7 +1614,7 @@ void libertas_set_cmd_ctrl_node(wlan_private * priv,
1599 struct cmd_ctrl_node *ptempnode, 1614 struct cmd_ctrl_node *ptempnode,
1600 u32 cmd_oid, u16 wait_option, void *pdata_buf) 1615 u32 cmd_oid, u16 wait_option, void *pdata_buf)
1601{ 1616{
1602 lbs_deb_enter(LBS_DEB_CMD); 1617 lbs_deb_enter(LBS_DEB_HOST);
1603 1618
1604 if (!ptempnode) 1619 if (!ptempnode)
1605 return; 1620 return;
@@ -1608,7 +1623,7 @@ void libertas_set_cmd_ctrl_node(wlan_private * priv,
1608 ptempnode->wait_option = wait_option; 1623 ptempnode->wait_option = wait_option;
1609 ptempnode->pdata_buf = pdata_buf; 1624 ptempnode->pdata_buf = pdata_buf;
1610 1625
1611 lbs_deb_leave(LBS_DEB_CMD); 1626 lbs_deb_leave(LBS_DEB_HOST);
1612} 1627}
1613 1628
1614/** 1629/**
@@ -1627,12 +1642,15 @@ int libertas_execute_next_command(wlan_private * priv)
1627 unsigned long flags; 1642 unsigned long flags;
1628 int ret = 0; 1643 int ret = 0;
1629 1644
1630 lbs_deb_enter(LBS_DEB_CMD); 1645 // Debug group is LBS_DEB_THREAD and not LBS_DEB_HOST, because the
1646 // only caller to us is libertas_thread() and we get even when a
1647 // data packet is received
1648 lbs_deb_enter(LBS_DEB_THREAD);
1631 1649
1632 spin_lock_irqsave(&adapter->driver_lock, flags); 1650 spin_lock_irqsave(&adapter->driver_lock, flags);
1633 1651
1634 if (adapter->cur_cmd) { 1652 if (adapter->cur_cmd) {
1635 lbs_pr_alert( "EXEC_NEXT_CMD: there is command in processing!\n"); 1653 lbs_pr_alert( "EXEC_NEXT_CMD: already processing command!\n");
1636 spin_unlock_irqrestore(&adapter->driver_lock, flags); 1654 spin_unlock_irqrestore(&adapter->driver_lock, flags);
1637 ret = -1; 1655 ret = -1;
1638 goto done; 1656 goto done;
@@ -1646,22 +1664,20 @@ int libertas_execute_next_command(wlan_private * priv)
1646 spin_unlock_irqrestore(&adapter->driver_lock, flags); 1664 spin_unlock_irqrestore(&adapter->driver_lock, flags);
1647 1665
1648 if (cmdnode) { 1666 if (cmdnode) {
1649 lbs_deb_cmd(
1650 "EXEC_NEXT_CMD: Got next command from cmdpendingq\n");
1651 cmdptr = (struct cmd_ds_command *)cmdnode->bufvirtualaddr; 1667 cmdptr = (struct cmd_ds_command *)cmdnode->bufvirtualaddr;
1652 1668
1653 if (is_command_allowed_in_ps(cmdptr->command)) { 1669 if (is_command_allowed_in_ps(cmdptr->command)) {
1654 if ((adapter->psstate == PS_STATE_SLEEP) || 1670 if ((adapter->psstate == PS_STATE_SLEEP) ||
1655 (adapter->psstate == PS_STATE_PRE_SLEEP)) { 1671 (adapter->psstate == PS_STATE_PRE_SLEEP)) {
1656 lbs_deb_cmd( 1672 lbs_deb_host(
1657 "EXEC_NEXT_CMD: Cannot send cmd 0x%x in psstate %d\n", 1673 "EXEC_NEXT_CMD: cannot send cmd 0x%04x in psstate %d\n",
1658 le16_to_cpu(cmdptr->command), 1674 le16_to_cpu(cmdptr->command),
1659 adapter->psstate); 1675 adapter->psstate);
1660 ret = -1; 1676 ret = -1;
1661 goto done; 1677 goto done;
1662 } 1678 }
1663 lbs_deb_cmd("EXEC_NEXT_CMD: OK to send command " 1679 lbs_deb_host("EXEC_NEXT_CMD: OK to send command "
1664 "0x%x in psstate %d\n", 1680 "0x%04x in psstate %d\n",
1665 le16_to_cpu(cmdptr->command), 1681 le16_to_cpu(cmdptr->command),
1666 adapter->psstate); 1682 adapter->psstate);
1667 } else if (adapter->psstate != PS_STATE_FULL_POWER) { 1683 } else if (adapter->psstate != PS_STATE_FULL_POWER) {
@@ -1699,13 +1715,13 @@ int libertas_execute_next_command(wlan_private * priv)
1699 struct cmd_ds_802_11_ps_mode *psm = 1715 struct cmd_ds_802_11_ps_mode *psm =
1700 &cmdptr->params.psmode; 1716 &cmdptr->params.psmode;
1701 1717
1702 lbs_deb_cmd( 1718 lbs_deb_host(
1703 "EXEC_NEXT_CMD: PS cmd- action=0x%x\n", 1719 "EXEC_NEXT_CMD: PS cmd, action 0x%02x\n",
1704 psm->action); 1720 psm->action);
1705 if (psm->action != 1721 if (psm->action !=
1706 cpu_to_le16(CMD_SUBCMD_EXIT_PS)) { 1722 cpu_to_le16(CMD_SUBCMD_EXIT_PS)) {
1707 lbs_deb_cmd( 1723 lbs_deb_host(
1708 "EXEC_NEXT_CMD: Ignore Enter PS cmd\n"); 1724 "EXEC_NEXT_CMD: ignore ENTER_PS cmd\n");
1709 list_del((struct list_head *)cmdnode); 1725 list_del((struct list_head *)cmdnode);
1710 libertas_cleanup_and_insert_cmd(priv, cmdnode); 1726 libertas_cleanup_and_insert_cmd(priv, cmdnode);
1711 1727
@@ -1715,8 +1731,8 @@ int libertas_execute_next_command(wlan_private * priv)
1715 1731
1716 if ((adapter->psstate == PS_STATE_SLEEP) || 1732 if ((adapter->psstate == PS_STATE_SLEEP) ||
1717 (adapter->psstate == PS_STATE_PRE_SLEEP)) { 1733 (adapter->psstate == PS_STATE_PRE_SLEEP)) {
1718 lbs_deb_cmd( 1734 lbs_deb_host(
1719 "EXEC_NEXT_CMD: Ignore ExitPS cmd in sleep\n"); 1735 "EXEC_NEXT_CMD: ignore EXIT_PS cmd in sleep\n");
1720 list_del((struct list_head *)cmdnode); 1736 list_del((struct list_head *)cmdnode);
1721 libertas_cleanup_and_insert_cmd(priv, cmdnode); 1737 libertas_cleanup_and_insert_cmd(priv, cmdnode);
1722 adapter->needtowakeup = 1; 1738 adapter->needtowakeup = 1;
@@ -1725,12 +1741,12 @@ int libertas_execute_next_command(wlan_private * priv)
1725 goto done; 1741 goto done;
1726 } 1742 }
1727 1743
1728 lbs_deb_cmd( 1744 lbs_deb_host(
1729 "EXEC_NEXT_CMD: Sending Exit_PS down...\n"); 1745 "EXEC_NEXT_CMD: sending EXIT_PS\n");
1730 } 1746 }
1731 } 1747 }
1732 list_del((struct list_head *)cmdnode); 1748 list_del((struct list_head *)cmdnode);
1733 lbs_deb_cmd("EXEC_NEXT_CMD: Sending 0x%04X command\n", 1749 lbs_deb_host("EXEC_NEXT_CMD: sending command 0x%04x\n",
1734 le16_to_cpu(cmdptr->command)); 1750 le16_to_cpu(cmdptr->command));
1735 DownloadcommandToStation(priv, cmdnode); 1751 DownloadcommandToStation(priv, cmdnode);
1736 } else { 1752 } else {
@@ -1746,15 +1762,15 @@ int libertas_execute_next_command(wlan_private * priv)
1746 /* check for valid WPA group keys */ 1762 /* check for valid WPA group keys */
1747 if (adapter->wpa_mcast_key.len || 1763 if (adapter->wpa_mcast_key.len ||
1748 adapter->wpa_unicast_key.len) { 1764 adapter->wpa_unicast_key.len) {
1749 lbs_deb_cmd( 1765 lbs_deb_host(
1750 "EXEC_NEXT_CMD: WPA enabled and GTK_SET" 1766 "EXEC_NEXT_CMD: WPA enabled and GTK_SET"
1751 " go back to PS_SLEEP"); 1767 " go back to PS_SLEEP");
1752 libertas_ps_sleep(priv, 0); 1768 libertas_ps_sleep(priv, 0);
1753 } 1769 }
1754 } else { 1770 } else {
1755 lbs_deb_cmd( 1771 lbs_deb_host(
1756 "EXEC_NEXT_CMD: command PendQ is empty," 1772 "EXEC_NEXT_CMD: cmdpendingq empty, "
1757 " go back to PS_SLEEP"); 1773 "go back to PS_SLEEP");
1758 libertas_ps_sleep(priv, 0); 1774 libertas_ps_sleep(priv, 0);
1759 } 1775 }
1760 } 1776 }
@@ -1762,7 +1778,7 @@ int libertas_execute_next_command(wlan_private * priv)
1762 1778
1763 ret = 0; 1779 ret = 0;
1764done: 1780done:
1765 lbs_deb_leave(LBS_DEB_CMD); 1781 lbs_deb_leave(LBS_DEB_THREAD);
1766 return ret; 1782 return ret;
1767} 1783}
1768 1784
@@ -1771,7 +1787,7 @@ void libertas_send_iwevcustom_event(wlan_private * priv, s8 * str)
1771 union iwreq_data iwrq; 1787 union iwreq_data iwrq;
1772 u8 buf[50]; 1788 u8 buf[50];
1773 1789
1774 lbs_deb_enter(LBS_DEB_CMD); 1790 lbs_deb_enter(LBS_DEB_WEXT);
1775 1791
1776 memset(&iwrq, 0, sizeof(union iwreq_data)); 1792 memset(&iwrq, 0, sizeof(union iwreq_data));
1777 memset(buf, 0, sizeof(buf)); 1793 memset(buf, 0, sizeof(buf));
@@ -1781,13 +1797,13 @@ void libertas_send_iwevcustom_event(wlan_private * priv, s8 * str)
1781 iwrq.data.length = strlen(buf) + 1 + IW_EV_LCP_LEN; 1797 iwrq.data.length = strlen(buf) + 1 + IW_EV_LCP_LEN;
1782 1798
1783 /* Send Event to upper layer */ 1799 /* Send Event to upper layer */
1784 lbs_deb_cmd("Event Indication string = %s\n", (char *)buf); 1800 lbs_deb_wext("event indication string %s\n", (char *)buf);
1785 lbs_deb_cmd("Event Indication String length = %d\n", iwrq.data.length); 1801 lbs_deb_wext("event indication length %d\n", iwrq.data.length);
1802 lbs_deb_wext("sending wireless event IWEVCUSTOM for %s\n", str);
1786 1803
1787 lbs_deb_cmd("Sending wireless event IWEVCUSTOM for %s\n", str);
1788 wireless_send_event(priv->dev, IWEVCUSTOM, &iwrq, buf); 1804 wireless_send_event(priv->dev, IWEVCUSTOM, &iwrq, buf);
1789 1805
1790 lbs_deb_leave(LBS_DEB_CMD); 1806 lbs_deb_leave(LBS_DEB_WEXT);
1791} 1807}
1792 1808
1793static int sendconfirmsleep(wlan_private * priv, u8 * cmdptr, u16 size) 1809static int sendconfirmsleep(wlan_private * priv, u8 * cmdptr, u16 size)
@@ -1796,19 +1812,19 @@ static int sendconfirmsleep(wlan_private * priv, u8 * cmdptr, u16 size)
1796 wlan_adapter *adapter = priv->adapter; 1812 wlan_adapter *adapter = priv->adapter;
1797 int ret = 0; 1813 int ret = 0;
1798 1814
1799 lbs_deb_enter(LBS_DEB_CMD); 1815 lbs_deb_enter(LBS_DEB_HOST);
1800 1816
1801 lbs_deb_cmd("SEND_SLEEPC_CMD: Before download, size of cmd = %d\n", 1817 lbs_deb_host("SEND_SLEEPC_CMD: before download, cmd size %d\n",
1802 size); 1818 size);
1803 1819
1804 lbs_deb_hex(LBS_DEB_CMD, "sleep confirm command", cmdptr, size); 1820 lbs_deb_hex(LBS_DEB_HOST, "sleep confirm command", cmdptr, size);
1805 1821
1806 ret = priv->hw_host_to_card(priv, MVMS_CMD, cmdptr, size); 1822 ret = priv->hw_host_to_card(priv, MVMS_CMD, cmdptr, size);
1807 priv->dnld_sent = DNLD_RES_RECEIVED; 1823 priv->dnld_sent = DNLD_RES_RECEIVED;
1808 1824
1809 spin_lock_irqsave(&adapter->driver_lock, flags); 1825 spin_lock_irqsave(&adapter->driver_lock, flags);
1810 if (adapter->intcounter || adapter->currenttxskb) 1826 if (adapter->intcounter || adapter->currenttxskb)
1811 lbs_deb_cmd("SEND_SLEEPC_CMD: intcounter=%d currenttxskb=%p\n", 1827 lbs_deb_host("SEND_SLEEPC_CMD: intcounter %d, currenttxskb %p\n",
1812 adapter->intcounter, adapter->currenttxskb); 1828 adapter->intcounter, adapter->currenttxskb);
1813 spin_unlock_irqrestore(&adapter->driver_lock, flags); 1829 spin_unlock_irqrestore(&adapter->driver_lock, flags);
1814 1830
@@ -1820,22 +1836,21 @@ static int sendconfirmsleep(wlan_private * priv, u8 * cmdptr, u16 size)
1820 if (!adapter->intcounter) { 1836 if (!adapter->intcounter) {
1821 adapter->psstate = PS_STATE_SLEEP; 1837 adapter->psstate = PS_STATE_SLEEP;
1822 } else { 1838 } else {
1823 lbs_deb_cmd("SEND_SLEEPC_CMD: After sent,IntC=%d\n", 1839 lbs_deb_host("SEND_SLEEPC_CMD: after sent, intcounter %d\n",
1824 adapter->intcounter); 1840 adapter->intcounter);
1825 } 1841 }
1826 spin_unlock_irqrestore(&adapter->driver_lock, flags); 1842 spin_unlock_irqrestore(&adapter->driver_lock, flags);
1827 1843
1828 lbs_deb_cmd("SEND_SLEEPC_CMD: Sent Confirm Sleep command\n"); 1844 lbs_deb_host("SEND_SLEEPC_CMD: sent confirm sleep\n");
1829 lbs_deb_cmd("+");
1830 } 1845 }
1831 1846
1832 lbs_deb_leave_args(LBS_DEB_CMD, "ret %d", ret); 1847 lbs_deb_leave_args(LBS_DEB_HOST, "ret %d", ret);
1833 return ret; 1848 return ret;
1834} 1849}
1835 1850
1836void libertas_ps_sleep(wlan_private * priv, int wait_option) 1851void libertas_ps_sleep(wlan_private * priv, int wait_option)
1837{ 1852{
1838 lbs_deb_enter(LBS_DEB_CMD); 1853 lbs_deb_enter(LBS_DEB_HOST);
1839 1854
1840 /* 1855 /*
1841 * PS is currently supported only in Infrastructure mode 1856 * PS is currently supported only in Infrastructure mode
@@ -1845,11 +1860,11 @@ void libertas_ps_sleep(wlan_private * priv, int wait_option)
1845 libertas_prepare_and_send_command(priv, CMD_802_11_PS_MODE, 1860 libertas_prepare_and_send_command(priv, CMD_802_11_PS_MODE,
1846 CMD_SUBCMD_ENTER_PS, wait_option, 0, NULL); 1861 CMD_SUBCMD_ENTER_PS, wait_option, 0, NULL);
1847 1862
1848 lbs_deb_leave(LBS_DEB_CMD); 1863 lbs_deb_leave(LBS_DEB_HOST);
1849} 1864}
1850 1865
1851/** 1866/**
1852 * @brief This function sends Eixt_PS command to firmware. 1867 * @brief This function sends Exit_PS command to firmware.
1853 * 1868 *
1854 * @param priv A pointer to wlan_private structure 1869 * @param priv A pointer to wlan_private structure
1855 * @param wait_option wait response or not 1870 * @param wait_option wait response or not
@@ -1859,17 +1874,15 @@ void libertas_ps_wakeup(wlan_private * priv, int wait_option)
1859{ 1874{
1860 __le32 Localpsmode; 1875 __le32 Localpsmode;
1861 1876
1862 lbs_deb_enter(LBS_DEB_CMD); 1877 lbs_deb_enter(LBS_DEB_HOST);
1863 1878
1864 Localpsmode = cpu_to_le32(WLAN802_11POWERMODECAM); 1879 Localpsmode = cpu_to_le32(WLAN802_11POWERMODECAM);
1865 1880
1866 lbs_deb_cmd("Exit_PS: Localpsmode = %d\n", WLAN802_11POWERMODECAM);
1867
1868 libertas_prepare_and_send_command(priv, CMD_802_11_PS_MODE, 1881 libertas_prepare_and_send_command(priv, CMD_802_11_PS_MODE,
1869 CMD_SUBCMD_EXIT_PS, 1882 CMD_SUBCMD_EXIT_PS,
1870 wait_option, 0, &Localpsmode); 1883 wait_option, 0, &Localpsmode);
1871 1884
1872 lbs_deb_leave(LBS_DEB_CMD); 1885 lbs_deb_leave(LBS_DEB_HOST);
1873} 1886}
1874 1887
1875/** 1888/**
@@ -1886,31 +1899,31 @@ void libertas_ps_confirm_sleep(wlan_private * priv, u16 psmode)
1886 wlan_adapter *adapter = priv->adapter; 1899 wlan_adapter *adapter = priv->adapter;
1887 u8 allowed = 1; 1900 u8 allowed = 1;
1888 1901
1889 lbs_deb_enter(LBS_DEB_CMD); 1902 lbs_deb_enter(LBS_DEB_HOST);
1890 1903
1891 if (priv->dnld_sent) { 1904 if (priv->dnld_sent) {
1892 allowed = 0; 1905 allowed = 0;
1893 lbs_deb_cmd("D"); 1906 lbs_deb_host("dnld_sent was set");
1894 } 1907 }
1895 1908
1896 spin_lock_irqsave(&adapter->driver_lock, flags); 1909 spin_lock_irqsave(&adapter->driver_lock, flags);
1897 if (adapter->cur_cmd) { 1910 if (adapter->cur_cmd) {
1898 allowed = 0; 1911 allowed = 0;
1899 lbs_deb_cmd("C"); 1912 lbs_deb_host("cur_cmd was set");
1900 } 1913 }
1901 if (adapter->intcounter > 0) { 1914 if (adapter->intcounter > 0) {
1902 allowed = 0; 1915 allowed = 0;
1903 lbs_deb_cmd("I%d", adapter->intcounter); 1916 lbs_deb_host("intcounter %d", adapter->intcounter);
1904 } 1917 }
1905 spin_unlock_irqrestore(&adapter->driver_lock, flags); 1918 spin_unlock_irqrestore(&adapter->driver_lock, flags);
1906 1919
1907 if (allowed) { 1920 if (allowed) {
1908 lbs_deb_cmd("Sending libertas_ps_confirm_sleep\n"); 1921 lbs_deb_host("sending libertas_ps_confirm_sleep\n");
1909 sendconfirmsleep(priv, (u8 *) & adapter->libertas_ps_confirm_sleep, 1922 sendconfirmsleep(priv, (u8 *) & adapter->libertas_ps_confirm_sleep,
1910 sizeof(struct PS_CMD_ConfirmSleep)); 1923 sizeof(struct PS_CMD_ConfirmSleep));
1911 } else { 1924 } else {
1912 lbs_deb_cmd("Sleep Confirm has been delayed\n"); 1925 lbs_deb_host("sleep confirm has been delayed\n");
1913 } 1926 }
1914 1927
1915 lbs_deb_leave(LBS_DEB_CMD); 1928 lbs_deb_leave(LBS_DEB_HOST);
1916} 1929}