bde32c63e7861bf8b863b621da1d962de21cb444
[openwrt/svn-archive/archive.git] / package / mac80211 / patches / 325-rt2x00-Correctly-initialize-TXINFO-for-crypto-rt28.patch
1 From 3bb9fb0141f276cd330e3eaee5c5e75b7f8bdb6a Mon Sep 17 00:00:00 2001
2 From: Ivo van Doorn <IvDoorn@gmail.com>
3 Date: Sat, 21 Feb 2009 20:41:06 +0100
4 Subject: [PATCH] rt2x00: Correctly initialize TXINFO for crypto (rt2800usb)
5
6 Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
7 ---
8 drivers/net/wireless/rt2x00/rt2800usb.c | 23 ++++++++++++-----------
9 1 files changed, 12 insertions(+), 11 deletions(-)
10
11 --- a/drivers/net/wireless/rt2x00/rt2800usb.c
12 +++ b/drivers/net/wireless/rt2x00/rt2800usb.c
13 @@ -358,7 +358,7 @@ static void rt2800usb_config_wcid_attr(s
14 u32 offset;
15 u32 reg;
16
17 - offset = MAC_WCID_ATTR_ENTRY(crypto->aid);
18 + offset = MAC_WCID_ATTR_ENTRY(key->hw_key_idx);
19
20 rt2x00usb_register_read(rt2x00dev, offset, &reg);
21 rt2x00_set_field32(&reg, MAC_WCID_ATTRIBUTE_KEYTAB,
22 @@ -369,7 +369,7 @@ static void rt2800usb_config_wcid_attr(s
23 rt2x00_set_field32(&reg, MAC_WCID_ATTRIBUTE_RX_WIUDF, 0);
24 rt2x00usb_register_write(rt2x00dev, offset, reg);
25
26 - offset = MAC_IVEIV_ENTRY(crypto->aid);
27 + offset = MAC_IVEIV_ENTRY(key->hw_key_idx);
28
29 memset(&iveiv_entry, 0, sizeof(iveiv_entry));
30 if ((crypto->cipher == CIPHER_TKIP) ||
31 @@ -380,7 +380,7 @@ static void rt2800usb_config_wcid_attr(s
32 rt2x00usb_register_multiwrite(rt2x00dev, offset,
33 &iveiv_entry, sizeof(iveiv_entry));
34
35 - offset = MAC_WCID_ENTRY(crypto->aid);
36 + offset = MAC_WCID_ENTRY(key->hw_key_idx);
37
38 memset(&wcid_entry, 0, sizeof(wcid_entry));
39 if (crypto->cmd == SET_KEY)
40 @@ -425,10 +425,10 @@ static int rt2800usb_config_shared_key(s
41 * Using the correct defines correctly will cause overhead,
42 * so just calculate the correct offset.
43 */
44 - field.bit_offset = (4 * key->keyidx);
45 + field.bit_offset = (4 * key->keyidx) + (16 * (crypto->bssidx & 1));
46 field.bit_mask = 0x7 << field.bit_offset;
47
48 - offset = SHARED_KEY_MODE_ENTRY(key->hw_key_idx / 8);
49 + offset = SHARED_KEY_MODE_ENTRY(key->hw_key_idx / 2);
50
51 rt2x00usb_register_read(rt2x00dev, offset, &reg);
52 rt2x00_set_field32(&reg, field,
53 @@ -2001,16 +2001,16 @@ static void rt2800usb_write_tx_desc(stru
54 rt2x00_set_field32(&word, TXWI_W1_NSEQ,
55 test_bit(ENTRY_TXD_GENERATE_SEQ, &txdesc->flags));
56 rt2x00_set_field32(&word, TXWI_W1_BW_WIN_SIZE, txdesc->ba_size);
57 - rt2x00_set_field32(&word, TXWI_W1_WIRELESS_CLI_ID, 0xff);
58 + rt2x00_set_field32(&word, TXWI_W1_WIRELESS_CLI_ID,
59 + test_bit(ENTRY_TXD_ENCRYPT, &txdesc->flags) ?
60 + txdesc->key_idx : 0xff);
61 rt2x00_set_field32(&word, TXWI_W1_MPDU_TOTAL_BYTE_COUNT, skb->len);
62 rt2x00_set_field32(&word, TXWI_W1_PACKETID,
63 skbdesc->entry->entry_idx);
64 rt2x00_desc_write(txwi, 1, word);
65
66 - if (test_bit(ENTRY_TXD_ENCRYPT, &txdesc->flags)) {
67 - _rt2x00_desc_write(txwi, 2, skbdesc->iv[0]);
68 - _rt2x00_desc_write(txwi, 3, skbdesc->iv[1]);
69 - }
70 + _rt2x00_desc_write(txwi, 2, 0 /* skbdesc->iv[0] */);
71 + _rt2x00_desc_write(txwi, 3, 0 /* skbdesc->iv[1] */);
72
73 /*
74 * Initialize TX descriptor
75 @@ -2018,7 +2018,8 @@ static void rt2800usb_write_tx_desc(stru
76 rt2x00_desc_read(txi, 0, &word);
77 rt2x00_set_field32(&word, TXINFO_W0_USB_DMA_TX_PKT_LEN,
78 skb->len + TXWI_DESC_SIZE);
79 - rt2x00_set_field32(&word, TXINFO_W0_WIV, 1);
80 + rt2x00_set_field32(&word, TXINFO_W0_WIV,
81 + !test_bit(ENTRY_TXD_ENCRYPT_IV, &txdesc->flags));
82 rt2x00_set_field32(&word, TXINFO_W0_QSEL, 2);
83 rt2x00_set_field32(&word, TXINFO_W0_SW_USE_LAST_ROUND, 0);
84 rt2x00_set_field32(&word, TXINFO_W0_USB_DMA_NEXT_VALID, 0);