aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi
diff options
context:
space:
mode:
authorWey-Yi Guy <wey-yi.w.guy@intel.com>2010-03-04 16:38:58 -0500
committerReinette Chatre <reinette.chatre@intel.com>2010-03-19 16:41:25 -0400
commitbeac5498b792ed8420885ee23e8d4f2885ee2d13 (patch)
treed89810c6e190ec712c4da9f9cb36fbd525663d9b /drivers/net/wireless/iwlwifi
parentb74e31a9bc1013e69b85b139072485dc153453dd (diff)
iwlwifi: move plcp check to separated function
Move the plcp error checking into stand alone function and pointed by ops to accommodate devices not needing this recovery. Signed-off-by: Trieu 'Andrew' Nguyen <trieux.t.nguyen@intel.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')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-1000.c1
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-4965.c1
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-5000.c2
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-6000.c2
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-core.h5
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-rx.c58
6 files changed, 47 insertions, 22 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-1000.c b/drivers/net/wireless/iwlwifi/iwl-1000.c
index 5a9cb70160f6..c6d6a0c2cd3c 100644
--- a/drivers/net/wireless/iwlwifi/iwl-1000.c
+++ b/drivers/net/wireless/iwlwifi/iwl-1000.c
@@ -213,6 +213,7 @@ static struct iwl_lib_ops iwl1000_lib = {
213 }, 213 },
214 .add_bcast_station = iwl_add_bcast_station, 214 .add_bcast_station = iwl_add_bcast_station,
215 .recover_from_tx_stall = iwl_bg_monitor_recover, 215 .recover_from_tx_stall = iwl_bg_monitor_recover,
216 .recover_from_statistics = iwl_recover_from_statistics,
216}; 217};
217 218
218static const struct iwl_ops iwl1000_ops = { 219static const struct iwl_ops iwl1000_ops = {
diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.c b/drivers/net/wireless/iwlwifi/iwl-4965.c
index acca89a635a5..5efd60a5b988 100644
--- a/drivers/net/wireless/iwlwifi/iwl-4965.c
+++ b/drivers/net/wireless/iwlwifi/iwl-4965.c
@@ -2221,6 +2221,7 @@ static struct iwl_lib_ops iwl4965_lib = {
2221 .set_ct_kill = iwl4965_set_ct_threshold, 2221 .set_ct_kill = iwl4965_set_ct_threshold,
2222 }, 2222 },
2223 .add_bcast_station = iwl_add_bcast_station, 2223 .add_bcast_station = iwl_add_bcast_station,
2224 .recover_from_statistics = iwl_recover_from_statistics,
2224}; 2225};
2225 2226
2226static const struct iwl_ops iwl4965_ops = { 2227static const struct iwl_ops iwl4965_ops = {
diff --git a/drivers/net/wireless/iwlwifi/iwl-5000.c b/drivers/net/wireless/iwlwifi/iwl-5000.c
index a01b3c59a5a7..75f2a5156beb 100644
--- a/drivers/net/wireless/iwlwifi/iwl-5000.c
+++ b/drivers/net/wireless/iwlwifi/iwl-5000.c
@@ -1500,6 +1500,7 @@ struct iwl_lib_ops iwl5000_lib = {
1500 }, 1500 },
1501 .add_bcast_station = iwl_add_bcast_station, 1501 .add_bcast_station = iwl_add_bcast_station,
1502 .recover_from_tx_stall = iwl_bg_monitor_recover, 1502 .recover_from_tx_stall = iwl_bg_monitor_recover,
1503 .recover_from_statistics = iwl_recover_from_statistics,
1503}; 1504};
1504 1505
1505static struct iwl_lib_ops iwl5150_lib = { 1506static struct iwl_lib_ops iwl5150_lib = {
@@ -1555,6 +1556,7 @@ static struct iwl_lib_ops iwl5150_lib = {
1555 }, 1556 },
1556 .add_bcast_station = iwl_add_bcast_station, 1557 .add_bcast_station = iwl_add_bcast_station,
1557 .recover_from_tx_stall = iwl_bg_monitor_recover, 1558 .recover_from_tx_stall = iwl_bg_monitor_recover,
1559 .recover_from_statistics = iwl_recover_from_statistics,
1558}; 1560};
1559 1561
1560static const struct iwl_ops iwl5000_ops = { 1562static const struct iwl_ops iwl5000_ops = {
diff --git a/drivers/net/wireless/iwlwifi/iwl-6000.c b/drivers/net/wireless/iwlwifi/iwl-6000.c
index 4fbc38cfd911..b1f0e5c7e287 100644
--- a/drivers/net/wireless/iwlwifi/iwl-6000.c
+++ b/drivers/net/wireless/iwlwifi/iwl-6000.c
@@ -279,6 +279,7 @@ static struct iwl_lib_ops iwl6000_lib = {
279 }, 279 },
280 .add_bcast_station = iwl_add_bcast_station, 280 .add_bcast_station = iwl_add_bcast_station,
281 .recover_from_tx_stall = iwl_bg_monitor_recover, 281 .recover_from_tx_stall = iwl_bg_monitor_recover,
282 .recover_from_statistics = iwl_recover_from_statistics,
282}; 283};
283 284
284static const struct iwl_ops iwl6000_ops = { 285static const struct iwl_ops iwl6000_ops = {
@@ -345,6 +346,7 @@ static struct iwl_lib_ops iwl6050_lib = {
345 }, 346 },
346 .add_bcast_station = iwl_add_bcast_station, 347 .add_bcast_station = iwl_add_bcast_station,
347 .recover_from_tx_stall = iwl_bg_monitor_recover, 348 .recover_from_tx_stall = iwl_bg_monitor_recover,
349 .recover_from_statistics = iwl_recover_from_statistics,
348}; 350};
349 351
350static const struct iwl_ops iwl6050_ops = { 352static const struct iwl_ops iwl6050_ops = {
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.h b/drivers/net/wireless/iwlwifi/iwl-core.h
index c4cd1deb3b3e..4251afb8bf5e 100644
--- a/drivers/net/wireless/iwlwifi/iwl-core.h
+++ b/drivers/net/wireless/iwlwifi/iwl-core.h
@@ -193,6 +193,9 @@ struct iwl_lib_ops {
193 void (*add_bcast_station)(struct iwl_priv *priv); 193 void (*add_bcast_station)(struct iwl_priv *priv);
194 /* recover from tx queue stall */ 194 /* recover from tx queue stall */
195 void (*recover_from_tx_stall)(unsigned long data); 195 void (*recover_from_tx_stall)(unsigned long data);
196 /* recover from errors showed in statistics */
197 void (*recover_from_statistics)(struct iwl_priv *priv,
198 struct iwl_rx_packet *pkt);
196}; 199};
197 200
198struct iwl_led_ops { 201struct iwl_led_ops {
@@ -434,6 +437,8 @@ void iwl_rx_missed_beacon_notif(struct iwl_priv *priv,
434 struct iwl_rx_mem_buffer *rxb); 437 struct iwl_rx_mem_buffer *rxb);
435void iwl_rx_spectrum_measure_notif(struct iwl_priv *priv, 438void iwl_rx_spectrum_measure_notif(struct iwl_priv *priv,
436 struct iwl_rx_mem_buffer *rxb); 439 struct iwl_rx_mem_buffer *rxb);
440void iwl_recover_from_statistics(struct iwl_priv *priv,
441 struct iwl_rx_packet *pkt);
437void iwl_rx_statistics(struct iwl_priv *priv, 442void iwl_rx_statistics(struct iwl_priv *priv,
438 struct iwl_rx_mem_buffer *rxb); 443 struct iwl_rx_mem_buffer *rxb);
439void iwl_reply_statistics(struct iwl_priv *priv, 444void iwl_reply_statistics(struct iwl_priv *priv,
diff --git a/drivers/net/wireless/iwlwifi/iwl-rx.c b/drivers/net/wireless/iwlwifi/iwl-rx.c
index 8116aa0d7678..d368b8df8d87 100644
--- a/drivers/net/wireless/iwlwifi/iwl-rx.c
+++ b/drivers/net/wireless/iwlwifi/iwl-rx.c
@@ -617,28 +617,18 @@ static void iwl_accumulative_statistics(struct iwl_priv *priv,
617#define REG_RECALIB_PERIOD (60) 617#define REG_RECALIB_PERIOD (60)
618 618
619#define PLCP_MSG "plcp_err exceeded %u, %u, %u, %u, %u, %d, %u mSecs\n" 619#define PLCP_MSG "plcp_err exceeded %u, %u, %u, %u, %u, %d, %u mSecs\n"
620void iwl_rx_statistics(struct iwl_priv *priv, 620/*
621 struct iwl_rx_mem_buffer *rxb) 621 * This function checks for plcp error.
622 * - When the plcp error is exceeding the thresholds, it will reset the radio
623 * to improve the throughput.
624 */
625void iwl_recover_from_statistics(struct iwl_priv *priv,
626 struct iwl_rx_packet *pkt)
622{ 627{
623 int change;
624 struct iwl_rx_packet *pkt = rxb_addr(rxb);
625 int combined_plcp_delta; 628 int combined_plcp_delta;
626 unsigned int plcp_msec; 629 unsigned int plcp_msec;
627 unsigned long plcp_received_jiffies; 630 unsigned long plcp_received_jiffies;
628 631
629 IWL_DEBUG_RX(priv, "Statistics notification received (%d vs %d).\n",
630 (int)sizeof(priv->statistics),
631 le32_to_cpu(pkt->len_n_flags) & FH_RSCSR_FRAME_SIZE_MSK);
632
633 change = ((priv->statistics.general.temperature !=
634 pkt->u.stats.general.temperature) ||
635 ((priv->statistics.flag &
636 STATISTICS_REPLY_FLG_HT40_MODE_MSK) !=
637 (pkt->u.stats.flag & STATISTICS_REPLY_FLG_HT40_MODE_MSK)));
638
639#ifdef CONFIG_IWLWIFI_DEBUG
640 iwl_accumulative_statistics(priv, (__le32 *)&pkt->u.stats);
641#endif
642 /* 632 /*
643 * check for plcp_err and trigger radio reset if it exceeds 633 * check for plcp_err and trigger radio reset if it exceeds
644 * the plcp error threshold plcp_delta. 634 * the plcp error threshold plcp_delta.
@@ -659,11 +649,11 @@ void iwl_rx_statistics(struct iwl_priv *priv,
659 le32_to_cpu(priv->statistics.rx.ofdm_ht.plcp_err)); 649 le32_to_cpu(priv->statistics.rx.ofdm_ht.plcp_err));
660 650
661 if ((combined_plcp_delta > 0) && 651 if ((combined_plcp_delta > 0) &&
662 ((combined_plcp_delta * 100) / plcp_msec) > 652 ((combined_plcp_delta * 100) / plcp_msec) >
663 priv->cfg->plcp_delta_threshold) { 653 priv->cfg->plcp_delta_threshold) {
664 /* 654 /*
665 * if plcp_err exceed the threshold, the following 655 * if plcp_err exceed the threshold,
666 * data is printed in csv format: 656 * the following data is printed in csv format:
667 * Text: plcp_err exceeded %d, 657 * Text: plcp_err exceeded %d,
668 * Received ofdm.plcp_err, 658 * Received ofdm.plcp_err,
669 * Current ofdm.plcp_err, 659 * Current ofdm.plcp_err,
@@ -678,9 +668,8 @@ void iwl_rx_statistics(struct iwl_priv *priv,
678 le32_to_cpu(priv->statistics.rx.ofdm.plcp_err), 668 le32_to_cpu(priv->statistics.rx.ofdm.plcp_err),
679 le32_to_cpu(pkt->u.stats.rx.ofdm_ht.plcp_err), 669 le32_to_cpu(pkt->u.stats.rx.ofdm_ht.plcp_err),
680 le32_to_cpu( 670 le32_to_cpu(
681 priv->statistics.rx.ofdm_ht.plcp_err), 671 priv->statistics.rx.ofdm_ht.plcp_err),
682 combined_plcp_delta, plcp_msec); 672 combined_plcp_delta, plcp_msec);
683
684 /* 673 /*
685 * Reset the RF radio due to the high plcp 674 * Reset the RF radio due to the high plcp
686 * error rate 675 * error rate
@@ -688,6 +677,31 @@ void iwl_rx_statistics(struct iwl_priv *priv,
688 iwl_force_reset(priv, IWL_RF_RESET); 677 iwl_force_reset(priv, IWL_RF_RESET);
689 } 678 }
690 } 679 }
680}
681EXPORT_SYMBOL(iwl_recover_from_statistics);
682
683void iwl_rx_statistics(struct iwl_priv *priv,
684 struct iwl_rx_mem_buffer *rxb)
685{
686 int change;
687 struct iwl_rx_packet *pkt = rxb_addr(rxb);
688
689
690 IWL_DEBUG_RX(priv, "Statistics notification received (%d vs %d).\n",
691 (int)sizeof(priv->statistics),
692 le32_to_cpu(pkt->len_n_flags) & FH_RSCSR_FRAME_SIZE_MSK);
693
694 change = ((priv->statistics.general.temperature !=
695 pkt->u.stats.general.temperature) ||
696 ((priv->statistics.flag &
697 STATISTICS_REPLY_FLG_HT40_MODE_MSK) !=
698 (pkt->u.stats.flag & STATISTICS_REPLY_FLG_HT40_MODE_MSK)));
699
700#ifdef CONFIG_IWLWIFI_DEBUG
701 iwl_accumulative_statistics(priv, (__le32 *)&pkt->u.stats);
702#endif
703 if (priv->cfg->ops->lib->recover_from_statistics)
704 priv->cfg->ops->lib->recover_from_statistics(priv, pkt);
691 705
692 memcpy(&priv->statistics, &pkt->u.stats, sizeof(priv->statistics)); 706 memcpy(&priv->statistics, &pkt->u.stats, sizeof(priv->statistics));
693 707