Return-path: Received: from mail.deathmatch.net ([70.167.247.36]:3398 "EHLO mail.deathmatch.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752273AbYJ3DYb (ORCPT ); Wed, 29 Oct 2008 23:24:31 -0400 Date: Wed, 29 Oct 2008 23:24:26 -0400 From: Bob Copeland To: Nick Kossifidis 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 Message-ID: <20081030032426.GB26970@hash.localnet> (sfid-20081030_042435_588516_80861066) References: <20081029021121.GA3079@makis> <20081029024603.GA22759@hash.localnet> <40f31dec0810290408h5ee08c8l1e14d576064f01a4@mail.gmail.com> <40f31dec0810290741t6378eebelbdacf4e5c8d63bff@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii In-Reply-To: <40f31dec0810290741t6378eebelbdacf4e5c8d63bff@mail.gmail.com> Sender: linux-wireless-owner@vger.kernel.org List-ID: On Wed, Oct 29, 2008 at 04:41:22PM +0200, Nick Kossifidis wrote: > 2008/10/29 Bob Copeland : > 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 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 --- 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