Jesse Keating 2f82dd
From 2386b8d18106262e27c9ca1a674a1018af29bdde Mon Sep 17 00:00:00 2001
Jesse Keating 2f82dd
From: Wey-Yi Guy <wey-yi.w.guy@intel.com>
Jesse Keating 2f82dd
Date: Tue, 16 Mar 2010 10:46:31 -0700
Jesse Keating 2f82dd
Subject: [PATCH 17/17] iwlwifi: iwl_good_ack_health() only apply to AGN device
Jesse Keating 2f82dd
Jesse Keating 2f82dd
iwl_good_ack_health() check for expected and actual ack count which only
Jesse Keating 2f82dd
apply to aggregation mode. Move the function to iwlagn module.
Jesse Keating 2f82dd
Jesse Keating 2f82dd
Reported-by: Chantry Xavier <chantry.xavier@gmail.com>
Jesse Keating 2f82dd
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
Jesse Keating 2f82dd
Signed-off-by: Reinette Chatre <reinette.chatre@intel.com>
Jesse Keating 2f82dd
---
Jesse Keating 2f82dd
 drivers/net/wireless/iwlwifi/iwl-agn.c  |   45 ++++++++++++++++++++++++++++++
Jesse Keating 2f82dd
 drivers/net/wireless/iwlwifi/iwl-core.h |    2 +
Jesse Keating 2f82dd
 drivers/net/wireless/iwlwifi/iwl-rx.c   |   46 -------------------------------
Jesse Keating 2f82dd
 3 files changed, 47 insertions(+), 46 deletions(-)
Jesse Keating 2f82dd
Jesse Keating 2f82dd
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c
Jesse Keating 2f82dd
index c22db6c..d57f215 100644
Jesse Keating 2f82dd
--- a/drivers/net/wireless/iwlwifi/iwl-agn.c
Jesse Keating 2f82dd
+++ b/drivers/net/wireless/iwlwifi/iwl-agn.c
Jesse Keating 2f82dd
@@ -1316,6 +1316,51 @@ static void iwl_irq_tasklet(struct iwl_priv *priv)
Jesse Keating 2f82dd
 		iwl_enable_interrupts(priv);
Jesse Keating 2f82dd
 }
Jesse Keating 2f82dd
 
Jesse Keating 2f82dd
+/* the threshold ratio of actual_ack_cnt to expected_ack_cnt in percent */
Jesse Keating 2f82dd
+#define ACK_CNT_RATIO (50)
Jesse Keating 2f82dd
+#define BA_TIMEOUT_CNT (5)
Jesse Keating 2f82dd
+#define BA_TIMEOUT_MAX (16)
Jesse Keating 2f82dd
+
Jesse Keating 2f82dd
+/**
Jesse Keating 2f82dd
+ * iwl_good_ack_health - checks for ACK count ratios, BA timeout retries.
Jesse Keating 2f82dd
+ *
Jesse Keating 2f82dd
+ * When the ACK count ratio is 0 and aggregated BA timeout retries exceeding
Jesse Keating 2f82dd
+ * the BA_TIMEOUT_MAX, reload firmware and bring system back to normal
Jesse Keating 2f82dd
+ * operation state.
Jesse Keating 2f82dd
+ */
Jesse Keating 2f82dd
+bool iwl_good_ack_health(struct iwl_priv *priv,
Jesse Keating 2f82dd
+				struct iwl_rx_packet *pkt)
Jesse Keating 2f82dd
+{
Jesse Keating 2f82dd
+	bool rc = true;
Jesse Keating 2f82dd
+	int actual_ack_cnt_delta, expected_ack_cnt_delta;
Jesse Keating 2f82dd
+	int ba_timeout_delta;
Jesse Keating 2f82dd
+
Jesse Keating 2f82dd
+	actual_ack_cnt_delta =
Jesse Keating 2f82dd
+		le32_to_cpu(pkt->u.stats.tx.actual_ack_cnt) -
Jesse Keating 2f82dd
+		le32_to_cpu(priv->statistics.tx.actual_ack_cnt);
Jesse Keating 2f82dd
+	expected_ack_cnt_delta =
Jesse Keating 2f82dd
+		le32_to_cpu(pkt->u.stats.tx.expected_ack_cnt) -
Jesse Keating 2f82dd
+		le32_to_cpu(priv->statistics.tx.expected_ack_cnt);
Jesse Keating 2f82dd
+	ba_timeout_delta =
Jesse Keating 2f82dd
+		le32_to_cpu(pkt->u.stats.tx.agg.ba_timeout) -
Jesse Keating 2f82dd
+		le32_to_cpu(priv->statistics.tx.agg.ba_timeout);
Jesse Keating 2f82dd
+	if ((priv->_agn.agg_tids_count > 0) &&
Jesse Keating 2f82dd
+	    (expected_ack_cnt_delta > 0) &&
Jesse Keating 2f82dd
+	    (((actual_ack_cnt_delta * 100) / expected_ack_cnt_delta)
Jesse Keating 2f82dd
+		< ACK_CNT_RATIO) &&
Jesse Keating 2f82dd
+	    (ba_timeout_delta > BA_TIMEOUT_CNT)) {
Jesse Keating 2f82dd
+		IWL_DEBUG_RADIO(priv, "actual_ack_cnt delta = %d,"
Jesse Keating 2f82dd
+				" expected_ack_cnt = %d\n",
Jesse Keating 2f82dd
+				actual_ack_cnt_delta, expected_ack_cnt_delta);
Jesse Keating 2f82dd
+		IWL_DEBUG_RADIO(priv, "agg ba_timeout delta = %d\n",
Jesse Keating 2f82dd
+				ba_timeout_delta);
Jesse Keating 2f82dd
+		if (!actual_ack_cnt_delta &&
Jesse Keating 2f82dd
+		    (ba_timeout_delta >= BA_TIMEOUT_MAX))
Jesse Keating 2f82dd
+			rc = false;
Jesse Keating 2f82dd
+	}
Jesse Keating 2f82dd
+	return rc;
Jesse Keating 2f82dd
+}
Jesse Keating 2f82dd
+
Jesse Keating 2f82dd
 
Jesse Keating 2f82dd
 /******************************************************************************
Jesse Keating 2f82dd
  *
Jesse Keating 2f82dd
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.h b/drivers/net/wireless/iwlwifi/iwl-core.h
Jesse Keating 2f82dd
index 8bf0c39..ca4a516 100644
Jesse Keating 2f82dd
--- a/drivers/net/wireless/iwlwifi/iwl-core.h
Jesse Keating 2f82dd
+++ b/drivers/net/wireless/iwlwifi/iwl-core.h
Jesse Keating 2f82dd
@@ -584,6 +584,8 @@ void iwl_disable_ict(struct iwl_priv *priv);
Jesse Keating 2f82dd
 int iwl_alloc_isr_ict(struct iwl_priv *priv);
Jesse Keating 2f82dd
 void iwl_free_isr_ict(struct iwl_priv *priv);
Jesse Keating 2f82dd
 irqreturn_t iwl_isr_ict(int irq, void *data);
Jesse Keating 2f82dd
+bool iwl_good_ack_health(struct iwl_priv *priv,
Jesse Keating 2f82dd
+			 struct iwl_rx_packet *pkt);
Jesse Keating 2f82dd
 
Jesse Keating 2f82dd
 static inline u16 iwl_pcie_link_ctl(struct iwl_priv *priv)
Jesse Keating 2f82dd
 {
Jesse Keating 2f82dd
diff --git a/drivers/net/wireless/iwlwifi/iwl-rx.c b/drivers/net/wireless/iwlwifi/iwl-rx.c
Jesse Keating 2f82dd
index 1b2a3fc..054d169 100644
Jesse Keating 2f82dd
--- a/drivers/net/wireless/iwlwifi/iwl-rx.c
Jesse Keating 2f82dd
+++ b/drivers/net/wireless/iwlwifi/iwl-rx.c
Jesse Keating 2f82dd
@@ -592,52 +592,6 @@ static void iwl_accumulative_statistics(struct iwl_priv *priv,
Jesse Keating 2f82dd
 
Jesse Keating 2f82dd
 #define REG_RECALIB_PERIOD (60)
Jesse Keating 2f82dd
 
Jesse Keating 2f82dd
-/* the threshold ratio of actual_ack_cnt to expected_ack_cnt in percent */
Jesse Keating 2f82dd
-#define ACK_CNT_RATIO (50)
Jesse Keating 2f82dd
-#define BA_TIMEOUT_CNT (5)
Jesse Keating 2f82dd
-#define BA_TIMEOUT_MAX (16)
Jesse Keating 2f82dd
-
Jesse Keating 2f82dd
-/**
Jesse Keating 2f82dd
- * iwl_good_ack_health - checks for ACK count ratios, BA timeout retries.
Jesse Keating 2f82dd
- *
Jesse Keating 2f82dd
- * When the ACK count ratio is 0 and aggregated BA timeout retries exceeding
Jesse Keating 2f82dd
- * the BA_TIMEOUT_MAX, reload firmware and bring system back to normal
Jesse Keating 2f82dd
- * operation state.
Jesse Keating 2f82dd
- */
Jesse Keating 2f82dd
-bool iwl_good_ack_health(struct iwl_priv *priv,
Jesse Keating 2f82dd
-				struct iwl_rx_packet *pkt)
Jesse Keating 2f82dd
-{
Jesse Keating 2f82dd
-	bool rc = true;
Jesse Keating 2f82dd
-	int actual_ack_cnt_delta, expected_ack_cnt_delta;
Jesse Keating 2f82dd
-	int ba_timeout_delta;
Jesse Keating 2f82dd
-
Jesse Keating 2f82dd
-	actual_ack_cnt_delta =
Jesse Keating 2f82dd
-		le32_to_cpu(pkt->u.stats.tx.actual_ack_cnt) -
Jesse Keating 2f82dd
-		le32_to_cpu(priv->statistics.tx.actual_ack_cnt);
Jesse Keating 2f82dd
-	expected_ack_cnt_delta =
Jesse Keating 2f82dd
-		le32_to_cpu(pkt->u.stats.tx.expected_ack_cnt) -
Jesse Keating 2f82dd
-		le32_to_cpu(priv->statistics.tx.expected_ack_cnt);
Jesse Keating 2f82dd
-	ba_timeout_delta =
Jesse Keating 2f82dd
-		le32_to_cpu(pkt->u.stats.tx.agg.ba_timeout) -
Jesse Keating 2f82dd
-		le32_to_cpu(priv->statistics.tx.agg.ba_timeout);
Jesse Keating 2f82dd
-	if ((priv->_agn.agg_tids_count > 0) &&
Jesse Keating 2f82dd
-	    (expected_ack_cnt_delta > 0) &&
Jesse Keating 2f82dd
-	    (((actual_ack_cnt_delta * 100) / expected_ack_cnt_delta)
Jesse Keating 2f82dd
-		< ACK_CNT_RATIO) &&
Jesse Keating 2f82dd
-	    (ba_timeout_delta > BA_TIMEOUT_CNT)) {
Jesse Keating 2f82dd
-		IWL_DEBUG_RADIO(priv, "actual_ack_cnt delta = %d,"
Jesse Keating 2f82dd
-				" expected_ack_cnt = %d\n",
Jesse Keating 2f82dd
-				actual_ack_cnt_delta, expected_ack_cnt_delta);
Jesse Keating 2f82dd
-		IWL_DEBUG_RADIO(priv, "agg ba_timeout delta = %d\n",
Jesse Keating 2f82dd
-				ba_timeout_delta);
Jesse Keating 2f82dd
-		if (!actual_ack_cnt_delta &&
Jesse Keating 2f82dd
-		    (ba_timeout_delta >= BA_TIMEOUT_MAX))
Jesse Keating 2f82dd
-			rc = false;
Jesse Keating 2f82dd
-	}
Jesse Keating 2f82dd
-	return rc;
Jesse Keating 2f82dd
-}
Jesse Keating 2f82dd
-EXPORT_SYMBOL(iwl_good_ack_health);
Jesse Keating 2f82dd
-
Jesse Keating 2f82dd
 /**
Jesse Keating 2f82dd
  * iwl_good_plcp_health - checks for plcp error.
Jesse Keating 2f82dd
  *
Jesse Keating 2f82dd
-- 
Jesse Keating 2f82dd
1.6.3.3
Jesse Keating 2f82dd