Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp5359071ybp; Tue, 8 Oct 2019 01:22:15 -0700 (PDT) X-Google-Smtp-Source: APXvYqyxKLR1Wv5fJPvCDr/QShjJ2urC9wsyKHQsLH2V7EJXpcP0pG/5O2rKbj5/2AJMDZE8hvXV X-Received: by 2002:a17:907:441d:: with SMTP id om21mr28218111ejb.188.1570522935730; Tue, 08 Oct 2019 01:22:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570522935; cv=none; d=google.com; s=arc-20160816; b=Y6MyKMbQ8/Mpy9YT5dmUCKZGvVZdKvTfS4bXChexFdxLC/mv1DNOAo+KA4tnfirqCB 4R6PHxap8F3/KfkoGb+3q+okSRqRtj55V4lHONXM+9bHj37s37C3xMr1I2pM+LV1l/hP F221hcWkWqpRYBIwAZWDsmTdaphKvUnq4jmzea00JMPmaUlM4MEdsL+4pf4aHIsa1wU5 vp1iNT28r/cevWSxYD4mHj7pCZ1371tugOGYfMe8vLzpN2kx+hbE6eGKZ8JoWQS/v6Wo L18aXwceN9ceVZFCRLmxT++XYC0MEOedu+OrbF95W6poqjlqPbIt+8AzFWeDjDcAIB+w gymQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:authenticated-by; bh=CC5BZkZHBdHHYwjKdHSdnXGK9X0t8eilQlaeXudrYUY=; b=RLZLUWHqzJO8NATuhH0ioA6+PdpXBxgivQ4HFrQjRAG6wmKezi3ZDge2XEhTRKRuD/ +olhLi24hgdY7fR+pfSSulD/4GuXo3ErWgVZHKMNay0KeqvuhgJDPw67UTZNTl52KbR/ 4+iXLlMiy7BpbT05jwILiq9mt4yjncV4fslJs6lIBhEoE6351dUq70gy/5yhwhmYWJeY g34uSgeShdhykRXOXDZbg5WNIsr12FmGHcc5VUK7kAc80Z+t5ItuRWN3pWylUWaB4OXu 0smEuranf+ywFpMA1sUJ4W6pVYi6w4baY7AUBGgldPCp8dyYRsRnvbukGs5JisMxvdb2 7+yw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 64si11846432edf.34.2019.10.08.01.21.51; Tue, 08 Oct 2019 01:22:15 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730607AbfJHIVP (ORCPT + 99 others); Tue, 8 Oct 2019 04:21:15 -0400 Received: from rtits2.realtek.com ([211.75.126.72]:47347 "EHLO rtits2.realtek.com.tw" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730554AbfJHIVO (ORCPT ); Tue, 8 Oct 2019 04:21:14 -0400 Authenticated-By: X-SpamFilter-By: BOX Solutions SpamTrap 5.62 with qID x988L8Yc028146, This message is accepted by code: ctloc85258 Received: from mail.realtek.com (RTITCASV01.realtek.com.tw[172.21.6.18]) by rtits2.realtek.com.tw (8.15.2/2.57/5.78) with ESMTPS id x988L8Yc028146 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Tue, 8 Oct 2019 16:21:09 +0800 Received: from localhost.localdomain (172.21.68.126) by RTITCASV01.realtek.com.tw (172.21.6.18) with Microsoft SMTP Server id 14.3.468.0; Tue, 8 Oct 2019 16:21:08 +0800 From: To: CC: , Subject: [PATCH 06/10] rtw88: add NL80211_EXT_FEATURE_CAN_REPLACE_PTK0 support Date: Tue, 8 Oct 2019 16:20:57 +0800 Message-ID: <20191008082101.2494-7-yhchuang@realtek.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191008082101.2494-1-yhchuang@realtek.com> References: <20191008082101.2494-1-yhchuang@realtek.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [172.21.68.126] Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: Tzu-En Huang 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 Signed-off-by: Yan-Hsuan Chuang --- drivers/net/wireless/realtek/rtw88/mac.h | 5 +++++ drivers/net/wireless/realtek/rtw88/mac80211.c | 1 + drivers/net/wireless/realtek/rtw88/main.c | 2 ++ 3 files changed, 8 insertions(+) diff --git a/drivers/net/wireless/realtek/rtw88/mac.h b/drivers/net/wireless/realtek/rtw88/mac.h index a67fa82973e4..592dc830160c 100644 --- a/drivers/net/wireless/realtek/rtw88/mac.h +++ b/drivers/net/wireless/realtek/rtw88/mac.h @@ -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 diff --git a/drivers/net/wireless/realtek/rtw88/mac80211.c b/drivers/net/wireless/realtek/rtw88/mac80211.c index 3e4f2f27ced2..2247bd61e716 100644 --- a/drivers/net/wireless/realtek/rtw88/mac80211.c +++ b/drivers/net/wireless/realtek/rtw88/mac80211.c @@ -546,6 +546,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; } diff --git a/drivers/net/wireless/realtek/rtw88/main.c b/drivers/net/wireless/realtek/rtw88/main.c index edd490c507b5..71f11c973307 100644 --- a/drivers/net/wireless/realtek/rtw88/main.c +++ b/drivers/net/wireless/realtek/rtw88/main.c @@ -1403,6 +1403,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); -- 2.17.1