diff options
author | Alexander Wetzel <alexander@wetzel-home.de> | 2019-06-29 15:50:13 -0400 |
---|---|---|
committer | Johannes Berg <johannes.berg@intel.com> | 2019-07-26 07:28:59 -0400 |
commit | 3e47bf1ca4c363ba8b1f99c4c3dcda13d2979954 (patch) | |
tree | bae4421aca28d386485e5fc0a6d32c82c0bca7e6 | |
parent | 5d29050b409d961df34a7290270ba53f0c025152 (diff) |
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 <alexander@wetzel-home.de>
Link: https://lore.kernel.org/r/20190629195015.19680-2-alexander@wetzel-home.de
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
-rw-r--r-- | include/net/mac80211.h | 8 | ||||
-rw-r--r-- | net/mac80211/debugfs.c | 2 | ||||
-rw-r--r-- | net/mac80211/key.c | 18 | ||||
-rw-r--r-- | net/mac80211/main.c | 18 |
4 files changed, 14 insertions, 32 deletions
diff --git a/include/net/mac80211.h b/include/net/mac80211.h index fbe1c29e3349..58941893a13f 100644 --- a/include/net/mac80211.h +++ b/include/net/mac80211.h | |||
@@ -2268,12 +2268,6 @@ struct ieee80211_txq { | |||
2268 | * @IEEE80211_HW_SUPPORTS_ONLY_HE_MULTI_BSSID: Hardware supports multi BSSID | 2268 | * @IEEE80211_HW_SUPPORTS_ONLY_HE_MULTI_BSSID: Hardware supports multi BSSID |
2269 | * only for HE APs. Applies if @IEEE80211_HW_SUPPORTS_MULTI_BSSID is set. | 2269 | * only for HE APs. Applies if @IEEE80211_HW_SUPPORTS_MULTI_BSSID is set. |
2270 | * | 2270 | * |
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 | * | ||
2277 | * @NUM_IEEE80211_HW_FLAGS: number of hardware flags, used for sizing arrays | 2271 | * @NUM_IEEE80211_HW_FLAGS: number of hardware flags, used for sizing arrays |
2278 | */ | 2272 | */ |
2279 | enum ieee80211_hw_flags { | 2273 | enum ieee80211_hw_flags { |
@@ -2325,8 +2319,6 @@ enum ieee80211_hw_flags { | |||
2325 | IEEE80211_HW_TX_STATUS_NO_AMPDU_LEN, | 2319 | IEEE80211_HW_TX_STATUS_NO_AMPDU_LEN, |
2326 | IEEE80211_HW_SUPPORTS_MULTI_BSSID, | 2320 | IEEE80211_HW_SUPPORTS_MULTI_BSSID, |
2327 | IEEE80211_HW_SUPPORTS_ONLY_HE_MULTI_BSSID, | 2321 | IEEE80211_HW_SUPPORTS_ONLY_HE_MULTI_BSSID, |
2328 | IEEE80211_HW_EXT_KEY_ID_NATIVE, | ||
2329 | IEEE80211_HW_NO_AMPDU_KEYBORDER_SUPPORT, | ||
2330 | 2322 | ||
2331 | /* keep last, obviously */ | 2323 | /* keep last, obviously */ |
2332 | NUM_IEEE80211_HW_FLAGS | 2324 | NUM_IEEE80211_HW_FLAGS |
diff --git a/net/mac80211/debugfs.c b/net/mac80211/debugfs.c index 2e7f75938c51..47435f57e086 100644 --- a/net/mac80211/debugfs.c +++ b/net/mac80211/debugfs.c | |||
@@ -271,8 +271,6 @@ static const char *hw_flag_names[] = { | |||
271 | FLAG(TX_STATUS_NO_AMPDU_LEN), | 271 | FLAG(TX_STATUS_NO_AMPDU_LEN), |
272 | FLAG(SUPPORTS_MULTI_BSSID), | 272 | FLAG(SUPPORTS_MULTI_BSSID), |
273 | FLAG(SUPPORTS_ONLY_HE_MULTI_BSSID), | 273 | FLAG(SUPPORTS_ONLY_HE_MULTI_BSSID), |
274 | FLAG(EXT_KEY_ID_NATIVE), | ||
275 | FLAG(NO_AMPDU_KEYBORDER_SUPPORT), | ||
276 | #undef FLAG | 274 | #undef FLAG |
277 | }; | 275 | }; |
278 | 276 | ||
diff --git a/net/mac80211/key.c b/net/mac80211/key.c index dd60f6428049..92c3affb0eb0 100644 --- a/net/mac80211/key.c +++ b/net/mac80211/key.c | |||
@@ -270,8 +270,7 @@ int ieee80211_set_tx_key(struct ieee80211_key *key) | |||
270 | 270 | ||
271 | sta->ptk_idx = key->conf.keyidx; | 271 | sta->ptk_idx = key->conf.keyidx; |
272 | 272 | ||
273 | if (ieee80211_hw_check(&local->hw, NO_AMPDU_KEYBORDER_SUPPORT)) | 273 | clear_sta_flag(sta, WLAN_STA_BLOCK_BA); |
274 | clear_sta_flag(sta, WLAN_STA_BLOCK_BA); | ||
275 | ieee80211_check_fast_xmit(sta); | 274 | ieee80211_check_fast_xmit(sta); |
276 | 275 | ||
277 | return 0; | 276 | return 0; |
@@ -289,16 +288,15 @@ static void ieee80211_pairwise_rekey(struct ieee80211_key *old, | |||
289 | if (new->conf.flags & IEEE80211_KEY_FLAG_NO_AUTO_TX) { | 288 | if (new->conf.flags & IEEE80211_KEY_FLAG_NO_AUTO_TX) { |
290 | /* Extended Key ID key install, initial one or rekey */ | 289 | /* Extended Key ID key install, initial one or rekey */ |
291 | 290 | ||
292 | if (sta->ptk_idx != INVALID_PTK_KEYIDX && | 291 | if (sta->ptk_idx != INVALID_PTK_KEYIDX) { |
293 | ieee80211_hw_check(&local->hw, | ||
294 | NO_AMPDU_KEYBORDER_SUPPORT)) { | ||
295 | /* Aggregation Sessions with Extended Key ID must not | 292 | /* Aggregation Sessions with Extended Key ID must not |
296 | * mix MPDUs with different keyIDs within one A-MPDU. | 293 | * mix MPDUs with different keyIDs within one A-MPDU. |
297 | * Tear down any running Tx aggregation and all new | 294 | * Tear down running Tx aggregation sessions and block |
298 | * Rx/Tx aggregation request during rekey if the driver | 295 | * new Rx/Tx aggregation requests during rekey to |
299 | * asks us to do so. (Blocking Tx only would be | 296 | * ensure there are no A-MPDUs for the driver to |
300 | * sufficient but WLAN_STA_BLOCK_BA gets the job done | 297 | * aggregate. (Blocking Tx only would be sufficient but |
301 | * for the few ms we need it.) | 298 | * WLAN_STA_BLOCK_BA gets the job done for the few ms |
299 | * we need it.) | ||
302 | */ | 300 | */ |
303 | set_sta_flag(sta, WLAN_STA_BLOCK_BA); | 301 | set_sta_flag(sta, WLAN_STA_BLOCK_BA); |
304 | mutex_lock(&sta->ampdu_mlme.mtx); | 302 | mutex_lock(&sta->ampdu_mlme.mtx); |
diff --git a/net/mac80211/main.c b/net/mac80211/main.c index 4c2702f128f3..29b9d57df1a3 100644 --- a/net/mac80211/main.c +++ b/net/mac80211/main.c | |||
@@ -1048,21 +1048,15 @@ int ieee80211_register_hw(struct ieee80211_hw *hw) | |||
1048 | } | 1048 | } |
1049 | } | 1049 | } |
1050 | 1050 | ||
1051 | /* Enable Extended Key IDs when driver allowed it, or when it | 1051 | /* Mac80211 and therefore all drivers using SW crypto only |
1052 | * supports neither HW crypto nor A-MPDUs | 1052 | * are able to handle PTK rekeys and Extended Key ID. |
1053 | */ | 1053 | */ |
1054 | if ((!local->ops->set_key && | 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) | ||
1064 | wiphy_ext_feature_set(local->hw.wiphy, | 1055 | wiphy_ext_feature_set(local->hw.wiphy, |
1065 | NL80211_EXT_FEATURE_CAN_REPLACE_PTK0); | 1056 | NL80211_EXT_FEATURE_CAN_REPLACE_PTK0); |
1057 | wiphy_ext_feature_set(local->hw.wiphy, | ||
1058 | NL80211_EXT_FEATURE_EXT_KEY_ID); | ||
1059 | } | ||
1066 | 1060 | ||
1067 | /* | 1061 | /* |
1068 | * Calculate scan IE length -- we need this to alloc | 1062 | * Calculate scan IE length -- we need this to alloc |