aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211
diff options
context:
space:
mode:
authorYogesh Ashok Powar <yogeshp@marvell.com>2011-04-27 09:10:29 -0400
committerJohn W. Linville <linville@tuxdriver.com>2011-04-28 14:53:21 -0400
commitaac6af5534fade2b18682a0b9efad1a6c04c34c6 (patch)
tree786840d7b3dc0ea942e91075ffe6f2cf5ba9d5d9 /net/mac80211
parente2186b7c25ef9cdb6d631c8dd6a672f41abe22d5 (diff)
mac80211: Skip tailroom reservation for full HW-crypto devices
In xmit path, devices that do full hardware crypto (including TKIP MMIC) need no tailroom. For such devices, tailroom reservation can be skipped if all the keys are programmed into the hardware (i.e software crypto is not used for any of the keys) and none of the keys wants software to generate Michael MIC. Signed-off-by: Yogesh Ashok Powar <yogeshp@marvell.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/mac80211')
-rw-r--r--net/mac80211/ieee80211_i.h3
-rw-r--r--net/mac80211/key.c19
-rw-r--r--net/mac80211/tx.c7
3 files changed, 21 insertions, 8 deletions
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
index 8d6d6e3d95da..9e3b4f0f31bd 100644
--- a/net/mac80211/ieee80211_i.h
+++ b/net/mac80211/ieee80211_i.h
@@ -766,6 +766,9 @@ struct ieee80211_local {
766 766
767 int tx_headroom; /* required headroom for hardware/radiotap */ 767 int tx_headroom; /* required headroom for hardware/radiotap */
768 768
769 /* count for keys needing tailroom space allocation */
770 int crypto_tx_tailroom_needed_cnt;
771
769 /* Tasklet and skb queue to process calls from IRQ mode. All frames 772 /* Tasklet and skb queue to process calls from IRQ mode. All frames
770 * added to skb_queue will be processed, but frames in 773 * added to skb_queue will be processed, but frames in
771 * skb_queue_unreliable may be dropped if the total length of these 774 * skb_queue_unreliable may be dropped if the total length of these
diff --git a/net/mac80211/key.c b/net/mac80211/key.c
index af3c56482c80..ca3c626b011a 100644
--- a/net/mac80211/key.c
+++ b/net/mac80211/key.c
@@ -101,6 +101,10 @@ 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->local->crypto_tx_tailroom_needed_cnt--;
107
104 return 0; 108 return 0;
105 } 109 }
106 110
@@ -156,6 +160,9 @@ static void ieee80211_key_disable_hw_accel(struct ieee80211_key *key)
156 key->conf.keyidx, sta ? sta->addr : bcast_addr, ret); 160 key->conf.keyidx, sta ? sta->addr : bcast_addr, ret);
157 161
158 key->flags &= ~KEY_FLAG_UPLOADED_TO_HARDWARE; 162 key->flags &= ~KEY_FLAG_UPLOADED_TO_HARDWARE;
163
164 if (!(key->conf.flags & IEEE80211_KEY_FLAG_GENERATE_MMIC))
165 key->local->crypto_tx_tailroom_needed_cnt++;
159} 166}
160 167
161void ieee80211_key_removed(struct ieee80211_key_conf *key_conf) 168void ieee80211_key_removed(struct ieee80211_key_conf *key_conf)
@@ -388,8 +395,10 @@ static void __ieee80211_key_destroy(struct ieee80211_key *key)
388 ieee80211_aes_key_free(key->u.ccmp.tfm); 395 ieee80211_aes_key_free(key->u.ccmp.tfm);
389 if (key->conf.cipher == WLAN_CIPHER_SUITE_AES_CMAC) 396 if (key->conf.cipher == WLAN_CIPHER_SUITE_AES_CMAC)
390 ieee80211_aes_cmac_key_free(key->u.aes_cmac.tfm); 397 ieee80211_aes_cmac_key_free(key->u.aes_cmac.tfm);
391 if (key->local) 398 if (key->local) {
392 ieee80211_debugfs_key_remove(key); 399 ieee80211_debugfs_key_remove(key);
400 key->local->crypto_tx_tailroom_needed_cnt--;
401 }
393 402
394 kfree(key); 403 kfree(key);
395} 404}
@@ -451,6 +460,8 @@ int ieee80211_key_link(struct ieee80211_key *key,
451 460
452 ieee80211_debugfs_key_add(key); 461 ieee80211_debugfs_key_add(key);
453 462
463 key->local->crypto_tx_tailroom_needed_cnt++;
464
454 ret = ieee80211_key_enable_hw_accel(key); 465 ret = ieee80211_key_enable_hw_accel(key);
455 466
456 mutex_unlock(&sdata->local->key_mtx); 467 mutex_unlock(&sdata->local->key_mtx);
@@ -492,8 +503,12 @@ void ieee80211_enable_keys(struct ieee80211_sub_if_data *sdata)
492 503
493 mutex_lock(&sdata->local->key_mtx); 504 mutex_lock(&sdata->local->key_mtx);
494 505
495 list_for_each_entry(key, &sdata->key_list, list) 506 sdata->local->crypto_tx_tailroom_needed_cnt = 0;
507
508 list_for_each_entry(key, &sdata->key_list, list) {
509 sdata->local->crypto_tx_tailroom_needed_cnt++;
496 ieee80211_key_enable_hw_accel(key); 510 ieee80211_key_enable_hw_accel(key);
511 }
497 512
498 mutex_unlock(&sdata->local->key_mtx); 513 mutex_unlock(&sdata->local->key_mtx);
499} 514}
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
index a2043e405493..e3e3aa173af0 100644
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -1476,12 +1476,7 @@ static int ieee80211_skb_resize(struct ieee80211_local *local,
1476{ 1476{
1477 int tail_need = 0; 1477 int tail_need = 0;
1478 1478
1479 /* 1479 if (may_encrypt && local->crypto_tx_tailroom_needed_cnt) {
1480 * This could be optimised, devices that do full hardware
1481 * crypto (including TKIP MMIC) need no tailroom... But we
1482 * have no drivers for such devices currently.
1483 */
1484 if (may_encrypt) {
1485 tail_need = IEEE80211_ENCRYPT_TAILROOM; 1480 tail_need = IEEE80211_ENCRYPT_TAILROOM;
1486 tail_need -= skb_tailroom(skb); 1481 tail_need -= skb_tailroom(skb);
1487 tail_need = max_t(int, tail_need, 0); 1482 tail_need = max_t(int, tail_need, 0);