Commit f266526d authored by Stanislaw Gruszka's avatar Stanislaw Gruszka Committed by John W. Linville

iwlwifi: cleanup iwl_good_ack_health

Make ack health code easies to read. Compared to previous
code, we do not print debug messages when expected_ack_cnt_delta == 0
and also do check against negative deltas.
Signed-off-by: default avatarStanislaw Gruszka <sgruszka@redhat.com>
Acked-by: default avatarWey-Yi Guy <wey-yi.w.guy@intel.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent ca3d9389
...@@ -1407,34 +1407,37 @@ static void iwl_irq_tasklet(struct iwl_priv *priv) ...@@ -1407,34 +1407,37 @@ static void iwl_irq_tasklet(struct iwl_priv *priv)
/** /**
* iwl_good_ack_health - checks for ACK count ratios, BA timeout retries. * iwl_good_ack_health - checks for ACK count ratios, BA timeout retries.
* *
* When the ACK count ratio is 0 and aggregated BA timeout retries exceeding * When the ACK count ratio is low and aggregated BA timeout retries exceeding
* the BA_TIMEOUT_MAX, reload firmware and bring system back to normal * the BA_TIMEOUT_MAX, reload firmware and bring system back to normal
* operation state. * operation state.
*/ */
bool iwl_good_ack_health(struct iwl_priv *priv, bool iwl_good_ack_health(struct iwl_priv *priv, struct iwl_rx_packet *pkt)
struct iwl_rx_packet *pkt)
{ {
bool rc = true; int actual_delta, expected_delta, ba_timeout_delta;
int actual_ack_cnt_delta, expected_ack_cnt_delta; struct statistics_tx *cur, *old;
int ba_timeout_delta;
if (priv->_agn.agg_tids_count)
actual_ack_cnt_delta = return true;
le32_to_cpu(pkt->u.stats.tx.actual_ack_cnt) -
le32_to_cpu(priv->_agn.statistics.tx.actual_ack_cnt); cur = &pkt->u.stats.tx;
expected_ack_cnt_delta = old = &priv->_agn.statistics.tx;
le32_to_cpu(pkt->u.stats.tx.expected_ack_cnt) -
le32_to_cpu(priv->_agn.statistics.tx.expected_ack_cnt); actual_delta = le32_to_cpu(cur->actual_ack_cnt) -
ba_timeout_delta = le32_to_cpu(old->actual_ack_cnt);
le32_to_cpu(pkt->u.stats.tx.agg.ba_timeout) - expected_delta = le32_to_cpu(cur->expected_ack_cnt) -
le32_to_cpu(priv->_agn.statistics.tx.agg.ba_timeout); le32_to_cpu(old->expected_ack_cnt);
if ((priv->_agn.agg_tids_count > 0) &&
(expected_ack_cnt_delta > 0) && /* Values should not be negative, but we do not trust the firmware */
(((actual_ack_cnt_delta * 100) / expected_ack_cnt_delta) if (actual_delta <= 0 || expected_delta <= 0)
< ACK_CNT_RATIO) && return true;
(ba_timeout_delta > BA_TIMEOUT_CNT)) {
IWL_DEBUG_RADIO(priv, "actual_ack_cnt delta = %d," ba_timeout_delta = le32_to_cpu(cur->agg.ba_timeout) -
" expected_ack_cnt = %d\n", le32_to_cpu(old->agg.ba_timeout);
actual_ack_cnt_delta, expected_ack_cnt_delta);
if ((actual_delta * 100 / expected_delta) < ACK_CNT_RATIO &&
ba_timeout_delta > BA_TIMEOUT_CNT) {
IWL_DEBUG_RADIO(priv, "deltas: actual %d expected %d ba_timeout %d\n",
actual_delta, expected_delta, ba_timeout_delta);
#ifdef CONFIG_IWLWIFI_DEBUGFS #ifdef CONFIG_IWLWIFI_DEBUGFS
/* /*
...@@ -1442,20 +1445,18 @@ bool iwl_good_ack_health(struct iwl_priv *priv, ...@@ -1442,20 +1445,18 @@ bool iwl_good_ack_health(struct iwl_priv *priv,
* statistics aren't available. If DEBUGFS is set but * statistics aren't available. If DEBUGFS is set but
* DEBUG is not, these will just compile out. * DEBUG is not, these will just compile out.
*/ */
IWL_DEBUG_RADIO(priv, "rx_detected_cnt delta = %d\n", IWL_DEBUG_RADIO(priv, "rx_detected_cnt delta %d\n",
priv->_agn.delta_statistics.tx.rx_detected_cnt); priv->_agn.delta_statistics.tx.rx_detected_cnt);
IWL_DEBUG_RADIO(priv, IWL_DEBUG_RADIO(priv,
"ack_or_ba_timeout_collision delta = %d\n", "ack_or_ba_timeout_collision delta %d\n",
priv->_agn.delta_statistics.tx. priv->_agn.delta_statistics.tx.ack_or_ba_timeout_collision);
ack_or_ba_timeout_collision);
#endif #endif
IWL_DEBUG_RADIO(priv, "agg ba_timeout delta = %d\n",
ba_timeout_delta); if (ba_timeout_delta >= BA_TIMEOUT_MAX)
if (!actual_ack_cnt_delta && return false;
(ba_timeout_delta >= BA_TIMEOUT_MAX))
rc = false;
} }
return rc;
return true;
} }
......
Markdown is supported
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