rtw88: add NL80211_EXT_FEATURE_CAN_REPLACE_PTK0 support
authorTzu-En Huang <tehuang@realtek.com>
Tue, 8 Oct 2019 08:20:57 +0000 (16:20 +0800)
committerKalle Valo <kvalo@codeaurora.org>
Mon, 14 Oct 2019 09:10:48 +0000 (12:10 +0300)
Add support for NL80211_EXT_FEATURE_CAN_REPLACE_PTK0 feature.
According to the "Hardware crypto acceleration" documentation section,
when set_key() is called with %DISABLE_KEY command, for outgoing frames,
we flush out frames in the queues with the old key; for incoming frames,
no frames will be passed to mac80211 decrypted with the old key due to
rtw_sec_clear_cam().

Signed-off-by: Tzu-En Huang <tehuang@realtek.com>
Signed-off-by: Yan-Hsuan Chuang <yhchuang@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
drivers/net/wireless/realtek/rtw88/mac.h
drivers/net/wireless/realtek/rtw88/mac80211.c
drivers/net/wireless/realtek/rtw88/main.c

index a67fa82..592dc83 100644 (file)
@@ -33,4 +33,9 @@ int rtw_download_firmware(struct rtw_dev *rtwdev, struct rtw_fw_state *fw);
 int rtw_mac_init(struct rtw_dev *rtwdev);
 void rtw_mac_flush_queues(struct rtw_dev *rtwdev, u32 queues, bool drop);
 
+static inline void rtw_mac_flush_all_queues(struct rtw_dev *rtwdev, bool drop)
+{
+       rtw_mac_flush_queues(rtwdev, BIT(rtwdev->hw->queues) - 1, drop);
+}
+
 #endif
index d03b0b7..8d7a342 100644 (file)
@@ -533,6 +533,7 @@ static int rtw_ops_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
                                  hw_key_type, hw_key_idx);
                break;
        case DISABLE_KEY:
+               rtw_mac_flush_all_queues(rtwdev, false);
                rtw_sec_clear_cam(rtwdev, sec, key->hw_key_idx);
                break;
        }
index e0cc4c1..5343d86 100644 (file)
@@ -1324,6 +1324,8 @@ int rtw_register_hw(struct rtw_dev *rtwdev, struct ieee80211_hw *hw)
 
        hw->wiphy->features |= NL80211_FEATURE_SCAN_RANDOM_MAC_ADDR;
 
+       wiphy_ext_feature_set(hw->wiphy, NL80211_EXT_FEATURE_CAN_REPLACE_PTK0);
+
        rtw_set_supported_band(hw, rtwdev->chip);
        SET_IEEE80211_PERM_ADDR(hw, rtwdev->efuse.addr);