aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211/key.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/mac80211/key.c')
-rw-r--r--net/mac80211/key.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/net/mac80211/key.c b/net/mac80211/key.c
index af3c56482c80..b510721e3b3d 100644
--- a/net/mac80211/key.c
+++ b/net/mac80211/key.c
@@ -101,6 +101,11 @@ static int ieee80211_key_enable_hw_accel(struct ieee80211_key *key)
101 101
102 if (!ret) { 102 if (!ret) {
103 key->flags |= KEY_FLAG_UPLOADED_TO_HARDWARE; 103 key->flags |= KEY_FLAG_UPLOADED_TO_HARDWARE;
104
105 if (!((key->conf.flags & IEEE80211_KEY_FLAG_GENERATE_MMIC) ||
106 (key->conf.flags & IEEE80211_KEY_FLAG_GENERATE_IV)))
107 key->local->crypto_tx_tailroom_needed_cnt--;
108
104 return 0; 109 return 0;
105 } 110 }
106 111
@@ -156,6 +161,10 @@ static void ieee80211_key_disable_hw_accel(struct ieee80211_key *key)
156 key->conf.keyidx, sta ? sta->addr : bcast_addr, ret); 161 key->conf.keyidx, sta ? sta->addr : bcast_addr, ret);
157 162
158 key->flags &= ~KEY_FLAG_UPLOADED_TO_HARDWARE; 163 key->flags &= ~KEY_FLAG_UPLOADED_TO_HARDWARE;
164
165 if (!((key->conf.flags & IEEE80211_KEY_FLAG_GENERATE_MMIC) ||
166 (key->conf.flags & IEEE80211_KEY_FLAG_GENERATE_IV)))
167 key->local->crypto_tx_tailroom_needed_cnt++;
159} 168}
160 169
161void ieee80211_key_removed(struct ieee80211_key_conf *key_conf) 170void ieee80211_key_removed(struct ieee80211_key_conf *key_conf)
@@ -388,8 +397,10 @@ static void __ieee80211_key_destroy(struct ieee80211_key *key)
388 ieee80211_aes_key_free(key->u.ccmp.tfm); 397 ieee80211_aes_key_free(key->u.ccmp.tfm);
389 if (key->conf.cipher == WLAN_CIPHER_SUITE_AES_CMAC) 398 if (key->conf.cipher == WLAN_CIPHER_SUITE_AES_CMAC)
390 ieee80211_aes_cmac_key_free(key->u.aes_cmac.tfm); 399 ieee80211_aes_cmac_key_free(key->u.aes_cmac.tfm);
391 if (key->local) 400 if (key->local) {
392 ieee80211_debugfs_key_remove(key); 401 ieee80211_debugfs_key_remove(key);
402 key->local->crypto_tx_tailroom_needed_cnt--;
403 }
393 404
394 kfree(key); 405 kfree(key);
395} 406}
@@ -451,6 +462,8 @@ int ieee80211_key_link(struct ieee80211_key *key,
451 462
452 ieee80211_debugfs_key_add(key); 463 ieee80211_debugfs_key_add(key);
453 464
465 key->local->crypto_tx_tailroom_needed_cnt++;
466
454 ret = ieee80211_key_enable_hw_accel(key); 467 ret = ieee80211_key_enable_hw_accel(key);
455 468
456 mutex_unlock(&sdata->local->key_mtx); 469 mutex_unlock(&sdata->local->key_mtx);
@@ -492,8 +505,12 @@ void ieee80211_enable_keys(struct ieee80211_sub_if_data *sdata)
492 505
493 mutex_lock(&sdata->local->key_mtx); 506 mutex_lock(&sdata->local->key_mtx);
494 507
495 list_for_each_entry(key, &sdata->key_list, list) 508 sdata->local->crypto_tx_tailroom_needed_cnt = 0;
509
510 list_for_each_entry(key, &sdata->key_list, list) {
511 sdata->local->crypto_tx_tailroom_needed_cnt++;
496 ieee80211_key_enable_hw_accel(key); 512 ieee80211_key_enable_hw_accel(key);
513 }
497 514
498 mutex_unlock(&sdata->local->key_mtx); 515 mutex_unlock(&sdata->local->key_mtx);
499} 516}