1
0
mirror of git://projects.qi-hardware.com/openwrt-xburst.git synced 2024-12-19 01:44:39 +02:00
openwrt-xburst/package/mac80211/patches/325-rt2x00-Correctly-initialize-TXINFO-for-crypto-rt28.patch
nbd 2b3c255cdd upgrade to latest compat-wireless and rt2800 version
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@14605 3c298f89-4303-0410-b956-a3cf2f4a3e73
2009-02-21 20:38:07 +00:00

90 lines
3.6 KiB
Diff

From 3bb9fb0141f276cd330e3eaee5c5e75b7f8bdb6a Mon Sep 17 00:00:00 2001
From: Ivo van Doorn <IvDoorn@gmail.com>
Date: Sat, 21 Feb 2009 20:41:06 +0100
Subject: [PATCH] rt2x00: Correctly initialize TXINFO for crypto (rt2800usb)
Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
---
drivers/net/wireless/rt2x00/rt2800usb.c | 23 ++++++++++++-----------
1 files changed, 12 insertions(+), 11 deletions(-)
diff --git a/drivers/net/wireless/rt2x00/rt2800usb.c b/drivers/net/wireless/rt2x00/rt2800usb.c
index a95ef3c..b983744 100644
--- a/drivers/net/wireless/rt2x00/rt2800usb.c
+++ b/drivers/net/wireless/rt2x00/rt2800usb.c
@@ -358,7 +358,7 @@ static void rt2800usb_config_wcid_attr(struct rt2x00_dev *rt2x00dev,
u32 offset;
u32 reg;
- offset = MAC_WCID_ATTR_ENTRY(crypto->aid);
+ offset = MAC_WCID_ATTR_ENTRY(key->hw_key_idx);
rt2x00usb_register_read(rt2x00dev, offset, &reg);
rt2x00_set_field32(&reg, MAC_WCID_ATTRIBUTE_KEYTAB,
@@ -369,7 +369,7 @@ static void rt2800usb_config_wcid_attr(struct rt2x00_dev *rt2x00dev,
rt2x00_set_field32(&reg, MAC_WCID_ATTRIBUTE_RX_WIUDF, 0);
rt2x00usb_register_write(rt2x00dev, offset, reg);
- offset = MAC_IVEIV_ENTRY(crypto->aid);
+ offset = MAC_IVEIV_ENTRY(key->hw_key_idx);
memset(&iveiv_entry, 0, sizeof(iveiv_entry));
if ((crypto->cipher == CIPHER_TKIP) ||
@@ -380,7 +380,7 @@ static void rt2800usb_config_wcid_attr(struct rt2x00_dev *rt2x00dev,
rt2x00usb_register_multiwrite(rt2x00dev, offset,
&iveiv_entry, sizeof(iveiv_entry));
- offset = MAC_WCID_ENTRY(crypto->aid);
+ offset = MAC_WCID_ENTRY(key->hw_key_idx);
memset(&wcid_entry, 0, sizeof(wcid_entry));
if (crypto->cmd == SET_KEY)
@@ -425,10 +425,10 @@ static int rt2800usb_config_shared_key(struct rt2x00_dev *rt2x00dev,
* Using the correct defines correctly will cause overhead,
* so just calculate the correct offset.
*/
- field.bit_offset = (4 * key->keyidx);
+ field.bit_offset = (4 * key->keyidx) + (16 * (crypto->bssidx & 1));
field.bit_mask = 0x7 << field.bit_offset;
- offset = SHARED_KEY_MODE_ENTRY(key->hw_key_idx / 8);
+ offset = SHARED_KEY_MODE_ENTRY(key->hw_key_idx / 2);
rt2x00usb_register_read(rt2x00dev, offset, &reg);
rt2x00_set_field32(&reg, field,
@@ -2001,16 +2001,16 @@ static void rt2800usb_write_tx_desc(struct rt2x00_dev *rt2x00dev,
rt2x00_set_field32(&word, TXWI_W1_NSEQ,
test_bit(ENTRY_TXD_GENERATE_SEQ, &txdesc->flags));
rt2x00_set_field32(&word, TXWI_W1_BW_WIN_SIZE, txdesc->ba_size);
- rt2x00_set_field32(&word, TXWI_W1_WIRELESS_CLI_ID, 0xff);
+ rt2x00_set_field32(&word, TXWI_W1_WIRELESS_CLI_ID,
+ test_bit(ENTRY_TXD_ENCRYPT, &txdesc->flags) ?
+ txdesc->key_idx : 0xff);
rt2x00_set_field32(&word, TXWI_W1_MPDU_TOTAL_BYTE_COUNT, skb->len);
rt2x00_set_field32(&word, TXWI_W1_PACKETID,
skbdesc->entry->entry_idx);
rt2x00_desc_write(txwi, 1, word);
- if (test_bit(ENTRY_TXD_ENCRYPT, &txdesc->flags)) {
- _rt2x00_desc_write(txwi, 2, skbdesc->iv[0]);
- _rt2x00_desc_write(txwi, 3, skbdesc->iv[1]);
- }
+ _rt2x00_desc_write(txwi, 2, 0 /* skbdesc->iv[0] */);
+ _rt2x00_desc_write(txwi, 3, 0 /* skbdesc->iv[1] */);
/*
* Initialize TX descriptor
@@ -2018,7 +2018,8 @@ static void rt2800usb_write_tx_desc(struct rt2x00_dev *rt2x00dev,
rt2x00_desc_read(txi, 0, &word);
rt2x00_set_field32(&word, TXINFO_W0_USB_DMA_TX_PKT_LEN,
skb->len + TXWI_DESC_SIZE);
- rt2x00_set_field32(&word, TXINFO_W0_WIV, 1);
+ rt2x00_set_field32(&word, TXINFO_W0_WIV,
+ !test_bit(ENTRY_TXD_ENCRYPT_IV, &txdesc->flags));
rt2x00_set_field32(&word, TXINFO_W0_QSEL, 2);
rt2x00_set_field32(&word, TXINFO_W0_SW_USE_LAST_ROUND, 0);
rt2x00_set_field32(&word, TXINFO_W0_USB_DMA_NEXT_VALID, 0);
--
1.6.0