Message ID | ed12ec17-ae6e-45fa-a72f-23e0a34654da@gmail.com (mailing list archive) |
---|---|
State | Superseded |
Delegated to: | Ping-Ke Shih |
Headers | show |
Series | wifi: rtlwifi: Add new rtl8192du driver | expand |
Hi On 2024-04-09, Bitterblue Smith wrote: > Some (all?) management frames are incorrectly reported to mac80211 as > decrypted when actually the hardware did not decrypt them. This results > in speeds 3-5 times lower than expected, 20-30 Mbps instead of 100 > Mbps. > > Fix this by checking the encryption type field of the RX descriptor. > rtw88 does the same thing. > > This fix was tested only with rtl8192du, which will use the same code. > > Cc: stable@vger.kernel.org > Signed-off-by: Bitterblue Smith <rtl8821cerfe2@gmail.com> > --- > v4: > - Patch is new in v4. This patch indeed provides a nice speedup with WPA3/ SAE on my rtl8192du: v3 of the patch series: $ iperf3 -c <remote_server_ipv6> Connecting to host <remote_server_ipv6>, port 5201 [ 5] local <local_client_ipv6> port 45806 connected to <remote_server_ipv6> port 5201 [ ID] Interval Transfer Bitrate Retr Cwnd [ 5] 0.00-1.00 sec 3.75 MBytes 31.4 Mbits/sec 0 241 KBytes [ 5] 1.00-2.00 sec 3.88 MBytes 32.5 Mbits/sec 0 411 KBytes [ 5] 2.00-3.00 sec 3.88 MBytes 32.5 Mbits/sec 0 580 KBytes [ 5] 3.00-4.00 sec 3.88 MBytes 32.5 Mbits/sec 0 720 KBytes [ 5] 4.00-5.00 sec 2.62 MBytes 22.0 Mbits/sec 0 846 KBytes [ 5] 5.00-6.00 sec 2.75 MBytes 23.1 Mbits/sec 0 1004 KBytes [ 5] 6.00-7.00 sec 2.62 MBytes 22.0 Mbits/sec 0 1.14 MBytes [ 5] 7.00-8.00 sec 2.75 MBytes 23.1 Mbits/sec 0 1.27 MBytes [ 5] 8.00-9.00 sec 2.62 MBytes 22.0 Mbits/sec 0 1.41 MBytes [ 5] 9.00-10.00 sec 2.75 MBytes 23.1 Mbits/sec 0 1.55 MBytes - - - - - - - - - - - - - - - - - - - - - - - - - [ ID] Interval Transfer Bitrate Retr [ 5] 0.00-10.00 sec 31.5 MBytes 26.4 Mbits/sec 0 sender [ 5] 0.00-10.00 sec 30.4 MBytes 25.5 Mbits/sec receiver iperf Done. $ iperf3 -c <remote_server_ipv6> --reverse Connecting to host <remote_server_ipv6>, port 5201 Reverse mode, remote host <remote_server_ipv6> is sending [ 5] local <local_client_ipv6> port 57564 connected to <remote_server_ipv6> port 5201 [ ID] Interval Transfer Bitrate [ 5] 0.00-1.00 sec 3.25 MBytes 27.2 Mbits/sec [ 5] 1.00-2.00 sec 2.50 MBytes 21.0 Mbits/sec [ 5] 2.00-3.00 sec 2.25 MBytes 18.9 Mbits/sec [ 5] 3.00-4.00 sec 2.25 MBytes 18.9 Mbits/sec [ 5] 4.00-5.00 sec 2.88 MBytes 24.1 Mbits/sec [ 5] 5.00-6.00 sec 2.88 MBytes 24.1 Mbits/sec [ 5] 6.00-7.00 sec 2.38 MBytes 19.9 Mbits/sec [ 5] 7.00-8.00 sec 2.62 MBytes 22.0 Mbits/sec [ 5] 8.00-9.00 sec 3.00 MBytes 25.2 Mbits/sec [ 5] 9.00-10.00 sec 3.00 MBytes 25.2 Mbits/sec - - - - - - - - - - - - - - - - - - - - - - - - - [ ID] Interval Transfer Bitrate Retr [ 5] 0.00-10.01 sec 29.9 MBytes 25.0 Mbits/sec 0 sender [ 5] 0.00-10.00 sec 27.0 MBytes 22.6 Mbits/sec receiver iperf Done. $ iperf3 -c <remote_server_ipv6> --bidir Connecting to host <remote_server_ipv6>, port 5201 [ 5] local <local_client_ipv6> port 44242 connected to <remote_server_ipv6> port 5201 [ 7] local <local_client_ipv6> port 44252 connected to <remote_server_ipv6> port 5201 [ ID][Role] Interval Transfer Bitrate Retr Cwnd [ 5][TX-C] 0.00-1.00 sec 2.00 MBytes 16.8 Mbits/sec 0 109 KBytes [ 7][RX-C] 0.00-1.00 sec 1.00 MBytes 8.38 Mbits/sec [ 5][TX-C] 1.00-2.00 sec 2.75 MBytes 23.1 Mbits/sec 0 212 KBytes [ 7][RX-C] 1.00-2.00 sec 640 KBytes 5.24 Mbits/sec [ 5][TX-C] 2.00-3.00 sec 2.25 MBytes 18.9 Mbits/sec 0 315 KBytes [ 7][RX-C] 2.00-3.00 sec 640 KBytes 5.24 Mbits/sec [ 5][TX-C] 3.00-4.00 sec 3.12 MBytes 26.2 Mbits/sec 0 421 KBytes [ 7][RX-C] 3.00-4.00 sec 512 KBytes 4.19 Mbits/sec [ 5][TX-C] 4.00-5.00 sec 4.00 MBytes 33.6 Mbits/sec 0 551 KBytes [ 7][RX-C] 4.00-5.00 sec 640 KBytes 5.24 Mbits/sec [ 5][TX-C] 5.00-6.00 sec 2.50 MBytes 21.0 Mbits/sec 0 676 KBytes [ 7][RX-C] 5.00-6.00 sec 384 KBytes 3.15 Mbits/sec [ 5][TX-C] 6.00-7.00 sec 2.75 MBytes 23.1 Mbits/sec 0 802 KBytes [ 7][RX-C] 6.00-7.00 sec 384 KBytes 3.15 Mbits/sec [ 5][TX-C] 7.00-8.00 sec 2.62 MBytes 22.0 Mbits/sec 0 925 KBytes [ 7][RX-C] 7.00-8.00 sec 256 KBytes 2.10 Mbits/sec [ 5][TX-C] 8.00-9.00 sec 2.75 MBytes 23.1 Mbits/sec 0 1.05 MBytes [ 7][RX-C] 8.00-9.00 sec 512 KBytes 4.19 Mbits/sec [ 5][TX-C] 9.00-10.00 sec 2.62 MBytes 22.0 Mbits/sec 0 1.19 MBytes [ 7][RX-C] 9.00-10.00 sec 256 KBytes 2.10 Mbits/sec - - - - - - - - - - - - - - - - - - - - - - - - - [ ID][Role] Interval Transfer Bitrate Retr [ 5][TX-C] 0.00-10.00 sec 27.4 MBytes 23.0 Mbits/sec 0 sender [ 5][TX-C] 0.00-10.00 sec 25.4 MBytes 21.3 Mbits/sec receiver [ 7][RX-C] 0.00-10.00 sec 6.12 MBytes 5.14 Mbits/sec 1 sender [ 7][RX-C] 0.00-10.00 sec 5.12 MBytes 4.30 Mbits/sec receiver iperf Done. *********************************************************************** v4 of the patch series: $ iperf3 -c <remote_server_ipv6> Connecting to host <remote_server_ipv6>, port 5201 [ 5] local <local_client_ipv6> port 60528 connected to <remote_server_ipv6> port 5201 [ ID] Interval Transfer Bitrate Retr Cwnd [ 5] 0.00-1.00 sec 13.1 MBytes 110 Mbits/sec 0 445 KBytes [ 5] 1.00-2.00 sec 13.2 MBytes 111 Mbits/sec 0 644 KBytes [ 5] 2.00-3.00 sec 11.9 MBytes 99.6 Mbits/sec 0 768 KBytes [ 5] 3.00-4.00 sec 11.5 MBytes 96.5 Mbits/sec 0 855 KBytes [ 5] 4.00-5.00 sec 12.0 MBytes 101 Mbits/sec 0 945 KBytes [ 5] 5.00-6.00 sec 11.4 MBytes 95.5 Mbits/sec 0 945 KBytes [ 5] 6.00-7.00 sec 11.6 MBytes 97.5 Mbits/sec 0 945 KBytes [ 5] 7.00-8.00 sec 11.2 MBytes 94.4 Mbits/sec 0 945 KBytes [ 5] 8.00-9.00 sec 13.0 MBytes 109 Mbits/sec 0 945 KBytes [ 5] 9.00-10.00 sec 12.0 MBytes 101 Mbits/sec 0 1000 KBytes - - - - - - - - - - - - - - - - - - - - - - - - - [ ID] Interval Transfer Bitrate Retr [ 5] 0.00-10.00 sec 121 MBytes 101 Mbits/sec 0 sender [ 5] 0.00-10.03 sec 118 MBytes 98.3 Mbits/sec receiver iperf Done. $ iperf3 -c <remote_server_ipv6> --reverse Connecting to host <remote_server_ipv6>, port 5201 Reverse mode, remote host <remote_server_ipv6> is sending [ 5] local <local_client_ipv6> port 59562 connected to <remote_server_ipv6> port 5201 [ ID] Interval Transfer Bitrate [ 5] 0.00-1.00 sec 16.0 MBytes 134 Mbits/sec [ 5] 1.00-2.00 sec 14.9 MBytes 125 Mbits/sec [ 5] 2.00-3.00 sec 19.2 MBytes 162 Mbits/sec [ 5] 3.00-4.00 sec 14.9 MBytes 125 Mbits/sec [ 5] 4.00-5.00 sec 18.2 MBytes 153 Mbits/sec [ 5] 5.00-6.00 sec 18.9 MBytes 158 Mbits/sec [ 5] 6.00-7.00 sec 17.8 MBytes 149 Mbits/sec [ 5] 7.00-8.00 sec 17.5 MBytes 147 Mbits/sec [ 5] 8.00-9.00 sec 15.1 MBytes 127 Mbits/sec [ 5] 9.00-10.00 sec 14.8 MBytes 124 Mbits/sec - - - - - - - - - - - - - - - - - - - - - - - - - [ ID] Interval Transfer Bitrate Retr [ 5] 0.00-10.01 sec 171 MBytes 144 Mbits/sec 1 sender [ 5] 0.00-10.00 sec 167 MBytes 140 Mbits/sec receiver iperf Done $ iperf3 -c <remote_server_ipv6> --bidir Connecting to host <remote_server_ipv6>, port 5201 [ 5] local <local_client_ipv6> port 34312 connected to <remote_server_ipv6> port 5201 [ 7] local <local_client_ipv6> port 34318 connected to <remote_server_ipv6> port 5201 [ ID][Role] Interval Transfer Bitrate Retr Cwnd [ 5][TX-C] 0.00-1.00 sec 8.25 MBytes 69.1 Mbits/sec 0 395 KBytes [ 7][RX-C] 0.00-1.00 sec 7.00 MBytes 58.7 Mbits/sec [ 5][TX-C] 1.00-2.00 sec 3.38 MBytes 28.3 Mbits/sec 0 420 KBytes [ 7][RX-C] 1.00-2.00 sec 14.6 MBytes 123 Mbits/sec [ 5][TX-C] 2.00-3.00 sec 2.88 MBytes 24.1 Mbits/sec 0 473 KBytes [ 7][RX-C] 2.00-3.00 sec 15.4 MBytes 129 Mbits/sec [ 5][TX-C] 3.00-4.00 sec 1.12 MBytes 9.44 Mbits/sec 0 531 KBytes [ 7][RX-C] 3.00-4.00 sec 10.9 MBytes 91.2 Mbits/sec [ 5][TX-C] 4.00-5.00 sec 1.12 MBytes 9.44 Mbits/sec 0 558 KBytes [ 7][RX-C] 4.00-5.00 sec 10.8 MBytes 90.2 Mbits/sec [ 5][TX-C] 5.00-6.00 sec 1.38 MBytes 11.5 Mbits/sec 0 600 KBytes [ 7][RX-C] 5.00-6.00 sec 3.62 MBytes 30.4 Mbits/sec [ 5][TX-C] 6.00-7.00 sec 2.75 MBytes 23.1 Mbits/sec 0 718 KBytes [ 7][RX-C] 6.00-7.00 sec 12.2 MBytes 103 Mbits/sec [ 5][TX-C] 7.00-8.00 sec 2.75 MBytes 23.1 Mbits/sec 0 853 KBytes [ 7][RX-C] 7.00-8.00 sec 11.1 MBytes 93.3 Mbits/sec [ 5][TX-C] 8.00-9.00 sec 2.75 MBytes 23.1 Mbits/sec 0 1.03 MBytes [ 7][RX-C] 8.00-9.00 sec 13.6 MBytes 114 Mbits/sec [ 5][TX-C] 9.00-10.00 sec 4.12 MBytes 34.6 Mbits/sec 0 1.12 MBytes [ 7][RX-C] 9.00-10.00 sec 16.6 MBytes 139 Mbits/sec - - - - - - - - - - - - - - - - - - - - - - - - - [ ID][Role] Interval Transfer Bitrate Retr [ 5][TX-C] 0.00-10.00 sec 30.5 MBytes 25.6 Mbits/sec 0 sender [ 5][TX-C] 0.00-10.04 sec 27.1 MBytes 22.7 Mbits/sec receiver [ 7][RX-C] 0.00-10.00 sec 119 MBytes 99.7 Mbits/sec 10 sender [ 7][RX-C] 0.00-10.04 sec 116 MBytes 96.8 Mbits/sec receiver iperf Done. Regards Stefan Lippers-Hollmann
Bitterblue Smith <rtl8821cerfe2@gmail.com> wrote: > Some (all?) management frames are incorrectly reported to mac80211 as > decrypted when actually the hardware did not decrypt them. This results > in speeds 3-5 times lower than expected, 20-30 Mbps instead of 100 > Mbps. > > Fix this by checking the encryption type field of the RX descriptor. > rtw88 does the same thing. > > This fix was tested only with rtl8192du, which will use the same code. > > Cc: stable@vger.kernel.org > Signed-off-by: Bitterblue Smith <rtl8821cerfe2@gmail.com> Acked-by: Ping-Ke Shih <pkshih@realtek.com>
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192de/trx.c b/drivers/net/wireless/realtek/rtlwifi/rtl8192de/trx.c index 192982ec8152..30b262c3f6d0 100644 --- a/drivers/net/wireless/realtek/rtlwifi/rtl8192de/trx.c +++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192de/trx.c @@ -413,7 +413,8 @@ bool rtl92de_rx_query_desc(struct ieee80211_hw *hw, struct rtl_stats *stats, stats->icv = (u16)get_rx_desc_icv(pdesc); stats->crc = (u16)get_rx_desc_crc32(pdesc); stats->hwerror = (stats->crc | stats->icv); - stats->decrypted = !get_rx_desc_swdec(pdesc); + stats->decrypted = !get_rx_desc_swdec(pdesc) && + get_rx_desc_enc_type(pdesc) != RX_DESC_ENC_NONE; stats->rate = (u8)get_rx_desc_rxmcs(pdesc); stats->shortpreamble = (u16)get_rx_desc_splcp(pdesc); stats->isampdu = (bool)(get_rx_desc_paggr(pdesc) == 1); @@ -426,8 +427,6 @@ bool rtl92de_rx_query_desc(struct ieee80211_hw *hw, struct rtl_stats *stats, rx_status->band = hw->conf.chandef.chan->band; if (get_rx_desc_crc32(pdesc)) rx_status->flag |= RX_FLAG_FAILED_FCS_CRC; - if (!get_rx_desc_swdec(pdesc)) - rx_status->flag |= RX_FLAG_DECRYPTED; if (get_rx_desc_bw(pdesc)) rx_status->bw = RATE_INFO_BW_40; if (get_rx_desc_rxht(pdesc)) diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192de/trx.h b/drivers/net/wireless/realtek/rtlwifi/rtl8192de/trx.h index 2992668c156c..f189ee2d9be2 100644 --- a/drivers/net/wireless/realtek/rtlwifi/rtl8192de/trx.h +++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192de/trx.h @@ -14,6 +14,15 @@ #define USB_HWDESC_HEADER_LEN 32 #define CRCLENGTH 4 +enum rtl92d_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, +}; + /* macros to read/write various fields in RX or TX descriptors */ static inline void set_tx_desc_pkt_size(__le32 *__pdesc, u32 __val) @@ -246,6 +255,11 @@ static inline u32 get_rx_desc_drv_info_size(__le32 *__pdesc) return le32_get_bits(*__pdesc, GENMASK(19, 16)); } +static inline u32 get_rx_desc_enc_type(__le32 *__pdesc) +{ + return le32_get_bits(*__pdesc, GENMASK(22, 20)); +} + static inline u32 get_rx_desc_shift(__le32 *__pdesc) { return le32_get_bits(*__pdesc, GENMASK(25, 24));
Some (all?) management frames are incorrectly reported to mac80211 as decrypted when actually the hardware did not decrypt them. This results in speeds 3-5 times lower than expected, 20-30 Mbps instead of 100 Mbps. Fix this by checking the encryption type field of the RX descriptor. rtw88 does the same thing. This fix was tested only with rtl8192du, which will use the same code. Cc: stable@vger.kernel.org Signed-off-by: Bitterblue Smith <rtl8821cerfe2@gmail.com> --- v4: - Patch is new in v4. --- .../net/wireless/realtek/rtlwifi/rtl8192de/trx.c | 5 ++--- .../net/wireless/realtek/rtlwifi/rtl8192de/trx.h | 14 ++++++++++++++ 2 files changed, 16 insertions(+), 3 deletions(-)