Skip to content

Commit

Permalink
Revert "mac80211: Skip tailroom reservation for full HW-crypto devices"
Browse files Browse the repository at this point in the history
This reverts commit aac6af5.

Conflicts:

	net/mac80211/key.c

That commit has a race that causes a warning, as documented in the thread
here:

	http://marc.info/?l=linux-wireless&m=130717684914101&w=2

Signed-off-by: John W. Linville <linville@tuxdriver.com>
  • Loading branch information
John W. Linville committed Jun 6, 2011
1 parent d2ac49f commit ab6a44c
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 23 deletions.
3 changes: 0 additions & 3 deletions net/mac80211/ieee80211_i.h
Original file line number Diff line number Diff line change
Expand Up @@ -775,9 +775,6 @@ struct ieee80211_local {

int tx_headroom; /* required headroom for hardware/radiotap */

/* count for keys needing tailroom space allocation */
int crypto_tx_tailroom_needed_cnt;

/* Tasklet and skb queue to process calls from IRQ mode. All frames
* added to skb_queue will be processed, but frames in
* skb_queue_unreliable may be dropped if the total length of these
Expand Down
21 changes: 2 additions & 19 deletions net/mac80211/key.c
Original file line number Diff line number Diff line change
Expand Up @@ -101,11 +101,6 @@ static int ieee80211_key_enable_hw_accel(struct ieee80211_key *key)

if (!ret) {
key->flags |= KEY_FLAG_UPLOADED_TO_HARDWARE;

if (!((key->conf.flags & IEEE80211_KEY_FLAG_GENERATE_MMIC) ||
(key->conf.flags & IEEE80211_KEY_FLAG_GENERATE_IV)))
key->local->crypto_tx_tailroom_needed_cnt--;

return 0;
}

Expand Down Expand Up @@ -161,10 +156,6 @@ static void ieee80211_key_disable_hw_accel(struct ieee80211_key *key)
key->conf.keyidx, sta ? sta->addr : bcast_addr, ret);

key->flags &= ~KEY_FLAG_UPLOADED_TO_HARDWARE;

if (!((key->conf.flags & IEEE80211_KEY_FLAG_GENERATE_MMIC) ||
(key->conf.flags & IEEE80211_KEY_FLAG_GENERATE_IV)))
key->local->crypto_tx_tailroom_needed_cnt++;
}

void ieee80211_key_removed(struct ieee80211_key_conf *key_conf)
Expand Down Expand Up @@ -403,10 +394,8 @@ static void __ieee80211_key_destroy(struct ieee80211_key *key)
ieee80211_aes_key_free(key->u.ccmp.tfm);
if (key->conf.cipher == WLAN_CIPHER_SUITE_AES_CMAC)
ieee80211_aes_cmac_key_free(key->u.aes_cmac.tfm);
if (key->local) {
if (key->local)
ieee80211_debugfs_key_remove(key);
key->local->crypto_tx_tailroom_needed_cnt--;
}

kfree(key);
}
Expand Down Expand Up @@ -468,8 +457,6 @@ int ieee80211_key_link(struct ieee80211_key *key,

ieee80211_debugfs_key_add(key);

key->local->crypto_tx_tailroom_needed_cnt++;

ret = ieee80211_key_enable_hw_accel(key);

mutex_unlock(&sdata->local->key_mtx);
Expand Down Expand Up @@ -511,12 +498,8 @@ void ieee80211_enable_keys(struct ieee80211_sub_if_data *sdata)

mutex_lock(&sdata->local->key_mtx);

sdata->local->crypto_tx_tailroom_needed_cnt = 0;

list_for_each_entry(key, &sdata->key_list, list) {
sdata->local->crypto_tx_tailroom_needed_cnt++;
list_for_each_entry(key, &sdata->key_list, list)
ieee80211_key_enable_hw_accel(key);
}

mutex_unlock(&sdata->local->key_mtx);
}
Expand Down
7 changes: 6 additions & 1 deletion net/mac80211/tx.c
Original file line number Diff line number Diff line change
Expand Up @@ -1480,7 +1480,12 @@ static int ieee80211_skb_resize(struct ieee80211_local *local,
{
int tail_need = 0;

if (may_encrypt && local->crypto_tx_tailroom_needed_cnt) {
/*
* This could be optimised, devices that do full hardware
* crypto (including TKIP MMIC) need no tailroom... But we
* have no drivers for such devices currently.
*/
if (may_encrypt) {
tail_need = IEEE80211_ENCRYPT_TAILROOM;
tail_need -= skb_tailroom(skb);
tail_need = max_t(int, tail_need, 0);
Expand Down

0 comments on commit ab6a44c

Please sign in to comment.