1 From dde442877db96055110a9c7c55fa1cb95cc1d87e Mon Sep 17 00:00:00 2001
2 From: Ivo van Doorn <IvDoorn@gmail.com>
3 Date: Sat, 21 Feb 2009 20:40:23 +0100
4 Subject: [PATCH] rt2x00: Correctly initialize TXINFO for crypto (rt2800pci)
6 Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
8 drivers/net/wireless/rt2x00/rt2800pci.c | 22 +++++++++++-----------
9 1 files changed, 11 insertions(+), 11 deletions(-)
11 diff --git a/drivers/net/wireless/rt2x00/rt2800pci.c b/drivers/net/wireless/rt2x00/rt2800pci.c
12 index 63d6499..9fd6fa2 100644
13 --- a/drivers/net/wireless/rt2x00/rt2800pci.c
14 +++ b/drivers/net/wireless/rt2x00/rt2800pci.c
15 @@ -331,7 +331,7 @@ static void rt2800pci_config_wcid_attr(struct rt2x00_dev *rt2x00dev,
19 - offset = MAC_WCID_ATTR_ENTRY(crypto->aid);
20 + offset = MAC_WCID_ATTR_ENTRY(key->hw_key_idx);
22 rt2x00pci_register_read(rt2x00dev, offset, ®);
23 rt2x00_set_field32(®, MAC_WCID_ATTRIBUTE_KEYTAB,
24 @@ -342,7 +342,7 @@ static void rt2800pci_config_wcid_attr(struct rt2x00_dev *rt2x00dev,
25 rt2x00_set_field32(®, MAC_WCID_ATTRIBUTE_RX_WIUDF, 0);
26 rt2x00pci_register_write(rt2x00dev, offset, reg);
28 - offset = MAC_IVEIV_ENTRY(crypto->aid);
29 + offset = MAC_IVEIV_ENTRY(key->hw_key_idx);
31 memset(&iveiv_entry, 0, sizeof(iveiv_entry));
32 if ((crypto->cipher == CIPHER_TKIP) ||
33 @@ -353,7 +353,7 @@ static void rt2800pci_config_wcid_attr(struct rt2x00_dev *rt2x00dev,
34 rt2x00pci_register_multiwrite(rt2x00dev, offset,
35 &iveiv_entry, sizeof(iveiv_entry));
37 - offset = MAC_WCID_ENTRY(crypto->aid);
38 + offset = MAC_WCID_ENTRY(key->hw_key_idx);
40 memset(&wcid_entry, 0, sizeof(wcid_entry));
41 if (crypto->cmd == SET_KEY)
42 @@ -393,10 +393,10 @@ static int rt2800pci_config_shared_key(struct rt2x00_dev *rt2x00dev,
43 * Using the correct defines correctly will cause overhead,
44 * so just calculate the correct offset.
46 - field.bit_offset = (4 * key->keyidx);
47 + field.bit_offset = (4 * key->keyidx) + (16 * (crypto->bssidx & 1));
48 field.bit_mask = 0x7 << field.bit_offset;
50 - offset = SHARED_KEY_MODE_ENTRY(key->hw_key_idx / 8);
51 + offset = SHARED_KEY_MODE_ENTRY(key->hw_key_idx / 2);
52 rt2x00pci_register_read(rt2x00dev, offset, ®);
53 rt2x00_set_field32(®, field,
54 (crypto->cmd == SET_KEY) * crypto->cipher);
55 @@ -1813,16 +1813,15 @@ static void rt2800pci_write_tx_desc(struct rt2x00_dev *rt2x00dev,
56 test_bit(ENTRY_TXD_GENERATE_SEQ, &txdesc->flags));
57 rt2x00_set_field32(&word, TXWI_W1_BW_WIN_SIZE, txdesc->ba_size);
58 rt2x00_set_field32(&word, TXWI_W1_WIRELESS_CLI_ID,
59 - skbdesc->entry->entry_idx);
60 + test_bit(ENTRY_TXD_ENCRYPT, &txdesc->flags) ?
61 + txdesc->key_idx : 0xff);
62 rt2x00_set_field32(&word, TXWI_W1_MPDU_TOTAL_BYTE_COUNT, skb->len);
63 rt2x00_set_field32(&word, TXWI_W1_PACKETID,
64 skbdesc->entry->queue->qid);
65 rt2x00_desc_write(txwi, 1, word);
67 - if (test_bit(ENTRY_TXD_ENCRYPT, &txdesc->flags)) {
68 - _rt2x00_desc_write(txwi, 2, skbdesc->iv[0]);
69 - _rt2x00_desc_write(txwi, 3, skbdesc->iv[1]);
71 + _rt2x00_desc_write(txwi, 2, 0 /* skbdesc->iv[0] */);
72 + _rt2x00_desc_write(txwi, 3, 0 /* skbdesc->iv[1] */);
75 * Initialize TX descriptor
76 @@ -1849,7 +1848,8 @@ static void rt2800pci_write_tx_desc(struct rt2x00_dev *rt2x00dev,
77 rt2x00_desc_write(txd, 2, word);
79 rt2x00_desc_read(txd, 3, &word);
80 - rt2x00_set_field32(&word, TXD_W3_WIV, 1);
81 + rt2x00_set_field32(&word, TXD_W3_WIV,
82 + !test_bit(ENTRY_TXD_ENCRYPT_IV, &txdesc->flags));
83 rt2x00_set_field32(&word, TXD_W3_QSEL, 2);
84 rt2x00_desc_write(txd, 3, word);