aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/libertas
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/libertas')
-rw-r--r--drivers/net/wireless/libertas/11d.c16
-rw-r--r--drivers/net/wireless/libertas/11d.h5
-rw-r--r--drivers/net/wireless/libertas/assoc.c16
-rw-r--r--drivers/net/wireless/libertas/cmd.c254
-rw-r--r--drivers/net/wireless/libertas/cmd.h9
-rw-r--r--drivers/net/wireless/libertas/cmdresp.c66
-rw-r--r--drivers/net/wireless/libertas/debugfs.c8
-rw-r--r--drivers/net/wireless/libertas/decl.h5
-rw-r--r--drivers/net/wireless/libertas/dev.h4
-rw-r--r--drivers/net/wireless/libertas/host.h3
-rw-r--r--drivers/net/wireless/libertas/hostcmd.h7
-rw-r--r--drivers/net/wireless/libertas/if_cs.c3
-rw-r--r--drivers/net/wireless/libertas/join.c9
-rw-r--r--drivers/net/wireless/libertas/join.h9
-rw-r--r--drivers/net/wireless/libertas/main.c35
-rw-r--r--drivers/net/wireless/libertas/scan.c4
-rw-r--r--drivers/net/wireless/libertas/scan.h7
-rw-r--r--drivers/net/wireless/libertas/wext.c40
18 files changed, 171 insertions, 329 deletions
diff --git a/drivers/net/wireless/libertas/11d.c b/drivers/net/wireless/libertas/11d.c
index 5e10ce0d351c..4bc46a60ae2f 100644
--- a/drivers/net/wireless/libertas/11d.c
+++ b/drivers/net/wireless/libertas/11d.c
@@ -79,7 +79,7 @@ static u8 *lbs_code_2_region(u8 code)
79 * @param nrchan number of channels 79 * @param nrchan number of channels
80 * @return the nrchan-th chan number 80 * @return the nrchan-th chan number
81*/ 81*/
82static u8 lbs_get_chan_11d(u8 band, u8 firstchan, u8 nrchan, u8 *chan) 82static u8 lbs_get_chan_11d(u8 firstchan, u8 nrchan, u8 *chan)
83/*find the nrchan-th chan after the firstchan*/ 83/*find the nrchan-th chan after the firstchan*/
84{ 84{
85 u8 i; 85 u8 i;
@@ -134,7 +134,7 @@ static u8 lbs_channel_known_11d(u8 chan,
134 return 0; 134 return 0;
135} 135}
136 136
137u32 lbs_chan_2_freq(u8 chan, u8 band) 137u32 lbs_chan_2_freq(u8 chan)
138{ 138{
139 struct chan_freq_power *cf; 139 struct chan_freq_power *cf;
140 u16 i; 140 u16 i;
@@ -264,7 +264,7 @@ static void lbs_generate_parsed_region_chan_11d(struct region_channel *region_ch
264 * @param chan chan 264 * @param chan chan
265 * @return TRUE;FALSE 265 * @return TRUE;FALSE
266*/ 266*/
267static u8 lbs_region_chan_supported_11d(u8 region, u8 band, u8 chan) 267static u8 lbs_region_chan_supported_11d(u8 region, u8 chan)
268{ 268{
269 struct chan_freq_power *cfp; 269 struct chan_freq_power *cfp;
270 int cfp_no; 270 int cfp_no;
@@ -273,7 +273,7 @@ static u8 lbs_region_chan_supported_11d(u8 region, u8 band, u8 chan)
273 273
274 lbs_deb_enter(LBS_DEB_11D); 274 lbs_deb_enter(LBS_DEB_11D);
275 275
276 cfp = lbs_get_region_cfp_table(region, band, &cfp_no); 276 cfp = lbs_get_region_cfp_table(region, &cfp_no);
277 if (cfp == NULL) 277 if (cfp == NULL)
278 return 0; 278 return 0;
279 279
@@ -367,7 +367,7 @@ static int parse_domain_info_11d(struct ieeetypes_countryinfofullset*
367 for (i = 0; idx < MAX_NO_OF_CHAN && i < nrchan; i++) { 367 for (i = 0; idx < MAX_NO_OF_CHAN && i < nrchan; i++) {
368 /*step4: channel is supported? */ 368 /*step4: channel is supported? */
369 369
370 if (!lbs_get_chan_11d(band, firstchan, i, &curchan)) { 370 if (!lbs_get_chan_11d(firstchan, i, &curchan)) {
371 /* Chan is not found in UN table */ 371 /* Chan is not found in UN table */
372 lbs_deb_11d("chan is not supported: %d \n", i); 372 lbs_deb_11d("chan is not supported: %d \n", i);
373 break; 373 break;
@@ -375,8 +375,7 @@ static int parse_domain_info_11d(struct ieeetypes_countryinfofullset*
375 375
376 lastchan = curchan; 376 lastchan = curchan;
377 377
378 if (lbs_region_chan_supported_11d 378 if (lbs_region_chan_supported_11d(region, curchan)) {
379 (region, band, curchan)) {
380 /*step5: Check if curchan is supported by mrvl in region */ 379 /*step5: Check if curchan is supported by mrvl in region */
381 parsed_region_chan->chanpwr[idx].chan = curchan; 380 parsed_region_chan->chanpwr[idx].chan = curchan;
382 parsed_region_chan->chanpwr[idx].pwr = 381 parsed_region_chan->chanpwr[idx].pwr =
@@ -554,8 +553,7 @@ done:
554 * @param resp pointer to command response buffer 553 * @param resp pointer to command response buffer
555 * @return 0; -1 554 * @return 0; -1
556 */ 555 */
557int lbs_ret_802_11d_domain_info(struct lbs_private *priv, 556int lbs_ret_802_11d_domain_info(struct cmd_ds_command *resp)
558 struct cmd_ds_command *resp)
559{ 557{
560 struct cmd_ds_802_11d_domain_info *domaininfo = &resp->params.domaininforesp; 558 struct cmd_ds_802_11d_domain_info *domaininfo = &resp->params.domaininforesp;
561 struct mrvlietypes_domainparamset *domain = &domaininfo->domain; 559 struct mrvlietypes_domainparamset *domain = &domaininfo->domain;
diff --git a/drivers/net/wireless/libertas/11d.h b/drivers/net/wireless/libertas/11d.h
index 811eea2cfba3..4f4f47f0f878 100644
--- a/drivers/net/wireless/libertas/11d.h
+++ b/drivers/net/wireless/libertas/11d.h
@@ -83,7 +83,7 @@ struct lbs_private;
83u8 lbs_get_scan_type_11d(u8 chan, 83u8 lbs_get_scan_type_11d(u8 chan,
84 struct parsed_region_chan_11d *parsed_region_chan); 84 struct parsed_region_chan_11d *parsed_region_chan);
85 85
86u32 lbs_chan_2_freq(u8 chan, u8 band); 86u32 lbs_chan_2_freq(u8 chan);
87 87
88void lbs_init_11d(struct lbs_private *priv); 88void lbs_init_11d(struct lbs_private *priv);
89 89
@@ -93,8 +93,7 @@ int lbs_cmd_802_11d_domain_info(struct lbs_private *priv,
93 struct cmd_ds_command *cmd, u16 cmdno, 93 struct cmd_ds_command *cmd, u16 cmdno,
94 u16 cmdOption); 94 u16 cmdOption);
95 95
96int lbs_ret_802_11d_domain_info(struct lbs_private *priv, 96int lbs_ret_802_11d_domain_info(struct cmd_ds_command *resp);
97 struct cmd_ds_command *resp);
98 97
99struct bss_descriptor; 98struct bss_descriptor;
100int lbs_parse_dnld_countryinfo_11d(struct lbs_private *priv, 99int lbs_parse_dnld_countryinfo_11d(struct lbs_private *priv,
diff --git a/drivers/net/wireless/libertas/assoc.c b/drivers/net/wireless/libertas/assoc.c
index 707b7ff592ec..95d98203eb4e 100644
--- a/drivers/net/wireless/libertas/assoc.c
+++ b/drivers/net/wireless/libertas/assoc.c
@@ -268,13 +268,11 @@ static int assoc_helper_wep_keys(struct lbs_private *priv,
268 268
269 /* enable/disable the MAC's WEP packet filter */ 269 /* enable/disable the MAC's WEP packet filter */
270 if (assoc_req->secinfo.wep_enabled) 270 if (assoc_req->secinfo.wep_enabled)
271 priv->currentpacketfilter |= CMD_ACT_MAC_WEP_ENABLE; 271 priv->mac_control |= CMD_ACT_MAC_WEP_ENABLE;
272 else 272 else
273 priv->currentpacketfilter &= ~CMD_ACT_MAC_WEP_ENABLE; 273 priv->mac_control &= ~CMD_ACT_MAC_WEP_ENABLE;
274 274
275 ret = lbs_set_mac_packet_filter(priv); 275 lbs_set_mac_control(priv);
276 if (ret)
277 goto out;
278 276
279 mutex_lock(&priv->lock); 277 mutex_lock(&priv->lock);
280 278
@@ -304,9 +302,7 @@ static int assoc_helper_secinfo(struct lbs_private *priv,
304 memcpy(&priv->secinfo, &assoc_req->secinfo, 302 memcpy(&priv->secinfo, &assoc_req->secinfo,
305 sizeof(struct lbs_802_11_security)); 303 sizeof(struct lbs_802_11_security));
306 304
307 ret = lbs_set_mac_packet_filter(priv); 305 lbs_set_mac_control(priv);
308 if (ret)
309 goto out;
310 306
311 /* If RSN is already enabled, don't try to enable it again, since 307 /* If RSN is already enabled, don't try to enable it again, since
312 * ENABLE_RSN resets internal state machines and will clobber the 308 * ENABLE_RSN resets internal state machines and will clobber the
@@ -628,10 +624,6 @@ void lbs_association_worker(struct work_struct *work)
628 lbs_prepare_and_send_command(priv, 624 lbs_prepare_and_send_command(priv,
629 CMD_802_11_RSSI, 625 CMD_802_11_RSSI,
630 0, CMD_OPTION_WAITFORRSP, 0, NULL); 626 0, CMD_OPTION_WAITFORRSP, 0, NULL);
631
632 lbs_prepare_and_send_command(priv,
633 CMD_802_11_GET_LOG,
634 0, CMD_OPTION_WAITFORRSP, 0, NULL);
635 } else { 627 } else {
636 ret = -1; 628 ret = -1;
637 } 629 }
diff --git a/drivers/net/wireless/libertas/cmd.c b/drivers/net/wireless/libertas/cmd.c
index 445c6dc09786..59801f103e66 100644
--- a/drivers/net/wireless/libertas/cmd.c
+++ b/drivers/net/wireless/libertas/cmd.c
@@ -14,9 +14,46 @@
14#include "cmd.h" 14#include "cmd.h"
15 15
16static struct cmd_ctrl_node *lbs_get_cmd_ctrl_node(struct lbs_private *priv); 16static struct cmd_ctrl_node *lbs_get_cmd_ctrl_node(struct lbs_private *priv);
17static void lbs_set_cmd_ctrl_node(struct lbs_private *priv, 17
18 struct cmd_ctrl_node *ptempnode, 18
19 void *pdata_buf); 19/**
20 * @brief Simple callback that copies response back into command
21 *
22 * @param priv A pointer to struct lbs_private structure
23 * @param extra A pointer to the original command structure for which
24 * 'resp' is a response
25 * @param resp A pointer to the command response
26 *
27 * @return 0 on success, error on failure
28 */
29int lbs_cmd_copyback(struct lbs_private *priv, unsigned long extra,
30 struct cmd_header *resp)
31{
32 struct cmd_header *buf = (void *)extra;
33 uint16_t copy_len;
34
35 copy_len = min(le16_to_cpu(buf->size), le16_to_cpu(resp->size));
36 memcpy(buf, resp, copy_len);
37 return 0;
38}
39EXPORT_SYMBOL_GPL(lbs_cmd_copyback);
40
41/**
42 * @brief Simple callback that ignores the result. Use this if
43 * you just want to send a command to the hardware, but don't
44 * care for the result.
45 *
46 * @param priv ignored
47 * @param extra ignored
48 * @param resp ignored
49 *
50 * @return 0 for success
51 */
52static int lbs_cmd_async_callback(struct lbs_private *priv, unsigned long extra,
53 struct cmd_header *resp)
54{
55 return 0;
56}
20 57
21 58
22/** 59/**
@@ -143,8 +180,7 @@ int lbs_host_sleep_cfg(struct lbs_private *priv, uint32_t criteria)
143} 180}
144EXPORT_SYMBOL_GPL(lbs_host_sleep_cfg); 181EXPORT_SYMBOL_GPL(lbs_host_sleep_cfg);
145 182
146static int lbs_cmd_802_11_ps_mode(struct lbs_private *priv, 183static int lbs_cmd_802_11_ps_mode(struct cmd_ds_command *cmd,
147 struct cmd_ds_command *cmd,
148 u16 cmd_action) 184 u16 cmd_action)
149{ 185{
150 struct cmd_ds_802_11_ps_mode *psm = &cmd->params.psmode; 186 struct cmd_ds_802_11_ps_mode *psm = &cmd->params.psmode;
@@ -439,8 +475,7 @@ int lbs_cmd_802_11_key_material(struct lbs_private *priv, uint16_t cmd_action,
439 return ret; 475 return ret;
440} 476}
441 477
442static int lbs_cmd_802_11_reset(struct lbs_private *priv, 478static int lbs_cmd_802_11_reset(struct cmd_ds_command *cmd, int cmd_action)
443 struct cmd_ds_command *cmd, int cmd_action)
444{ 479{
445 struct cmd_ds_802_11_reset *reset = &cmd->params.reset; 480 struct cmd_ds_802_11_reset *reset = &cmd->params.reset;
446 481
@@ -454,30 +489,6 @@ static int lbs_cmd_802_11_reset(struct lbs_private *priv,
454 return 0; 489 return 0;
455} 490}
456 491
457static int lbs_cmd_802_11_get_log(struct lbs_private *priv,
458 struct cmd_ds_command *cmd)
459{
460 lbs_deb_enter(LBS_DEB_CMD);
461 cmd->command = cpu_to_le16(CMD_802_11_GET_LOG);
462 cmd->size =
463 cpu_to_le16(sizeof(struct cmd_ds_802_11_get_log) + S_DS_GEN);
464
465 lbs_deb_leave(LBS_DEB_CMD);
466 return 0;
467}
468
469static int lbs_cmd_802_11_get_stat(struct lbs_private *priv,
470 struct cmd_ds_command *cmd)
471{
472 lbs_deb_enter(LBS_DEB_CMD);
473 cmd->command = cpu_to_le16(CMD_802_11_GET_STAT);
474 cmd->size =
475 cpu_to_le16(sizeof(struct cmd_ds_802_11_get_stat) + S_DS_GEN);
476
477 lbs_deb_leave(LBS_DEB_CMD);
478 return 0;
479}
480
481static int lbs_cmd_802_11_snmp_mib(struct lbs_private *priv, 492static int lbs_cmd_802_11_snmp_mib(struct lbs_private *priv,
482 struct cmd_ds_command *cmd, 493 struct cmd_ds_command *cmd,
483 int cmd_action, 494 int cmd_action,
@@ -598,8 +609,7 @@ static int lbs_cmd_802_11_snmp_mib(struct lbs_private *priv,
598 return 0; 609 return 0;
599} 610}
600 611
601static int lbs_cmd_802_11_rf_tx_power(struct lbs_private *priv, 612static int lbs_cmd_802_11_rf_tx_power(struct cmd_ds_command *cmd,
602 struct cmd_ds_command *cmd,
603 u16 cmd_action, void *pdata_buf) 613 u16 cmd_action, void *pdata_buf)
604{ 614{
605 615
@@ -642,8 +652,7 @@ static int lbs_cmd_802_11_rf_tx_power(struct lbs_private *priv,
642 return 0; 652 return 0;
643} 653}
644 654
645static int lbs_cmd_802_11_monitor_mode(struct lbs_private *priv, 655static int lbs_cmd_802_11_monitor_mode(struct cmd_ds_command *cmd,
646 struct cmd_ds_command *cmd,
647 u16 cmd_action, void *pdata_buf) 656 u16 cmd_action, void *pdata_buf)
648{ 657{
649 struct cmd_ds_802_11_monitor_mode *monitor = &cmd->params.monitor; 658 struct cmd_ds_802_11_monitor_mode *monitor = &cmd->params.monitor;
@@ -870,8 +879,7 @@ static int lbs_cmd_802_11_rssi(struct lbs_private *priv,
870 return 0; 879 return 0;
871} 880}
872 881
873static int lbs_cmd_reg_access(struct lbs_private *priv, 882static int lbs_cmd_reg_access(struct cmd_ds_command *cmdptr,
874 struct cmd_ds_command *cmdptr,
875 u8 cmd_action, void *pdata_buf) 883 u8 cmd_action, void *pdata_buf)
876{ 884{
877 struct lbs_offset_value *offval; 885 struct lbs_offset_value *offval;
@@ -968,9 +976,8 @@ static int lbs_cmd_802_11_mac_address(struct lbs_private *priv,
968 return 0; 976 return 0;
969} 977}
970 978
971static int lbs_cmd_802_11_eeprom_access(struct lbs_private *priv, 979static int lbs_cmd_802_11_eeprom_access(struct cmd_ds_command *cmd,
972 struct cmd_ds_command *cmd, 980 void *pdata_buf)
973 int cmd_action, void *pdata_buf)
974{ 981{
975 struct lbs_ioctl_regrdwr *ea = pdata_buf; 982 struct lbs_ioctl_regrdwr *ea = pdata_buf;
976 983
@@ -990,8 +997,7 @@ static int lbs_cmd_802_11_eeprom_access(struct lbs_private *priv,
990 return 0; 997 return 0;
991} 998}
992 999
993static int lbs_cmd_bt_access(struct lbs_private *priv, 1000static int lbs_cmd_bt_access(struct cmd_ds_command *cmd,
994 struct cmd_ds_command *cmd,
995 u16 cmd_action, void *pdata_buf) 1001 u16 cmd_action, void *pdata_buf)
996{ 1002{
997 struct cmd_ds_bt_access *bt_access = &cmd->params.bt; 1003 struct cmd_ds_bt_access *bt_access = &cmd->params.bt;
@@ -1028,8 +1034,7 @@ static int lbs_cmd_bt_access(struct lbs_private *priv,
1028 return 0; 1034 return 0;
1029} 1035}
1030 1036
1031static int lbs_cmd_fwt_access(struct lbs_private *priv, 1037static int lbs_cmd_fwt_access(struct cmd_ds_command *cmd,
1032 struct cmd_ds_command *cmd,
1033 u16 cmd_action, void *pdata_buf) 1038 u16 cmd_action, void *pdata_buf)
1034{ 1039{
1035 struct cmd_ds_fwt_access *fwt_access = &cmd->params.fwt; 1040 struct cmd_ds_fwt_access *fwt_access = &cmd->params.fwt;
@@ -1200,24 +1205,6 @@ static void lbs_submit_command(struct lbs_private *priv,
1200 lbs_deb_leave(LBS_DEB_HOST); 1205 lbs_deb_leave(LBS_DEB_HOST);
1201} 1206}
1202 1207
1203static int lbs_cmd_mac_control(struct lbs_private *priv,
1204 struct cmd_ds_command *cmd)
1205{
1206 struct cmd_ds_mac_control *mac = &cmd->params.macctrl;
1207
1208 lbs_deb_enter(LBS_DEB_CMD);
1209
1210 cmd->command = cpu_to_le16(CMD_MAC_CONTROL);
1211 cmd->size = cpu_to_le16(sizeof(struct cmd_ds_mac_control) + S_DS_GEN);
1212 mac->action = cpu_to_le16(priv->currentpacketfilter);
1213
1214 lbs_deb_cmd("MAC_CONTROL: action 0x%04x, size %d\n",
1215 le16_to_cpu(mac->action), le16_to_cpu(cmd->size));
1216
1217 lbs_deb_leave(LBS_DEB_CMD);
1218 return 0;
1219}
1220
1221/** 1208/**
1222 * This function inserts command node to cmdfreeq 1209 * This function inserts command node to cmdfreeq
1223 * after cleans it. Requires priv->driver_lock held. 1210 * after cleans it. Requires priv->driver_lock held.
@@ -1260,7 +1247,7 @@ void lbs_complete_command(struct lbs_private *priv, struct cmd_ctrl_node *cmd,
1260 cmd->cmdwaitqwoken = 1; 1247 cmd->cmdwaitqwoken = 1;
1261 wake_up_interruptible(&cmd->cmdwait_q); 1248 wake_up_interruptible(&cmd->cmdwait_q);
1262 1249
1263 if (!cmd->callback) 1250 if (!cmd->callback || cmd->callback == lbs_cmd_async_callback)
1264 __lbs_cleanup_and_insert_cmd(priv, cmd); 1251 __lbs_cleanup_and_insert_cmd(priv, cmd);
1265 priv->cur_cmd = NULL; 1252 priv->cur_cmd = NULL;
1266} 1253}
@@ -1304,18 +1291,20 @@ int lbs_set_radio_control(struct lbs_private *priv)
1304 return ret; 1291 return ret;
1305} 1292}
1306 1293
1307int lbs_set_mac_packet_filter(struct lbs_private *priv) 1294void lbs_set_mac_control(struct lbs_private *priv)
1308{ 1295{
1309 int ret = 0; 1296 struct cmd_ds_mac_control cmd;
1310 1297
1311 lbs_deb_enter(LBS_DEB_CMD); 1298 lbs_deb_enter(LBS_DEB_CMD);
1312 1299
1313 /* Send MAC control command to station */ 1300 cmd.hdr.size = cpu_to_le16(sizeof(cmd));
1314 ret = lbs_prepare_and_send_command(priv, 1301 cmd.action = cpu_to_le16(priv->mac_control);
1315 CMD_MAC_CONTROL, 0, 0, 0, NULL); 1302 cmd.reserved = 0;
1316 1303
1317 lbs_deb_leave_args(LBS_DEB_CMD, "ret %d", ret); 1304 lbs_cmd_async(priv, CMD_MAC_CONTROL,
1318 return ret; 1305 &cmd.hdr, sizeof(cmd));
1306
1307 lbs_deb_leave(LBS_DEB_CMD);
1319} 1308}
1320 1309
1321/** 1310/**
@@ -1364,7 +1353,8 @@ int lbs_prepare_and_send_command(struct lbs_private *priv,
1364 goto done; 1353 goto done;
1365 } 1354 }
1366 1355
1367 lbs_set_cmd_ctrl_node(priv, cmdnode, pdata_buf); 1356 cmdnode->callback = NULL;
1357 cmdnode->callback_arg = (unsigned long)pdata_buf;
1368 1358
1369 cmdptr = (struct cmd_ds_command *)cmdnode->cmdbuf; 1359 cmdptr = (struct cmd_ds_command *)cmdnode->cmdbuf;
1370 1360
@@ -1379,11 +1369,7 @@ int lbs_prepare_and_send_command(struct lbs_private *priv,
1379 1369
1380 switch (cmd_no) { 1370 switch (cmd_no) {
1381 case CMD_802_11_PS_MODE: 1371 case CMD_802_11_PS_MODE:
1382 ret = lbs_cmd_802_11_ps_mode(priv, cmdptr, cmd_action); 1372 ret = lbs_cmd_802_11_ps_mode(cmdptr, cmd_action);
1383 break;
1384
1385 case CMD_MAC_CONTROL:
1386 ret = lbs_cmd_mac_control(priv, cmdptr);
1387 break; 1373 break;
1388 1374
1389 case CMD_802_11_ASSOCIATE: 1375 case CMD_802_11_ASSOCIATE:
@@ -1398,25 +1384,15 @@ int lbs_prepare_and_send_command(struct lbs_private *priv,
1398 case CMD_802_11_AD_HOC_START: 1384 case CMD_802_11_AD_HOC_START:
1399 ret = lbs_cmd_80211_ad_hoc_start(priv, cmdptr, pdata_buf); 1385 ret = lbs_cmd_80211_ad_hoc_start(priv, cmdptr, pdata_buf);
1400 break; 1386 break;
1401 case CMD_CODE_DNLD:
1402 break;
1403 1387
1404 case CMD_802_11_RESET: 1388 case CMD_802_11_RESET:
1405 ret = lbs_cmd_802_11_reset(priv, cmdptr, cmd_action); 1389 ret = lbs_cmd_802_11_reset(cmdptr, cmd_action);
1406 break;
1407
1408 case CMD_802_11_GET_LOG:
1409 ret = lbs_cmd_802_11_get_log(priv, cmdptr);
1410 break; 1390 break;
1411 1391
1412 case CMD_802_11_AUTHENTICATE: 1392 case CMD_802_11_AUTHENTICATE:
1413 ret = lbs_cmd_80211_authenticate(priv, cmdptr, pdata_buf); 1393 ret = lbs_cmd_80211_authenticate(priv, cmdptr, pdata_buf);
1414 break; 1394 break;
1415 1395
1416 case CMD_802_11_GET_STAT:
1417 ret = lbs_cmd_802_11_get_stat(priv, cmdptr);
1418 break;
1419
1420 case CMD_802_11_SNMP_MIB: 1396 case CMD_802_11_SNMP_MIB:
1421 ret = lbs_cmd_802_11_snmp_mib(priv, cmdptr, 1397 ret = lbs_cmd_802_11_snmp_mib(priv, cmdptr,
1422 cmd_action, cmd_oid, pdata_buf); 1398 cmd_action, cmd_oid, pdata_buf);
@@ -1425,12 +1401,12 @@ int lbs_prepare_and_send_command(struct lbs_private *priv,
1425 case CMD_MAC_REG_ACCESS: 1401 case CMD_MAC_REG_ACCESS:
1426 case CMD_BBP_REG_ACCESS: 1402 case CMD_BBP_REG_ACCESS:
1427 case CMD_RF_REG_ACCESS: 1403 case CMD_RF_REG_ACCESS:
1428 ret = lbs_cmd_reg_access(priv, cmdptr, cmd_action, pdata_buf); 1404 ret = lbs_cmd_reg_access(cmdptr, cmd_action, pdata_buf);
1429 break; 1405 break;
1430 1406
1431 case CMD_802_11_RF_TX_POWER: 1407 case CMD_802_11_RF_TX_POWER:
1432 ret = lbs_cmd_802_11_rf_tx_power(priv, cmdptr, 1408 ret = lbs_cmd_802_11_rf_tx_power(cmdptr,
1433 cmd_action, pdata_buf); 1409 cmd_action, pdata_buf);
1434 break; 1410 break;
1435 1411
1436 case CMD_802_11_RATE_ADAPT_RATESET: 1412 case CMD_802_11_RATE_ADAPT_RATESET:
@@ -1443,7 +1419,7 @@ int lbs_prepare_and_send_command(struct lbs_private *priv,
1443 break; 1419 break;
1444 1420
1445 case CMD_802_11_MONITOR_MODE: 1421 case CMD_802_11_MONITOR_MODE:
1446 ret = lbs_cmd_802_11_monitor_mode(priv, cmdptr, 1422 ret = lbs_cmd_802_11_monitor_mode(cmdptr,
1447 cmd_action, pdata_buf); 1423 cmd_action, pdata_buf);
1448 break; 1424 break;
1449 1425
@@ -1456,12 +1432,7 @@ int lbs_prepare_and_send_command(struct lbs_private *priv,
1456 break; 1432 break;
1457 1433
1458 case CMD_802_11_AD_HOC_STOP: 1434 case CMD_802_11_AD_HOC_STOP:
1459 ret = lbs_cmd_80211_ad_hoc_stop(priv, cmdptr); 1435 ret = lbs_cmd_80211_ad_hoc_stop(cmdptr);
1460 break;
1461
1462 case CMD_802_11_PAIRWISE_TSC:
1463 break;
1464 case CMD_802_11_GROUP_TSC:
1465 break; 1436 break;
1466 1437
1467 case CMD_802_11_MAC_ADDRESS: 1438 case CMD_802_11_MAC_ADDRESS:
@@ -1469,8 +1440,7 @@ int lbs_prepare_and_send_command(struct lbs_private *priv,
1469 break; 1440 break;
1470 1441
1471 case CMD_802_11_EEPROM_ACCESS: 1442 case CMD_802_11_EEPROM_ACCESS:
1472 ret = lbs_cmd_802_11_eeprom_access(priv, cmdptr, 1443 ret = lbs_cmd_802_11_eeprom_access(cmdptr, pdata_buf);
1473 cmd_action, pdata_buf);
1474 break; 1444 break;
1475 1445
1476 case CMD_802_11_SET_AFC: 1446 case CMD_802_11_SET_AFC:
@@ -1537,11 +1507,11 @@ int lbs_prepare_and_send_command(struct lbs_private *priv,
1537 ret = 0; 1507 ret = 0;
1538 break; 1508 break;
1539 case CMD_BT_ACCESS: 1509 case CMD_BT_ACCESS:
1540 ret = lbs_cmd_bt_access(priv, cmdptr, cmd_action, pdata_buf); 1510 ret = lbs_cmd_bt_access(cmdptr, cmd_action, pdata_buf);
1541 break; 1511 break;
1542 1512
1543 case CMD_FWT_ACCESS: 1513 case CMD_FWT_ACCESS:
1544 ret = lbs_cmd_fwt_access(priv, cmdptr, cmd_action, pdata_buf); 1514 ret = lbs_cmd_fwt_access(cmdptr, cmd_action, pdata_buf);
1545 break; 1515 break;
1546 1516
1547 case CMD_GET_TSF: 1517 case CMD_GET_TSF:
@@ -1714,36 +1684,6 @@ static struct cmd_ctrl_node *lbs_get_cmd_ctrl_node(struct lbs_private *priv)
1714} 1684}
1715 1685
1716/** 1686/**
1717 * @brief This function cleans command node.
1718 *
1719 * @param ptempnode A pointer to cmdCtrlNode structure
1720 * @return n/a
1721 */
1722
1723/**
1724 * @brief This function initializes the command node.
1725 *
1726 * @param priv A pointer to struct lbs_private structure
1727 * @param ptempnode A pointer to cmd_ctrl_node structure
1728 * @param pdata_buf A pointer to informaion buffer
1729 * @return 0 or -1
1730 */
1731static void lbs_set_cmd_ctrl_node(struct lbs_private *priv,
1732 struct cmd_ctrl_node *ptempnode,
1733 void *pdata_buf)
1734{
1735 lbs_deb_enter(LBS_DEB_HOST);
1736
1737 if (!ptempnode)
1738 return;
1739
1740 ptempnode->callback = NULL;
1741 ptempnode->callback_arg = (unsigned long)pdata_buf;
1742
1743 lbs_deb_leave(LBS_DEB_HOST);
1744}
1745
1746/**
1747 * @brief This function executes next command in command 1687 * @brief This function executes next command in command
1748 * pending queue. It will put fimware back to PS mode 1688 * pending queue. It will put fimware back to PS mode
1749 * if applicable. 1689 * if applicable.
@@ -1930,10 +1870,6 @@ static int sendconfirmsleep(struct lbs_private *priv, u8 *cmdptr, u16 size)
1930 int ret = 0; 1870 int ret = 0;
1931 1871
1932 lbs_deb_enter(LBS_DEB_HOST); 1872 lbs_deb_enter(LBS_DEB_HOST);
1933
1934 lbs_deb_host("SEND_SLEEPC_CMD: before download, cmd size %d\n",
1935 size);
1936
1937 lbs_deb_hex(LBS_DEB_HOST, "sleep confirm command", cmdptr, size); 1873 lbs_deb_hex(LBS_DEB_HOST, "sleep confirm command", cmdptr, size);
1938 1874
1939 ret = priv->hw_host_to_card(priv, MVMS_CMD, cmdptr, size); 1875 ret = priv->hw_host_to_card(priv, MVMS_CMD, cmdptr, size);
@@ -1956,8 +1892,6 @@ static int sendconfirmsleep(struct lbs_private *priv, u8 *cmdptr, u16 size)
1956 priv->intcounter); 1892 priv->intcounter);
1957 } 1893 }
1958 spin_unlock_irqrestore(&priv->driver_lock, flags); 1894 spin_unlock_irqrestore(&priv->driver_lock, flags);
1959
1960 lbs_deb_host("SEND_SLEEPC_CMD: sent confirm sleep\n");
1961 } 1895 }
1962 1896
1963 lbs_deb_leave_args(LBS_DEB_HOST, "ret %d", ret); 1897 lbs_deb_leave_args(LBS_DEB_HOST, "ret %d", ret);
@@ -2009,10 +1943,10 @@ void lbs_ps_wakeup(struct lbs_private *priv, int wait_option)
2009 * @param psmode Power Saving mode 1943 * @param psmode Power Saving mode
2010 * @return n/a 1944 * @return n/a
2011 */ 1945 */
2012void lbs_ps_confirm_sleep(struct lbs_private *priv, u16 psmode) 1946void lbs_ps_confirm_sleep(struct lbs_private *priv)
2013{ 1947{
2014 unsigned long flags =0; 1948 unsigned long flags =0;
2015 u8 allowed = 1; 1949 int allowed = 1;
2016 1950
2017 lbs_deb_enter(LBS_DEB_HOST); 1951 lbs_deb_enter(LBS_DEB_HOST);
2018 1952
@@ -2044,32 +1978,10 @@ void lbs_ps_confirm_sleep(struct lbs_private *priv, u16 psmode)
2044} 1978}
2045 1979
2046 1980
2047/** 1981static struct cmd_ctrl_node *__lbs_cmd_async(struct lbs_private *priv,
2048 * @brief Simple callback that copies response back into command 1982 uint16_t command, struct cmd_header *in_cmd, int in_cmd_size,
2049 * 1983 int (*callback)(struct lbs_private *, unsigned long, struct cmd_header *),
2050 * @param priv A pointer to struct lbs_private structure 1984 unsigned long callback_arg)
2051 * @param extra A pointer to the original command structure for which
2052 * 'resp' is a response
2053 * @param resp A pointer to the command response
2054 *
2055 * @return 0 on success, error on failure
2056 */
2057int lbs_cmd_copyback(struct lbs_private *priv, unsigned long extra,
2058 struct cmd_header *resp)
2059{
2060 struct cmd_header *buf = (void *)extra;
2061 uint16_t copy_len;
2062
2063 copy_len = min(le16_to_cpu(buf->size), le16_to_cpu(resp->size));
2064 memcpy(buf, resp, copy_len);
2065 return 0;
2066}
2067EXPORT_SYMBOL_GPL(lbs_cmd_copyback);
2068
2069struct cmd_ctrl_node *__lbs_cmd_async(struct lbs_private *priv, uint16_t command,
2070 struct cmd_header *in_cmd, int in_cmd_size,
2071 int (*callback)(struct lbs_private *, unsigned long, struct cmd_header *),
2072 unsigned long callback_arg)
2073{ 1985{
2074 struct cmd_ctrl_node *cmdnode; 1986 struct cmd_ctrl_node *cmdnode;
2075 1987
@@ -2106,9 +2018,6 @@ struct cmd_ctrl_node *__lbs_cmd_async(struct lbs_private *priv, uint16_t command
2106 2018
2107 lbs_deb_host("PREP_CMD: command 0x%04x\n", command); 2019 lbs_deb_host("PREP_CMD: command 0x%04x\n", command);
2108 2020
2109 /* here was the big old switch() statement, which is now obsolete,
2110 * because the caller of lbs_cmd() sets up all of *cmd for us. */
2111
2112 cmdnode->cmdwaitqwoken = 0; 2021 cmdnode->cmdwaitqwoken = 0;
2113 lbs_queue_cmd(priv, cmdnode); 2022 lbs_queue_cmd(priv, cmdnode);
2114 wake_up_interruptible(&priv->waitq); 2023 wake_up_interruptible(&priv->waitq);
@@ -2118,6 +2027,15 @@ struct cmd_ctrl_node *__lbs_cmd_async(struct lbs_private *priv, uint16_t command
2118 return cmdnode; 2027 return cmdnode;
2119} 2028}
2120 2029
2030void lbs_cmd_async(struct lbs_private *priv, uint16_t command,
2031 struct cmd_header *in_cmd, int in_cmd_size)
2032{
2033 lbs_deb_enter(LBS_DEB_CMD);
2034 __lbs_cmd_async(priv, command, in_cmd, in_cmd_size,
2035 lbs_cmd_async_callback, 0);
2036 lbs_deb_leave(LBS_DEB_CMD);
2037}
2038
2121int __lbs_cmd(struct lbs_private *priv, uint16_t command, 2039int __lbs_cmd(struct lbs_private *priv, uint16_t command,
2122 struct cmd_header *in_cmd, int in_cmd_size, 2040 struct cmd_header *in_cmd, int in_cmd_size,
2123 int (*callback)(struct lbs_private *, unsigned long, struct cmd_header *), 2041 int (*callback)(struct lbs_private *, unsigned long, struct cmd_header *),
diff --git a/drivers/net/wireless/libertas/cmd.h b/drivers/net/wireless/libertas/cmd.h
index d250e6bc0609..3dfc2d43c224 100644
--- a/drivers/net/wireless/libertas/cmd.h
+++ b/drivers/net/wireless/libertas/cmd.h
@@ -18,12 +18,9 @@
18#define lbs_cmd_with_response(priv, cmdnr, cmd) \ 18#define lbs_cmd_with_response(priv, cmdnr, cmd) \
19 lbs_cmd(priv, cmdnr, cmd, lbs_cmd_copyback, (unsigned long) (cmd)) 19 lbs_cmd(priv, cmdnr, cmd, lbs_cmd_copyback, (unsigned long) (cmd))
20 20
21/* __lbs_cmd() will free the cmdnode and return success/failure. 21void lbs_cmd_async(struct lbs_private *priv, uint16_t command,
22 __lbs_cmd_async() requires that the callback free the cmdnode */ 22 struct cmd_header *in_cmd, int in_cmd_size);
23struct cmd_ctrl_node *__lbs_cmd_async(struct lbs_private *priv, uint16_t command, 23
24 struct cmd_header *in_cmd, int in_cmd_size,
25 int (*callback)(struct lbs_private *, unsigned long, struct cmd_header *),
26 unsigned long callback_arg);
27int __lbs_cmd(struct lbs_private *priv, uint16_t command, 24int __lbs_cmd(struct lbs_private *priv, uint16_t command,
28 struct cmd_header *in_cmd, int in_cmd_size, 25 struct cmd_header *in_cmd, int in_cmd_size,
29 int (*callback)(struct lbs_private *, unsigned long, struct cmd_header *), 26 int (*callback)(struct lbs_private *, unsigned long, struct cmd_header *),
diff --git a/drivers/net/wireless/libertas/cmdresp.c b/drivers/net/wireless/libertas/cmdresp.c
index 63aa884b18f2..888f92d8afc9 100644
--- a/drivers/net/wireless/libertas/cmdresp.c
+++ b/drivers/net/wireless/libertas/cmdresp.c
@@ -146,22 +146,6 @@ static int lbs_ret_reg_access(struct lbs_private *priv,
146 return ret; 146 return ret;
147} 147}
148 148
149static int lbs_ret_802_11_stat(struct lbs_private *priv,
150 struct cmd_ds_command *resp)
151{
152 lbs_deb_enter(LBS_DEB_CMD);
153/* currently priv->wlan802_11Stat is unused
154
155 struct cmd_ds_802_11_get_stat *p11Stat = &resp->params.gstat;
156
157 // TODO Convert it to Big endian befor copy
158 memcpy(&priv->wlan802_11Stat,
159 p11Stat, sizeof(struct cmd_ds_802_11_get_stat));
160*/
161 lbs_deb_leave(LBS_DEB_CMD);
162 return 0;
163}
164
165static int lbs_ret_802_11_snmp_mib(struct lbs_private *priv, 149static int lbs_ret_802_11_snmp_mib(struct lbs_private *priv,
166 struct cmd_ds_command *resp) 150 struct cmd_ds_command *resp)
167{ 151{
@@ -303,20 +287,6 @@ static int lbs_ret_802_11_eeprom_access(struct lbs_private *priv,
303 return 0; 287 return 0;
304} 288}
305 289
306static int lbs_ret_get_log(struct lbs_private *priv,
307 struct cmd_ds_command *resp)
308{
309 struct cmd_ds_802_11_get_log *logmessage = &resp->params.glog;
310
311 lbs_deb_enter(LBS_DEB_CMD);
312
313 /* Stored little-endian */
314 memcpy(&priv->logmsg, logmessage, sizeof(struct cmd_ds_802_11_get_log));
315
316 lbs_deb_leave(LBS_DEB_CMD);
317 return 0;
318}
319
320static int lbs_ret_802_11_bcn_ctrl(struct lbs_private * priv, 290static int lbs_ret_802_11_bcn_ctrl(struct lbs_private * priv,
321 struct cmd_ds_command *resp) 291 struct cmd_ds_command *resp)
322{ 292{
@@ -335,7 +305,6 @@ static int lbs_ret_802_11_bcn_ctrl(struct lbs_private * priv,
335} 305}
336 306
337static inline int handle_cmd_response(struct lbs_private *priv, 307static inline int handle_cmd_response(struct lbs_private *priv,
338 unsigned long dummy,
339 struct cmd_header *cmd_response) 308 struct cmd_header *cmd_response)
340{ 309{
341 struct cmd_ds_command *resp = (struct cmd_ds_command *) cmd_response; 310 struct cmd_ds_command *resp = (struct cmd_ds_command *) cmd_response;
@@ -352,10 +321,6 @@ static inline int handle_cmd_response(struct lbs_private *priv,
352 ret = lbs_ret_reg_access(priv, respcmd, resp); 321 ret = lbs_ret_reg_access(priv, respcmd, resp);
353 break; 322 break;
354 323
355 case CMD_RET(CMD_802_11_GET_LOG):
356 ret = lbs_ret_get_log(priv, resp);
357 break;
358
359 case CMD_RET_802_11_ASSOCIATE: 324 case CMD_RET_802_11_ASSOCIATE:
360 case CMD_RET(CMD_802_11_ASSOCIATE): 325 case CMD_RET(CMD_802_11_ASSOCIATE):
361 case CMD_RET(CMD_802_11_REASSOCIATE): 326 case CMD_RET(CMD_802_11_REASSOCIATE):
@@ -364,7 +329,7 @@ static inline int handle_cmd_response(struct lbs_private *priv,
364 329
365 case CMD_RET(CMD_802_11_DISASSOCIATE): 330 case CMD_RET(CMD_802_11_DISASSOCIATE):
366 case CMD_RET(CMD_802_11_DEAUTHENTICATE): 331 case CMD_RET(CMD_802_11_DEAUTHENTICATE):
367 ret = lbs_ret_80211_disassociate(priv, resp); 332 ret = lbs_ret_80211_disassociate(priv);
368 break; 333 break;
369 334
370 case CMD_RET(CMD_802_11_AD_HOC_START): 335 case CMD_RET(CMD_802_11_AD_HOC_START):
@@ -372,10 +337,6 @@ static inline int handle_cmd_response(struct lbs_private *priv,
372 ret = lbs_ret_80211_ad_hoc_start(priv, resp); 337 ret = lbs_ret_80211_ad_hoc_start(priv, resp);
373 break; 338 break;
374 339
375 case CMD_RET(CMD_802_11_GET_STAT):
376 ret = lbs_ret_802_11_stat(priv, resp);
377 break;
378
379 case CMD_RET(CMD_802_11_SNMP_MIB): 340 case CMD_RET(CMD_802_11_SNMP_MIB):
380 ret = lbs_ret_802_11_snmp_mib(priv, resp); 341 ret = lbs_ret_802_11_snmp_mib(priv, resp);
381 break; 342 break;
@@ -394,7 +355,6 @@ static inline int handle_cmd_response(struct lbs_private *priv,
394 break; 355 break;
395 356
396 case CMD_RET(CMD_MAC_MULTICAST_ADR): 357 case CMD_RET(CMD_MAC_MULTICAST_ADR):
397 case CMD_RET(CMD_MAC_CONTROL):
398 case CMD_RET(CMD_802_11_RESET): 358 case CMD_RET(CMD_802_11_RESET):
399 case CMD_RET(CMD_802_11_AUTHENTICATE): 359 case CMD_RET(CMD_802_11_AUTHENTICATE):
400 case CMD_RET(CMD_802_11_BEACON_STOP): 360 case CMD_RET(CMD_802_11_BEACON_STOP):
@@ -413,7 +373,7 @@ static inline int handle_cmd_response(struct lbs_private *priv,
413 break; 373 break;
414 374
415 case CMD_RET(CMD_802_11_AD_HOC_STOP): 375 case CMD_RET(CMD_802_11_AD_HOC_STOP):
416 ret = lbs_ret_80211_ad_hoc_stop(priv, resp); 376 ret = lbs_ret_80211_ad_hoc_stop(priv);
417 break; 377 break;
418 378
419 case CMD_RET(CMD_802_11_EEPROM_ACCESS): 379 case CMD_RET(CMD_802_11_EEPROM_ACCESS):
@@ -421,7 +381,7 @@ static inline int handle_cmd_response(struct lbs_private *priv,
421 break; 381 break;
422 382
423 case CMD_RET(CMD_802_11D_DOMAIN_INFO): 383 case CMD_RET(CMD_802_11D_DOMAIN_INFO):
424 ret = lbs_ret_802_11d_domain_info(priv, resp); 384 ret = lbs_ret_802_11d_domain_info(resp);
425 break; 385 break;
426 386
427 case CMD_RET(CMD_802_11_TPC_CFG): 387 case CMD_RET(CMD_802_11_TPC_CFG):
@@ -624,7 +584,7 @@ int lbs_process_rx_command(struct lbs_private *priv)
624 ret = priv->cur_cmd->callback(priv, priv->cur_cmd->callback_arg, 584 ret = priv->cur_cmd->callback(priv, priv->cur_cmd->callback_arg,
625 resp); 585 resp);
626 } else 586 } else
627 ret = handle_cmd_response(priv, 0, resp); 587 ret = handle_cmd_response(priv, resp);
628 588
629 spin_lock_irqsave(&priv->driver_lock, flags); 589 spin_lock_irqsave(&priv->driver_lock, flags);
630 590
@@ -675,11 +635,9 @@ int lbs_process_event(struct lbs_private *priv)
675 eventcause = priv->eventcause >> SBI_EVENT_CAUSE_SHIFT; 635 eventcause = priv->eventcause >> SBI_EVENT_CAUSE_SHIFT;
676 spin_unlock_irq(&priv->driver_lock); 636 spin_unlock_irq(&priv->driver_lock);
677 637
678 lbs_deb_cmd("event cause %d\n", eventcause);
679
680 switch (eventcause) { 638 switch (eventcause) {
681 case MACREG_INT_CODE_LINK_SENSED: 639 case MACREG_INT_CODE_LINK_SENSED:
682 lbs_deb_cmd("EVENT: MACREG_INT_CODE_LINK_SENSED\n"); 640 lbs_deb_cmd("EVENT: link sensed\n");
683 break; 641 break;
684 642
685 case MACREG_INT_CODE_DEAUTHENTICATED: 643 case MACREG_INT_CODE_DEAUTHENTICATED:
@@ -698,7 +656,7 @@ int lbs_process_event(struct lbs_private *priv)
698 break; 656 break;
699 657
700 case MACREG_INT_CODE_PS_SLEEP: 658 case MACREG_INT_CODE_PS_SLEEP:
701 lbs_deb_cmd("EVENT: sleep\n"); 659 lbs_deb_cmd("EVENT: ps sleep\n");
702 660
703 /* handle unexpected PS SLEEP event */ 661 /* handle unexpected PS SLEEP event */
704 if (priv->psstate == PS_STATE_FULL_POWER) { 662 if (priv->psstate == PS_STATE_FULL_POWER) {
@@ -708,17 +666,17 @@ int lbs_process_event(struct lbs_private *priv)
708 } 666 }
709 priv->psstate = PS_STATE_PRE_SLEEP; 667 priv->psstate = PS_STATE_PRE_SLEEP;
710 668
711 lbs_ps_confirm_sleep(priv, (u16) priv->psmode); 669 lbs_ps_confirm_sleep(priv);
712 670
713 break; 671 break;
714 672
715 case MACREG_INT_CODE_HOST_AWAKE: 673 case MACREG_INT_CODE_HOST_AWAKE:
716 lbs_deb_cmd("EVENT: HOST_AWAKE\n"); 674 lbs_deb_cmd("EVENT: host awake\n");
717 lbs_send_confirmwake(priv); 675 lbs_send_confirmwake(priv);
718 break; 676 break;
719 677
720 case MACREG_INT_CODE_PS_AWAKE: 678 case MACREG_INT_CODE_PS_AWAKE:
721 lbs_deb_cmd("EVENT: awake\n"); 679 lbs_deb_cmd("EVENT: ps awake\n");
722 /* handle unexpected PS AWAKE event */ 680 /* handle unexpected PS AWAKE event */
723 if (priv->psstate == PS_STATE_FULL_POWER) { 681 if (priv->psstate == PS_STATE_FULL_POWER) {
724 lbs_deb_cmd( 682 lbs_deb_cmd(
@@ -749,14 +707,16 @@ int lbs_process_event(struct lbs_private *priv)
749 lbs_deb_cmd("EVENT: MULTICAST MIC ERROR\n"); 707 lbs_deb_cmd("EVENT: MULTICAST MIC ERROR\n");
750 handle_mic_failureevent(priv, MACREG_INT_CODE_MIC_ERR_MULTICAST); 708 handle_mic_failureevent(priv, MACREG_INT_CODE_MIC_ERR_MULTICAST);
751 break; 709 break;
710
752 case MACREG_INT_CODE_MIB_CHANGED: 711 case MACREG_INT_CODE_MIB_CHANGED:
712 lbs_deb_cmd("EVENT: MIB CHANGED\n");
713 break;
753 case MACREG_INT_CODE_INIT_DONE: 714 case MACREG_INT_CODE_INIT_DONE:
715 lbs_deb_cmd("EVENT: INIT DONE\n");
754 break; 716 break;
755
756 case MACREG_INT_CODE_ADHOC_BCN_LOST: 717 case MACREG_INT_CODE_ADHOC_BCN_LOST:
757 lbs_deb_cmd("EVENT: ADHOC beacon lost\n"); 718 lbs_deb_cmd("EVENT: ADHOC beacon lost\n");
758 break; 719 break;
759
760 case MACREG_INT_CODE_RSSI_LOW: 720 case MACREG_INT_CODE_RSSI_LOW:
761 lbs_pr_alert("EVENT: rssi low\n"); 721 lbs_pr_alert("EVENT: rssi low\n");
762 break; 722 break;
diff --git a/drivers/net/wireless/libertas/debugfs.c b/drivers/net/wireless/libertas/debugfs.c
index 8f88786b036f..7072e26b42d9 100644
--- a/drivers/net/wireless/libertas/debugfs.c
+++ b/drivers/net/wireless/libertas/debugfs.c
@@ -19,7 +19,7 @@ static char *szStates[] = {
19}; 19};
20 20
21#ifdef PROC_DEBUG 21#ifdef PROC_DEBUG
22static void lbs_debug_init(struct lbs_private *priv, struct net_device *dev); 22static void lbs_debug_init(struct lbs_private *priv);
23#endif 23#endif
24 24
25static int open_file_generic(struct inode *inode, struct file *file) 25static int open_file_generic(struct inode *inode, struct file *file)
@@ -78,7 +78,7 @@ static ssize_t lbs_getscantable(struct file *file, char __user *userbuf,
78 u16 spectrum_mgmt = (iter_bss->capability & WLAN_CAPABILITY_SPECTRUM_MGMT); 78 u16 spectrum_mgmt = (iter_bss->capability & WLAN_CAPABILITY_SPECTRUM_MGMT);
79 79
80 pos += snprintf(buf+pos, len-pos, 80 pos += snprintf(buf+pos, len-pos,
81 "%02u| %03d | %04ld | %s |", 81 "%02u| %03d | %04d | %s |",
82 numscansdone, iter_bss->channel, iter_bss->rssi, 82 numscansdone, iter_bss->channel, iter_bss->rssi,
83 print_mac(mac, iter_bss->bssid)); 83 print_mac(mac, iter_bss->bssid));
84 pos += snprintf(buf+pos, len-pos, " %04x-", iter_bss->capability); 84 pos += snprintf(buf+pos, len-pos, " %04x-", iter_bss->capability);
@@ -778,7 +778,7 @@ void lbs_debugfs_init_one(struct lbs_private *priv, struct net_device *dev)
778 } 778 }
779 779
780#ifdef PROC_DEBUG 780#ifdef PROC_DEBUG
781 lbs_debug_init(priv, dev); 781 lbs_debug_init(priv);
782#endif 782#endif
783exit: 783exit:
784 return; 784 return;
@@ -952,7 +952,7 @@ static struct file_operations lbs_debug_fops = {
952 * @param dev pointer net_device 952 * @param dev pointer net_device
953 * @return N/A 953 * @return N/A
954 */ 954 */
955static void lbs_debug_init(struct lbs_private *priv, struct net_device *dev) 955static void lbs_debug_init(struct lbs_private *priv)
956{ 956{
957 int i; 957 int i;
958 958
diff --git a/drivers/net/wireless/libertas/decl.h b/drivers/net/wireless/libertas/decl.h
index 4e22341b4f3d..cadc59d7f77f 100644
--- a/drivers/net/wireless/libertas/decl.h
+++ b/drivers/net/wireless/libertas/decl.h
@@ -17,7 +17,7 @@ struct net_device;
17struct cmd_ctrl_node; 17struct cmd_ctrl_node;
18struct cmd_ds_command; 18struct cmd_ds_command;
19 19
20int lbs_set_mac_packet_filter(struct lbs_private *priv); 20void lbs_set_mac_control(struct lbs_private *priv);
21 21
22void lbs_send_tx_feedback(struct lbs_private *priv); 22void lbs_send_tx_feedback(struct lbs_private *priv);
23 23
@@ -49,7 +49,7 @@ int lbs_set_regiontable(struct lbs_private *priv, u8 region, u8 band);
49int lbs_process_rxed_packet(struct lbs_private *priv, struct sk_buff *); 49int lbs_process_rxed_packet(struct lbs_private *priv, struct sk_buff *);
50 50
51void lbs_ps_sleep(struct lbs_private *priv, int wait_option); 51void lbs_ps_sleep(struct lbs_private *priv, int wait_option);
52void lbs_ps_confirm_sleep(struct lbs_private *priv, u16 psmode); 52void lbs_ps_confirm_sleep(struct lbs_private *priv);
53void lbs_ps_wakeup(struct lbs_private *priv, int wait_option); 53void lbs_ps_wakeup(struct lbs_private *priv, int wait_option);
54 54
55struct chan_freq_power *lbs_find_cfp_by_band_and_channel( 55struct chan_freq_power *lbs_find_cfp_by_band_and_channel(
@@ -63,7 +63,6 @@ void lbs_send_iwevcustom_event(struct lbs_private *priv, s8 *str);
63 63
64/* main.c */ 64/* main.c */
65struct chan_freq_power *lbs_get_region_cfp_table(u8 region, 65struct chan_freq_power *lbs_get_region_cfp_table(u8 region,
66 u8 band,
67 int *cfp_no); 66 int *cfp_no);
68struct lbs_private *lbs_add_card(void *card, struct device *dmdev); 67struct lbs_private *lbs_add_card(void *card, struct device *dmdev);
69int lbs_remove_card(struct lbs_private *priv); 68int lbs_remove_card(struct lbs_private *priv);
diff --git a/drivers/net/wireless/libertas/dev.h b/drivers/net/wireless/libertas/dev.h
index ff2c046ca73f..17e02bed6bfa 100644
--- a/drivers/net/wireless/libertas/dev.h
+++ b/drivers/net/wireless/libertas/dev.h
@@ -252,7 +252,7 @@ struct lbs_private {
252 struct sk_buff *currenttxskb; 252 struct sk_buff *currenttxskb;
253 253
254 /** NIC Operation characteristics */ 254 /** NIC Operation characteristics */
255 u16 currentpacketfilter; 255 u16 mac_control;
256 u32 connect_status; 256 u32 connect_status;
257 u32 mesh_connect_status; 257 u32 mesh_connect_status;
258 u16 regioncode; 258 u16 regioncode;
@@ -323,8 +323,6 @@ struct lbs_private {
323 u8 *prdeeprom; 323 u8 *prdeeprom;
324 struct lbs_offset_value offsetvalue; 324 struct lbs_offset_value offsetvalue;
325 325
326 struct cmd_ds_802_11_get_log logmsg;
327
328 u32 monitormode; 326 u32 monitormode;
329 u8 fw_ready; 327 u8 fw_ready;
330}; 328};
diff --git a/drivers/net/wireless/libertas/host.h b/drivers/net/wireless/libertas/host.h
index 1aa04076b1ac..aae878b042c0 100644
--- a/drivers/net/wireless/libertas/host.h
+++ b/drivers/net/wireless/libertas/host.h
@@ -33,7 +33,6 @@
33#define CMD_RET_802_11_ASSOCIATE 0x8012 33#define CMD_RET_802_11_ASSOCIATE 0x8012
34 34
35/* Command codes */ 35/* Command codes */
36#define CMD_CODE_DNLD 0x0002
37#define CMD_GET_HW_SPEC 0x0003 36#define CMD_GET_HW_SPEC 0x0003
38#define CMD_EEPROM_UPDATE 0x0004 37#define CMD_EEPROM_UPDATE 0x0004
39#define CMD_802_11_RESET 0x0005 38#define CMD_802_11_RESET 0x0005
@@ -68,8 +67,6 @@
68#define CMD_802_11_AD_HOC_JOIN 0x002c 67#define CMD_802_11_AD_HOC_JOIN 0x002c
69#define CMD_802_11_QUERY_TKIP_REPLY_CNTRS 0x002e 68#define CMD_802_11_QUERY_TKIP_REPLY_CNTRS 0x002e
70#define CMD_802_11_ENABLE_RSN 0x002f 69#define CMD_802_11_ENABLE_RSN 0x002f
71#define CMD_802_11_PAIRWISE_TSC 0x0036
72#define CMD_802_11_GROUP_TSC 0x0037
73#define CMD_802_11_SET_AFC 0x003c 70#define CMD_802_11_SET_AFC 0x003c
74#define CMD_802_11_GET_AFC 0x003d 71#define CMD_802_11_GET_AFC 0x003d
75#define CMD_802_11_AD_HOC_STOP 0x0040 72#define CMD_802_11_AD_HOC_STOP 0x0040
diff --git a/drivers/net/wireless/libertas/hostcmd.h b/drivers/net/wireless/libertas/hostcmd.h
index 56bc1aa2bb00..acbcd56831cb 100644
--- a/drivers/net/wireless/libertas/hostcmd.h
+++ b/drivers/net/wireless/libertas/hostcmd.h
@@ -195,6 +195,8 @@ struct cmd_ds_802_11_scan_rsp {
195}; 195};
196 196
197struct cmd_ds_802_11_get_log { 197struct cmd_ds_802_11_get_log {
198 struct cmd_header hdr;
199
198 __le32 mcasttxframe; 200 __le32 mcasttxframe;
199 __le32 failed; 201 __le32 failed;
200 __le32 retry; 202 __le32 retry;
@@ -211,8 +213,9 @@ struct cmd_ds_802_11_get_log {
211}; 213};
212 214
213struct cmd_ds_mac_control { 215struct cmd_ds_mac_control {
216 struct cmd_header hdr;
214 __le16 action; 217 __le16 action;
215 __le16 reserved; 218 u16 reserved;
216}; 219};
217 220
218struct cmd_ds_mac_multicast_adr { 221struct cmd_ds_mac_multicast_adr {
@@ -695,13 +698,11 @@ struct cmd_ds_command {
695 /* command Body */ 698 /* command Body */
696 union { 699 union {
697 struct cmd_ds_802_11_ps_mode psmode; 700 struct cmd_ds_802_11_ps_mode psmode;
698 struct cmd_ds_mac_control macctrl;
699 struct cmd_ds_802_11_associate associate; 701 struct cmd_ds_802_11_associate associate;
700 struct cmd_ds_802_11_deauthenticate deauth; 702 struct cmd_ds_802_11_deauthenticate deauth;
701 struct cmd_ds_802_11_ad_hoc_start ads; 703 struct cmd_ds_802_11_ad_hoc_start ads;
702 struct cmd_ds_802_11_reset reset; 704 struct cmd_ds_802_11_reset reset;
703 struct cmd_ds_802_11_ad_hoc_result result; 705 struct cmd_ds_802_11_ad_hoc_result result;
704 struct cmd_ds_802_11_get_log glog;
705 struct cmd_ds_802_11_authenticate auth; 706 struct cmd_ds_802_11_authenticate auth;
706 struct cmd_ds_802_11_get_stat gstat; 707 struct cmd_ds_802_11_get_stat gstat;
707 struct cmd_ds_802_3_get_stat gstat_8023; 708 struct cmd_ds_802_3_get_stat gstat_8023;
diff --git a/drivers/net/wireless/libertas/if_cs.c b/drivers/net/wireless/libertas/if_cs.c
index 5a9cadb97503..d17746582160 100644
--- a/drivers/net/wireless/libertas/if_cs.c
+++ b/drivers/net/wireless/libertas/if_cs.c
@@ -882,6 +882,9 @@ static int if_cs_probe(struct pcmcia_device *p_dev)
882 goto out3; 882 goto out3;
883 } 883 }
884 884
885 /* The firmware for the CF card supports powersave */
886 priv->ps_supported = 1;
887
885 ret = 0; 888 ret = 0;
886 goto out; 889 goto out;
887 890
diff --git a/drivers/net/wireless/libertas/join.c b/drivers/net/wireless/libertas/join.c
index 56e64a697c37..3e5026ff2ffa 100644
--- a/drivers/net/wireless/libertas/join.c
+++ b/drivers/net/wireless/libertas/join.c
@@ -561,8 +561,7 @@ done:
561 return ret; 561 return ret;
562} 562}
563 563
564int lbs_cmd_80211_ad_hoc_stop(struct lbs_private *priv, 564int lbs_cmd_80211_ad_hoc_stop(struct cmd_ds_command *cmd)
565 struct cmd_ds_command *cmd)
566{ 565{
567 cmd->command = cpu_to_le16(CMD_802_11_AD_HOC_STOP); 566 cmd->command = cpu_to_le16(CMD_802_11_AD_HOC_STOP);
568 cmd->size = cpu_to_le16(S_DS_GEN); 567 cmd->size = cpu_to_le16(S_DS_GEN);
@@ -773,8 +772,7 @@ done:
773 return ret; 772 return ret;
774} 773}
775 774
776int lbs_ret_80211_disassociate(struct lbs_private *priv, 775int lbs_ret_80211_disassociate(struct lbs_private *priv)
777 struct cmd_ds_command *resp)
778{ 776{
779 lbs_deb_enter(LBS_DEB_JOIN); 777 lbs_deb_enter(LBS_DEB_JOIN);
780 778
@@ -863,8 +861,7 @@ done:
863 return ret; 861 return ret;
864} 862}
865 863
866int lbs_ret_80211_ad_hoc_stop(struct lbs_private *priv, 864int lbs_ret_80211_ad_hoc_stop(struct lbs_private *priv)
867 struct cmd_ds_command *resp)
868{ 865{
869 lbs_deb_enter(LBS_DEB_JOIN); 866 lbs_deb_enter(LBS_DEB_JOIN);
870 867
diff --git a/drivers/net/wireless/libertas/join.h b/drivers/net/wireless/libertas/join.h
index 792c64fe3514..bfc3a10a2f39 100644
--- a/drivers/net/wireless/libertas/join.h
+++ b/drivers/net/wireless/libertas/join.h
@@ -18,8 +18,7 @@ int lbs_cmd_80211_authenticate(struct lbs_private *priv,
18int lbs_cmd_80211_ad_hoc_join(struct lbs_private *priv, 18int lbs_cmd_80211_ad_hoc_join(struct lbs_private *priv,
19 struct cmd_ds_command *cmd, 19 struct cmd_ds_command *cmd,
20 void *pdata_buf); 20 void *pdata_buf);
21int lbs_cmd_80211_ad_hoc_stop(struct lbs_private *priv, 21int lbs_cmd_80211_ad_hoc_stop(struct cmd_ds_command *cmd);
22 struct cmd_ds_command *cmd);
23int lbs_cmd_80211_ad_hoc_start(struct lbs_private *priv, 22int lbs_cmd_80211_ad_hoc_start(struct lbs_private *priv,
24 struct cmd_ds_command *cmd, 23 struct cmd_ds_command *cmd,
25 void *pdata_buf); 24 void *pdata_buf);
@@ -31,10 +30,8 @@ int lbs_cmd_80211_associate(struct lbs_private *priv,
31 30
32int lbs_ret_80211_ad_hoc_start(struct lbs_private *priv, 31int lbs_ret_80211_ad_hoc_start(struct lbs_private *priv,
33 struct cmd_ds_command *resp); 32 struct cmd_ds_command *resp);
34int lbs_ret_80211_ad_hoc_stop(struct lbs_private *priv, 33int lbs_ret_80211_ad_hoc_stop(struct lbs_private *priv);
35 struct cmd_ds_command *resp); 34int lbs_ret_80211_disassociate(struct lbs_private *priv);
36int lbs_ret_80211_disassociate(struct lbs_private *priv,
37 struct cmd_ds_command *resp);
38int lbs_ret_80211_associate(struct lbs_private *priv, 35int lbs_ret_80211_associate(struct lbs_private *priv,
39 struct cmd_ds_command *resp); 36 struct cmd_ds_command *resp);
40 37
diff --git a/drivers/net/wireless/libertas/main.c b/drivers/net/wireless/libertas/main.c
index 2e5bac826c48..1eb0cb0a82b7 100644
--- a/drivers/net/wireless/libertas/main.c
+++ b/drivers/net/wireless/libertas/main.c
@@ -581,45 +581,45 @@ static int lbs_copy_multicast_address(struct lbs_private *priv,
581static void lbs_set_multicast_list(struct net_device *dev) 581static void lbs_set_multicast_list(struct net_device *dev)
582{ 582{
583 struct lbs_private *priv = dev->priv; 583 struct lbs_private *priv = dev->priv;
584 int oldpacketfilter; 584 int old_mac_control;
585 DECLARE_MAC_BUF(mac); 585 DECLARE_MAC_BUF(mac);
586 586
587 lbs_deb_enter(LBS_DEB_NET); 587 lbs_deb_enter(LBS_DEB_NET);
588 588
589 oldpacketfilter = priv->currentpacketfilter; 589 old_mac_control = priv->mac_control;
590 590
591 if (dev->flags & IFF_PROMISC) { 591 if (dev->flags & IFF_PROMISC) {
592 lbs_deb_net("enable promiscuous mode\n"); 592 lbs_deb_net("enable promiscuous mode\n");
593 priv->currentpacketfilter |= 593 priv->mac_control |=
594 CMD_ACT_MAC_PROMISCUOUS_ENABLE; 594 CMD_ACT_MAC_PROMISCUOUS_ENABLE;
595 priv->currentpacketfilter &= 595 priv->mac_control &=
596 ~(CMD_ACT_MAC_ALL_MULTICAST_ENABLE | 596 ~(CMD_ACT_MAC_ALL_MULTICAST_ENABLE |
597 CMD_ACT_MAC_MULTICAST_ENABLE); 597 CMD_ACT_MAC_MULTICAST_ENABLE);
598 } else { 598 } else {
599 /* Multicast */ 599 /* Multicast */
600 priv->currentpacketfilter &= 600 priv->mac_control &=
601 ~CMD_ACT_MAC_PROMISCUOUS_ENABLE; 601 ~CMD_ACT_MAC_PROMISCUOUS_ENABLE;
602 602
603 if (dev->flags & IFF_ALLMULTI || dev->mc_count > 603 if (dev->flags & IFF_ALLMULTI || dev->mc_count >
604 MRVDRV_MAX_MULTICAST_LIST_SIZE) { 604 MRVDRV_MAX_MULTICAST_LIST_SIZE) {
605 lbs_deb_net( "enabling all multicast\n"); 605 lbs_deb_net( "enabling all multicast\n");
606 priv->currentpacketfilter |= 606 priv->mac_control |=
607 CMD_ACT_MAC_ALL_MULTICAST_ENABLE; 607 CMD_ACT_MAC_ALL_MULTICAST_ENABLE;
608 priv->currentpacketfilter &= 608 priv->mac_control &=
609 ~CMD_ACT_MAC_MULTICAST_ENABLE; 609 ~CMD_ACT_MAC_MULTICAST_ENABLE;
610 } else { 610 } else {
611 priv->currentpacketfilter &= 611 priv->mac_control &=
612 ~CMD_ACT_MAC_ALL_MULTICAST_ENABLE; 612 ~CMD_ACT_MAC_ALL_MULTICAST_ENABLE;
613 613
614 if (!dev->mc_count) { 614 if (!dev->mc_count) {
615 lbs_deb_net("no multicast addresses, " 615 lbs_deb_net("no multicast addresses, "
616 "disabling multicast\n"); 616 "disabling multicast\n");
617 priv->currentpacketfilter &= 617 priv->mac_control &=
618 ~CMD_ACT_MAC_MULTICAST_ENABLE; 618 ~CMD_ACT_MAC_MULTICAST_ENABLE;
619 } else { 619 } else {
620 int i; 620 int i;
621 621
622 priv->currentpacketfilter |= 622 priv->mac_control |=
623 CMD_ACT_MAC_MULTICAST_ENABLE; 623 CMD_ACT_MAC_MULTICAST_ENABLE;
624 624
625 priv->nr_of_multicastmacaddr = 625 priv->nr_of_multicastmacaddr =
@@ -642,9 +642,8 @@ static void lbs_set_multicast_list(struct net_device *dev)
642 } 642 }
643 } 643 }
644 644
645 if (priv->currentpacketfilter != oldpacketfilter) { 645 if (priv->mac_control != old_mac_control)
646 lbs_set_mac_packet_filter(priv); 646 lbs_set_mac_control(priv);
647 }
648 647
649 lbs_deb_leave(LBS_DEB_NET); 648 lbs_deb_leave(LBS_DEB_NET);
650} 649}
@@ -804,7 +803,7 @@ static int lbs_thread(void *data)
804 lbs_deb_thread("main_thread: PRE_SLEEP--intcounter=%d currenttxskb=%p dnld_sent=%d cur_cmd=%p, confirm now\n", 803 lbs_deb_thread("main_thread: PRE_SLEEP--intcounter=%d currenttxskb=%p dnld_sent=%d cur_cmd=%p, confirm now\n",
805 priv->intcounter, priv->currenttxskb, priv->dnld_sent, priv->cur_cmd); 804 priv->intcounter, priv->currenttxskb, priv->dnld_sent, priv->cur_cmd);
806 805
807 lbs_ps_confirm_sleep(priv, (u16) priv->psmode); 806 lbs_ps_confirm_sleep(priv);
808 } else { 807 } else {
809 /* workaround for firmware sending 808 /* workaround for firmware sending
810 * deauth/linkloss event immediately 809 * deauth/linkloss event immediately
@@ -945,7 +944,7 @@ static int lbs_setup_firmware(struct lbs_private *priv)
945 goto done; 944 goto done;
946 } 945 }
947 946
948 lbs_set_mac_packet_filter(priv); 947 lbs_set_mac_control(priv);
949 948
950 ret = lbs_get_data_rate(priv); 949 ret = lbs_get_data_rate(priv);
951 if (ret < 0) { 950 if (ret < 0) {
@@ -1036,7 +1035,7 @@ static int lbs_init_adapter(struct lbs_private *priv)
1036 priv->secinfo.auth_mode = IW_AUTH_ALG_OPEN_SYSTEM; 1035 priv->secinfo.auth_mode = IW_AUTH_ALG_OPEN_SYSTEM;
1037 priv->mode = IW_MODE_INFRA; 1036 priv->mode = IW_MODE_INFRA;
1038 priv->curbssparams.channel = DEFAULT_AD_HOC_CHANNEL; 1037 priv->curbssparams.channel = DEFAULT_AD_HOC_CHANNEL;
1039 priv->currentpacketfilter = CMD_ACT_MAC_RX_ON | CMD_ACT_MAC_TX_ON; 1038 priv->mac_control = CMD_ACT_MAC_RX_ON | CMD_ACT_MAC_TX_ON;
1040 priv->radioon = RADIO_ON; 1039 priv->radioon = RADIO_ON;
1041 priv->auto_rate = 1; 1040 priv->auto_rate = 1;
1042 priv->capability = WLAN_CAPABILITY_SHORT_PREAMBLE; 1041 priv->capability = WLAN_CAPABILITY_SHORT_PREAMBLE;
@@ -1392,7 +1391,7 @@ static void lbs_remove_mesh(struct lbs_private *priv)
1392 * @param cfp_no A pointer to CFP number 1391 * @param cfp_no A pointer to CFP number
1393 * @return A pointer to CFP 1392 * @return A pointer to CFP
1394 */ 1393 */
1395struct chan_freq_power *lbs_get_region_cfp_table(u8 region, u8 band, int *cfp_no) 1394struct chan_freq_power *lbs_get_region_cfp_table(u8 region, int *cfp_no)
1396{ 1395{
1397 int i, end; 1396 int i, end;
1398 1397
@@ -1426,7 +1425,7 @@ int lbs_set_regiontable(struct lbs_private *priv, u8 region, u8 band)
1426 1425
1427 memset(priv->region_channel, 0, sizeof(priv->region_channel)); 1426 memset(priv->region_channel, 0, sizeof(priv->region_channel));
1428 1427
1429 cfp = lbs_get_region_cfp_table(region, band, &cfp_no); 1428 cfp = lbs_get_region_cfp_table(region, &cfp_no);
1430 if (cfp != NULL) { 1429 if (cfp != NULL) {
1431 priv->region_channel[i].nrcfp = cfp_no; 1430 priv->region_channel[i].nrcfp = cfp_no;
1432 priv->region_channel[i].CFP = cfp; 1431 priv->region_channel[i].CFP = cfp;
diff --git a/drivers/net/wireless/libertas/scan.c b/drivers/net/wireless/libertas/scan.c
index 0598541451d8..3825b7979fc4 100644
--- a/drivers/net/wireless/libertas/scan.c
+++ b/drivers/net/wireless/libertas/scan.c
@@ -602,7 +602,7 @@ static int lbs_scan_networks(struct lbs_private *priv, int full_scan)
602 lbs_deb_scan("scan table:\n"); 602 lbs_deb_scan("scan table:\n");
603 list_for_each_entry(iter, &priv->network_list, list) 603 list_for_each_entry(iter, &priv->network_list, list)
604 lbs_deb_scan("%02d: BSSID %s, RSSI %d, SSID '%s'\n", 604 lbs_deb_scan("%02d: BSSID %s, RSSI %d, SSID '%s'\n",
605 i++, print_mac(mac, iter->bssid), (int)iter->rssi, 605 i++, print_mac(mac, iter->bssid), iter->rssi,
606 escape_essid(iter->ssid, iter->ssid_len)); 606 escape_essid(iter->ssid, iter->ssid_len));
607 mutex_unlock(&priv->lock); 607 mutex_unlock(&priv->lock);
608#endif 608#endif
@@ -948,7 +948,7 @@ struct bss_descriptor *lbs_find_ssid_in_list(struct lbs_private *priv,
948 uint8_t *bssid, uint8_t mode, 948 uint8_t *bssid, uint8_t mode,
949 int channel) 949 int channel)
950{ 950{
951 uint8_t bestrssi = 0; 951 u32 bestrssi = 0;
952 struct bss_descriptor * iter_bss = NULL; 952 struct bss_descriptor * iter_bss = NULL;
953 struct bss_descriptor * found_bss = NULL; 953 struct bss_descriptor * found_bss = NULL;
954 struct bss_descriptor * tmp_oldest = NULL; 954 struct bss_descriptor * tmp_oldest = NULL;
diff --git a/drivers/net/wireless/libertas/scan.h b/drivers/net/wireless/libertas/scan.h
index c50c8b74714b..b50cf1415e04 100644
--- a/drivers/net/wireless/libertas/scan.h
+++ b/drivers/net/wireless/libertas/scan.h
@@ -34,14 +34,9 @@ struct bss_descriptor {
34 u8 ssid_len; 34 u8 ssid_len;
35 35
36 u16 capability; 36 u16 capability;
37 37 u32 rssi;
38 /* receive signal strength in dBm */
39 long rssi;
40
41 u32 channel; 38 u32 channel;
42
43 u16 beaconperiod; 39 u16 beaconperiod;
44
45 u32 atimwindow; 40 u32 atimwindow;
46 41
47 /* IW_MODE_AUTO, IW_MODE_ADHOC, IW_MODE_INFRA */ 42 /* IW_MODE_AUTO, IW_MODE_ADHOC, IW_MODE_INFRA */
diff --git a/drivers/net/wireless/libertas/wext.c b/drivers/net/wireless/libertas/wext.c
index cded4bb69164..738142e802d4 100644
--- a/drivers/net/wireless/libertas/wext.c
+++ b/drivers/net/wireless/libertas/wext.c
@@ -605,7 +605,7 @@ static int lbs_get_range(struct net_device *dev, struct iw_request_info *info,
605 lbs_deb_wext("chan_no %d\n", chan_no); 605 lbs_deb_wext("chan_no %d\n", chan_no);
606 range->freq[range->num_frequency].i = (long)chan_no; 606 range->freq[range->num_frequency].i = (long)chan_no;
607 range->freq[range->num_frequency].m = 607 range->freq[range->num_frequency].m =
608 (long)lbs_chan_2_freq(chan_no, band) * 100000; 608 (long)lbs_chan_2_freq(chan_no) * 100000;
609 range->freq[range->num_frequency].e = 1; 609 range->freq[range->num_frequency].e = 1;
610 range->num_frequency++; 610 range->num_frequency++;
611 } 611 }
@@ -656,13 +656,10 @@ static int lbs_get_range(struct net_device *dev, struct iw_request_info *info,
656 range->num_encoding_sizes = 2; 656 range->num_encoding_sizes = 2;
657 range->max_encoding_tokens = 4; 657 range->max_encoding_tokens = 4;
658 658
659 range->min_pmp = 1000000; 659 /*
660 range->max_pmp = 120000000; 660 * Right now we support only "iwconfig ethX power on|off"
661 range->min_pmt = 1000; 661 */
662 range->max_pmt = 1000000; 662 range->pm_capa = IW_POWER_ON;
663 range->pmp_flags = IW_POWER_PERIOD;
664 range->pmt_flags = IW_POWER_TIMEOUT;
665 range->pm_capa = IW_POWER_PERIOD | IW_POWER_TIMEOUT | IW_POWER_ALL_R;
666 663
667 /* 664 /*
668 * Minimum version we recommend 665 * Minimum version we recommend
@@ -784,21 +781,14 @@ static int lbs_get_power(struct net_device *dev, struct iw_request_info *info,
784 struct iw_param *vwrq, char *extra) 781 struct iw_param *vwrq, char *extra)
785{ 782{
786 struct lbs_private *priv = dev->priv; 783 struct lbs_private *priv = dev->priv;
787 int mode;
788 784
789 lbs_deb_enter(LBS_DEB_WEXT); 785 lbs_deb_enter(LBS_DEB_WEXT);
790 786
791 mode = priv->psmode;
792
793 if ((vwrq->disabled = (mode == LBS802_11POWERMODECAM))
794 || priv->connect_status == LBS_DISCONNECTED)
795 {
796 goto out;
797 }
798
799 vwrq->value = 0; 787 vwrq->value = 0;
788 vwrq->flags = 0;
789 vwrq->disabled = priv->psmode == LBS802_11POWERMODECAM
790 || priv->connect_status == LBS_DISCONNECTED;
800 791
801out:
802 lbs_deb_leave(LBS_DEB_WEXT); 792 lbs_deb_leave(LBS_DEB_WEXT);
803 return 0; 793 return 0;
804} 794}
@@ -820,6 +810,7 @@ static struct iw_statistics *lbs_get_wireless_stats(struct net_device *dev)
820 int stats_valid = 0; 810 int stats_valid = 0;
821 u8 rssi; 811 u8 rssi;
822 u32 tx_retries; 812 u32 tx_retries;
813 struct cmd_ds_802_11_get_log log;
823 814
824 lbs_deb_enter(LBS_DEB_WEXT); 815 lbs_deb_enter(LBS_DEB_WEXT);
825 816
@@ -863,7 +854,11 @@ static struct iw_statistics *lbs_get_wireless_stats(struct net_device *dev)
863 /* Quality by TX errors */ 854 /* Quality by TX errors */
864 priv->wstats.discard.retries = priv->stats.tx_errors; 855 priv->wstats.discard.retries = priv->stats.tx_errors;
865 856
866 tx_retries = le32_to_cpu(priv->logmsg.retry); 857 memset(&log, 0, sizeof(log));
858 log.hdr.size = cpu_to_le16(sizeof(log));
859 lbs_cmd_with_response(priv, CMD_802_11_GET_LOG, &log);
860
861 tx_retries = le32_to_cpu(log.retry);
867 862
868 if (tx_retries > 75) 863 if (tx_retries > 75)
869 tx_qual = (90 - tx_retries) * POOR / 15; 864 tx_qual = (90 - tx_retries) * POOR / 15;
@@ -879,10 +874,9 @@ static struct iw_statistics *lbs_get_wireless_stats(struct net_device *dev)
879 (PERFECT - VERY_GOOD) / 50 + VERY_GOOD; 874 (PERFECT - VERY_GOOD) / 50 + VERY_GOOD;
880 quality = min(quality, tx_qual); 875 quality = min(quality, tx_qual);
881 876
882 priv->wstats.discard.code = le32_to_cpu(priv->logmsg.wepundecryptable); 877 priv->wstats.discard.code = le32_to_cpu(log.wepundecryptable);
883 priv->wstats.discard.fragment = le32_to_cpu(priv->logmsg.rxfrag);
884 priv->wstats.discard.retries = tx_retries; 878 priv->wstats.discard.retries = tx_retries;
885 priv->wstats.discard.misc = le32_to_cpu(priv->logmsg.ackfailure); 879 priv->wstats.discard.misc = le32_to_cpu(log.ackfailure);
886 880
887 /* Calculate quality */ 881 /* Calculate quality */
888 priv->wstats.qual.qual = min_t(u8, quality, 100); 882 priv->wstats.qual.qual = min_t(u8, quality, 100);
@@ -892,8 +886,6 @@ static struct iw_statistics *lbs_get_wireless_stats(struct net_device *dev)
892 /* update stats asynchronously for future calls */ 886 /* update stats asynchronously for future calls */
893 lbs_prepare_and_send_command(priv, CMD_802_11_RSSI, 0, 887 lbs_prepare_and_send_command(priv, CMD_802_11_RSSI, 0,
894 0, 0, NULL); 888 0, 0, NULL);
895 lbs_prepare_and_send_command(priv, CMD_802_11_GET_LOG, 0,
896 0, 0, NULL);
897out: 889out:
898 if (!stats_valid) { 890 if (!stats_valid) {
899 priv->wstats.miss.beacon = 0; 891 priv->wstats.miss.beacon = 0;