libertas: convert GET_LOG to a direct command
authorHolger Schurig <hs4233@mail.mn-solutions.de>
Mon, 17 Mar 2008 11:45:58 +0000 (12:45 +0100)
committerJohn W. Linville <linville@tuxdriver.com>
Tue, 25 Mar 2008 20:41:48 +0000 (16:41 -0400)
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>
drivers/net/wireless/libertas/assoc.c
drivers/net/wireless/libertas/cmd.c
drivers/net/wireless/libertas/cmdresp.c
drivers/net/wireless/libertas/dev.h
drivers/net/wireless/libertas/hostcmd.h
drivers/net/wireless/libertas/wext.c

index fcea2a124a5614eb84a7c7a917499945c89068f8..95d98203eb4ebdccbf9936b7a29a745a8715161e 100644 (file)
@@ -624,10 +624,6 @@ void lbs_association_worker(struct work_struct *work)
                        lbs_prepare_and_send_command(priv,
                                CMD_802_11_RSSI,
                                0, CMD_OPTION_WAITFORRSP, 0, NULL);
-
-                       lbs_prepare_and_send_command(priv,
-                               CMD_802_11_GET_LOG,
-                               0, CMD_OPTION_WAITFORRSP, 0, NULL);
                } else {
                        ret = -1;
                }
index be8a170b633f0023d530b2f55598ebeae75f8409..5e35788946f1c20c49daa0322f6a672a4774435d 100644 (file)
@@ -494,18 +494,6 @@ static int lbs_cmd_802_11_reset(struct lbs_private *priv,
        return 0;
 }
 
-static int lbs_cmd_802_11_get_log(struct lbs_private *priv,
-                                  struct cmd_ds_command *cmd)
-{
-       lbs_deb_enter(LBS_DEB_CMD);
-       cmd->command = cpu_to_le16(CMD_802_11_GET_LOG);
-       cmd->size =
-               cpu_to_le16(sizeof(struct cmd_ds_802_11_get_log) + S_DS_GEN);
-
-       lbs_deb_leave(LBS_DEB_CMD);
-       return 0;
-}
-
 static int lbs_cmd_802_11_get_stat(struct lbs_private *priv,
                                    struct cmd_ds_command *cmd)
 {
@@ -1423,10 +1411,6 @@ int lbs_prepare_and_send_command(struct lbs_private *priv,
                ret = lbs_cmd_802_11_reset(priv, cmdptr, cmd_action);
                break;
 
-       case CMD_802_11_GET_LOG:
-               ret = lbs_cmd_802_11_get_log(priv, cmdptr);
-               break;
-
        case CMD_802_11_AUTHENTICATE:
                ret = lbs_cmd_80211_authenticate(priv, cmdptr, pdata_buf);
                break;
index 5534a7b859da56d054a75c5a41294abfcd419005..240feeb1b49bf67d9db6171d63dc6ec5df596154 100644 (file)
@@ -303,20 +303,6 @@ static int lbs_ret_802_11_eeprom_access(struct lbs_private *priv,
        return 0;
 }
 
-static int lbs_ret_get_log(struct lbs_private *priv,
-                           struct cmd_ds_command *resp)
-{
-       struct cmd_ds_802_11_get_log *logmessage = &resp->params.glog;
-
-       lbs_deb_enter(LBS_DEB_CMD);
-
-       /* Stored little-endian */
-       memcpy(&priv->logmsg, logmessage, sizeof(struct cmd_ds_802_11_get_log));
-
-       lbs_deb_leave(LBS_DEB_CMD);
-       return 0;
-}
-
 static int lbs_ret_802_11_bcn_ctrl(struct lbs_private * priv,
                                        struct cmd_ds_command *resp)
 {
@@ -352,10 +338,6 @@ static inline int handle_cmd_response(struct lbs_private *priv,
                ret = lbs_ret_reg_access(priv, respcmd, resp);
                break;
 
-       case CMD_RET(CMD_802_11_GET_LOG):
-               ret = lbs_ret_get_log(priv, resp);
-               break;
-
        case CMD_RET_802_11_ASSOCIATE:
        case CMD_RET(CMD_802_11_ASSOCIATE):
        case CMD_RET(CMD_802_11_REASSOCIATE):
index 4122a322343246cb406b156be38f31f01005fc92..17e02bed6bfa8caf6d3e0cd2f5ea0f1b5b062f7e 100644 (file)
@@ -323,8 +323,6 @@ struct lbs_private {
        u8 *prdeeprom;
        struct lbs_offset_value offsetvalue;
 
-       struct cmd_ds_802_11_get_log logmsg;
-
        u32 monitormode;
        u8 fw_ready;
 };
index b5361b3393d9d03943aab0757b8b333a03928b34..acbcd56831cbc0097f0c8e70d149d71795e653f4 100644 (file)
@@ -195,6 +195,8 @@ struct cmd_ds_802_11_scan_rsp {
 };
 
 struct cmd_ds_802_11_get_log {
+       struct cmd_header hdr;
+
        __le32 mcasttxframe;
        __le32 failed;
        __le32 retry;
@@ -701,7 +703,6 @@ struct cmd_ds_command {
                struct cmd_ds_802_11_ad_hoc_start ads;
                struct cmd_ds_802_11_reset reset;
                struct cmd_ds_802_11_ad_hoc_result result;
-               struct cmd_ds_802_11_get_log glog;
                struct cmd_ds_802_11_authenticate auth;
                struct cmd_ds_802_11_get_stat gstat;
                struct cmd_ds_802_3_get_stat gstat_8023;
index cded4bb6916425f2f42377604d52c3547b603ea6..5ccb4e0c8d64aa2c79ec226b95124b418a1c6ad4 100644 (file)
@@ -820,6 +820,7 @@ static struct iw_statistics *lbs_get_wireless_stats(struct net_device *dev)
        int stats_valid = 0;
        u8 rssi;
        u32 tx_retries;
+       struct cmd_ds_802_11_get_log log;
 
        lbs_deb_enter(LBS_DEB_WEXT);
 
@@ -863,7 +864,11 @@ static struct iw_statistics *lbs_get_wireless_stats(struct net_device *dev)
        /* Quality by TX errors */
        priv->wstats.discard.retries = priv->stats.tx_errors;
 
-       tx_retries = le32_to_cpu(priv->logmsg.retry);
+       memset(&log, 0, sizeof(log));
+       log.hdr.size = cpu_to_le16(sizeof(log));
+       lbs_cmd_with_response(priv, CMD_802_11_GET_LOG, &log);
+
+       tx_retries = le32_to_cpu(log.retry);
 
        if (tx_retries > 75)
                tx_qual = (90 - tx_retries) * POOR / 15;
@@ -879,10 +884,9 @@ static struct iw_statistics *lbs_get_wireless_stats(struct net_device *dev)
                    (PERFECT - VERY_GOOD) / 50 + VERY_GOOD;
        quality = min(quality, tx_qual);
 
-       priv->wstats.discard.code = le32_to_cpu(priv->logmsg.wepundecryptable);
-       priv->wstats.discard.fragment = le32_to_cpu(priv->logmsg.rxfrag);
+       priv->wstats.discard.code = le32_to_cpu(log.wepundecryptable);
        priv->wstats.discard.retries = tx_retries;
-       priv->wstats.discard.misc = le32_to_cpu(priv->logmsg.ackfailure);
+       priv->wstats.discard.misc = le32_to_cpu(log.ackfailure);
 
        /* Calculate quality */
        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)
        /* update stats asynchronously for future calls */
        lbs_prepare_and_send_command(priv, CMD_802_11_RSSI, 0,
                                        0, 0, NULL);
-       lbs_prepare_and_send_command(priv, CMD_802_11_GET_LOG, 0,
-                                       0, 0, NULL);
 out:
        if (!stats_valid) {
                priv->wstats.miss.beacon = 0;