rtl8xxxu: Improve the A-MPDU retransmission rate with RTS/CTS protection
authorChris Chiu <chris.chiu@canonical.com>
Wed, 15 Dec 2021 08:58:19 +0000 (16:58 +0800)
committerKalle Valo <kvalo@kernel.org>
Mon, 20 Dec 2021 19:04:03 +0000 (21:04 +0200)
The A-MPDU TX retransmission rate is always high (> 20%) even in a very
clean environment. However, the vendor driver retransimission rate is
< 10% in the same test bed. The difference is the vendor driver starts
the A-MPDU TXOP with initial RTS/CTS handshake which is observed in the
air capture and the TX descriptor. Since the driver does not know how
many frames will be aggregated and the estimated duration, forcing the
RTS/CTS protection for A-MPDU helps to lower the retransmission rate
from > 20% to ~12% in the same test setup with the vendor driver.

Signed-off-by: Chris Chiu <chris.chiu@canonical.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20211215085819.729345-1-chris.chiu@canonical.com
drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c

index a42e208..06d59ff 100644 (file)
@@ -4859,7 +4859,7 @@ rtl8xxxu_fill_txdesc_v1(struct ieee80211_hw *hw, struct ieee80211_hdr *hdr,
         * rts_rate is zero if RTS/CTS or CTS to SELF are not enabled
         */
        tx_desc->txdw4 |= cpu_to_le32(rts_rate << TXDESC32_RTS_RATE_SHIFT);
-       if (rate_flags & IEEE80211_TX_RC_USE_RTS_CTS) {
+       if (ampdu_enable || (rate_flags & IEEE80211_TX_RC_USE_RTS_CTS)) {
                tx_desc->txdw4 |= cpu_to_le32(TXDESC32_RTS_CTS_ENABLE);
                tx_desc->txdw4 |= cpu_to_le32(TXDESC32_HW_RTS_ENABLE);
        } else if (rate_flags & IEEE80211_TX_RC_USE_CTS_PROTECT) {
@@ -4930,7 +4930,7 @@ rtl8xxxu_fill_txdesc_v2(struct ieee80211_hw *hw, struct ieee80211_hdr *hdr,
        /*
         * rts_rate is zero if RTS/CTS or CTS to SELF are not enabled
         */
-       if (rate_flags & IEEE80211_TX_RC_USE_RTS_CTS) {
+       if (ampdu_enable || (rate_flags & IEEE80211_TX_RC_USE_RTS_CTS)) {
                tx_desc40->txdw3 |= cpu_to_le32(TXDESC40_RTS_CTS_ENABLE);
                tx_desc40->txdw3 |= cpu_to_le32(TXDESC40_HW_RTS_ENABLE);
        } else if (rate_flags & IEEE80211_TX_RC_USE_CTS_PROTECT) {