Linux wireless drivers development
 help / color / mirror / Atom feed
From: Bruno Randolf <br1@einfach.org>
To: linville@tuxdriver.com
Cc: ath5k-devel@lists.ath5k.org, linux-wireless@vger.kernel.org
Subject: [PATCH 6/6] ath: Fix WEP hardware encryption
Date: Tue, 25 Jan 2011 13:15:49 +0900	[thread overview]
Message-ID: <20110125041549.6944.15800.stgit@localhost6.localdomain6> (raw)
In-Reply-To: <20110125041522.6944.22566.stgit@localhost6.localdomain6>

In AP mode hardware encryption for WEP was not used on the RX side because
there was a mismatch in the key indices. The key index in the WLAN header is
0-3 while the hardware key cache was configured for key indices >= 4. This is
ok for transmit but received packets were not decrypted in HW and therefore
mac80211 had to decrypt them in SW - this can be easily seen by adding some
debug prints in mac80211/wep.c (around line 296). I have noticed it by watching
the system CPU load under high traffic.

This patch configures WEP keys into the "standard" key indices 0-4 which were
reserved for that.

Tested with ath5k on a 600MHz mips board the difference is ~15% CPU load (with
this patch) vs. ~45% CPU load (before) when the AP receives 28Mbps of WEP
encrypted data.

Signed-off-by: Bruno Randolf <br1@einfach.org>
---
 drivers/net/wireless/ath/key.c |   14 +++++++++++---
 1 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wireless/ath/key.c b/drivers/net/wireless/ath/key.c
index 5d465e5..5748dae 100644
--- a/drivers/net/wireless/ath/key.c
+++ b/drivers/net/wireless/ath/key.c
@@ -465,6 +465,16 @@ int ath_key_config(struct ath_common *common,
 	hk.kv_len = key->keylen;
 	memcpy(hk.kv_val, key->key, key->keylen);
 
+	/* set WEP keys directly to index */
+	if ((key->cipher == WLAN_CIPHER_SUITE_WEP40 ||
+	     key->cipher == WLAN_CIPHER_SUITE_WEP104) && key->keyidx < 4) {
+		ret = ath_hw_set_keycache_entry(common, key->keyidx, &hk, NULL);
+		if (!ret)
+			return -EIO;
+		set_bit(key->keyidx, common->keymap);
+		return key->keyidx;
+	}
+
 	if (!(key->flags & IEEE80211_KEY_FLAG_PAIRWISE)) {
 		switch (vif->type) {
 		case NL80211_IFTYPE_AP:
@@ -541,10 +551,8 @@ EXPORT_SYMBOL(ath_key_config);
 void ath_key_delete(struct ath_common *common, struct ieee80211_key_conf *key)
 {
 	ath_hw_keyreset(common, key->hw_key_idx);
-	if (key->hw_key_idx < IEEE80211_WEP_NKID)
-		return;
-
 	clear_bit(key->hw_key_idx, common->keymap);
+
 	if (key->cipher != WLAN_CIPHER_SUITE_TKIP)
 		return;
 


  parent reply	other threads:[~2011-01-25  4:15 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-25  4:15 [PATCH 1/6] ath5k: ath5k_setup_channels cleanup and whitespace Bruno Randolf
2011-01-25  4:15 ` [PATCH 2/6] ath5k: Use local variable for capabilities Bruno Randolf
2011-01-25  4:15 ` [PATCH 3/6] ath: Add function to check if 4.9GHz channels are allowed Bruno Randolf
2011-01-25  4:15 ` [PATCH 4/6] ath5k: Enable 802.11j 4.9GHz frequencies Bruno Randolf
2011-01-25  4:15 ` [PATCH 5/6] ath9k: Remove unused IEEE80211_WEP_NKID Bruno Randolf
2011-01-25  4:15 ` Bruno Randolf [this message]
2011-01-25 18:32   ` [PATCH 6/6] ath: Fix WEP hardware encryption Jouni Malinen
2011-01-26  2:38     ` Bruno Randolf
2011-01-26  8:29       ` Johannes Berg
2011-01-26  9:21         ` [ath5k-devel] " Bruno Randolf
2011-01-26  9:23           ` Johannes Berg
2011-01-26  9:37       ` Jouni Malinen
2011-01-26 10:36         ` Bruno Randolf
2011-01-27  5:51           ` Vasanthakumar Thiagarajan
2011-01-27  9:19             ` Bruno Randolf

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=20110125041549.6944.15800.stgit@localhost6.localdomain6 \
    --to=br1@einfach.org \
    --cc=ath5k-devel@lists.ath5k.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=linville@tuxdriver.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