mac80211: free up 2 bytes in skb->cb
Free up 2 bytes in skb->cb to be used for multi-rate retry later. Move iv_len and icv_len initialization into key alloc. Signed-off-by: Felix Fietkau <nbd@openwrt.org> Signed-off-by: John W. Linville <linville@tuxdriver.com>
This commit is contained in:
parent
417bd25ac4
commit
76708dee38
@ -1188,7 +1188,7 @@ ath5k_txbuf_setup(struct ath5k_softc *sc, struct ath5k_buf *bf)
|
|||||||
|
|
||||||
if (info->control.hw_key) {
|
if (info->control.hw_key) {
|
||||||
keyidx = info->control.hw_key->hw_key_idx;
|
keyidx = info->control.hw_key->hw_key_idx;
|
||||||
pktlen += info->control.icv_len;
|
pktlen += info->control.hw_key->icv_len;
|
||||||
}
|
}
|
||||||
ret = ah->ah_setup_tx_desc(ah, ds, pktlen,
|
ret = ah->ah_setup_tx_desc(ah, ds, pktlen,
|
||||||
ieee80211_get_hdrlen_from_skb(skb), AR5K_PKT_TYPE_NORMAL,
|
ieee80211_get_hdrlen_from_skb(skb), AR5K_PKT_TYPE_NORMAL,
|
||||||
|
@ -237,7 +237,7 @@ static int ath_tx_prepare(struct ath_softc *sc,
|
|||||||
|
|
||||||
if (tx_info->control.hw_key) {
|
if (tx_info->control.hw_key) {
|
||||||
txctl->keyix = tx_info->control.hw_key->hw_key_idx;
|
txctl->keyix = tx_info->control.hw_key->hw_key_idx;
|
||||||
txctl->frmlen += tx_info->control.icv_len;
|
txctl->frmlen += tx_info->control.hw_key->icv_len;
|
||||||
|
|
||||||
if (tx_info->control.hw_key->alg == ALG_WEP)
|
if (tx_info->control.hw_key->alg == ALG_WEP)
|
||||||
txctl->keytype = ATH9K_KEY_TYPE_WEP;
|
txctl->keytype = ATH9K_KEY_TYPE_WEP;
|
||||||
|
@ -252,7 +252,7 @@ int b43_generate_txhdr(struct b43_wldev *dev,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Hardware appends ICV. */
|
/* Hardware appends ICV. */
|
||||||
plcp_fragment_len += info->control.icv_len;
|
plcp_fragment_len += info->control.hw_key->icv_len;
|
||||||
|
|
||||||
key_idx = b43_kidx_to_fw(dev, key_idx);
|
key_idx = b43_kidx_to_fw(dev, key_idx);
|
||||||
mac_ctl |= (key_idx << B43_TXH_MAC_KEYIDX_SHIFT) &
|
mac_ctl |= (key_idx << B43_TXH_MAC_KEYIDX_SHIFT) &
|
||||||
@ -260,7 +260,7 @@ int b43_generate_txhdr(struct b43_wldev *dev,
|
|||||||
mac_ctl |= (key->algorithm << B43_TXH_MAC_KEYALG_SHIFT) &
|
mac_ctl |= (key->algorithm << B43_TXH_MAC_KEYALG_SHIFT) &
|
||||||
B43_TXH_MAC_KEYALG;
|
B43_TXH_MAC_KEYALG;
|
||||||
wlhdr_len = ieee80211_hdrlen(fctl);
|
wlhdr_len = ieee80211_hdrlen(fctl);
|
||||||
iv_len = min((size_t) info->control.iv_len,
|
iv_len = min((size_t) info->control.hw_key->iv_len,
|
||||||
ARRAY_SIZE(txhdr->iv));
|
ARRAY_SIZE(txhdr->iv));
|
||||||
memcpy(txhdr->iv, ((u8 *) wlhdr) + wlhdr_len, iv_len);
|
memcpy(txhdr->iv, ((u8 *) wlhdr) + wlhdr_len, iv_len);
|
||||||
}
|
}
|
||||||
|
@ -243,7 +243,7 @@ static int generate_txhdr_fw3(struct b43legacy_wldev *dev,
|
|||||||
|
|
||||||
if (key->enabled) {
|
if (key->enabled) {
|
||||||
/* Hardware appends ICV. */
|
/* Hardware appends ICV. */
|
||||||
plcp_fragment_len += info->control.icv_len;
|
plcp_fragment_len += info->control.hw_key->icv_len;
|
||||||
|
|
||||||
key_idx = b43legacy_kidx_to_fw(dev, key_idx);
|
key_idx = b43legacy_kidx_to_fw(dev, key_idx);
|
||||||
mac_ctl |= (key_idx << B43legacy_TX4_MAC_KEYIDX_SHIFT) &
|
mac_ctl |= (key_idx << B43legacy_TX4_MAC_KEYIDX_SHIFT) &
|
||||||
@ -252,7 +252,7 @@ static int generate_txhdr_fw3(struct b43legacy_wldev *dev,
|
|||||||
B43legacy_TX4_MAC_KEYALG_SHIFT) &
|
B43legacy_TX4_MAC_KEYALG_SHIFT) &
|
||||||
B43legacy_TX4_MAC_KEYALG;
|
B43legacy_TX4_MAC_KEYALG;
|
||||||
wlhdr_len = ieee80211_hdrlen(wlhdr->frame_control);
|
wlhdr_len = ieee80211_hdrlen(wlhdr->frame_control);
|
||||||
iv_len = min((size_t)info->control.iv_len,
|
iv_len = min((size_t)info->control.hw_key->iv_len,
|
||||||
ARRAY_SIZE(txhdr->iv));
|
ARRAY_SIZE(txhdr->iv));
|
||||||
memcpy(txhdr->iv, ((u8 *)wlhdr) + wlhdr_len, iv_len);
|
memcpy(txhdr->iv, ((u8 *)wlhdr) + wlhdr_len, iv_len);
|
||||||
} else {
|
} else {
|
||||||
|
@ -56,10 +56,10 @@ unsigned int rt2x00crypto_tx_overhead(struct ieee80211_tx_info *tx_info)
|
|||||||
* note that these lengths should only be added when
|
* note that these lengths should only be added when
|
||||||
* mac80211 does not generate it.
|
* mac80211 does not generate it.
|
||||||
*/
|
*/
|
||||||
overhead += tx_info->control.icv_len;
|
overhead += key->icv_len;
|
||||||
|
|
||||||
if (!(key->flags & IEEE80211_KEY_FLAG_GENERATE_IV))
|
if (!(key->flags & IEEE80211_KEY_FLAG_GENERATE_IV))
|
||||||
overhead += tx_info->control.iv_len;
|
overhead += key->iv_len;
|
||||||
|
|
||||||
if (!(key->flags & IEEE80211_KEY_FLAG_GENERATE_MMIC)) {
|
if (!(key->flags & IEEE80211_KEY_FLAG_GENERATE_MMIC)) {
|
||||||
if (key->alg == ALG_TKIP)
|
if (key->alg == ALG_TKIP)
|
||||||
|
@ -374,7 +374,7 @@ int rt2x00queue_write_tx_frame(struct data_queue *queue, struct sk_buff *skb)
|
|||||||
struct queue_entry *entry = rt2x00queue_get_entry(queue, Q_INDEX);
|
struct queue_entry *entry = rt2x00queue_get_entry(queue, Q_INDEX);
|
||||||
struct txentry_desc txdesc;
|
struct txentry_desc txdesc;
|
||||||
struct skb_frame_desc *skbdesc;
|
struct skb_frame_desc *skbdesc;
|
||||||
unsigned int iv_len = IEEE80211_SKB_CB(skb)->control.iv_len;
|
unsigned int iv_len;
|
||||||
|
|
||||||
if (unlikely(rt2x00queue_full(queue)))
|
if (unlikely(rt2x00queue_full(queue)))
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
@ -410,8 +410,11 @@ int rt2x00queue_write_tx_frame(struct data_queue *queue, struct sk_buff *skb)
|
|||||||
* the frame so we can provide it to the driver seperately.
|
* the frame so we can provide it to the driver seperately.
|
||||||
*/
|
*/
|
||||||
if (test_bit(ENTRY_TXD_ENCRYPT, &txdesc.flags) &&
|
if (test_bit(ENTRY_TXD_ENCRYPT, &txdesc.flags) &&
|
||||||
!test_bit(ENTRY_TXD_ENCRYPT_IV, &txdesc.flags))
|
!test_bit(ENTRY_TXD_ENCRYPT_IV, &txdesc.flags) &&
|
||||||
|
(IEEE80211_SKB_CB(skb)->control.hw_key != NULL)) {
|
||||||
|
iv_len = IEEE80211_SKB_CB(skb)->control.hw_key->iv_len;
|
||||||
rt2x00crypto_tx_remove_iv(skb, iv_len);
|
rt2x00crypto_tx_remove_iv(skb, iv_len);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* It could be possible that the queue was corrupted and this
|
* It could be possible that the queue was corrupted and this
|
||||||
|
@ -337,8 +337,6 @@ struct ieee80211_tx_info {
|
|||||||
unsigned long jiffies;
|
unsigned long jiffies;
|
||||||
s8 rts_cts_rate_idx, alt_retry_rate_idx;
|
s8 rts_cts_rate_idx, alt_retry_rate_idx;
|
||||||
u8 retry_limit;
|
u8 retry_limit;
|
||||||
u8 icv_len;
|
|
||||||
u8 iv_len;
|
|
||||||
} control;
|
} control;
|
||||||
struct {
|
struct {
|
||||||
u64 ampdu_ack_map;
|
u64 ampdu_ack_map;
|
||||||
@ -635,6 +633,8 @@ enum ieee80211_key_flags {
|
|||||||
*/
|
*/
|
||||||
struct ieee80211_key_conf {
|
struct ieee80211_key_conf {
|
||||||
enum ieee80211_key_alg alg;
|
enum ieee80211_key_alg alg;
|
||||||
|
u8 icv_len;
|
||||||
|
u8 iv_len;
|
||||||
u8 hw_key_idx;
|
u8 hw_key_idx;
|
||||||
u8 flags;
|
u8 flags;
|
||||||
s8 keyidx;
|
s8 keyidx;
|
||||||
|
@ -281,6 +281,20 @@ struct ieee80211_key *ieee80211_key_alloc(enum ieee80211_key_alg alg,
|
|||||||
key->conf.alg = alg;
|
key->conf.alg = alg;
|
||||||
key->conf.keyidx = idx;
|
key->conf.keyidx = idx;
|
||||||
key->conf.keylen = key_len;
|
key->conf.keylen = key_len;
|
||||||
|
switch (alg) {
|
||||||
|
case ALG_WEP:
|
||||||
|
key->conf.iv_len = WEP_IV_LEN;
|
||||||
|
key->conf.icv_len = WEP_ICV_LEN;
|
||||||
|
break;
|
||||||
|
case ALG_TKIP:
|
||||||
|
key->conf.iv_len = TKIP_IV_LEN;
|
||||||
|
key->conf.icv_len = TKIP_ICV_LEN;
|
||||||
|
break;
|
||||||
|
case ALG_CCMP:
|
||||||
|
key->conf.iv_len = CCMP_HDR_LEN;
|
||||||
|
key->conf.icv_len = CCMP_MIC_LEN;
|
||||||
|
break;
|
||||||
|
}
|
||||||
memcpy(key->conf.key, key_data, key_len);
|
memcpy(key->conf.key, key_data, key_len);
|
||||||
INIT_LIST_HEAD(&key->list);
|
INIT_LIST_HEAD(&key->list);
|
||||||
INIT_LIST_HEAD(&key->todo);
|
INIT_LIST_HEAD(&key->todo);
|
||||||
|
@ -313,9 +313,6 @@ static int wep_encrypt_skb(struct ieee80211_tx_data *tx, struct sk_buff *skb)
|
|||||||
{
|
{
|
||||||
struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
|
struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
|
||||||
|
|
||||||
info->control.iv_len = WEP_IV_LEN;
|
|
||||||
info->control.icv_len = WEP_ICV_LEN;
|
|
||||||
|
|
||||||
if (!(tx->key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE)) {
|
if (!(tx->key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE)) {
|
||||||
if (ieee80211_wep_encrypt(tx->local, skb, tx->key))
|
if (ieee80211_wep_encrypt(tx->local, skb, tx->key))
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -152,9 +152,6 @@ static int tkip_encrypt_skb(struct ieee80211_tx_data *tx, struct sk_buff *skb)
|
|||||||
int len, tail;
|
int len, tail;
|
||||||
u8 *pos;
|
u8 *pos;
|
||||||
|
|
||||||
info->control.icv_len = TKIP_ICV_LEN;
|
|
||||||
info->control.iv_len = TKIP_IV_LEN;
|
|
||||||
|
|
||||||
if ((tx->key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE) &&
|
if ((tx->key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE) &&
|
||||||
!(tx->key->conf.flags & IEEE80211_KEY_FLAG_GENERATE_IV)) {
|
!(tx->key->conf.flags & IEEE80211_KEY_FLAG_GENERATE_IV)) {
|
||||||
/* hwaccel - with no need for preallocated room for IV/ICV */
|
/* hwaccel - with no need for preallocated room for IV/ICV */
|
||||||
@ -374,9 +371,6 @@ static int ccmp_encrypt_skb(struct ieee80211_tx_data *tx, struct sk_buff *skb)
|
|||||||
u8 *pos, *pn;
|
u8 *pos, *pn;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
info->control.icv_len = CCMP_MIC_LEN;
|
|
||||||
info->control.iv_len = CCMP_HDR_LEN;
|
|
||||||
|
|
||||||
if ((tx->key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE) &&
|
if ((tx->key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE) &&
|
||||||
!(tx->key->conf.flags & IEEE80211_KEY_FLAG_GENERATE_IV)) {
|
!(tx->key->conf.flags & IEEE80211_KEY_FLAG_GENERATE_IV)) {
|
||||||
/* hwaccel - with no need for preallocated room for CCMP "
|
/* hwaccel - with no need for preallocated room for CCMP "
|
||||||
|
Loading…
x
Reference in New Issue
Block a user