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

iwlwifi: format and show statistics counter from uCode



To help debug uCode related problem, adding "delta" and "max"
information in debugfs statistics counters display.

Those information show the delta between two statistics report from
uCode, user can monitor the counters for any "un-normal" behavior.

Signed-off-by: default avatarWey-Yi Guy <wey-yi.w.guy@intel.com>
Signed-off-by: default avatarJay <Sternberg&lt;jay.e.sternberg@intel.com>
Signed-off-by: default avatarZhu Yi <yi.zhu@intel.com>
Signed-off-by: default avatarReinette Chatre <reinette.chatre@intel.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 9ed333e0
Loading
Loading
Loading
Loading
+527 −323

File changed.

Preview size limit exceeded, changes collapsed.

+2 −0
Original line number Diff line number Diff line
@@ -1162,6 +1162,8 @@ struct iwl_priv {
	struct iwl_notif_statistics statistics;
#ifdef CONFIG_IWLWIFI_DEBUG
	struct iwl_notif_statistics accum_statistics;
	struct iwl_notif_statistics delta_statistics;
	struct iwl_notif_statistics max_delta;
#endif

	/* context information */
+16 −3
Original line number Diff line number Diff line
@@ -564,15 +564,24 @@ static void iwl_accumulative_statistics(struct iwl_priv *priv,
	int i;
	__le32 *prev_stats;
	u32 *accum_stats;
	u32 *delta, *max_delta;

	prev_stats = (__le32 *)&priv->statistics;
	accum_stats = (u32 *)&priv->accum_statistics;
	delta = (u32 *)&priv->delta_statistics;
	max_delta = (u32 *)&priv->max_delta;

	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) -
	     i += sizeof(__le32), stats++, prev_stats++, delta++,
	     max_delta++, accum_stats++) {
		if (le32_to_cpu(*stats) > le32_to_cpu(*prev_stats)) {
			*delta = (le32_to_cpu(*stats) -
				le32_to_cpu(*prev_stats));
			*accum_stats += *delta;
			if (*delta > *max_delta)
				*max_delta = *delta;
		}
	}

	/* reset accumulative statistics for "no-counter" type statistics */
	priv->accum_statistics.general.temperature =
@@ -641,6 +650,10 @@ void iwl_reply_statistics(struct iwl_priv *priv,
#ifdef CONFIG_IWLWIFI_DEBUG
		memset(&priv->accum_statistics, 0,
			sizeof(struct iwl_notif_statistics));
		memset(&priv->delta_statistics, 0,
			sizeof(struct iwl_notif_statistics));
		memset(&priv->max_delta, 0,
			sizeof(struct iwl_notif_statistics));
#endif
		IWL_DEBUG_RX(priv, "Statistics have been cleared\n");
	}