From: Johannes Berg Keys that are only used for RX as well as management-only keys don't need to have tailroom added to data frames (we already add tailroom to all management frames), so don't count them. This avoids allocating tailroom for every frame just because a management key would need it. Reviewed-by: Miriam Rachel Korenblit Signed-off-by: Johannes Berg --- net/mac80211/key.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/net/mac80211/key.c b/net/mac80211/key.c index 8d04fba60e17..436a165d0b91 100644 --- a/net/mac80211/key.c +++ b/net/mac80211/key.c @@ -93,6 +93,19 @@ static void decrease_tailroom_need_count(struct ieee80211_sub_if_data *sdata) static bool ieee80211_key_needs_tailroom(struct ieee80211_key *key) { + /* non-pairwise keys from a station are only for RX */ + if (key->sta && !(key->conf.flags & IEEE80211_KEY_FLAG_PAIRWISE)) + return false; + + /* management frames always have tailroom reserved */ + switch (key->conf.cipher) { + 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: + return false; + } + if (key->conf.flags & (IEEE80211_KEY_FLAG_GENERATE_MMIC | IEEE80211_KEY_FLAG_PUT_MIC_SPACE | IEEE80211_KEY_FLAG_RESERVE_TAILROOM)) -- 2.56.0