]> git.karo-electronics.de Git - mv-sheeva.git/blobdiff - drivers/net/wireless/iwlwifi/iwl-rx.c
iwlwifi: showing accumulative ucode statistics counters
[mv-sheeva.git] / drivers / net / wireless / iwlwifi / iwl-rx.c
index 493626bcd3ec53102f7d5d00c15cc5a7045588dd..7ad327ef9cb53bd5af46f765f680830a7c71a821 100644 (file)
@@ -548,6 +548,44 @@ static void iwl_rx_calc_noise(struct iwl_priv *priv)
                        priv->last_rx_noise);
 }
 
+#ifdef CONFIG_IWLWIFI_DEBUG
+/*
+ *  based on the assumption of all statistics counter are in DWORD
+ *  FIXME: This function is for debugging, do not deal with
+ *  the case of counters roll-over.
+ */
+static void iwl_accumulative_statistics(struct iwl_priv *priv,
+                                       __le32 *stats)
+{
+       int i;
+       __le32 *prev_stats;
+       u32 *accum_stats;
+
+       prev_stats = (__le32 *)&priv->statistics;
+       accum_stats = (u32 *)&priv->accum_statistics;
+
+       for (i = sizeof(__le32); i < sizeof(struct iwl_notif_statistics);
+            i += sizeof(__le32), stats++, prev_stats++, accum_stats++)
+               if (le32_to_cpu(*stats) > le32_to_cpu(*prev_stats))
+                       *accum_stats += (le32_to_cpu(*stats) -
+                               le32_to_cpu(*prev_stats));
+
+       /* reset accumulative statistics for "no-counter" type statistics */
+       priv->accum_statistics.general.temperature =
+               priv->statistics.general.temperature;
+       priv->accum_statistics.general.temperature_m =
+               priv->statistics.general.temperature_m;
+       priv->accum_statistics.general.ttl_timestamp =
+               priv->statistics.general.ttl_timestamp;
+       priv->accum_statistics.tx.tx_power.ant_a =
+               priv->statistics.tx.tx_power.ant_a;
+       priv->accum_statistics.tx.tx_power.ant_b =
+               priv->statistics.tx.tx_power.ant_b;
+       priv->accum_statistics.tx.tx_power.ant_c =
+               priv->statistics.tx.tx_power.ant_c;
+}
+#endif
+
 #define REG_RECALIB_PERIOD (60)
 
 void iwl_rx_statistics(struct iwl_priv *priv,
@@ -566,6 +604,9 @@ void iwl_rx_statistics(struct iwl_priv *priv,
                    STATISTICS_REPLY_FLG_HT40_MODE_MSK) !=
                   (pkt->u.stats.flag & STATISTICS_REPLY_FLG_HT40_MODE_MSK)));
 
+#ifdef CONFIG_IWLWIFI_DEBUG
+       iwl_accumulative_statistics(priv, (__le32 *)&pkt->u.stats);
+#endif
        memcpy(&priv->statistics, &pkt->u.stats, sizeof(priv->statistics));
 
        set_bit(STATUS_STATISTICS, &priv->status);