diff options
author | Felix Fietkau <nbd@openwrt.org> | 2010-11-08 14:54:47 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2010-11-09 16:13:24 -0500 |
commit | 4df3071ebd92ef7115b409da64d0eb405d24a631 (patch) | |
tree | 825eaecb9d9e8d0fde7f61e5f98fdd823ccef718 /drivers/net/wireless/ath/ath9k/mac.c | |
parent | 790a11f268373b60069bc1371dc05143107c607c (diff) |
ath9k_hw: optimize interrupt mask changes
OProfile showed that ath9k was spending way too much time in
ath9k_hw_set_interrupts. Since most of the interrupt mask changes only
need to globally enable/disable interrupts, it makes sense to split
this part into separate functions, replacing all calls to
ath9k_hw_set_interrupts(ah, 0) with ath9k_hw_disable_interrupts(ah).
ath9k_hw_set_interrupts(ah, ah->imask) only gets changed to
ath9k_hw_enable_interrupts(ah), whenever ah->imask was not changed
since the point where interrupts were disabled.
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/ath/ath9k/mac.c')
-rw-r--r-- | drivers/net/wireless/ath/ath9k/mac.c | 86 |
1 files changed, 50 insertions, 36 deletions
diff --git a/drivers/net/wireless/ath/ath9k/mac.c b/drivers/net/wireless/ath/ath9k/mac.c index 8c13479b17c..65b1ee2a979 100644 --- a/drivers/net/wireless/ath/ath9k/mac.c +++ b/drivers/net/wireless/ath/ath9k/mac.c | |||
@@ -117,12 +117,11 @@ EXPORT_SYMBOL(ath9k_hw_numtxpending); | |||
117 | bool ath9k_hw_updatetxtriglevel(struct ath_hw *ah, bool bIncTrigLevel) | 117 | bool ath9k_hw_updatetxtriglevel(struct ath_hw *ah, bool bIncTrigLevel) |
118 | { | 118 | { |
119 | u32 txcfg, curLevel, newLevel; | 119 | u32 txcfg, curLevel, newLevel; |
120 | enum ath9k_int omask; | ||
121 | 120 | ||
122 | if (ah->tx_trig_level >= ah->config.max_txtrig_level) | 121 | if (ah->tx_trig_level >= ah->config.max_txtrig_level) |
123 | return false; | 122 | return false; |
124 | 123 | ||
125 | omask = ath9k_hw_set_interrupts(ah, ah->imask & ~ATH9K_INT_GLOBAL); | 124 | ath9k_hw_disable_interrupts(ah); |
126 | 125 | ||
127 | txcfg = REG_READ(ah, AR_TXCFG); | 126 | txcfg = REG_READ(ah, AR_TXCFG); |
128 | curLevel = MS(txcfg, AR_FTRIG); | 127 | curLevel = MS(txcfg, AR_FTRIG); |
@@ -136,7 +135,7 @@ bool ath9k_hw_updatetxtriglevel(struct ath_hw *ah, bool bIncTrigLevel) | |||
136 | REG_WRITE(ah, AR_TXCFG, | 135 | REG_WRITE(ah, AR_TXCFG, |
137 | (txcfg & ~AR_FTRIG) | SM(newLevel, AR_FTRIG)); | 136 | (txcfg & ~AR_FTRIG) | SM(newLevel, AR_FTRIG)); |
138 | 137 | ||
139 | ath9k_hw_set_interrupts(ah, omask); | 138 | ath9k_hw_enable_interrupts(ah); |
140 | 139 | ||
141 | ah->tx_trig_level = newLevel; | 140 | ah->tx_trig_level = newLevel; |
142 | 141 | ||
@@ -849,28 +848,59 @@ bool ath9k_hw_intrpend(struct ath_hw *ah) | |||
849 | } | 848 | } |
850 | EXPORT_SYMBOL(ath9k_hw_intrpend); | 849 | EXPORT_SYMBOL(ath9k_hw_intrpend); |
851 | 850 | ||
852 | enum ath9k_int ath9k_hw_set_interrupts(struct ath_hw *ah, | 851 | void ath9k_hw_disable_interrupts(struct ath_hw *ah) |
853 | enum ath9k_int ints) | 852 | { |
853 | struct ath_common *common = ath9k_hw_common(ah); | ||
854 | |||
855 | ath_print(common, ATH_DBG_INTERRUPT, "disable IER\n"); | ||
856 | REG_WRITE(ah, AR_IER, AR_IER_DISABLE); | ||
857 | (void) REG_READ(ah, AR_IER); | ||
858 | if (!AR_SREV_9100(ah)) { | ||
859 | REG_WRITE(ah, AR_INTR_ASYNC_ENABLE, 0); | ||
860 | (void) REG_READ(ah, AR_INTR_ASYNC_ENABLE); | ||
861 | |||
862 | REG_WRITE(ah, AR_INTR_SYNC_ENABLE, 0); | ||
863 | (void) REG_READ(ah, AR_INTR_SYNC_ENABLE); | ||
864 | } | ||
865 | } | ||
866 | EXPORT_SYMBOL(ath9k_hw_disable_interrupts); | ||
867 | |||
868 | void ath9k_hw_enable_interrupts(struct ath_hw *ah) | ||
869 | { | ||
870 | struct ath_common *common = ath9k_hw_common(ah); | ||
871 | |||
872 | if (!(ah->imask & ATH9K_INT_GLOBAL)) | ||
873 | return; | ||
874 | |||
875 | ath_print(common, ATH_DBG_INTERRUPT, "enable IER\n"); | ||
876 | REG_WRITE(ah, AR_IER, AR_IER_ENABLE); | ||
877 | if (!AR_SREV_9100(ah)) { | ||
878 | REG_WRITE(ah, AR_INTR_ASYNC_ENABLE, | ||
879 | AR_INTR_MAC_IRQ); | ||
880 | REG_WRITE(ah, AR_INTR_ASYNC_MASK, AR_INTR_MAC_IRQ); | ||
881 | |||
882 | |||
883 | REG_WRITE(ah, AR_INTR_SYNC_ENABLE, | ||
884 | AR_INTR_SYNC_DEFAULT); | ||
885 | REG_WRITE(ah, AR_INTR_SYNC_MASK, | ||
886 | AR_INTR_SYNC_DEFAULT); | ||
887 | } | ||
888 | ath_print(common, ATH_DBG_INTERRUPT, "AR_IMR 0x%x IER 0x%x\n", | ||
889 | REG_READ(ah, AR_IMR), REG_READ(ah, AR_IER)); | ||
890 | } | ||
891 | EXPORT_SYMBOL(ath9k_hw_enable_interrupts); | ||
892 | |||
893 | void ath9k_hw_set_interrupts(struct ath_hw *ah, enum ath9k_int ints) | ||
854 | { | 894 | { |
855 | enum ath9k_int omask = ah->imask; | 895 | enum ath9k_int omask = ah->imask; |
856 | u32 mask, mask2; | 896 | u32 mask, mask2; |
857 | struct ath9k_hw_capabilities *pCap = &ah->caps; | 897 | struct ath9k_hw_capabilities *pCap = &ah->caps; |
858 | struct ath_common *common = ath9k_hw_common(ah); | 898 | struct ath_common *common = ath9k_hw_common(ah); |
859 | 899 | ||
860 | ath_print(common, ATH_DBG_INTERRUPT, "0x%x => 0x%x\n", omask, ints); | 900 | if (!(ints & ATH9K_INT_GLOBAL)) |
861 | 901 | ath9k_hw_enable_interrupts(ah); | |
862 | if (omask & ATH9K_INT_GLOBAL) { | ||
863 | ath_print(common, ATH_DBG_INTERRUPT, "disable IER\n"); | ||
864 | REG_WRITE(ah, AR_IER, AR_IER_DISABLE); | ||
865 | (void) REG_READ(ah, AR_IER); | ||
866 | if (!AR_SREV_9100(ah)) { | ||
867 | REG_WRITE(ah, AR_INTR_ASYNC_ENABLE, 0); | ||
868 | (void) REG_READ(ah, AR_INTR_ASYNC_ENABLE); | ||
869 | 902 | ||
870 | REG_WRITE(ah, AR_INTR_SYNC_ENABLE, 0); | 903 | ath_print(common, ATH_DBG_INTERRUPT, "0x%x => 0x%x\n", omask, ints); |
871 | (void) REG_READ(ah, AR_INTR_SYNC_ENABLE); | ||
872 | } | ||
873 | } | ||
874 | 904 | ||
875 | /* TODO: global int Ref count */ | 905 | /* TODO: global int Ref count */ |
876 | mask = ints & ATH9K_INT_COMMON; | 906 | mask = ints & ATH9K_INT_COMMON; |
@@ -946,24 +976,8 @@ enum ath9k_int ath9k_hw_set_interrupts(struct ath_hw *ah, | |||
946 | REG_CLR_BIT(ah, AR_IMR_S5, AR_IMR_S5_TIM_TIMER); | 976 | REG_CLR_BIT(ah, AR_IMR_S5, AR_IMR_S5_TIM_TIMER); |
947 | } | 977 | } |
948 | 978 | ||
949 | if (ints & ATH9K_INT_GLOBAL) { | 979 | ath9k_hw_enable_interrupts(ah); |
950 | ath_print(common, ATH_DBG_INTERRUPT, "enable IER\n"); | ||
951 | REG_WRITE(ah, AR_IER, AR_IER_ENABLE); | ||
952 | if (!AR_SREV_9100(ah)) { | ||
953 | REG_WRITE(ah, AR_INTR_ASYNC_ENABLE, | ||
954 | AR_INTR_MAC_IRQ); | ||
955 | REG_WRITE(ah, AR_INTR_ASYNC_MASK, AR_INTR_MAC_IRQ); | ||
956 | |||
957 | |||
958 | REG_WRITE(ah, AR_INTR_SYNC_ENABLE, | ||
959 | AR_INTR_SYNC_DEFAULT); | ||
960 | REG_WRITE(ah, AR_INTR_SYNC_MASK, | ||
961 | AR_INTR_SYNC_DEFAULT); | ||
962 | } | ||
963 | ath_print(common, ATH_DBG_INTERRUPT, "AR_IMR 0x%x IER 0x%x\n", | ||
964 | REG_READ(ah, AR_IMR), REG_READ(ah, AR_IER)); | ||
965 | } | ||
966 | 980 | ||
967 | return omask; | 981 | return; |
968 | } | 982 | } |
969 | EXPORT_SYMBOL(ath9k_hw_set_interrupts); | 983 | EXPORT_SYMBOL(ath9k_hw_set_interrupts); |