rtw88: 8821c: Don't set RX_FLAG_DECRYPTED if packet has no encryption
authorGuo-Feng Fan <vincent_fann@realtek.com>
Thu, 15 Apr 2021 08:47:01 +0000 (16:47 +0800)
committerKalle Valo <kvalo@codeaurora.org>
Wed, 21 Apr 2021 09:37:36 +0000 (12:37 +0300)
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>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20210415084703.27255-2-pkshih@realtek.com
drivers/net/wireless/realtek/rtw88/rtw8821c.c

index 33c6cf1..785b818 100644 (file)
@@ -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);