git: fcb5e8d0c19a - main - rtwn: don't do 64 bit TSF extension by default
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 05 Dec 2024 07:30:18 UTC
The branch main has been updated by adrian: URL: https://cgit.FreeBSD.org/src/commit/?id=fcb5e8d0c19ac21515ab3047d39a76b32d835cec commit fcb5e8d0c19ac21515ab3047d39a76b32d835cec Author: Adrian Chadd <adrian@FreeBSD.org> AuthorDate: 2024-12-02 05:22:45 +0000 Commit: Adrian Chadd <adrian@FreeBSD.org> CommitDate: 2024-12-05 07:27:46 +0000 rtwn: don't do 64 bit TSF extension by default The TSF64 extension involves at least 3 reads from TSF registers (R92C_TSFTR(0), R92C_TSFTR(1), R92C_TSFTR(2)) which are 4 byte control transfers. They take up valuable USB link time. It's likely much less expensive for PCIe adapters. At some point it may be worthwhile enabling it by default just for those. With this disabled, the only USB traffic that I see during normal data operation are bulk TX/RX data transfers for 802.11 packets, and on NICs w/ net80211 rate control, the control register space read/writes for TX completion. (And that will also need addressing.) This is the difference between 15mbit TCP RX and 30mbit TCP RX on the 11n NICs, and around 40 to 50mbit TCP RX on the 11ac NICs in HT40 and VHT80. Locally tested: * RTL8188EU, STA mode * RTL8192CU, STA mode * RTL8192EU, STA mode * RTL8811AU, STA mode * RTL8821AU, STA mode Differential Revision: https://reviews.freebsd.org/D47861 --- sys/dev/rtwn/if_rtwn.c | 5 +++++ sys/dev/rtwn/if_rtwn_rx.c | 14 ++++++++++++-- sys/dev/rtwn/if_rtwnvar.h | 1 + 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/sys/dev/rtwn/if_rtwn.c b/sys/dev/rtwn/if_rtwn.c index e452448976dd..3d0dce516f84 100644 --- a/sys/dev/rtwn/if_rtwn.c +++ b/sys/dev/rtwn/if_rtwn.c @@ -331,6 +331,11 @@ rtwn_sysctlattach(struct rtwn_softc *sc) "ht40", CTLFLAG_RDTUN, &sc->sc_ht40, sc->sc_ht40, "Enable 40 MHz mode support"); + sc->sc_ena_tsf64 = 0; + SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(tree), OID_AUTO, + "ena_tsf64", CTLFLAG_RWTUN, &sc->sc_ena_tsf64, + sc->sc_ena_tsf64, "Enable/disable per-packet TSF64 reporting"); + #ifdef RTWN_DEBUG SYSCTL_ADD_U32(ctx, SYSCTL_CHILDREN(tree), OID_AUTO, "debug", CTLFLAG_RWTUN, &sc->sc_debug, sc->sc_debug, diff --git a/sys/dev/rtwn/if_rtwn_rx.c b/sys/dev/rtwn/if_rtwn_rx.c index ebfb8e67ec6d..58cd53b01e63 100644 --- a/sys/dev/rtwn/if_rtwn_rx.c +++ b/sys/dev/rtwn/if_rtwn_rx.c @@ -285,8 +285,18 @@ rtwn_rx_common(struct rtwn_softc *sc, struct mbuf *m, void *desc) rxs.c_pktflags |= IEEE80211_RX_F_FAIL_FCSCRC; rxs.r_flags |= IEEE80211_R_TSF_START; /* XXX undocumented */ - rxs.r_flags |= IEEE80211_R_TSF64; - rxs.c_rx_tsf = rtwn_extend_rx_tsf(sc, stat); + + /* + * Doing the TSF64 extension on USB is expensive, especially + * if it's being done on every MPDU in an AMPDU burst. + */ + if (sc->sc_ena_tsf64) { + rxs.r_flags |= IEEE80211_R_TSF64; + rxs.c_rx_tsf = rtwn_extend_rx_tsf(sc, stat); + } else { + rxs.r_flags |= IEEE80211_R_TSF32; + rxs.c_rx_tsf = le32toh(stat->tsf_low); + } /* Get RSSI from PHY status descriptor. */ is_cck = (rxs.c_pktflags & IEEE80211_RX_F_CCK) != 0; diff --git a/sys/dev/rtwn/if_rtwnvar.h b/sys/dev/rtwn/if_rtwnvar.h index 3d4db0a37a9e..d4458384dbd7 100644 --- a/sys/dev/rtwn/if_rtwnvar.h +++ b/sys/dev/rtwn/if_rtwnvar.h @@ -172,6 +172,7 @@ struct rtwn_softc { device_t sc_dev; int sc_ht40; + int sc_ena_tsf64; uint32_t sc_debug; int sc_hwcrypto; int sc_ratectl_sysctl;