summaryrefslogtreecommitdiffstats
path: root/net/mac80211/tx.c
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2015-04-10 14:03:17 +0200
committerJohannes Berg <johannes.berg@intel.com>2015-04-22 10:07:37 +0200
commite495c24731a2651fc2c1c7feedc8ba3b31f6b5d4 (patch)
tree4de1853ef9c79953f4f25966b26a72e27f5a03d9 /net/mac80211/tx.c
parent725b812c839643639d6135b1f7fb41e48de465a4 (diff)
downloadop-kernel-dev-e495c24731a2651fc2c1c7feedc8ba3b31f6b5d4.zip
op-kernel-dev-e495c24731a2651fc2c1c7feedc8ba3b31f6b5d4.tar.gz
mac80211: extend fast-xmit for more ciphers
When crypto is offloaded then in some cases it's all handled by the device, and in others only some space for the IV must be reserved in the frame. Handle both of these cases in the fast-xmit path, up to a limit of 18 bytes of space for IVs. Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net/mac80211/tx.c')
-rw-r--r--net/mac80211/tx.c40
1 files changed, 37 insertions, 3 deletions
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
index d983683..39e80c3 100644
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -2535,10 +2535,11 @@ void ieee80211_check_fast_xmit(struct sta_info *sta)
if (!build.key)
build.key = rcu_access_pointer(sdata->default_unicast_key);
if (build.key) {
- bool gen_iv, iv_spc;
+ bool gen_iv, iv_spc, mmic;
gen_iv = build.key->conf.flags & IEEE80211_KEY_FLAG_GENERATE_IV;
iv_spc = build.key->conf.flags & IEEE80211_KEY_FLAG_PUT_IV_SPACE;
+ mmic = build.key->conf.flags & IEEE80211_KEY_FLAG_GENERATE_MMIC;
/* don't handle software crypto */
if (!(build.key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE))
@@ -2567,9 +2568,42 @@ void ieee80211_check_fast_xmit(struct sta_info *sta)
if (gen_iv || iv_spc)
build.hdr_len += IEEE80211_GCMP_HDR_LEN;
break;
- default:
- /* don't do fast-xmit for these ciphers (yet) */
+ case WLAN_CIPHER_SUITE_TKIP:
+ /* cannot handle MMIC or IV generation in xmit-fast */
+ if (mmic || gen_iv)
+ goto out;
+ if (iv_spc)
+ build.hdr_len += IEEE80211_TKIP_IV_LEN;
+ break;
+ case WLAN_CIPHER_SUITE_WEP40:
+ case WLAN_CIPHER_SUITE_WEP104:
+ /* cannot handle IV generation in fast-xmit */
+ if (gen_iv)
+ goto out;
+ if (iv_spc)
+ build.hdr_len += IEEE80211_WEP_IV_LEN;
+ break;
+ case WLAN_CIPHER_SUITE_AES_CMAC:
+ case WLAN_CIPHER_SUITE_BIP_CMAC_256:
+ case WLAN_CIPHER_SUITE_BIP_GMAC_128:
+ case WLAN_CIPHER_SUITE_BIP_GMAC_256:
+ WARN(1,
+ "management cipher suite 0x%x enabled for data\n",
+ build.key->conf.cipher);
goto out;
+ default:
+ /* we don't know how to generate IVs for this at all */
+ if (WARN_ON(gen_iv))
+ goto out;
+ /* pure hardware keys are OK, of course */
+ if (!(build.key->flags & KEY_FLAG_CIPHER_SCHEME))
+ break;
+ /* cipher scheme might require space allocation */
+ if (iv_spc &&
+ build.key->conf.iv_len > IEEE80211_FAST_XMIT_MAX_IV)
+ goto out;
+ if (iv_spc)
+ build.hdr_len += build.key->conf.iv_len;
}
fc |= cpu_to_le16(IEEE80211_FCTL_PROTECTED);
OpenPOWER on IntegriCloud