From nobody Thu Dec 05 07:30:18 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Y3mJC0zKXz5g3rs; Thu, 05 Dec 2024 07:30:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Y3mJB4W5Kz4Ksx; Thu, 5 Dec 2024 07:30:18 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1733383818; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=hMEDtxtRZsNOmDZWiGouQI2okEs4cbheQ8Xn6fDhHEk=; b=nwC7didF/O3nE94dsMwmdPjQGihdxmDZ4fxrEMpdFzGMmXtY2eP4G2RhH/RlxSDnt4gEM7 KXNYVOcERCAGKnO8owFgog4uw2ju0ON+6DQX/0TsqWAP57pIx1aXpiDRmVLsHJzrHVz5/9 58rKyYJpshNCkTrIGU9oUOo1TLSkRVKQK92GaowkPjBWv37x5eRV03PjHYGkKAUHPIQ/Iv LwIYnRb38M4f/xQRjHvCm96KjzHKxK6zreFfqi6vgLgDXmkXHthr2cl+4Y1QJJAQdFHlMm jBboSnacVNLthwzg29rSg82dyVbHA6WRtDs1vPH3Jb08U/RSmVJlZDljHFNGfw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1733383818; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=hMEDtxtRZsNOmDZWiGouQI2okEs4cbheQ8Xn6fDhHEk=; b=X5/H+Oqc7RZJxnkQbxtxwLEnz5sSBaNGRWYC2MLYsKzftvmRFJyH1nhlxFld+t7TXL/aQZ BXO6X9HRHD8bGHlOQvi6zKGb8lFUjCgM/LseyF7LspMnP3PvmPggYHHj0hFK0cAUlC1Yuq tJhUCsGvJusJ2zO0oqG+V8m8m3Gmoo6IDLPCb4NFPIGOHc4U7E+6uOuD4HNQaByQHCS0MJ IOQUa97jxRIkqk7DeniSSIrJrj0a7Qg1FfT/RkgnBojDf7jzFCd6o7iiy9KILZFI7GvOSN DDSodD/hGoTPWFGG8p9VfSiKQ5ucm4y/aYxpEnMoLPJM+QPjleNLgyDOKi9VgQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1733383818; a=rsa-sha256; cv=none; b=J9e6hx9Q8A2Y3Ol5loOjjt7NwtUzwXlfM9PlD+GUVVpG7oWdRi0CtKGM4yX61n+vqp8Ju3 YEd9PVMQ6mjGy6r8m5Oyl8s4DaWQm3g0jMm+h+y+DsubD8AIHWKXyeu6ELikFt7mRAjzqF 3d3dIECvNdL8cTsm2TzPZe1Pj83PlczmaV0fyC97jnGv2pSNjUIAKF8btS+B0jEA4IU+wD HS+v5AFvQWcz+sf/L8SA9nHKh5db+13jHeKrO9aRn4332U3bazi3CsGfBcedLXE/9Jd4+D i86G+XovggLoy/uGfekptZ0s4LGUpWyxUtdAL1cP6+OC1vY55SF2pMnHH6hfTQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Y3mJB3YKGzjTF; Thu, 5 Dec 2024 07:30:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 4B57UIXd023673; Thu, 5 Dec 2024 07:30:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 4B57UIgK023670; Thu, 5 Dec 2024 07:30:18 GMT (envelope-from git) Date: Thu, 5 Dec 2024 07:30:18 GMT Message-Id: <202412050730.4B57UIgK023670@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Adrian Chadd Subject: git: fcb5e8d0c19a - main - rtwn: don't do 64 bit TSF extension by default List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: adrian X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: fcb5e8d0c19ac21515ab3047d39a76b32d835cec Auto-Submitted: auto-generated The branch main has been updated by adrian: URL: https://cgit.FreeBSD.org/src/commit/?id=fcb5e8d0c19ac21515ab3047d39a76b32d835cec commit fcb5e8d0c19ac21515ab3047d39a76b32d835cec Author: Adrian Chadd AuthorDate: 2024-12-02 05:22:45 +0000 Commit: Adrian Chadd 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;