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.
4 Signed-off-by: Felix Fietkau <nbd@openwrt.org>
6 --- a/include/net/mac80211.h
7 +++ b/include/net/mac80211.h
10 s8 rts_cts_rate_idx, alt_retry_rate_idx;
19 struct ieee80211_key_conf {
20 enum ieee80211_key_alg alg;
26 --- a/drivers/net/wireless/b43/xmit.c
27 +++ b/drivers/net/wireless/b43/xmit.c
31 /* Hardware appends ICV. */
32 - plcp_fragment_len += info->control.icv_len;
33 + plcp_fragment_len += info->control.hw_key->icv_len;
35 key_idx = b43_kidx_to_fw(dev, key_idx);
36 mac_ctl |= (key_idx << B43_TXH_MAC_KEYIDX_SHIFT) &
38 mac_ctl |= (key->algorithm << B43_TXH_MAC_KEYALG_SHIFT) &
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);
46 --- a/drivers/net/wireless/b43legacy/xmit.c
47 +++ b/drivers/net/wireless/b43legacy/xmit.c
51 /* Hardware appends ICV. */
52 - plcp_fragment_len += info->control.icv_len;
53 + plcp_fragment_len += info->control.hw_key->icv_len;
55 key_idx = b43legacy_kidx_to_fw(dev, key_idx);
56 mac_ctl |= (key_idx << B43legacy_TX4_MAC_KEYIDX_SHIFT) &
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);
66 --- a/net/mac80211/wep.c
67 +++ b/net/mac80211/wep.c
70 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
72 - info->control.iv_len = WEP_IV_LEN;
73 - info->control.icv_len = WEP_ICV_LEN;
75 if (!(tx->key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE)) {
76 if (ieee80211_wep_encrypt(tx->local, skb, tx->key))
78 --- a/net/mac80211/wpa.c
79 +++ b/net/mac80211/wpa.c
84 - info->control.icv_len = TKIP_ICV_LEN;
85 - info->control.iv_len = TKIP_IV_LEN;
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 */
94 - info->control.icv_len = CCMP_MIC_LEN;
95 - info->control.iv_len = CCMP_HDR_LEN;
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 @@
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;
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
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;
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
125 * note that these lengths should only be added when
126 * mac80211 does not generate it.
128 - overhead += tx_info->control.icv_len;
129 + overhead += key->icv_len;
131 if (!(key->flags & IEEE80211_KEY_FLAG_GENERATE_IV))
132 - overhead += tx_info->control.iv_len;
133 + overhead += key->iv_len;
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
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;
146 if (unlikely(rt2x00queue_full(queue)))
149 * the frame so we can provide it to the driver seperately.
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);
160 * It could be possible that the queue was corrupted and this
161 --- a/net/mac80211/key.c
162 +++ b/net/mac80211/key.c
165 key->conf.keyidx = idx;
166 key->conf.keylen = key_len;
169 + key->conf.iv_len = WEP_IV_LEN;
170 + key->conf.icv_len = WEP_ICV_LEN;
173 + key->conf.iv_len = TKIP_IV_LEN;
174 + key->conf.icv_len = TKIP_ICV_LEN;
177 + key->conf.iv_len = CCMP_HDR_LEN;
178 + key->conf.icv_len = CCMP_MIC_LEN;
181 memcpy(key->conf.key, key_data, key_len);
182 INIT_LIST_HEAD(&key->list);
183 INIT_LIST_HEAD(&key->todo);