Skip to content

Commit 3e47bf1

Browse files
alexw65500jmberg-intel
authored andcommitted
mac80211: Simplify Extended Key ID API
1) Drop IEEE80211_HW_EXT_KEY_ID_NATIVE and let drivers directly set the NL80211_EXT_FEATURE_EXT_KEY_ID flag. 2) Drop IEEE80211_HW_NO_AMPDU_KEYBORDER_SUPPORT and simply assume all drivers are unable to handle A-MPDU key borders. The new Extended Key ID API now requires all mac80211 drivers to set NL80211_EXT_FEATURE_EXT_KEY_ID when they implement set_key() and can handle Extended Key ID. For drivers not providing set_key() mac80211 itself enables Extended Key ID support, using the internal SW crypto services. Signed-off-by: Alexander Wetzel <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Johannes Berg <[email protected]>
1 parent 5d29050 commit 3e47bf1

File tree

4 files changed

+14
-32
lines changed

4 files changed

+14
-32
lines changed

include/net/mac80211.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2268,12 +2268,6 @@ struct ieee80211_txq {
22682268
* @IEEE80211_HW_SUPPORTS_ONLY_HE_MULTI_BSSID: Hardware supports multi BSSID
22692269
* only for HE APs. Applies if @IEEE80211_HW_SUPPORTS_MULTI_BSSID is set.
22702270
*
2271-
* @IEEE80211_HW_EXT_KEY_ID_NATIVE: Driver and hardware are supporting Extended
2272-
* Key ID and can handle two unicast keys per station for Rx and Tx.
2273-
*
2274-
* @IEEE80211_HW_NO_AMPDU_KEYBORDER_SUPPORT: The card/driver can't handle
2275-
* active Tx A-MPDU sessions with Extended Key IDs during rekey.
2276-
*
22772271
* @NUM_IEEE80211_HW_FLAGS: number of hardware flags, used for sizing arrays
22782272
*/
22792273
enum ieee80211_hw_flags {
@@ -2325,8 +2319,6 @@ enum ieee80211_hw_flags {
23252319
IEEE80211_HW_TX_STATUS_NO_AMPDU_LEN,
23262320
IEEE80211_HW_SUPPORTS_MULTI_BSSID,
23272321
IEEE80211_HW_SUPPORTS_ONLY_HE_MULTI_BSSID,
2328-
IEEE80211_HW_EXT_KEY_ID_NATIVE,
2329-
IEEE80211_HW_NO_AMPDU_KEYBORDER_SUPPORT,
23302322

23312323
/* keep last, obviously */
23322324
NUM_IEEE80211_HW_FLAGS

net/mac80211/debugfs.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -271,8 +271,6 @@ static const char *hw_flag_names[] = {
271271
FLAG(TX_STATUS_NO_AMPDU_LEN),
272272
FLAG(SUPPORTS_MULTI_BSSID),
273273
FLAG(SUPPORTS_ONLY_HE_MULTI_BSSID),
274-
FLAG(EXT_KEY_ID_NATIVE),
275-
FLAG(NO_AMPDU_KEYBORDER_SUPPORT),
276274
#undef FLAG
277275
};
278276

net/mac80211/key.c

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -270,8 +270,7 @@ int ieee80211_set_tx_key(struct ieee80211_key *key)
270270

271271
sta->ptk_idx = key->conf.keyidx;
272272

273-
if (ieee80211_hw_check(&local->hw, NO_AMPDU_KEYBORDER_SUPPORT))
274-
clear_sta_flag(sta, WLAN_STA_BLOCK_BA);
273+
clear_sta_flag(sta, WLAN_STA_BLOCK_BA);
275274
ieee80211_check_fast_xmit(sta);
276275

277276
return 0;
@@ -289,16 +288,15 @@ static void ieee80211_pairwise_rekey(struct ieee80211_key *old,
289288
if (new->conf.flags & IEEE80211_KEY_FLAG_NO_AUTO_TX) {
290289
/* Extended Key ID key install, initial one or rekey */
291290

292-
if (sta->ptk_idx != INVALID_PTK_KEYIDX &&
293-
ieee80211_hw_check(&local->hw,
294-
NO_AMPDU_KEYBORDER_SUPPORT)) {
291+
if (sta->ptk_idx != INVALID_PTK_KEYIDX) {
295292
/* Aggregation Sessions with Extended Key ID must not
296293
* mix MPDUs with different keyIDs within one A-MPDU.
297-
* Tear down any running Tx aggregation and all new
298-
* Rx/Tx aggregation request during rekey if the driver
299-
* asks us to do so. (Blocking Tx only would be
300-
* sufficient but WLAN_STA_BLOCK_BA gets the job done
301-
* for the few ms we need it.)
294+
* Tear down running Tx aggregation sessions and block
295+
* new Rx/Tx aggregation requests during rekey to
296+
* ensure there are no A-MPDUs for the driver to
297+
* aggregate. (Blocking Tx only would be sufficient but
298+
* WLAN_STA_BLOCK_BA gets the job done for the few ms
299+
* we need it.)
302300
*/
303301
set_sta_flag(sta, WLAN_STA_BLOCK_BA);
304302
mutex_lock(&sta->ampdu_mlme.mtx);

net/mac80211/main.c

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1048,21 +1048,15 @@ int ieee80211_register_hw(struct ieee80211_hw *hw)
10481048
}
10491049
}
10501050

1051-
/* Enable Extended Key IDs when driver allowed it, or when it
1052-
* supports neither HW crypto nor A-MPDUs
1051+
/* Mac80211 and therefore all drivers using SW crypto only
1052+
* are able to handle PTK rekeys and Extended Key ID.
10531053
*/
1054-
if ((!local->ops->set_key &&
1055-
!ieee80211_hw_check(hw, AMPDU_AGGREGATION)) ||
1056-
ieee80211_hw_check(&local->hw, EXT_KEY_ID_NATIVE))
1057-
wiphy_ext_feature_set(local->hw.wiphy,
1058-
NL80211_EXT_FEATURE_EXT_KEY_ID);
1059-
1060-
/* Mac80211 and therefore all cards only using SW crypto are able to
1061-
* handle PTK rekeys correctly
1062-
*/
1063-
if (!local->ops->set_key)
1054+
if (!local->ops->set_key) {
10641055
wiphy_ext_feature_set(local->hw.wiphy,
10651056
NL80211_EXT_FEATURE_CAN_REPLACE_PTK0);
1057+
wiphy_ext_feature_set(local->hw.wiphy,
1058+
NL80211_EXT_FEATURE_EXT_KEY_ID);
1059+
}
10661060

10671061
/*
10681062
* Calculate scan IE length -- we need this to alloc

0 commit comments

Comments
 (0)