aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/ath/ath9k/ani.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/ath/ath9k/ani.c')
-rw-r--r--drivers/net/wireless/ath/ath9k/ani.c83
1 files changed, 2 insertions, 81 deletions
diff --git a/drivers/net/wireless/ath/ath9k/ani.c b/drivers/net/wireless/ath/ath9k/ani.c
index b9595647810a..f2a907b4acb8 100644
--- a/drivers/net/wireless/ath/ath9k/ani.c
+++ b/drivers/net/wireless/ath/ath9k/ani.c
@@ -730,40 +730,7 @@ static void ath9k_hw_ani_read_counters(struct ath_hw *ah)
730 730
731} 731}
732 732
733static void ath9k_hw_ani_monitor_old(struct ath_hw *ah, 733void ath9k_hw_ani_monitor(struct ath_hw *ah, struct ath9k_channel *chan)
734 struct ath9k_channel *chan)
735{
736 struct ar5416AniState *aniState;
737
738 if (!DO_ANI(ah))
739 return;
740
741 aniState = &ah->curchan->ani;
742 ath9k_hw_ani_read_counters(ah);
743
744 if (aniState->listenTime > 5 * ah->aniperiod) {
745 if (aniState->ofdmPhyErrCount <= aniState->listenTime *
746 ah->config.ofdm_trig_low / 1000 &&
747 aniState->cckPhyErrCount <= aniState->listenTime *
748 ah->config.cck_trig_low / 1000)
749 ath9k_hw_ani_lower_immunity(ah);
750 ath9k_ani_restart(ah);
751 } else if (aniState->listenTime > ah->aniperiod) {
752 if (aniState->ofdmPhyErrCount > aniState->listenTime *
753 ah->config.ofdm_trig_high / 1000) {
754 ath9k_hw_ani_ofdm_err_trigger(ah);
755 ath9k_ani_restart(ah);
756 } else if (aniState->cckPhyErrCount >
757 aniState->listenTime * ah->config.cck_trig_high /
758 1000) {
759 ath9k_hw_ani_cck_err_trigger(ah);
760 ath9k_ani_restart(ah);
761 }
762 }
763}
764
765static void ath9k_hw_ani_monitor_new(struct ath_hw *ah,
766 struct ath9k_channel *chan)
767{ 734{
768 struct ar5416AniState *aniState; 735 struct ar5416AniState *aniState;
769 struct ath_common *common = ath9k_hw_common(ah); 736 struct ath_common *common = ath9k_hw_common(ah);
@@ -794,54 +761,26 @@ static void ath9k_hw_ani_monitor_new(struct ath_hw *ah,
794 if (aniState->listenTime > 5 * ah->aniperiod) { 761 if (aniState->listenTime > 5 * ah->aniperiod) {
795 if (ofdmPhyErrRate <= ah->config.ofdm_trig_low && 762 if (ofdmPhyErrRate <= ah->config.ofdm_trig_low &&
796 cckPhyErrRate <= ah->config.cck_trig_low) { 763 cckPhyErrRate <= ah->config.cck_trig_low) {
797 ath_print(common, ATH_DBG_ANI,
798 "1. listenTime=%d OFDM:%d errs=%d/s(<%d) "
799 "CCK:%d errs=%d/s(<%d) -> "
800 "ath9k_hw_ani_lower_immunity()\n",
801 aniState->listenTime,
802 aniState->ofdmNoiseImmunityLevel,
803 ofdmPhyErrRate,
804 ah->config.ofdm_trig_low,
805 aniState->cckNoiseImmunityLevel,
806 cckPhyErrRate,
807 ah->config.cck_trig_low);
808 ath9k_hw_ani_lower_immunity(ah); 764 ath9k_hw_ani_lower_immunity(ah);
809 aniState->ofdmsTurn = !aniState->ofdmsTurn; 765 aniState->ofdmsTurn = !aniState->ofdmsTurn;
810 } 766 }
811 ath_print(common, ATH_DBG_ANI,
812 "1 listenTime=%d ofdm=%d/s cck=%d/s - "
813 "calling ath9k_ani_restart()\n",
814 aniState->listenTime, ofdmPhyErrRate, cckPhyErrRate);
815 ath9k_ani_restart(ah); 767 ath9k_ani_restart(ah);
816 } else if (aniState->listenTime > ah->aniperiod) { 768 } else if (aniState->listenTime > ah->aniperiod) {
817 /* check to see if need to raise immunity */ 769 /* check to see if need to raise immunity */
818 if (ofdmPhyErrRate > ah->config.ofdm_trig_high && 770 if (ofdmPhyErrRate > ah->config.ofdm_trig_high &&
819 (cckPhyErrRate <= ah->config.cck_trig_high || 771 (cckPhyErrRate <= ah->config.cck_trig_high ||
820 aniState->ofdmsTurn)) { 772 aniState->ofdmsTurn)) {
821 ath_print(common, ATH_DBG_ANI,
822 "2 listenTime=%d OFDM:%d errs=%d/s(>%d) -> "
823 "ath9k_hw_ani_ofdm_err_trigger()\n",
824 aniState->listenTime,
825 aniState->ofdmNoiseImmunityLevel,
826 ofdmPhyErrRate,
827 ah->config.ofdm_trig_high);
828 ath9k_hw_ani_ofdm_err_trigger(ah); 773 ath9k_hw_ani_ofdm_err_trigger(ah);
829 ath9k_ani_restart(ah); 774 ath9k_ani_restart(ah);
830 aniState->ofdmsTurn = false; 775 aniState->ofdmsTurn = false;
831 } else if (cckPhyErrRate > ah->config.cck_trig_high) { 776 } else if (cckPhyErrRate > ah->config.cck_trig_high) {
832 ath_print(common, ATH_DBG_ANI,
833 "3 listenTime=%d CCK:%d errs=%d/s(>%d) -> "
834 "ath9k_hw_ani_cck_err_trigger()\n",
835 aniState->listenTime,
836 aniState->cckNoiseImmunityLevel,
837 cckPhyErrRate,
838 ah->config.cck_trig_high);
839 ath9k_hw_ani_cck_err_trigger(ah); 777 ath9k_hw_ani_cck_err_trigger(ah);
840 ath9k_ani_restart(ah); 778 ath9k_ani_restart(ah);
841 aniState->ofdmsTurn = true; 779 aniState->ofdmsTurn = true;
842 } 780 }
843 } 781 }
844} 782}
783EXPORT_SYMBOL(ath9k_hw_ani_monitor);
845 784
846void ath9k_enable_mib_counters(struct ath_hw *ah) 785void ath9k_enable_mib_counters(struct ath_hw *ah)
847{ 786{
@@ -1065,21 +1004,3 @@ void ath9k_hw_ani_init(struct ath_hw *ah)
1065 ath9k_ani_restart(ah); 1004 ath9k_ani_restart(ah);
1066 ath9k_enable_mib_counters(ah); 1005 ath9k_enable_mib_counters(ah);
1067} 1006}
1068
1069void ath9k_hw_attach_ani_ops_old(struct ath_hw *ah)
1070{
1071 struct ath_hw_ops *ops = ath9k_hw_ops(ah);
1072
1073 ops->ani_monitor = ath9k_hw_ani_monitor_old;
1074
1075 ath_print(ath9k_hw_common(ah), ATH_DBG_ANY, "Using ANI v1\n");
1076}
1077
1078void ath9k_hw_attach_ani_ops_new(struct ath_hw *ah)
1079{
1080 struct ath_hw_ops *ops = ath9k_hw_ops(ah);
1081
1082 ops->ani_monitor = ath9k_hw_ani_monitor_new;
1083
1084 ath_print(ath9k_hw_common(ah), ATH_DBG_ANY, "Using ANI v2\n");
1085}