aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/rt2x00/rt2x00queue.c
diff options
context:
space:
mode:
authorIvo van Doorn <ivdoorn@gmail.com>2008-12-03 11:29:48 -0500
committerJohn W. Linville <linville@tuxdriver.com>2008-12-05 09:35:57 -0500
commit9c3444d33e65ade06af82d19522686c1873b953a (patch)
tree5d4ccac8c604fafe3dd66be98e132f7282ccba7f /drivers/net/wireless/rt2x00/rt2x00queue.c
parent1c02667db5eae801b8fc279fdfa618164c0efb6e (diff)
rt2x00: Move crypto TX descriptor handling to rt2x00crypto.c
Move all code which determines the right TX descriptor fields specific to crypto support into rt2x00crypto.c. This makes the code in rt2x00queue more simpler and better concentrates all crypto code into a single location. With this we can also remove some ifdefs in rt2x00queue.c since the code inside the ifdef is either very small, or only calling empty functions (see empty function definitions in rt2x00lib.h). Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/rt2x00/rt2x00queue.c')
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00queue.c29
1 files changed, 5 insertions, 24 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2x00queue.c b/drivers/net/wireless/rt2x00/rt2x00queue.c
index e4a1dbeb18fd..eaec6bd93ed5 100644
--- a/drivers/net/wireless/rt2x00/rt2x00queue.c
+++ b/drivers/net/wireless/rt2x00/rt2x00queue.c
@@ -55,14 +55,12 @@ struct sk_buff *rt2x00queue_alloc_rxskb(struct rt2x00_dev *rt2x00dev,
55 /* 55 /*
56 * For IV/EIV/ICV assembly we must make sure there is 56 * For IV/EIV/ICV assembly we must make sure there is
57 * at least 8 bytes bytes available in headroom for IV/EIV 57 * at least 8 bytes bytes available in headroom for IV/EIV
58 * and 4 bytes for ICV data as tailroon. 58 * and 8 bytes for ICV data as tailroon.
59 */ 59 */
60#ifdef CONFIG_RT2X00_LIB_CRYPTO
61 if (test_bit(CONFIG_SUPPORT_HW_CRYPTO, &rt2x00dev->flags)) { 60 if (test_bit(CONFIG_SUPPORT_HW_CRYPTO, &rt2x00dev->flags)) {
62 head_size += 8; 61 head_size += 8;
63 tail_size += 4; 62 tail_size += 8;
64 } 63 }
65#endif /* CONFIG_RT2X00_LIB_CRYPTO */
66 64
67 /* 65 /*
68 * Allocate skbuffer. 66 * Allocate skbuffer.
@@ -174,7 +172,7 @@ static void rt2x00queue_create_tx_descriptor(struct queue_entry *entry,
174 txdesc->cw_max = entry->queue->cw_max; 172 txdesc->cw_max = entry->queue->cw_max;
175 txdesc->aifs = entry->queue->aifs; 173 txdesc->aifs = entry->queue->aifs;
176 174
177 /* Data length + CRC + IV/EIV/ICV/MMIC (when using encryption) */ 175 /* Data length + CRC */
178 data_length = entry->skb->len + 4; 176 data_length = entry->skb->len + 4;
179 177
180 /* 178 /*
@@ -183,34 +181,17 @@ static void rt2x00queue_create_tx_descriptor(struct queue_entry *entry,
183 if (!(tx_info->flags & IEEE80211_TX_CTL_NO_ACK)) 181 if (!(tx_info->flags & IEEE80211_TX_CTL_NO_ACK))
184 __set_bit(ENTRY_TXD_ACK, &txdesc->flags); 182 __set_bit(ENTRY_TXD_ACK, &txdesc->flags);
185 183
186#ifdef CONFIG_RT2X00_LIB_CRYPTO
187 if (test_bit(CONFIG_SUPPORT_HW_CRYPTO, &rt2x00dev->flags) && 184 if (test_bit(CONFIG_SUPPORT_HW_CRYPTO, &rt2x00dev->flags) &&
188 !entry->skb->do_not_encrypt) { 185 !entry->skb->do_not_encrypt) {
189 struct ieee80211_key_conf *hw_key = tx_info->control.hw_key; 186 /* Apply crypto specific descriptor information */
190 187 rt2x00crypto_create_tx_descriptor(entry, txdesc);
191 __set_bit(ENTRY_TXD_ENCRYPT, &txdesc->flags);
192
193 txdesc->cipher = rt2x00crypto_key_to_cipher(hw_key);
194
195 if (hw_key->flags & IEEE80211_KEY_FLAG_PAIRWISE)
196 __set_bit(ENTRY_TXD_ENCRYPT_PAIRWISE, &txdesc->flags);
197
198 txdesc->key_idx = hw_key->hw_key_idx;
199 txdesc->iv_offset = ieee80211_get_hdrlen_from_skb(entry->skb);
200 188
201 /* 189 /*
202 * Extend frame length to include all encryption overhead 190 * Extend frame length to include all encryption overhead
203 * that will be added by the hardware. 191 * that will be added by the hardware.
204 */ 192 */
205 data_length += rt2x00crypto_tx_overhead(tx_info); 193 data_length += rt2x00crypto_tx_overhead(tx_info);
206
207 if (!(hw_key->flags & IEEE80211_KEY_FLAG_GENERATE_IV))
208 __set_bit(ENTRY_TXD_ENCRYPT_IV, &txdesc->flags);
209
210 if (!(hw_key->flags & IEEE80211_KEY_FLAG_GENERATE_MMIC))
211 __set_bit(ENTRY_TXD_ENCRYPT_MMIC, &txdesc->flags);
212 } 194 }
213#endif /* CONFIG_RT2X00_LIB_CRYPTO */
214 195
215 /* 196 /*
216 * Check if this is a RTS/CTS frame 197 * Check if this is a RTS/CTS frame