aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/libertas
diff options
context:
space:
mode:
authorHolger Schurig <hs4233@mail.mn-solutions.de>2008-03-17 07:45:58 -0400
committerJohn W. Linville <linville@tuxdriver.com>2008-03-25 16:41:48 -0400
commitc49c3b77c8c611f562ca4e201d88d3e69465f928 (patch)
tree937308f8020b0e9437cdf8b9e8f6a43f10a26282 /drivers/net/wireless/libertas
parentc97329e21fc487ebf251c920d46537ff5fb4d8a7 (diff)
libertas: convert GET_LOG to a direct command
Now uses __lbs_cmd() to get the "log" (it's actually more a snapshot of various counters, not a sequential log). Besides the "mechanical" convertion the patch add the following logical changes: * Removes the priv->logmsg variable, it was only used in one place anyway, also don't blindly get the counters when associating. Getting the counters then the user asks via WEXT for them is good enought. * don't set wstats.discard.fragment with log.rxfrag, because the latter is a counter for successfully received packets, not for fragmented packets. Signed-off-by: Holger Schurig <hs4233@mail.mn-solutions.de> Acked-by: Dan Williams <dcbw@redhat.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/libertas')
-rw-r--r--drivers/net/wireless/libertas/assoc.c4
-rw-r--r--drivers/net/wireless/libertas/cmd.c16
-rw-r--r--drivers/net/wireless/libertas/cmdresp.c18
-rw-r--r--drivers/net/wireless/libertas/dev.h2
-rw-r--r--drivers/net/wireless/libertas/hostcmd.h3
-rw-r--r--drivers/net/wireless/libertas/wext.c14
6 files changed, 10 insertions, 47 deletions
diff --git a/drivers/net/wireless/libertas/assoc.c b/drivers/net/wireless/libertas/assoc.c
index fcea2a124a5..95d98203eb4 100644
--- a/drivers/net/wireless/libertas/assoc.c
+++ b/drivers/net/wireless/libertas/assoc.c
@@ -624,10 +624,6 @@ void lbs_association_worker(struct work_struct *work)
624 lbs_prepare_and_send_command(priv, 624 lbs_prepare_and_send_command(priv,
625 CMD_802_11_RSSI, 625 CMD_802_11_RSSI,
626 0, CMD_OPTION_WAITFORRSP, 0, NULL); 626 0, CMD_OPTION_WAITFORRSP, 0, NULL);
627
628 lbs_prepare_and_send_command(priv,
629 CMD_802_11_GET_LOG,
630 0, CMD_OPTION_WAITFORRSP, 0, NULL);
631 } else { 627 } else {
632 ret = -1; 628 ret = -1;
633 } 629 }
diff --git a/drivers/net/wireless/libertas/cmd.c b/drivers/net/wireless/libertas/cmd.c
index be8a170b633..5e35788946f 100644
--- a/drivers/net/wireless/libertas/cmd.c
+++ b/drivers/net/wireless/libertas/cmd.c
@@ -494,18 +494,6 @@ static int lbs_cmd_802_11_reset(struct lbs_private *priv,
494 return 0; 494 return 0;
495} 495}
496 496
497static int lbs_cmd_802_11_get_log(struct lbs_private *priv,
498 struct cmd_ds_command *cmd)
499{
500 lbs_deb_enter(LBS_DEB_CMD);
501 cmd->command = cpu_to_le16(CMD_802_11_GET_LOG);
502 cmd->size =
503 cpu_to_le16(sizeof(struct cmd_ds_802_11_get_log) + S_DS_GEN);
504
505 lbs_deb_leave(LBS_DEB_CMD);
506 return 0;
507}
508
509static int lbs_cmd_802_11_get_stat(struct lbs_private *priv, 497static int lbs_cmd_802_11_get_stat(struct lbs_private *priv,
510 struct cmd_ds_command *cmd) 498 struct cmd_ds_command *cmd)
511{ 499{
@@ -1423,10 +1411,6 @@ int lbs_prepare_and_send_command(struct lbs_private *priv,
1423 ret = lbs_cmd_802_11_reset(priv, cmdptr, cmd_action); 1411 ret = lbs_cmd_802_11_reset(priv, cmdptr, cmd_action);
1424 break; 1412 break;
1425 1413
1426 case CMD_802_11_GET_LOG:
1427 ret = lbs_cmd_802_11_get_log(priv, cmdptr);
1428 break;
1429
1430 case CMD_802_11_AUTHENTICATE: 1414 case CMD_802_11_AUTHENTICATE:
1431 ret = lbs_cmd_80211_authenticate(priv, cmdptr, pdata_buf); 1415 ret = lbs_cmd_80211_authenticate(priv, cmdptr, pdata_buf);
1432 break; 1416 break;
diff --git a/drivers/net/wireless/libertas/cmdresp.c b/drivers/net/wireless/libertas/cmdresp.c
index 5534a7b859d..240feeb1b49 100644
--- a/drivers/net/wireless/libertas/cmdresp.c
+++ b/drivers/net/wireless/libertas/cmdresp.c
@@ -303,20 +303,6 @@ static int lbs_ret_802_11_eeprom_access(struct lbs_private *priv,
303 return 0; 303 return 0;
304} 304}
305 305
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, 306static int lbs_ret_802_11_bcn_ctrl(struct lbs_private * priv,
321 struct cmd_ds_command *resp) 307 struct cmd_ds_command *resp)
322{ 308{
@@ -352,10 +338,6 @@ static inline int handle_cmd_response(struct lbs_private *priv,
352 ret = lbs_ret_reg_access(priv, respcmd, resp); 338 ret = lbs_ret_reg_access(priv, respcmd, resp);
353 break; 339 break;
354 340
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: 341 case CMD_RET_802_11_ASSOCIATE:
360 case CMD_RET(CMD_802_11_ASSOCIATE): 342 case CMD_RET(CMD_802_11_ASSOCIATE):
361 case CMD_RET(CMD_802_11_REASSOCIATE): 343 case CMD_RET(CMD_802_11_REASSOCIATE):
diff --git a/drivers/net/wireless/libertas/dev.h b/drivers/net/wireless/libertas/dev.h
index 4122a322343..17e02bed6bf 100644
--- a/drivers/net/wireless/libertas/dev.h
+++ b/drivers/net/wireless/libertas/dev.h
@@ -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/hostcmd.h b/drivers/net/wireless/libertas/hostcmd.h
index b5361b3393d..acbcd56831c 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;
@@ -701,7 +703,6 @@ struct cmd_ds_command {
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/wext.c b/drivers/net/wireless/libertas/wext.c
index cded4bb6916..5ccb4e0c8d6 100644
--- a/drivers/net/wireless/libertas/wext.c
+++ b/drivers/net/wireless/libertas/wext.c
@@ -820,6 +820,7 @@ static struct iw_statistics *lbs_get_wireless_stats(struct net_device *dev)
820 int stats_valid = 0; 820 int stats_valid = 0;
821 u8 rssi; 821 u8 rssi;
822 u32 tx_retries; 822 u32 tx_retries;
823 struct cmd_ds_802_11_get_log log;
823 824
824 lbs_deb_enter(LBS_DEB_WEXT); 825 lbs_deb_enter(LBS_DEB_WEXT);
825 826
@@ -863,7 +864,11 @@ static struct iw_statistics *lbs_get_wireless_stats(struct net_device *dev)
863 /* Quality by TX errors */ 864 /* Quality by TX errors */
864 priv->wstats.discard.retries = priv->stats.tx_errors; 865 priv->wstats.discard.retries = priv->stats.tx_errors;
865 866
866 tx_retries = le32_to_cpu(priv->logmsg.retry); 867 memset(&log, 0, sizeof(log));
868 log.hdr.size = cpu_to_le16(sizeof(log));
869 lbs_cmd_with_response(priv, CMD_802_11_GET_LOG, &log);
870
871 tx_retries = le32_to_cpu(log.retry);
867 872
868 if (tx_retries > 75) 873 if (tx_retries > 75)
869 tx_qual = (90 - tx_retries) * POOR / 15; 874 tx_qual = (90 - tx_retries) * POOR / 15;
@@ -879,10 +884,9 @@ static struct iw_statistics *lbs_get_wireless_stats(struct net_device *dev)
879 (PERFECT - VERY_GOOD) / 50 + VERY_GOOD; 884 (PERFECT - VERY_GOOD) / 50 + VERY_GOOD;
880 quality = min(quality, tx_qual); 885 quality = min(quality, tx_qual);
881 886
882 priv->wstats.discard.code = le32_to_cpu(priv->logmsg.wepundecryptable); 887 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; 888 priv->wstats.discard.retries = tx_retries;
885 priv->wstats.discard.misc = le32_to_cpu(priv->logmsg.ackfailure); 889 priv->wstats.discard.misc = le32_to_cpu(log.ackfailure);
886 890
887 /* Calculate quality */ 891 /* Calculate quality */
888 priv->wstats.qual.qual = min_t(u8, quality, 100); 892 priv->wstats.qual.qual = min_t(u8, quality, 100);
@@ -892,8 +896,6 @@ static struct iw_statistics *lbs_get_wireless_stats(struct net_device *dev)
892 /* update stats asynchronously for future calls */ 896 /* update stats asynchronously for future calls */
893 lbs_prepare_and_send_command(priv, CMD_802_11_RSSI, 0, 897 lbs_prepare_and_send_command(priv, CMD_802_11_RSSI, 0,
894 0, 0, NULL); 898 0, 0, NULL);
895 lbs_prepare_and_send_command(priv, CMD_802_11_GET_LOG, 0,
896 0, 0, NULL);
897out: 899out:
898 if (!stats_valid) { 900 if (!stats_valid) {
899 priv->wstats.miss.beacon = 0; 901 priv->wstats.miss.beacon = 0;