diff options
author | Stanislaw Gruszka <sgruszka@redhat.com> | 2011-02-08 03:31:57 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2011-02-09 16:09:49 -0500 |
commit | f266526da4d78b7af639e98777d453888b039c00 (patch) | |
tree | a04b3372200c279c6b37874cbd479e5078fef715 | |
parent | ca3d9389642946072ed448b2b7386f9e5d3f296b (diff) |
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: Stanislaw Gruszka <sgruszka@redhat.com>
Acked-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-agn.c | 69 |
1 files changed, 35 insertions, 34 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c index 096f8ad0f1b1..50be23b5fea2 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn.c +++ b/drivers/net/wireless/iwlwifi/iwl-agn.c | |||
@@ -1407,34 +1407,37 @@ static void iwl_irq_tasklet(struct iwl_priv *priv) | |||
1407 | /** | 1407 | /** |
1408 | * iwl_good_ack_health - checks for ACK count ratios, BA timeout retries. | 1408 | * iwl_good_ack_health - checks for ACK count ratios, BA timeout retries. |
1409 | * | 1409 | * |
1410 | * When the ACK count ratio is 0 and aggregated BA timeout retries exceeding | 1410 | * When the ACK count ratio is low and aggregated BA timeout retries exceeding |
1411 | * the BA_TIMEOUT_MAX, reload firmware and bring system back to normal | 1411 | * the BA_TIMEOUT_MAX, reload firmware and bring system back to normal |
1412 | * operation state. | 1412 | * operation state. |
1413 | */ | 1413 | */ |
1414 | bool iwl_good_ack_health(struct iwl_priv *priv, | 1414 | bool iwl_good_ack_health(struct iwl_priv *priv, struct iwl_rx_packet *pkt) |
1415 | struct iwl_rx_packet *pkt) | ||
1416 | { | 1415 | { |
1417 | bool rc = true; | 1416 | int actual_delta, expected_delta, ba_timeout_delta; |
1418 | int actual_ack_cnt_delta, expected_ack_cnt_delta; | 1417 | struct statistics_tx *cur, *old; |
1419 | int ba_timeout_delta; | 1418 | |
1420 | 1419 | if (priv->_agn.agg_tids_count) | |
1421 | actual_ack_cnt_delta = | 1420 | return true; |
1422 | le32_to_cpu(pkt->u.stats.tx.actual_ack_cnt) - | 1421 | |
1423 | le32_to_cpu(priv->_agn.statistics.tx.actual_ack_cnt); | 1422 | cur = &pkt->u.stats.tx; |
1424 | expected_ack_cnt_delta = | 1423 | old = &priv->_agn.statistics.tx; |
1425 | le32_to_cpu(pkt->u.stats.tx.expected_ack_cnt) - | 1424 | |
1426 | le32_to_cpu(priv->_agn.statistics.tx.expected_ack_cnt); | 1425 | actual_delta = le32_to_cpu(cur->actual_ack_cnt) - |
1427 | ba_timeout_delta = | 1426 | le32_to_cpu(old->actual_ack_cnt); |
1428 | le32_to_cpu(pkt->u.stats.tx.agg.ba_timeout) - | 1427 | expected_delta = le32_to_cpu(cur->expected_ack_cnt) - |
1429 | le32_to_cpu(priv->_agn.statistics.tx.agg.ba_timeout); | 1428 | le32_to_cpu(old->expected_ack_cnt); |
1430 | if ((priv->_agn.agg_tids_count > 0) && | 1429 | |
1431 | (expected_ack_cnt_delta > 0) && | 1430 | /* Values should not be negative, but we do not trust the firmware */ |
1432 | (((actual_ack_cnt_delta * 100) / expected_ack_cnt_delta) | 1431 | if (actual_delta <= 0 || expected_delta <= 0) |
1433 | < ACK_CNT_RATIO) && | 1432 | return true; |
1434 | (ba_timeout_delta > BA_TIMEOUT_CNT)) { | 1433 | |
1435 | IWL_DEBUG_RADIO(priv, "actual_ack_cnt delta = %d," | 1434 | ba_timeout_delta = le32_to_cpu(cur->agg.ba_timeout) - |
1436 | " expected_ack_cnt = %d\n", | 1435 | le32_to_cpu(old->agg.ba_timeout); |
1437 | actual_ack_cnt_delta, expected_ack_cnt_delta); | 1436 | |
1437 | if ((actual_delta * 100 / expected_delta) < ACK_CNT_RATIO && | ||
1438 | ba_timeout_delta > BA_TIMEOUT_CNT) { | ||
1439 | IWL_DEBUG_RADIO(priv, "deltas: actual %d expected %d ba_timeout %d\n", | ||
1440 | actual_delta, expected_delta, ba_timeout_delta); | ||
1438 | 1441 | ||
1439 | #ifdef CONFIG_IWLWIFI_DEBUGFS | 1442 | #ifdef CONFIG_IWLWIFI_DEBUGFS |
1440 | /* | 1443 | /* |
@@ -1442,20 +1445,18 @@ bool iwl_good_ack_health(struct iwl_priv *priv, | |||
1442 | * statistics aren't available. If DEBUGFS is set but | 1445 | * statistics aren't available. If DEBUGFS is set but |
1443 | * DEBUG is not, these will just compile out. | 1446 | * DEBUG is not, these will just compile out. |
1444 | */ | 1447 | */ |
1445 | IWL_DEBUG_RADIO(priv, "rx_detected_cnt delta = %d\n", | 1448 | IWL_DEBUG_RADIO(priv, "rx_detected_cnt delta %d\n", |
1446 | priv->_agn.delta_statistics.tx.rx_detected_cnt); | 1449 | priv->_agn.delta_statistics.tx.rx_detected_cnt); |
1447 | IWL_DEBUG_RADIO(priv, | 1450 | IWL_DEBUG_RADIO(priv, |
1448 | "ack_or_ba_timeout_collision delta = %d\n", | 1451 | "ack_or_ba_timeout_collision delta %d\n", |
1449 | priv->_agn.delta_statistics.tx. | 1452 | priv->_agn.delta_statistics.tx.ack_or_ba_timeout_collision); |
1450 | ack_or_ba_timeout_collision); | ||
1451 | #endif | 1453 | #endif |
1452 | IWL_DEBUG_RADIO(priv, "agg ba_timeout delta = %d\n", | 1454 | |
1453 | ba_timeout_delta); | 1455 | if (ba_timeout_delta >= BA_TIMEOUT_MAX) |
1454 | if (!actual_ack_cnt_delta && | 1456 | return false; |
1455 | (ba_timeout_delta >= BA_TIMEOUT_MAX)) | ||
1456 | rc = false; | ||
1457 | } | 1457 | } |
1458 | return rc; | 1458 | |
1459 | return true; | ||
1459 | } | 1460 | } |
1460 | 1461 | ||
1461 | 1462 | ||