Commit 92a35bda authored by Wey-Yi Guy's avatar Wey-Yi Guy Committed by John W. Linville
Browse files

iwlwifi: showing accumulative ucode statistics counters



Adding accumulative statistics counters in iwlwifi driver.
Statistics counters are reported by uCode every beacon interval; but can
be reset by uCode when needed. The accumulative statistics counters is
maintained by driver to keep track of the history of all the counters.

Update the ucode stats files in debugfs to display both latest and
accumulative counters.
Signed-off-by: default avatarWey-Yi Guy <wey-yi.w.guy@intel.com>
Signed-off-by: default avatarReinette Chatre <reinette.chatre@intel.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 88804e2b
......@@ -361,8 +361,6 @@ void iwl3945_hw_rx_statistics(struct iwl_priv *priv,
memcpy(&priv->statistics_39, pkt->u.raw, sizeof(priv->statistics_39));
iwl_leds_background(priv);
priv->last_statistics_time = jiffies;
}
/******************************************************************************
......
This diff is collapsed.
......@@ -1124,7 +1124,9 @@ struct iwl_priv {
struct iwl_tt_mgmt thermal_throttle;
struct iwl_notif_statistics statistics;
unsigned long last_statistics_time;
#ifdef CONFIG_IWLWIFI_DEBUG
struct iwl_notif_statistics accum_statistics;
#endif
/* context information */
u16 rates_mask;
......
......@@ -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);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment