linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bob Copeland <me@bobcopeland.com>
To: Nick Kossifidis <mickflemm@gmail.com>
Cc: jirislaby@gmail.com, ath5k-devel@lists.ath5k.org,
	linux-wireless@vger.kernel.org, linville@tuxdriver.com
Subject: Re: [ath5k-devel] [PATCH] ath5k: Update PCU code
Date: Wed, 29 Oct 2008 23:24:26 -0400	[thread overview]
Message-ID: <20081030032426.GB26970@hash.localnet> (raw)
In-Reply-To: <40f31dec0810290741t6378eebelbdacf4e5c8d63bff@mail.gmail.com>

On Wed, Oct 29, 2008 at 04:41:22PM +0200, Nick Kossifidis wrote:
> 2008/10/29 Bob Copeland <me@bobcopeland.com>:
> Yup you are right, we should set both to NULL so a temp micentry var
> would do the trick.
> 
> Should i resend this one or you 'll resend yours ?

Well I just decided to put this in a different patch.  Then I saw the
5211 check.. we already read the type without such a check and the 
other tkip stuff may well all blow up on such hardware.  So not sure
what to do about that case.

Anyway feel free to just roll this up into your original patch, or to 
write it differently given the above.

From: Bob Copeland <me@bobcopeland.com>
Subject: [PATCH] ath5k: fix keytable type buglet in ath5k_hw_reset_key

Be sure we clear out both the mic (if applicable) and
the encryption key type.

Signed-off-by: Bob Copeland <me@bobcopeland.com>
---
 drivers/net/wireless/ath5k/pcu.c |   15 +++++++++++----
 1 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/drivers/net/wireless/ath5k/pcu.c b/drivers/net/wireless/ath5k/pcu.c
index 9b46d64..d7f0c10 100644
--- a/drivers/net/wireless/ath5k/pcu.c
+++ b/drivers/net/wireless/ath5k/pcu.c
@@ -960,6 +960,7 @@ int ath5k_hw_beaconq_finish(struct ath5k_hw *ah, unsigned long phys_addr)
 int ath5k_hw_reset_key(struct ath5k_hw *ah, u16 entry)
 {
 	unsigned int i, type;
+	u16 micentry = entry + AR5K_KEYTABLE_MIC_OFFSET;
 
 	ATH5K_TRACE(ah->ah_sc);
 	AR5K_ASSERT_ENTRY(entry, AR5K_KEYTABLE_SIZE);
@@ -972,10 +973,10 @@ int ath5k_hw_reset_key(struct ath5k_hw *ah, u16 entry)
 	/* Reset associated MIC entry if TKIP
 	 * is enabled located at offset (entry + 64) */
 	if (type == AR5K_KEYTABLE_TYPE_TKIP) {
-		entry = entry + AR5K_KEYTABLE_MIC_OFFSET;
-		AR5K_ASSERT_ENTRY(entry, AR5K_KEYTABLE_SIZE);
+		AR5K_ASSERT_ENTRY(micentry, AR5K_KEYTABLE_SIZE);
 		for (i = 0; i < AR5K_KEYCACHE_SIZE / 2 ; i++)
-			ath5k_hw_reg_write(ah, 0, AR5K_KEYTABLE_OFF(entry, i));
+			ath5k_hw_reg_write(ah, 0,
+				AR5K_KEYTABLE_OFF(micentry, i));
 	}
 
 	/*
@@ -987,10 +988,16 @@ int ath5k_hw_reset_key(struct ath5k_hw *ah, u16 entry)
 	 * Note2: Windows driver (ndiswrapper) sets this to
 	 *        0x00000714 instead of 0x00000007
 	 */
-	if (ah->ah_version > AR5K_AR5211)
+	if (ah->ah_version > AR5K_AR5211) {
 		ath5k_hw_reg_write(ah, AR5K_KEYTABLE_TYPE_NULL,
 				AR5K_KEYTABLE_TYPE(entry));
 
+		if (type == AR5K_KEYTABLE_TYPE_TKIP) {
+			ath5k_hw_reg_write(ah, AR5K_KEYTABLE_TYPE_NULL,
+				AR5K_KEYTABLE_TYPE(micentry));
+		}
+	}
+
 	return 0;
 }
 
-- 
1.5.4.2.182.gb3092



-- 
Bob Copeland %% www.bobcopeland.com


  reply	other threads:[~2008-10-30  3:24 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-29  2:11 [PATCH] ath5k: Update PCU code Nick Kossifidis
2008-10-29  2:28 ` Nick Kossifidis
2008-10-29  2:46 ` Bob Copeland
2008-10-29 11:08   ` [ath5k-devel] " Nick Kossifidis
2008-10-29 14:05     ` Bob Copeland
2008-10-29 14:41       ` Nick Kossifidis
2008-10-30  3:24         ` Bob Copeland [this message]
2008-10-30 21:51           ` Nick Kossifidis

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20081030032426.GB26970@hash.localnet \
    --to=me@bobcopeland.com \
    --cc=ath5k-devel@lists.ath5k.org \
    --cc=jirislaby@gmail.com \
    --cc=linux-wireless@vger.kernel.org \
    --cc=linville@tuxdriver.com \
    --cc=mickflemm@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).