diff options
author | Felix Fietkau <nbd@openwrt.org> | 2010-10-04 14:09:50 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2010-10-06 16:30:39 -0400 |
commit | 95792178a58716a6afaeb5ab9654f1a0f17a5e8e (patch) | |
tree | 869bcf8f46f6851057233d464fc454652a1b5220 /drivers | |
parent | 8eb4980c33c35e97a0a226fdbc07e38da0f1f4aa (diff) |
ath9k_hw: merge ath9k_hw_ani_monitor_old and ath9k_hw_ani_monitor_new
After the last rounds of cleanup, these functions are now functionally
equivalent and can thus be merged.
Also get rid of some excessive (and redundant) debug messages.
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/wireless/ath/ath9k/ani.c | 83 | ||||
-rw-r--r-- | drivers/net/wireless/ath/ath9k/ar9002_hw.c | 5 | ||||
-rw-r--r-- | drivers/net/wireless/ath/ath9k/ar9003_hw.c | 2 | ||||
-rw-r--r-- | drivers/net/wireless/ath/ath9k/hw-ops.h | 6 | ||||
-rw-r--r-- | drivers/net/wireless/ath/ath9k/hw.h | 8 |
5 files changed, 3 insertions, 101 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 | ||
733 | static void ath9k_hw_ani_monitor_old(struct ath_hw *ah, | 733 | void 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 | |||
765 | static 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 | } |
783 | EXPORT_SYMBOL(ath9k_hw_ani_monitor); | ||
845 | 784 | ||
846 | void ath9k_enable_mib_counters(struct ath_hw *ah) | 785 | void 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 | |||
1069 | void 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 | |||
1078 | void 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 | } | ||
diff --git a/drivers/net/wireless/ath/ath9k/ar9002_hw.c b/drivers/net/wireless/ath/ath9k/ar9002_hw.c index 78bdf0cec5f0..a0471f2e1c7a 100644 --- a/drivers/net/wireless/ath/ath9k/ar9002_hw.c +++ b/drivers/net/wireless/ath/ath9k/ar9002_hw.c | |||
@@ -572,11 +572,6 @@ void ar9002_hw_attach_ops(struct ath_hw *ah) | |||
572 | 572 | ||
573 | ar9002_hw_attach_calib_ops(ah); | 573 | ar9002_hw_attach_calib_ops(ah); |
574 | ar9002_hw_attach_mac_ops(ah); | 574 | ar9002_hw_attach_mac_ops(ah); |
575 | |||
576 | if (modparam_force_new_ani) | ||
577 | ath9k_hw_attach_ani_ops_new(ah); | ||
578 | else | ||
579 | ath9k_hw_attach_ani_ops_old(ah); | ||
580 | } | 575 | } |
581 | 576 | ||
582 | void ar9002_hw_load_ani_reg(struct ath_hw *ah, struct ath9k_channel *chan) | 577 | void ar9002_hw_load_ani_reg(struct ath_hw *ah, struct ath9k_channel *chan) |
diff --git a/drivers/net/wireless/ath/ath9k/ar9003_hw.c b/drivers/net/wireless/ath/ath9k/ar9003_hw.c index 064168909108..02c970819f79 100644 --- a/drivers/net/wireless/ath/ath9k/ar9003_hw.c +++ b/drivers/net/wireless/ath/ath9k/ar9003_hw.c | |||
@@ -333,6 +333,4 @@ void ar9003_hw_attach_ops(struct ath_hw *ah) | |||
333 | ar9003_hw_attach_phy_ops(ah); | 333 | ar9003_hw_attach_phy_ops(ah); |
334 | ar9003_hw_attach_calib_ops(ah); | 334 | ar9003_hw_attach_calib_ops(ah); |
335 | ar9003_hw_attach_mac_ops(ah); | 335 | ar9003_hw_attach_mac_ops(ah); |
336 | |||
337 | ath9k_hw_attach_ani_ops_new(ah); | ||
338 | } | 336 | } |
diff --git a/drivers/net/wireless/ath/ath9k/hw-ops.h b/drivers/net/wireless/ath/ath9k/hw-ops.h index 6564d1f0ffb1..0a4ad348b699 100644 --- a/drivers/net/wireless/ath/ath9k/hw-ops.h +++ b/drivers/net/wireless/ath/ath9k/hw-ops.h | |||
@@ -128,12 +128,6 @@ static inline void ath9k_hw_set11n_virtualmorefrag(struct ath_hw *ah, void *ds, | |||
128 | ath9k_hw_ops(ah)->set11n_virtualmorefrag(ah, ds, vmf); | 128 | ath9k_hw_ops(ah)->set11n_virtualmorefrag(ah, ds, vmf); |
129 | } | 129 | } |
130 | 130 | ||
131 | static inline void ath9k_hw_ani_monitor(struct ath_hw *ah, | ||
132 | struct ath9k_channel *chan) | ||
133 | { | ||
134 | ath9k_hw_ops(ah)->ani_monitor(ah, chan); | ||
135 | } | ||
136 | |||
137 | /* Private hardware call ops */ | 131 | /* Private hardware call ops */ |
138 | 132 | ||
139 | /* PHY ops */ | 133 | /* PHY ops */ |
diff --git a/drivers/net/wireless/ath/ath9k/hw.h b/drivers/net/wireless/ath/ath9k/hw.h index c982a24146d2..87627dd63463 100644 --- a/drivers/net/wireless/ath/ath9k/hw.h +++ b/drivers/net/wireless/ath/ath9k/hw.h | |||
@@ -564,9 +564,6 @@ struct ath_hw_private_ops { | |||
564 | * | 564 | * |
565 | * @config_pci_powersave: | 565 | * @config_pci_powersave: |
566 | * @calibrate: periodic calibration for NF, ANI, IQ, ADC gain, ADC-DC | 566 | * @calibrate: periodic calibration for NF, ANI, IQ, ADC gain, ADC-DC |
567 | * | ||
568 | * @ani_monitor: called periodically by the core driver to collect | ||
569 | * MIB stats and adjust ANI if specific thresholds have been reached. | ||
570 | */ | 567 | */ |
571 | struct ath_hw_ops { | 568 | struct ath_hw_ops { |
572 | void (*config_pci_powersave)(struct ath_hw *ah, | 569 | void (*config_pci_powersave)(struct ath_hw *ah, |
@@ -607,8 +604,6 @@ struct ath_hw_ops { | |||
607 | u32 burstDuration); | 604 | u32 burstDuration); |
608 | void (*set11n_virtualmorefrag)(struct ath_hw *ah, void *ds, | 605 | void (*set11n_virtualmorefrag)(struct ath_hw *ah, void *ds, |
609 | u32 vmf); | 606 | u32 vmf); |
610 | |||
611 | void (*ani_monitor)(struct ath_hw *ah, struct ath9k_channel *chan); | ||
612 | }; | 607 | }; |
613 | 608 | ||
614 | struct ath_nf_limits { | 609 | struct ath_nf_limits { |
@@ -969,8 +964,7 @@ void ar9002_hw_load_ani_reg(struct ath_hw *ah, struct ath9k_channel *chan); | |||
969 | extern int modparam_force_new_ani; | 964 | extern int modparam_force_new_ani; |
970 | void ath9k_ani_reset(struct ath_hw *ah, bool is_scanning); | 965 | void ath9k_ani_reset(struct ath_hw *ah, bool is_scanning); |
971 | void ath9k_hw_proc_mib_event(struct ath_hw *ah); | 966 | void ath9k_hw_proc_mib_event(struct ath_hw *ah); |
972 | void ath9k_hw_attach_ani_ops_old(struct ath_hw *ah); | 967 | void ath9k_hw_ani_monitor(struct ath_hw *ah, struct ath9k_channel *chan); |
973 | void ath9k_hw_attach_ani_ops_new(struct ath_hw *ah); | ||
974 | 968 | ||
975 | #define ATH_PCIE_CAP_LINK_CTRL 0x70 | 969 | #define ATH_PCIE_CAP_LINK_CTRL 0x70 |
976 | #define ATH_PCIE_CAP_LINK_L0S 1 | 970 | #define ATH_PCIE_CAP_LINK_L0S 1 |