ath9k: Handle power modes in isr for power save.
PATCH 1/1 ath9k: Handle power modes in isr for power save.
Restore network sleep mode in isr if power save is enabled.
--- drivers/net/wireless/ath9k/ath9k.h | 3 ++- drivers/net/wireless/ath9k/main.c | 2 ++ 2 files changed, 4 insertions(+), 1 deletions(-)
drivers/net/wireless/ath9k/ath9k.h +2 -1
@@ -677,7 +677,8 @@ static inline void ath9k_ps_wakeup(struct ath_softc *sc)static inline void ath9k_ps_restore (struct ath_softc *sc) {if (atomic_dec_and_test (&sc->ps_usecount)) -if (sc->hw->conf.flags &IEEE80211_CONF_PS ) +if ((sc->hw->conf.flags &IEEE80211_CONF_PS ) && + !(sc->sc_flags &SC_OP_WAIT_FOR_BEACON ))ath9k_hw_setpower (sc->sc_ah, sc->sc_ah->restore_mode); }
drivers/net/wireless/ath9k/main.c +2 -0
@@ -516,6 +516,7 @@ irqreturn_t ath_isr(int irq, void *dev)return IRQ_NONE ; sc->intrstatus = status; +ath9k_ps_wakeup (sc);if (status &ATH9K_INT_FATAL ) {/* need a chip reset */
@@ -581,6 +582,7 @@ irqreturn_t ath_isr(int irq, void *dev) sched = true; } } +ath9k_ps_restore (sc); }while (0 );ath_debug_stat_interrupt (sc, status);
Signature · 1 line
1.6.0.1
PATCH 1/1 ath9k: Handle power modes in isr for power save.
Quoted 35 lines · Vivek Natarajan
Restore network sleep mode in isr if power save is enabled.
Signed-off-by Vivek Natarajan <[email protected]>--- drivers/net/wireless/ath9k/ath9k.h | 3 ++- drivers/net/wireless/ath9k/main.c | 2 ++ 2 files changed, 4 insertions(+), 1 deletions(-)drivers/net/wireless/ath9k/ath9k.h +2
-1@@ -677,7 +677,8 @@ static inline void ath9k_ps_wakeup(struct ath_softc *sc)static inline void ath9k_ps_restore (struct ath_softc *sc) {if (atomic_dec_and_test (&sc->ps_usecount)) -if (sc->hw->conf.flags &IEEE80211_CONF_PS ) +if ((sc->hw->conf.flags &IEEE80211_CONF_PS ) && + !(sc->sc_flags &SC_OP_WAIT_FOR_BEACON ))ath9k_hw_setpower (sc->sc_ah, sc->sc_ah->restore_mode); }drivers/net/wireless/ath9k/main.c +1
-0@@ -516,6 +516,7 @@ irqreturn_t ath_isr(int irq, void *dev)return IRQ_NONE ; sc->intrstatus = status; +ath9k_ps_wakeup (sc);if (status &ATH9K_INT_FATAL ) {/* need a chip reset */
drivers/net/wireless/ath9k/main.c irqreturn_t ath_isr(int irq, void *dev) · line 587
Quoted 6 lines
drivers/net/wireless/ath9k/main.c +1
-0@@ -581,6 +582,7 @@ irqreturn_t ath_isr(int irq, void *dev) sched = true; } } +ath9k_ps_restore (sc); }while (0 );
This needs proper locking.
Sujith
Quoted 10 lines · Sujith
drivers/net/wirele=
Quoted 9 lines · Vivek Natarajan
Restore network sleep mode in isr if power save is enabled.
Signed-off-by Vivek Natarajan <[email protected]>---
=A0drivers/net/wireless/ath9k/ath9k.h | =A0 =A03 ++- =A0drivers/net/wireless/ath9k/main.c =A0| =A0 =A02 ++ =A02 files changed, 4 insertions(+), 1 deletions(-)drivers/net/wirele= renamed from drivers/net/wireless/ath9k/ath9k.h +0
-0
ss/ath9k/ath9k.h
Quoted 4 lines
drivers/net/wireless/ath9k/ath9k.h static inline void ath9k_ps_wakeup(struct ath_so=
Quoted 4 lines
index 6481ea4..69292f3 100644
drivers/net/wireless/ath9k/ath9k.h +0
-0@@ -677,7 +677,8 @@ static inline void ath9k_ps_wakeup(struct ath_so=
ftc *sc)
Quoted 4 lines
drivers/net/wireless/ath9k/ath9k.h static inline void ath9k_ps_wakeup(struct ath_so= · line 680
Quoted 4 lines
drivers/net/wireless/ath9k/ath9k.h +0
-1=A0static inline void ath9k_ps_restore(struct ath_softc *sc) =A0{ =A0 =A0 =A0 if (atomic_dec_and_test(&sc->ps_usecount)) - =A0 =A0 =A0 =A0 =A0 =A0 if (sc->hw->conf.flags & IEEE80211_CONF_PS=
)
Quoted 1 line
drivers/net/wireless/ath9k/ath9k.h static inline void ath9k_ps_wakeup(struct ath_so= · line 680
Quoted 1 line
drivers/net/wireless/ath9k/ath9k.h +1
-0+ =A0 =A0 =A0 =A0 =A0 =A0 if ((sc->hw->conf.flags & IEEE80211_CONF_P=
S) &&
Quoted 1 line
drivers/net/wireless/ath9k/ath9k.h static inline void ath9k_ps_wakeup(struct ath_so= · line 681
Quoted 1 line
drivers/net/wireless/ath9k/ath9k.h +1
-0+ =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 !(sc->sc_flags & SC_OP_WAIT_FOR_BE=
ACON))
Quoted 1 line
Quoted 1 line
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 ath9k_hw_setpower(sc->sc=
_ah,
Quoted 1 line
Quoted 1 line
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =
=A0 =A0 =A0 sc->sc_ah->restore_mode);
Quoted 3 lines
Quoted 1 line
=A0}
This needs proper locking.
SC_OP_WAIT_FOR_BEACON is being changed in rx_tasklet and in isr which are mutually exclusive. Even though it might be changed in these two regions, it won't affect the ps_wake/ps_restore cycle.
IEEE80211_CONF_PS is changed in siwpower() and also in dynamic_ps_work. Even if it is changed while we are executing this ps_restore, there won't be any race condition on ps_wake/ps_restore cycle and it will work fine.
hw_setpower is just a register write function which may not need a prot= ection(?)
And for the protection of ps_wake/ps_restore itself, there is ps_count(atomic) which takes care of properly restoring power save state.
Overall, from my perspective there is no need for any more lock.
Thanks,
Vivek.
--
To unsubscribe from this list: send the line "unsubscribe linux-wireles= s" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 9 lines · Vivek Natarajan
SC_OP_WAIT_FOR_BEACONis being changed inrx_taskletand in isr which are mutually exclusive. Even though it might be changed in these two regions, it won't affect the ps_wake/ps_restore cycle.
IEEE80211_CONF_PSis changed insiwpower()and also indynamic_ps_work. Even if it is changed while we are executing thisps_restore, there won't be any race condition on ps_wake/ps_restore cycle and it will work fine.
Quoted 7 lines
hw_setpoweris just a register write function which may not need a protection(?)And for the protection of ps_wake/ps_restore itself, there is
ps_count(atomic)which takes care of properly restoring power save state.Overall, from my perspective there is no need for any more lock.
Sorry, I saw sc_flags and just assumed it would be set from process context. Thanks for the explanation.
Sujith