diff mbox series

[1/3] rtw88: 8821c: Don't set RX_FLAG_DECRYPTED if packet has no encryption

Message ID 20210415084703.27255-2-pkshih@realtek.com (mailing list archive)
State Accepted
Commit 559f6cb318375e9deb01d7d0e957d0d90a2db63d
Delegated to: Kalle Valo
Headers show
Series rtw88: fix some TX/RX bugs | expand

Commit Message

Ping-Ke Shih April 15, 2021, 8:47 a.m. UTC
From: Guo-Feng Fan <vincent_fann@realtek.com>

The value of GET_RX_DESC_SWDEC() indicates that if this RX
packet requires software decryption or not. And software
decryption is required when the packet was encrypted and the
hardware failed to decrypt it.

So, GET_RX_DESC_SWDEC() is negative does not mean that this
packet is decrypted, it might just have no encryption at all.
To actually see if the packet is decrypted, driver needs to
further check if the hardware has successfully decrypted it,
with a specific type of encryption algorithm.

Signed-off-by: Guo-Feng Fan <vincent_fann@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
---
 drivers/net/wireless/realtek/rtw88/rtw8821c.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Kalle Valo April 21, 2021, 9:38 a.m. UTC | #1
Ping-Ke Shih <pkshih@realtek.com> wrote:

> From: Guo-Feng Fan <vincent_fann@realtek.com>
> 
> The value of GET_RX_DESC_SWDEC() indicates that if this RX
> packet requires software decryption or not. And software
> decryption is required when the packet was encrypted and the
> hardware failed to decrypt it.
> 
> So, GET_RX_DESC_SWDEC() is negative does not mean that this
> packet is decrypted, it might just have no encryption at all.
> To actually see if the packet is decrypted, driver needs to
> further check if the hardware has successfully decrypted it,
> with a specific type of encryption algorithm.
> 
> Signed-off-by: Guo-Feng Fan <vincent_fann@realtek.com>
> Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>

3 patches applied to wireless-drivers-next.git, thanks.

559f6cb31837 rtw88: 8821c: Don't set RX_FLAG_DECRYPTED if packet has no encryption
a548909d7ad7 rtw88: Fix potential unrecoverable tx queue stop
7bd3760c71f7 rtw88: refine napi deinit flow
diff mbox series

Patch

diff --git a/drivers/net/wireless/realtek/rtw88/rtw8821c.c b/drivers/net/wireless/realtek/rtw88/rtw8821c.c
index 33c6cf1206c8..785b8181513f 100644
--- a/drivers/net/wireless/realtek/rtw88/rtw8821c.c
+++ b/drivers/net/wireless/realtek/rtw88/rtw8821c.c
@@ -581,7 +581,8 @@  static void rtw8821c_query_rx_desc(struct rtw_dev *rtwdev, u8 *rx_desc,
 	pkt_stat->phy_status = GET_RX_DESC_PHYST(rx_desc);
 	pkt_stat->icv_err = GET_RX_DESC_ICV_ERR(rx_desc);
 	pkt_stat->crc_err = GET_RX_DESC_CRC32(rx_desc);
-	pkt_stat->decrypted = !GET_RX_DESC_SWDEC(rx_desc);
+	pkt_stat->decrypted = !GET_RX_DESC_SWDEC(rx_desc) &&
+			      GET_RX_DESC_ENC_TYPE(rx_desc) != RX_DESC_ENC_NONE;
 	pkt_stat->is_c2h = GET_RX_DESC_C2H(rx_desc);
 	pkt_stat->pkt_len = GET_RX_DESC_PKT_LEN(rx_desc);
 	pkt_stat->drv_info_sz = GET_RX_DESC_DRV_INFO_SIZE(rx_desc);