mac80211: AMPDU handling for rekeys with Extended Key ID
authorAlexander Wetzel <alexander@wetzel-home.de>
Sat, 29 Jun 2019 19:50:14 +0000 (21:50 +0200)
committerJohannes Berg <johannes.berg@intel.com>
Fri, 26 Jul 2019 11:29:10 +0000 (13:29 +0200)
Extended Key ID allows A-MPDU sessions while rekeying as long as each
A-MPDU aggregates only MPDUs with one keyid together.

Drivers able to segregate MPDUs accordingly can tell mac80211 to not
stop A-MPDU sessions when rekeying by setting the new flag
IEEE80211_HW_AMPDU_KEYBORDER_SUPPORT.

Signed-off-by: Alexander Wetzel <alexander@wetzel-home.de>
Link: https://lore.kernel.org/r/20190629195015.19680-3-alexander@wetzel-home.de
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
include/net/mac80211.h
net/mac80211/debugfs.c
net/mac80211/key.c

index 58941893a13f118cc74b87310d039c4dd1db0aa2..0187d84031fcb860905bd240eca4452b20f12731 100644 (file)
@@ -2268,6 +2268,10 @@ struct ieee80211_txq {
  * @IEEE80211_HW_SUPPORTS_ONLY_HE_MULTI_BSSID: Hardware supports multi BSSID
  *     only for HE APs. Applies if @IEEE80211_HW_SUPPORTS_MULTI_BSSID is set.
  *
+ * @IEEE80211_HW_AMPDU_KEYBORDER_SUPPORT: The card and driver is only
+ *     aggregating MPDUs with the same keyid, allowing mac80211 to keep Tx
+ *     A-MPDU sessions active while rekeying with Extended Key ID.
+ *
  * @NUM_IEEE80211_HW_FLAGS: number of hardware flags, used for sizing arrays
  */
 enum ieee80211_hw_flags {
@@ -2319,6 +2323,7 @@ enum ieee80211_hw_flags {
        IEEE80211_HW_TX_STATUS_NO_AMPDU_LEN,
        IEEE80211_HW_SUPPORTS_MULTI_BSSID,
        IEEE80211_HW_SUPPORTS_ONLY_HE_MULTI_BSSID,
+       IEEE80211_HW_AMPDU_KEYBORDER_SUPPORT,
 
        /* keep last, obviously */
        NUM_IEEE80211_HW_FLAGS
index 47435f57e086b82d73974bad68cc1ed52fea6af6..568b3b276931416310b70774e4c5a32616ccba28 100644 (file)
@@ -271,6 +271,7 @@ static const char *hw_flag_names[] = {
        FLAG(TX_STATUS_NO_AMPDU_LEN),
        FLAG(SUPPORTS_MULTI_BSSID),
        FLAG(SUPPORTS_ONLY_HE_MULTI_BSSID),
+       FLAG(AMPDU_KEYBORDER_SUPPORT),
 #undef FLAG
 };
 
index 92c3affb0eb0b853c8ba77e314125b986abad95c..7dfee848abac0e7116cc749a0835d1058c8ce9c3 100644 (file)
@@ -270,7 +270,8 @@ int ieee80211_set_tx_key(struct ieee80211_key *key)
 
        sta->ptk_idx = key->conf.keyidx;
 
-       clear_sta_flag(sta, WLAN_STA_BLOCK_BA);
+       if (!ieee80211_hw_check(&local->hw, AMPDU_KEYBORDER_SUPPORT))
+               clear_sta_flag(sta, WLAN_STA_BLOCK_BA);
        ieee80211_check_fast_xmit(sta);
 
        return 0;
@@ -288,15 +289,16 @@ static void ieee80211_pairwise_rekey(struct ieee80211_key *old,
        if (new->conf.flags & IEEE80211_KEY_FLAG_NO_AUTO_TX) {
                /* Extended Key ID key install, initial one or rekey */
 
-               if (sta->ptk_idx != INVALID_PTK_KEYIDX) {
+               if (sta->ptk_idx != INVALID_PTK_KEYIDX &&
+                   !ieee80211_hw_check(&local->hw, AMPDU_KEYBORDER_SUPPORT)) {
                        /* Aggregation Sessions with Extended Key ID must not
                         * mix MPDUs with different keyIDs within one A-MPDU.
                         * Tear down running Tx aggregation sessions and block
                         * new Rx/Tx aggregation requests during rekey to
-                        * ensure there are no A-MPDUs for the driver to
-                        * aggregate. (Blocking Tx only would be sufficient but
-                        * WLAN_STA_BLOCK_BA gets the job done for the few ms
-                        * we need it.)
+                        * ensure there are no A-MPDUs when the driver is not
+                        * supporting A-MPDU key borders. (Blocking Tx only
+                        * would be sufficient but WLAN_STA_BLOCK_BA gets the
+                        * job done for the few ms we need it.)
                         */
                        set_sta_flag(sta, WLAN_STA_BLOCK_BA);
                        mutex_lock(&sta->ampdu_mlme.mtx);