Commit 3e47bf1c authored by Alexander Wetzel's avatar Alexander Wetzel Committed by Johannes Berg

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: default avatarAlexander Wetzel <alexander@wetzel-home.de>
Link: https://lore.kernel.org/r/20190629195015.19680-2-alexander@wetzel-home.deSigned-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
parent 5d29050b
...@@ -2268,12 +2268,6 @@ struct ieee80211_txq { ...@@ -2268,12 +2268,6 @@ struct ieee80211_txq {
* @IEEE80211_HW_SUPPORTS_ONLY_HE_MULTI_BSSID: Hardware supports multi BSSID * @IEEE80211_HW_SUPPORTS_ONLY_HE_MULTI_BSSID: Hardware supports multi BSSID
* only for HE APs. Applies if @IEEE80211_HW_SUPPORTS_MULTI_BSSID is set. * only for HE APs. Applies if @IEEE80211_HW_SUPPORTS_MULTI_BSSID is set.
* *
* @IEEE80211_HW_EXT_KEY_ID_NATIVE: Driver and hardware are supporting Extended
* Key ID and can handle two unicast keys per station for Rx and Tx.
*
* @IEEE80211_HW_NO_AMPDU_KEYBORDER_SUPPORT: The card/driver can't handle
* active Tx A-MPDU sessions with Extended Key IDs during rekey.
*
* @NUM_IEEE80211_HW_FLAGS: number of hardware flags, used for sizing arrays * @NUM_IEEE80211_HW_FLAGS: number of hardware flags, used for sizing arrays
*/ */
enum ieee80211_hw_flags { enum ieee80211_hw_flags {
...@@ -2325,8 +2319,6 @@ enum ieee80211_hw_flags { ...@@ -2325,8 +2319,6 @@ enum ieee80211_hw_flags {
IEEE80211_HW_TX_STATUS_NO_AMPDU_LEN, IEEE80211_HW_TX_STATUS_NO_AMPDU_LEN,
IEEE80211_HW_SUPPORTS_MULTI_BSSID, IEEE80211_HW_SUPPORTS_MULTI_BSSID,
IEEE80211_HW_SUPPORTS_ONLY_HE_MULTI_BSSID, IEEE80211_HW_SUPPORTS_ONLY_HE_MULTI_BSSID,
IEEE80211_HW_EXT_KEY_ID_NATIVE,
IEEE80211_HW_NO_AMPDU_KEYBORDER_SUPPORT,
/* keep last, obviously */ /* keep last, obviously */
NUM_IEEE80211_HW_FLAGS NUM_IEEE80211_HW_FLAGS
......
...@@ -271,8 +271,6 @@ static const char *hw_flag_names[] = { ...@@ -271,8 +271,6 @@ static const char *hw_flag_names[] = {
FLAG(TX_STATUS_NO_AMPDU_LEN), FLAG(TX_STATUS_NO_AMPDU_LEN),
FLAG(SUPPORTS_MULTI_BSSID), FLAG(SUPPORTS_MULTI_BSSID),
FLAG(SUPPORTS_ONLY_HE_MULTI_BSSID), FLAG(SUPPORTS_ONLY_HE_MULTI_BSSID),
FLAG(EXT_KEY_ID_NATIVE),
FLAG(NO_AMPDU_KEYBORDER_SUPPORT),
#undef FLAG #undef FLAG
}; };
......
...@@ -270,8 +270,7 @@ int ieee80211_set_tx_key(struct ieee80211_key *key) ...@@ -270,8 +270,7 @@ int ieee80211_set_tx_key(struct ieee80211_key *key)
sta->ptk_idx = key->conf.keyidx; sta->ptk_idx = key->conf.keyidx;
if (ieee80211_hw_check(&local->hw, NO_AMPDU_KEYBORDER_SUPPORT)) clear_sta_flag(sta, WLAN_STA_BLOCK_BA);
clear_sta_flag(sta, WLAN_STA_BLOCK_BA);
ieee80211_check_fast_xmit(sta); ieee80211_check_fast_xmit(sta);
return 0; return 0;
...@@ -289,16 +288,15 @@ static void ieee80211_pairwise_rekey(struct ieee80211_key *old, ...@@ -289,16 +288,15 @@ static void ieee80211_pairwise_rekey(struct ieee80211_key *old,
if (new->conf.flags & IEEE80211_KEY_FLAG_NO_AUTO_TX) { if (new->conf.flags & IEEE80211_KEY_FLAG_NO_AUTO_TX) {
/* Extended Key ID key install, initial one or rekey */ /* 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,
NO_AMPDU_KEYBORDER_SUPPORT)) {
/* Aggregation Sessions with Extended Key ID must not /* Aggregation Sessions with Extended Key ID must not
* mix MPDUs with different keyIDs within one A-MPDU. * mix MPDUs with different keyIDs within one A-MPDU.
* Tear down any running Tx aggregation and all new * Tear down running Tx aggregation sessions and block
* Rx/Tx aggregation request during rekey if the driver * new Rx/Tx aggregation requests during rekey to
* asks us to do so. (Blocking Tx only would be * ensure there are no A-MPDUs for the driver to
* sufficient but WLAN_STA_BLOCK_BA gets the job done * aggregate. (Blocking Tx only would be sufficient but
* for the few ms we need it.) * WLAN_STA_BLOCK_BA gets the job done for the few ms
* we need it.)
*/ */
set_sta_flag(sta, WLAN_STA_BLOCK_BA); set_sta_flag(sta, WLAN_STA_BLOCK_BA);
mutex_lock(&sta->ampdu_mlme.mtx); mutex_lock(&sta->ampdu_mlme.mtx);
......
...@@ -1048,21 +1048,15 @@ int ieee80211_register_hw(struct ieee80211_hw *hw) ...@@ -1048,21 +1048,15 @@ int ieee80211_register_hw(struct ieee80211_hw *hw)
} }
} }
/* Enable Extended Key IDs when driver allowed it, or when it /* Mac80211 and therefore all drivers using SW crypto only
* supports neither HW crypto nor A-MPDUs * are able to handle PTK rekeys and Extended Key ID.
*/ */
if ((!local->ops->set_key && if (!local->ops->set_key) {
!ieee80211_hw_check(hw, AMPDU_AGGREGATION)) ||
ieee80211_hw_check(&local->hw, EXT_KEY_ID_NATIVE))
wiphy_ext_feature_set(local->hw.wiphy,
NL80211_EXT_FEATURE_EXT_KEY_ID);
/* Mac80211 and therefore all cards only using SW crypto are able to
* handle PTK rekeys correctly
*/
if (!local->ops->set_key)
wiphy_ext_feature_set(local->hw.wiphy, wiphy_ext_feature_set(local->hw.wiphy,
NL80211_EXT_FEATURE_CAN_REPLACE_PTK0); NL80211_EXT_FEATURE_CAN_REPLACE_PTK0);
wiphy_ext_feature_set(local->hw.wiphy,
NL80211_EXT_FEATURE_EXT_KEY_ID);
}
/* /*
* Calculate scan IE length -- we need this to alloc * Calculate scan IE length -- we need this to alloc
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment