aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi/iwl-agn.c
diff options
context:
space:
mode:
authorWey-Yi Guy <wey-yi.w.guy@intel.com>2010-03-16 13:46:31 -0400
committerReinette Chatre <reinette.chatre@intel.com>2010-03-25 14:16:37 -0400
commit872c8ddcbec06995c1c7caa3e41c921290a8b6df (patch)
tree15aebc3465235e7d35c41f9f2470221b957fab71 /drivers/net/wireless/iwlwifi/iwl-agn.c
parente184f67d39f681b1e8c9a43ff7001c3405c2bd7c (diff)
iwlwifi: iwl_good_ack_health() only apply to AGN device
iwl_good_ack_health() check for expected and actual ack count which only apply to aggregation mode. Move the function to iwlagn module. Reported-by: Chantry Xavier <chantry.xavier@gmail.com> Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com> Signed-off-by: Reinette Chatre <reinette.chatre@intel.com>
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl-agn.c')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn.c54
1 files changed, 54 insertions, 0 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c
index e69e6256a41b..680e897b92db 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn.c
@@ -1417,6 +1417,60 @@ static void iwl_irq_tasklet(struct iwl_priv *priv)
1417 iwl_enable_interrupts(priv); 1417 iwl_enable_interrupts(priv);
1418} 1418}
1419 1419
1420/* the threshold ratio of actual_ack_cnt to expected_ack_cnt in percent */
1421#define ACK_CNT_RATIO (50)
1422#define BA_TIMEOUT_CNT (5)
1423#define BA_TIMEOUT_MAX (16)
1424
1425/**
1426 * iwl_good_ack_health - checks for ACK count ratios, BA timeout retries.
1427 *
1428 * When the ACK count ratio is 0 and aggregated BA timeout retries exceeding
1429 * the BA_TIMEOUT_MAX, reload firmware and bring system back to normal
1430 * operation state.
1431 */
1432bool iwl_good_ack_health(struct iwl_priv *priv,
1433 struct iwl_rx_packet *pkt)
1434{
1435 bool rc = true;
1436 int actual_ack_cnt_delta, expected_ack_cnt_delta;
1437 int ba_timeout_delta;
1438
1439 actual_ack_cnt_delta =
1440 le32_to_cpu(pkt->u.stats.tx.actual_ack_cnt) -
1441 le32_to_cpu(priv->statistics.tx.actual_ack_cnt);
1442 expected_ack_cnt_delta =
1443 le32_to_cpu(pkt->u.stats.tx.expected_ack_cnt) -
1444 le32_to_cpu(priv->statistics.tx.expected_ack_cnt);
1445 ba_timeout_delta =
1446 le32_to_cpu(pkt->u.stats.tx.agg.ba_timeout) -
1447 le32_to_cpu(priv->statistics.tx.agg.ba_timeout);
1448 if ((priv->_agn.agg_tids_count > 0) &&
1449 (expected_ack_cnt_delta > 0) &&
1450 (((actual_ack_cnt_delta * 100) / expected_ack_cnt_delta)
1451 < ACK_CNT_RATIO) &&
1452 (ba_timeout_delta > BA_TIMEOUT_CNT)) {
1453 IWL_DEBUG_RADIO(priv, "actual_ack_cnt delta = %d,"
1454 " expected_ack_cnt = %d\n",
1455 actual_ack_cnt_delta, expected_ack_cnt_delta);
1456
1457#ifdef CONFIG_IWLWIFI_DEBUG
1458 IWL_DEBUG_RADIO(priv, "rx_detected_cnt delta = %d\n",
1459 priv->delta_statistics.tx.rx_detected_cnt);
1460 IWL_DEBUG_RADIO(priv,
1461 "ack_or_ba_timeout_collision delta = %d\n",
1462 priv->delta_statistics.tx.
1463 ack_or_ba_timeout_collision);
1464#endif
1465 IWL_DEBUG_RADIO(priv, "agg ba_timeout delta = %d\n",
1466 ba_timeout_delta);
1467 if (!actual_ack_cnt_delta &&
1468 (ba_timeout_delta >= BA_TIMEOUT_MAX))
1469 rc = false;
1470 }
1471 return rc;
1472}
1473
1420 1474
1421/****************************************************************************** 1475/******************************************************************************
1422 * 1476 *