add the new compat-wireless for 2.6.27 + multi-rate retry and minstrel patches, renam...
[openwrt.git] / package / mac80211 / patches / 200-hwkey_len.patch
1 Free up 2 bytes in skb->cb to be used for multi-rate retry later.
2 Move iv_len and icv_len initialization into key alloc.
3
4 Signed-off-by: Felix Fietkau <nbd@openwrt.org>
5
6 --- a/include/net/mac80211.h
7 +++ b/include/net/mac80211.h
8 @@ -337,8 +337,6 @@
9 unsigned long jiffies;
10 s8 rts_cts_rate_idx, alt_retry_rate_idx;
11 u8 retry_limit;
12 - u8 icv_len;
13 - u8 iv_len;
14 } control;
15 struct {
16 u64 ampdu_ack_map;
17 @@ -635,6 +633,8 @@
18 */
19 struct ieee80211_key_conf {
20 enum ieee80211_key_alg alg;
21 + u8 icv_len;
22 + u8 iv_len;
23 u8 hw_key_idx;
24 u8 flags;
25 s8 keyidx;
26 --- a/drivers/net/wireless/b43/xmit.c
27 +++ b/drivers/net/wireless/b43/xmit.c
28 @@ -252,7 +252,7 @@
29 }
30
31 /* Hardware appends ICV. */
32 - plcp_fragment_len += info->control.icv_len;
33 + plcp_fragment_len += info->control.hw_key->icv_len;
34
35 key_idx = b43_kidx_to_fw(dev, key_idx);
36 mac_ctl |= (key_idx << B43_TXH_MAC_KEYIDX_SHIFT) &
37 @@ -260,7 +260,7 @@
38 mac_ctl |= (key->algorithm << B43_TXH_MAC_KEYALG_SHIFT) &
39 B43_TXH_MAC_KEYALG;
40 wlhdr_len = ieee80211_hdrlen(fctl);
41 - iv_len = min((size_t) info->control.iv_len,
42 + iv_len = min((size_t) info->control.hw_key->iv_len,
43 ARRAY_SIZE(txhdr->iv));
44 memcpy(txhdr->iv, ((u8 *) wlhdr) + wlhdr_len, iv_len);
45 }
46 --- a/drivers/net/wireless/b43legacy/xmit.c
47 +++ b/drivers/net/wireless/b43legacy/xmit.c
48 @@ -243,7 +243,7 @@
49
50 if (key->enabled) {
51 /* Hardware appends ICV. */
52 - plcp_fragment_len += info->control.icv_len;
53 + plcp_fragment_len += info->control.hw_key->icv_len;
54
55 key_idx = b43legacy_kidx_to_fw(dev, key_idx);
56 mac_ctl |= (key_idx << B43legacy_TX4_MAC_KEYIDX_SHIFT) &
57 @@ -252,7 +252,7 @@
58 B43legacy_TX4_MAC_KEYALG_SHIFT) &
59 B43legacy_TX4_MAC_KEYALG;
60 wlhdr_len = ieee80211_hdrlen(wlhdr->frame_control);
61 - iv_len = min((size_t)info->control.iv_len,
62 + iv_len = min((size_t)info->control.hw_key->iv_len,
63 ARRAY_SIZE(txhdr->iv));
64 memcpy(txhdr->iv, ((u8 *)wlhdr) + wlhdr_len, iv_len);
65 } else {
66 --- a/net/mac80211/wep.c
67 +++ b/net/mac80211/wep.c
68 @@ -313,9 +313,6 @@
69 {
70 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
71
72 - info->control.iv_len = WEP_IV_LEN;
73 - info->control.icv_len = WEP_ICV_LEN;
74 -
75 if (!(tx->key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE)) {
76 if (ieee80211_wep_encrypt(tx->local, skb, tx->key))
77 return -1;
78 --- a/net/mac80211/wpa.c
79 +++ b/net/mac80211/wpa.c
80 @@ -152,9 +152,6 @@
81 int len, tail;
82 u8 *pos;
83
84 - info->control.icv_len = TKIP_ICV_LEN;
85 - info->control.iv_len = TKIP_IV_LEN;
86 -
87 if ((tx->key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE) &&
88 !(tx->key->conf.flags & IEEE80211_KEY_FLAG_GENERATE_IV)) {
89 /* hwaccel - with no need for preallocated room for IV/ICV */
90 @@ -374,9 +371,6 @@
91 u8 *pos, *pn;
92 int i;
93
94 - info->control.icv_len = CCMP_MIC_LEN;
95 - info->control.iv_len = CCMP_HDR_LEN;
96 -
97 if ((tx->key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE) &&
98 !(tx->key->conf.flags & IEEE80211_KEY_FLAG_GENERATE_IV)) {
99 /* hwaccel - with no need for preallocated room for CCMP "
100 --- a/drivers/net/wireless/ath5k/base.c
101 +++ b/drivers/net/wireless/ath5k/base.c
102 @@ -1164,7 +1164,7 @@
103
104 if (info->control.hw_key) {
105 keyidx = info->control.hw_key->hw_key_idx;
106 - pktlen += info->control.icv_len;
107 + pktlen += info->control.hw_key->icv_len;
108 }
109 ret = ah->ah_setup_tx_desc(ah, ds, pktlen,
110 ieee80211_get_hdrlen_from_skb(skb), AR5K_PKT_TYPE_NORMAL,
111 --- a/drivers/net/wireless/ath9k/xmit.c
112 +++ b/drivers/net/wireless/ath9k/xmit.c
113 @@ -237,7 +237,7 @@
114
115 if (tx_info->control.hw_key) {
116 txctl->keyix = tx_info->control.hw_key->hw_key_idx;
117 - txctl->frmlen += tx_info->control.icv_len;
118 + txctl->frmlen += tx_info->control.hw_key->icv_len;
119
120 if (tx_info->control.hw_key->alg == ALG_WEP)
121 txctl->keytype = ATH9K_KEY_TYPE_WEP;
122 --- a/drivers/net/wireless/rt2x00/rt2x00crypto.c
123 +++ b/drivers/net/wireless/rt2x00/rt2x00crypto.c
124 @@ -56,10 +56,10 @@
125 * note that these lengths should only be added when
126 * mac80211 does not generate it.
127 */
128 - overhead += tx_info->control.icv_len;
129 + overhead += key->icv_len;
130
131 if (!(key->flags & IEEE80211_KEY_FLAG_GENERATE_IV))
132 - overhead += tx_info->control.iv_len;
133 + overhead += key->iv_len;
134
135 if (!(key->flags & IEEE80211_KEY_FLAG_GENERATE_MMIC)) {
136 if (key->alg == ALG_TKIP)
137 --- a/drivers/net/wireless/rt2x00/rt2x00queue.c
138 +++ b/drivers/net/wireless/rt2x00/rt2x00queue.c
139 @@ -374,7 +374,7 @@
140 struct queue_entry *entry = rt2x00queue_get_entry(queue, Q_INDEX);
141 struct txentry_desc txdesc;
142 struct skb_frame_desc *skbdesc;
143 - unsigned int iv_len = IEEE80211_SKB_CB(skb)->control.iv_len;
144 + unsigned int iv_len;
145
146 if (unlikely(rt2x00queue_full(queue)))
147 return -EINVAL;
148 @@ -410,8 +410,11 @@
149 * the frame so we can provide it to the driver seperately.
150 */
151 if (test_bit(ENTRY_TXD_ENCRYPT, &txdesc.flags) &&
152 - !test_bit(ENTRY_TXD_ENCRYPT_IV, &txdesc.flags))
153 + !test_bit(ENTRY_TXD_ENCRYPT_IV, &txdesc.flags) &&
154 + (IEEE80211_SKB_CB(skb)->control.hw_key != NULL)) {
155 + iv_len = IEEE80211_SKB_CB(skb)->control.hw_key->iv_len;
156 rt2x00crypto_tx_remove_iv(skb, iv_len);
157 + }
158
159 /*
160 * It could be possible that the queue was corrupted and this
161 --- a/net/mac80211/key.c
162 +++ b/net/mac80211/key.c
163 @@ -281,6 +281,20 @@
164 key->conf.alg = alg;
165 key->conf.keyidx = idx;
166 key->conf.keylen = key_len;
167 + switch (alg) {
168 + case ALG_WEP:
169 + key->conf.iv_len = WEP_IV_LEN;
170 + key->conf.icv_len = WEP_ICV_LEN;
171 + break;
172 + case ALG_TKIP:
173 + key->conf.iv_len = TKIP_IV_LEN;
174 + key->conf.icv_len = TKIP_ICV_LEN;
175 + break;
176 + case ALG_CCMP:
177 + key->conf.iv_len = CCMP_HDR_LEN;
178 + key->conf.icv_len = CCMP_MIC_LEN;
179 + break;
180 + }
181 memcpy(key->conf.key, key_data, key_len);
182 INIT_LIST_HEAD(&key->list);
183 INIT_LIST_HEAD(&key->todo);
This page took 0.052261 seconds and 5 git commands to generate.