Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

rtw88: Don't set RX_FLAG_DECRYPTED if packet has no encryption

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: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>

authored by

Ping-Ke Shih and committed by
Kalle Valo
0649ff58 c3594559

+15 -2
+2 -1
drivers/net/wireless/realtek/rtw88/rtw8822b.c
··· 836 836 pkt_stat->phy_status = GET_RX_DESC_PHYST(rx_desc); 837 837 pkt_stat->icv_err = GET_RX_DESC_ICV_ERR(rx_desc); 838 838 pkt_stat->crc_err = GET_RX_DESC_CRC32(rx_desc); 839 - pkt_stat->decrypted = !GET_RX_DESC_SWDEC(rx_desc); 839 + pkt_stat->decrypted = !GET_RX_DESC_SWDEC(rx_desc) && 840 + GET_RX_DESC_ENC_TYPE(rx_desc) != RX_DESC_ENC_NONE; 840 841 pkt_stat->is_c2h = GET_RX_DESC_C2H(rx_desc); 841 842 pkt_stat->pkt_len = GET_RX_DESC_PKT_LEN(rx_desc); 842 843 pkt_stat->drv_info_sz = GET_RX_DESC_DRV_INFO_SIZE(rx_desc);
+2 -1
drivers/net/wireless/realtek/rtw88/rtw8822c.c
··· 1704 1704 pkt_stat->phy_status = GET_RX_DESC_PHYST(rx_desc); 1705 1705 pkt_stat->icv_err = GET_RX_DESC_ICV_ERR(rx_desc); 1706 1706 pkt_stat->crc_err = GET_RX_DESC_CRC32(rx_desc); 1707 - pkt_stat->decrypted = !GET_RX_DESC_SWDEC(rx_desc); 1707 + pkt_stat->decrypted = !GET_RX_DESC_SWDEC(rx_desc) && 1708 + GET_RX_DESC_ENC_TYPE(rx_desc) != RX_DESC_ENC_NONE; 1708 1709 pkt_stat->is_c2h = GET_RX_DESC_C2H(rx_desc); 1709 1710 pkt_stat->pkt_len = GET_RX_DESC_PKT_LEN(rx_desc); 1710 1711 pkt_stat->drv_info_sz = GET_RX_DESC_DRV_INFO_SIZE(rx_desc);
+11
drivers/net/wireless/realtek/rtw88/rx.h
··· 5 5 #ifndef __RTW_RX_H_ 6 6 #define __RTW_RX_H_ 7 7 8 + enum rtw_rx_desc_enc { 9 + RX_DESC_ENC_NONE = 0, 10 + RX_DESC_ENC_WEP40 = 1, 11 + RX_DESC_ENC_TKIP_WO_MIC = 2, 12 + RX_DESC_ENC_TKIP_MIC = 3, 13 + RX_DESC_ENC_AES = 4, 14 + RX_DESC_ENC_WEP104 = 5, 15 + }; 16 + 8 17 #define GET_RX_DESC_PHYST(rxdesc) \ 9 18 le32_get_bits(*((__le32 *)(rxdesc) + 0x00), BIT(26)) 10 19 #define GET_RX_DESC_ICV_ERR(rxdesc) \ ··· 30 21 le32_get_bits(*((__le32 *)(rxdesc) + 0x00), GENMASK(19, 16)) 31 22 #define GET_RX_DESC_SHIFT(rxdesc) \ 32 23 le32_get_bits(*((__le32 *)(rxdesc) + 0x00), GENMASK(25, 24)) 24 + #define GET_RX_DESC_ENC_TYPE(rxdesc) \ 25 + le32_get_bits(*((__le32 *)(rxdesc) + 0x00), GENMASK(22, 20)) 33 26 #define GET_RX_DESC_RX_RATE(rxdesc) \ 34 27 le32_get_bits(*((__le32 *)(rxdesc) + 0x03), GENMASK(6, 0)) 35 28 #define GET_RX_DESC_MACID(rxdesc) \