public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 2/2] wifi: rtl8xxxu: enable MFP support
       [not found] <20240417093352.1840632-1-martin.kaistra@linutronix.de>
@ 2024-04-17  9:33 ` Martin Kaistra
  2024-04-18  0:19   ` Ping-Ke Shih
  0 siblings, 1 reply; 4+ messages in thread
From: Martin Kaistra @ 2024-04-17  9:33 UTC (permalink / raw)
  To: linux-wireless
  Cc: Jes Sorensen, Ping-Ke Shih, Bitterblue Smith,
	Sebastian Andrzej Siewior, stable

In order to connect to networks which require 802.11w, add the
MFP_CAPABLE flag and let mac80211 do the actual crypto in software.

When a robust management frame is received, rx_dec->swdec is not set,
even though the HW did not decrypt it. Extend the check and don't set
RX_FLAG_DECRYPTED for these frames in order to use SW decryption.

Use the security flag in the RX descriptor for this purpose, like it is
done in the rtw88 driver.

Cc: stable@vger.kernel.org
Signed-off-by: Martin Kaistra <martin.kaistra@linutronix.de>
---
 drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h      | 9 +++++++++
 drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 7 +++++--
 2 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h
index fd92d23c43d91..4f2615dbfd0f0 100644
--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h
+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h
@@ -122,6 +122,15 @@ enum rtl8xxxu_rx_type {
 	RX_TYPE_ERROR = -1
 };
 
+enum rtw_rx_desc_enc {
+	RX_DESC_ENC_NONE	= 0,
+	RX_DESC_ENC_WEP40	= 1,
+	RX_DESC_ENC_TKIP_WO_MIC	= 2,
+	RX_DESC_ENC_TKIP_MIC	= 3,
+	RX_DESC_ENC_AES		= 4,
+	RX_DESC_ENC_WEP104	= 5,
+};
+
 struct rtl8xxxu_rxdesc16 {
 #ifdef __LITTLE_ENDIAN
 	u32 pktlen:14;
diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
index 4a49f8f9d80f2..b15a30a54259e 100644
--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
@@ -6473,7 +6473,8 @@ int rtl8xxxu_parse_rxdesc16(struct rtl8xxxu_priv *priv, struct sk_buff *skb)
 			rx_status->mactime = rx_desc->tsfl;
 			rx_status->flag |= RX_FLAG_MACTIME_START;
 
-			if (!rx_desc->swdec)
+			if (!rx_desc->swdec &&
+			    rx_desc->security != RX_DESC_ENC_NONE)
 				rx_status->flag |= RX_FLAG_DECRYPTED;
 			if (rx_desc->crc32)
 				rx_status->flag |= RX_FLAG_FAILED_FCS_CRC;
@@ -6578,7 +6579,8 @@ int rtl8xxxu_parse_rxdesc24(struct rtl8xxxu_priv *priv, struct sk_buff *skb)
 			rx_status->mactime = rx_desc->tsfl;
 			rx_status->flag |= RX_FLAG_MACTIME_START;
 
-			if (!rx_desc->swdec)
+			if (!rx_desc->swdec &&
+			    rx_desc->security != RX_DESC_ENC_NONE)
 				rx_status->flag |= RX_FLAG_DECRYPTED;
 			if (rx_desc->crc32)
 				rx_status->flag |= RX_FLAG_FAILED_FCS_CRC;
@@ -7998,6 +8000,7 @@ static int rtl8xxxu_probe(struct usb_interface *interface,
 	ieee80211_hw_set(hw, HAS_RATE_CONTROL);
 	ieee80211_hw_set(hw, SUPPORT_FAST_XMIT);
 	ieee80211_hw_set(hw, AMPDU_AGGREGATION);
+	ieee80211_hw_set(hw, MFP_CAPABLE);
 
 	wiphy_ext_feature_set(hw->wiphy, NL80211_EXT_FEATURE_CQM_RSSI_LIST);
 
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* RE: [PATCH 2/2] wifi: rtl8xxxu: enable MFP support
  2024-04-17  9:33 ` [PATCH 2/2] wifi: rtl8xxxu: enable MFP support Martin Kaistra
@ 2024-04-18  0:19   ` Ping-Ke Shih
  2024-04-18  6:47     ` Martin Kaistra
  0 siblings, 1 reply; 4+ messages in thread
From: Ping-Ke Shih @ 2024-04-18  0:19 UTC (permalink / raw)
  To: Martin Kaistra, linux-wireless@vger.kernel.org
  Cc: Jes Sorensen, Bitterblue Smith, Sebastian Andrzej Siewior,
	stable@vger.kernel.org

Martin Kaistra <martin.kaistra@linutronix.de> wrote:

> 
> In order to connect to networks which require 802.11w, add the
> MFP_CAPABLE flag and let mac80211 do the actual crypto in software.
> 
> When a robust management frame is received, rx_dec->swdec is not set,
> even though the HW did not decrypt it. Extend the check and don't set
> RX_FLAG_DECRYPTED for these frames in order to use SW decryption.
> 
> Use the security flag in the RX descriptor for this purpose, like it is
> done in the rtw88 driver.
> 
> Cc: stable@vger.kernel.org
> Signed-off-by: Martin Kaistra <martin.kaistra@linutronix.de>

I would like to change subject to
"wifi: rtl8xxxu: enable MFP support with security flag of RX descriptor",
because the same subject as former patch cause confusing. I can change that
during committing. 

Others are good to me.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 2/2] wifi: rtl8xxxu: enable MFP support
  2024-04-18  0:19   ` Ping-Ke Shih
@ 2024-04-18  6:47     ` Martin Kaistra
  2024-04-18  6:54       ` Ping-Ke Shih
  0 siblings, 1 reply; 4+ messages in thread
From: Martin Kaistra @ 2024-04-18  6:47 UTC (permalink / raw)
  To: Ping-Ke Shih, linux-wireless@vger.kernel.org
  Cc: Jes Sorensen, Bitterblue Smith, Sebastian Andrzej Siewior,
	stable@vger.kernel.org

Am 18.04.24 um 02:19 schrieb Ping-Ke Shih:
> Martin Kaistra <martin.kaistra@linutronix.de> wrote:
> 
>>
>> In order to connect to networks which require 802.11w, add the
>> MFP_CAPABLE flag and let mac80211 do the actual crypto in software.
>>
>> When a robust management frame is received, rx_dec->swdec is not set,
>> even though the HW did not decrypt it. Extend the check and don't set
>> RX_FLAG_DECRYPTED for these frames in order to use SW decryption.
>>
>> Use the security flag in the RX descriptor for this purpose, like it is
>> done in the rtw88 driver.
>>
>> Cc: stable@vger.kernel.org
>> Signed-off-by: Martin Kaistra <martin.kaistra@linutronix.de>
> 
> I would like to change subject to
> "wifi: rtl8xxxu: enable MFP support with security flag of RX descriptor",
> because the same subject as former patch cause confusing. I can change that
> during committing.
> 
> Others are good to me.
> 

ok, subject change is fine for me.
I just noticed though, that I named the enum "rtw_rx_desc_enc" instead of the 
probably more appropriate "rtl8xxxu_rx_desc_enc". Should I change that?

Martin

^ permalink raw reply	[flat|nested] 4+ messages in thread

* RE: [PATCH 2/2] wifi: rtl8xxxu: enable MFP support
  2024-04-18  6:47     ` Martin Kaistra
@ 2024-04-18  6:54       ` Ping-Ke Shih
  0 siblings, 0 replies; 4+ messages in thread
From: Ping-Ke Shih @ 2024-04-18  6:54 UTC (permalink / raw)
  To: Martin Kaistra, linux-wireless@vger.kernel.org
  Cc: Jes Sorensen, Bitterblue Smith, Sebastian Andrzej Siewior,
	stable@vger.kernel.org

Martin Kaistra <martin.kaistra@linutronix.de> wrote:
> Am 18.04.24 um 02:19 schrieb Ping-Ke Shih:
> > Martin Kaistra <martin.kaistra@linutronix.de> wrote:
> >
> >>
> >> In order to connect to networks which require 802.11w, add the
> >> MFP_CAPABLE flag and let mac80211 do the actual crypto in software.
> >>
> >> When a robust management frame is received, rx_dec->swdec is not set,
> >> even though the HW did not decrypt it. Extend the check and don't set
> >> RX_FLAG_DECRYPTED for these frames in order to use SW decryption.
> >>
> >> Use the security flag in the RX descriptor for this purpose, like it is
> >> done in the rtw88 driver.
> >>
> >> Cc: stable@vger.kernel.org
> >> Signed-off-by: Martin Kaistra <martin.kaistra@linutronix.de>
> >
> > I would like to change subject to
> > "wifi: rtl8xxxu: enable MFP support with security flag of RX descriptor",
> > because the same subject as former patch cause confusing. I can change that
> > during committing.
> >
> > Others are good to me.
> >
> 
> ok, subject change is fine for me.
> I just noticed though, that I named the enum "rtw_rx_desc_enc" instead of the
> probably more appropriate "rtl8xxxu_rx_desc_enc". Should I change that?

I missed that. Please do it and change the subject by the way. Thanks.

Ping-Ke


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-04-18  6:54 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20240417093352.1840632-1-martin.kaistra@linutronix.de>
2024-04-17  9:33 ` [PATCH 2/2] wifi: rtl8xxxu: enable MFP support Martin Kaistra
2024-04-18  0:19   ` Ping-Ke Shih
2024-04-18  6:47     ` Martin Kaistra
2024-04-18  6:54       ` Ping-Ke Shih

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox