aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi/iwl-rx.c
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/iwl-rx.c
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/iwl-rx.c')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-rx.c58
1 files changed, 36 insertions, 22 deletions
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