2010-12-22 06:50:22

by Mohammed Shafi Shajakhan

[permalink] [raw]
Subject: [PATCH] ath9k: Reset keycache on resume

From: Mohammed Shafi Shajakhan <[email protected]>

It looks like some hardware registers are left into undefined state
after suspend/resume. At minimum, this can cause odd issues related to
key cache and hardware trying to encrypt/decrypt frames unexpectedly.
This seems to happen even when there is no keys configured, i.e., hardware
can end up touching TX frames just based of invalid key cache context
even if the driver is not asking a specific entry to be used. In
addition, RX can likely be affected. This patch fixes this issue.

Signed-off-by: Jouni Malinen <[email protected]>
Signed-off-by: Mohammed Shafi Shajakhan <[email protected]>
---
drivers/net/wireless/ath/ath9k/ath9k.h | 1 +
drivers/net/wireless/ath/ath9k/init.c | 2 +-
drivers/net/wireless/ath/ath9k/pci.c | 8 ++++++++
3 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/ath9k.h b/drivers/net/wireless/ath/ath9k/ath9k.h
index 2c31f51..12e60bb 100644
--- a/drivers/net/wireless/ath/ath9k/ath9k.h
+++ b/drivers/net/wireless/ath/ath9k/ath9k.h
@@ -669,6 +669,7 @@ extern int led_blink;
extern int ath9k_pm_qos_value;

irqreturn_t ath_isr(int irq, void *dev);
+void ath9k_init_crypto(struct ath_softc *sc);
int ath9k_init_device(u16 devid, struct ath_softc *sc, u16 subsysid,
const struct ath_bus_ops *bus_ops);
void ath9k_deinit_device(struct ath_softc *sc);
diff --git a/drivers/net/wireless/ath/ath9k/init.c b/drivers/net/wireless/ath/ath9k/init.c
index b0e5e71..91cb422 100644
--- a/drivers/net/wireless/ath/ath9k/init.c
+++ b/drivers/net/wireless/ath/ath9k/init.c
@@ -372,7 +372,7 @@ fail:
#undef DS2PHYS
}

-static void ath9k_init_crypto(struct ath_softc *sc)
+void ath9k_init_crypto(struct ath_softc *sc)
{
struct ath_common *common = ath9k_hw_common(sc->sc_ah);
int i = 0;
diff --git a/drivers/net/wireless/ath/ath9k/pci.c b/drivers/net/wireless/ath/ath9k/pci.c
index 7ca8499..af34d05 100644
--- a/drivers/net/wireless/ath/ath9k/pci.c
+++ b/drivers/net/wireless/ath/ath9k/pci.c
@@ -309,6 +309,14 @@ static int ath_pci_resume(struct device *device)
AR_GPIO_OUTPUT_MUX_AS_OUTPUT);
ath9k_hw_set_gpio(sc->sc_ah, sc->sc_ah->led_pin, 1);

+ /*
+ * Reset key cache to sane defaults (all entries cleared) instead of
+ * semi-random values after suspend/resume.
+ */
+ ath9k_ps_wakeup(sc);
+ ath9k_init_crypto(sc);
+ ath9k_ps_restore(sc);
+
sc->ps_idle = true;
ath_radio_disable(sc, hw);

--
1.7.0.4



2011-01-03 04:56:20

by Mohammed Shafi Shajakhan

[permalink] [raw]
Subject: Re: [PATCH] ath9k: Reset keycache on resume

On Saturday 01 January 2011 03:03 PM, Kalle Valo wrote:
> Hi,
>
> a minor nitpick:
>
Thanks for pointing it out.
> Mohammed Shafi Shajakhan<[email protected]> writes:
>
>
>> From: Mohammed Shafi Shajakhan<[email protected]>
>>
> This means that Mohammed is the author of the patch.
>
> [...]
>
Jouni is the author.
>
>> Signed-off-by: Jouni Malinen<[email protected]>
>> Signed-off-by: Mohammed Shafi Shajakhan<[email protected]>
>>
> But here the author's sob line should be first one, the order is from
> top to bottom. If Mohammed is the author, the sob lines should be
> reversed. But if Jouni actually is the author, the From line should be
> fixed.
>
> Of course this is just a style issue and doesn't matter that much, but
> it's still nice to get it right.
>
>

2011-01-01 09:33:32

by Kalle Valo

[permalink] [raw]
Subject: Re: [PATCH] ath9k: Reset keycache on resume

Hi,

a minor nitpick:

Mohammed Shafi Shajakhan <[email protected]> writes:

> From: Mohammed Shafi Shajakhan <[email protected]>

This means that Mohammed is the author of the patch.

[...]

> Signed-off-by: Jouni Malinen <[email protected]>
> Signed-off-by: Mohammed Shafi Shajakhan <[email protected]>

But here the author's sob line should be first one, the order is from
top to bottom. If Mohammed is the author, the sob lines should be
reversed. But if Jouni actually is the author, the From line should be
fixed.

Of course this is just a style issue and doesn't matter that much, but
it's still nice to get it right.

--
Kalle Valo