From nobody Sun Jul 19 16:49:12 2026 X-Original-To: dev-commits-src-all@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 4h38kK4LKGz6fpGY for ; Sun, 19 Jul 2026 16:49:13 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4h38kK2JkHz43mY for ; Sun, 19 Jul 2026 16:49:13 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1784479753; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=t5l4zMI8SDxsQZt5oxS8jyGiN1p5POeaL9+PEtEoFIU=; b=QXr9QaizYTtdLsDwRYDUCpqUJadOYzkxRE8zYZyUEAryvnFeqmcttDQnjkFjb6Br1fsZpR hAPnmsxDkTqyMRLrLQb0t318jueTwi8NAoADP3CfkCQ2vFLSUmoJWNFvLFmcp5+4QAYpU1 eYpTysW89L3BdY5dkSwzqvZKJThmFKYf9q5Ug90Uz9xvNFwnEC+mfPsNePXU5viZguIl42 xH+Qta91TPz0DocInTbrWdZABtAQUJheuhgElMpIM0pRV7vHjfPsZ9jBxOCCTg4ou59cZ2 bdgUyzkqezAYaeziWCTr4nue/ET7HL3oGqCCIbUf4Bqr0UkxJXnAhnDvPhkHAQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1784479753; a=rsa-sha256; cv=none; b=M4E9kqLcOiVbQ+pWnsBUH1RV7BJm46NWOTgjTYMSqRy5vNysVPSN1C99qZvGyuNZYtemXf yTkOb6f9h5LGoyitEtE7hUaKGNfoEdTxQP2Ks8urlzO0TQFZuXiGjGO19Ks6sqxTT5d7Fi MYLfd9kcl702YP2XdQGptADkaLfv1cxSOfivZ7QnLWGi27yA73VvkrinRETmD9x5UU+fhL jIpxybykfvQ4ZCuQAAikDagE9QDFG11XvqQ0fqO84Zg6fYh5nFFcdLAMF0HqlU99Y3Bv95 1VTl27L896ihYyKI+jwAsVRZmN7IuldlIisWUNTnNADG2S6qocA5OjT++gzftA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1784479753; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=t5l4zMI8SDxsQZt5oxS8jyGiN1p5POeaL9+PEtEoFIU=; b=tgGN0bPDO54UXVlkebL7gu1SIRx8XJOPLlVVpxeAG4vS3L1b9Pl+xKnl2Xz3dY9Wft/GRp G+tb5xgfuE7402zs5MQfxFAzKRCUprvElTTC7oTsUY30MUXY0MV8NgCm/Ej/zC9w1ghd/4 dgZ+OtuevdGKmkthkZ5updxP3gGHi5BWynAagOvp8qZ8s8W66K9eW74O2RkIG0C4ajxc4v S7VkbKjsIhr2Kzz0A9d9e7wlMUqhesfspgT7X1IMSEupxfYdn+NqA8X6WczRErlKsSc6Hk OVOviarq0k2X4wrIknlFvofHZ/osilmqpWTtt8UyDoKAEOMqb6XJx2bPovvjLA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4h38kJ5QK8z83t for ; Sun, 19 Jul 2026 16:49:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 31896 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Sun, 19 Jul 2026 16:49:12 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Cc: Nick Price From: Adrian Chadd Subject: git: 9b4585afd313 - main - aq(4): honor the kernel RSS policy and add a TX traffic-class helper List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list 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: 9b4585afd31384573fcebd156d0e4af32bcddf9e Auto-Submitted: auto-generated Date: Sun, 19 Jul 2026 16:49:12 +0000 Message-Id: <6a5d0008.31896.b3e54f9@gitrepo.freebsd.org> The branch main has been updated by adrian: URL: https://cgit.FreeBSD.org/src/commit/?id=9b4585afd31384573fcebd156d0e4af32bcddf9e commit 9b4585afd31384573fcebd156d0e4af32bcddf9e Author: Nick Price AuthorDate: 2026-07-19 16:41:37 +0000 Commit: Adrian Chadd CommitDate: 2026-07-19 16:41:37 +0000 aq(4): honor the kernel RSS policy and add a TX traffic-class helper Align RX steering with the kernel RSS framework and factor out the active-traffic-class count. RSS key and indirection table: on an options RSS kernel the stack owns a canonical hash key and a hash-to-bucket indirection table binding each bucket to a CPU. aq programmed a random arc4rand() key and a plain i % rss_qs table, so the hash it stamped in iri_flowid and the queue it steered a flow to did not match the CPU the stack chose -- defeating RSS affinity. Under #ifdef RSS take the key from rss_getkey() and each entry from rss_get_indirection_to_bucket(), as e1000/ixgbe/ixl do; the non-RSS build keeps the random key and round-robin table. RSS hash-type policy: drop the private hw.aq.enable_rss_udp knob (RDTUN, default on) and add aq_rss_hashconfig(), which under options RSS returns rss_gethashconfig() and otherwise the same UDP-off default. UDP 4-tuple hashing scatters a fragmented datagram's pieces across queues because only the first fragment carries the L4 ports, so it is now off by default and re-enabled the standard way, via net.inet.rss.udp_4tuple, matching ix/ixl/mlx5. On Atlantic 1 the UDP-off action stays the existing L3L4 flow-filter workaround; only its policy source changes. TX traffic-class helper: factor the active-TC count (one per active 8-ring group, capped at HW_ATL_B0_TCS_MAX) out of aq_hw_qos_set() into aq_hw_active_tcs(), so there is a single definition of the policy; the Atlantic 2 RSS redirection table reuses it. Reviewed by: adrian Differential Revision: https://reviews.freebsd.org/D58137 --- sys/dev/aq/aq_hw.c | 14 ++++++++++++-- sys/dev/aq/aq_hw.h | 1 + sys/dev/aq/aq_main.c | 36 +++++++++++++++++++++++------------- 3 files changed, 36 insertions(+), 15 deletions(-) diff --git a/sys/dev/aq/aq_hw.c b/sys/dev/aq/aq_hw.c index 1ad9d2e15ed7..e610f8b27ba7 100644 --- a/sys/dev/aq/aq_hw.c +++ b/sys/dev/aq/aq_hw.c @@ -46,6 +46,7 @@ #define AQ_HW_FW_SM_RAM 0x2U #define AQ_CFG_FW_MIN_VER_EXPECTED 0x01050006U +static uint32_t aq_hw_active_tcs(struct aq_hw *hw); int aq_hw_err_from_flags(struct aq_hw *hw) @@ -406,8 +407,7 @@ aq_hw_qos_set(struct aq_hw *hw) tps_tx_pkt_shed_data_arb_mode_set(hw, 0U); /* One TC per active 8-ring group; share the buffer across them. */ - n_tcs = howmany(hw->tx_rings_count, HW_ATL_B0_RINGS_PER_TC); - n_tcs = MIN(MAX(n_tcs, 1U), HW_ATL_B0_TCS_MAX); + n_tcs = aq_hw_active_tcs(hw); buff_size = AQ_HW_TXBUF_MAX / n_tcs; for (tc = 0; tc < n_tcs; tc++) { @@ -442,6 +442,16 @@ aq_hw_qos_set(struct aq_hw *hw) return (err); } +/* Tx traffic classes currently provisioned (one per active 8-ring group). */ +static uint32_t +aq_hw_active_tcs(struct aq_hw *hw) +{ + uint32_t n = howmany(MAX(hw->tx_rings_count, 1U), + HW_ATL_B0_RINGS_PER_TC); + + return (MIN(n, HW_ATL_B0_TCS_MAX)); +} + static int aq_hw_offload_set(struct aq_hw *hw) { diff --git a/sys/dev/aq/aq_hw.h b/sys/dev/aq/aq_hw.h index 339c7cb7bea0..0619910d012c 100644 --- a/sys/dev/aq/aq_hw.h +++ b/sys/dev/aq/aq_hw.h @@ -370,5 +370,6 @@ int aq_hw_rss_hash_set(struct aq_hw *hw, uint8_t rss_key[HW_ATL_RSS_HASHKEY_SIZE int aq_hw_rss_hash_get(struct aq_hw *hw, uint8_t rss_key[HW_ATL_RSS_HASHKEY_SIZE]); int aq_hw_rss_set(struct aq_hw *hw, uint8_t rss_table[HW_ATL_RSS_INDIRECTION_TABLE_MAX]); int aq_hw_udp_rss_enable(struct aq_hw *hw, bool enable); +u_int aq_rss_hashconfig(void); #endif // _AQ_HW_H_ diff --git a/sys/dev/aq/aq_main.c b/sys/dev/aq/aq_main.c index 5d2d9061c548..4c06447b55d3 100644 --- a/sys/dev/aq/aq_main.c +++ b/sys/dev/aq/aq_main.c @@ -286,15 +286,18 @@ static struct if_shared_ctx aq_sctx_init = { .isc_ntxd_default = {PAGE_SIZE / sizeof(volatile union aq_txc_desc) * 4}, }; -/* - * TUNEABLE PARAMETERS: - */ - -static SYSCTL_NODE(_hw, OID_AUTO, aq, CTLFLAG_RD, 0, "Atlantic driver parameters"); -/* UDP Receive-Side Scaling */ -static int aq_enable_rss_udp = 1; -SYSCTL_INT(_hw_aq, OID_AUTO, enable_rss_udp, CTLFLAG_RDTUN, &aq_enable_rss_udp, - 0, "Enable Receive-Side Scaling (RSS) for UDP"); +/* RSS hash types; honor the kernel policy (UDP 4-tuple off by default). */ +u_int +aq_rss_hashconfig(void) +{ +#ifdef RSS + return (rss_gethashconfig()); +#else + return (RSS_HASHTYPE_RSS_IPV4 | RSS_HASHTYPE_RSS_TCP_IPV4 | + RSS_HASHTYPE_RSS_IPV6 | RSS_HASHTYPE_RSS_TCP_IPV6 | + RSS_HASHTYPE_RSS_IPV6_EX | RSS_HASHTYPE_RSS_TCP_IPV6_EX); +#endif +} /* @@ -450,11 +453,16 @@ aq_if_attach_post(if_ctx_t ctx) aq_add_stats_sysctls(softc); /* RSS */ - arc4rand(softc->rss_key, HW_ATL_RSS_HASHKEY_SIZE, 0); uint32_t rss_qs = MIN(softc->rx_rings_count, HW_ATL_RSS_INDIRECTION_QUEUES_MAX); - for (int i = nitems(softc->rss_table); i--;){ +#ifdef RSS + rss_getkey(softc->rss_key); + for (int i = nitems(softc->rss_table); i--;) + softc->rss_table[i] = rss_get_indirection_to_bucket(i) % rss_qs; +#else + arc4rand(softc->rss_key, HW_ATL_RSS_HASHKEY_SIZE, 0); + for (int i = nitems(softc->rss_table); i--;) softc->rss_table[i] = i % rss_qs; - } +#endif exit: AQ_DBG_EXIT(rc); return (rc); @@ -738,7 +746,9 @@ aq_if_init(if_ctx_t ctx) aq_if_enable_intr(ctx); aq_hw_rss_hash_set(&softc->hw, softc->rss_key); aq_hw_rss_set(&softc->hw, softc->rss_table); - aq_hw_udp_rss_enable(hw, aq_enable_rss_udp); + aq_hw_udp_rss_enable(hw, (aq_rss_hashconfig() & + (RSS_HASHTYPE_RSS_UDP_IPV4 | RSS_HASHTYPE_RSS_UDP_IPV6 | + RSS_HASHTYPE_RSS_UDP_IPV6_EX)) != 0); aq_hw_set_link_speed(hw, hw->link_rate); /* iflib does not replay filter state after init; aq_hw_init() clears it. */