From nobody Mon Aug 31 17:18:38 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 4hYbLR2PVGz6r5lD for ; Mon, 31 Aug 2026 17:18:39 +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 "YR2" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4hYbLQ5KtWz3J5H for ; Mon, 31 Aug 2026 17:18:38 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1788196718; 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=jexzv05QrtIQjcGmngVPkB9aOUUXKxZPO0aBBF01edQ=; b=kG52CG9PWPqNuDUGgzKbQybMYshfw3JEP4Azg9VwVMzkcyg7La/x9xAw4moB86opdab1W5 4/VeuTSk9zapPjmzaIaNacUSLbEjbJIqrwqL2nNVI6z0d64gRkEmavNaOja8gihMEnXWh5 ZSKtOH5m2GXiRroRnSWUf8y6OkXxBHAm1r+4wvKGvRXHjTox8P76mDetcftQGbBC9HHl1F BkrHRqBkyVhG4gTAuek8h73pzZba1NUxLtpQmYcDGnB38+6H0HipwPHqeuTFukknC+xoYC aXp+1IIzi+1oUBPJVf0gsy4kwVT+Q+0Nr3ADCczfodpbt9OjD82oXuJVI/5pdg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1788196718; a=rsa-sha256; cv=none; b=lXbimjtnbXdvSJKcqcwOAzrkxWo7AKTJ0fgntLPSo/CNN7Ax2soKM/WFzNGfAyMEJXiPVF Zq3YM1gZUJGYCvjtrNksXCzaYrC1Y/qY2D/Zhs6I9iy3H3j0DzxTc78XlpEuAefHbjjf+m ynJACPGpN4/sixpyyM0MLkRQnaF93rFodHymoC56ut7fvSwHnyq1nPvEhbDP2owEYBEoZt YnUghMcD7N05WyFeMDDuv3vrLtwQVtbd3G5KCeiZ+pIiDCNoM8eTo6AvCbC6h3eWcaE3A8 DzxmHxNxL70v/1uNLGLxC626DGWT6nvEbsP327v186NpKGlSOhGamr6CULWoNw== 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=1788196718; 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=jexzv05QrtIQjcGmngVPkB9aOUUXKxZPO0aBBF01edQ=; b=coU7YWLFJs+M7c9ZuAdwK+njUO3P0jtpgJ968+fJ4r/iolgiJpAEAL6zNKpK7cHMXofT8J L4w8z3YZV1N4BrWKgG1rO42bnKUdsei6JNA6KECIGRLyQ8JQLwQ6zSnsipqReC4I/63zaf WZsd5v4iIpBwMm6x7kINpxyVFtZlvWqY3OH4NCpG5l0q4freHingX2Ek/MDG+Ioqv/ZDCJ hsI64DS1u94N2U6vZfPcg0rDl6F+gPLNT2kFM1T3yVFQmgn45EqueHgRd+zOU/IL/lgDbS IhGLDynXY+ZZIEjRe7vxcX1Ps9W2t37WX/ZmE6YrbCaA0pe48kT8JhOd1Ol8Xw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4hYbLQ4Jw0z4qH for ; Mon, 31 Aug 2026 17:18:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 369bd by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Mon, 31 Aug 2026 17:18:38 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Cc: Nick Price From: Ed Maste Subject: git: 239718d5f48e - stable/15 - 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: emaste X-Git-Repository: src X-Git-Refname: refs/heads/stable/15 X-Git-Reftype: branch X-Git-Commit: 239718d5f48ef113e05654bcdc0390782d10244a Auto-Submitted: auto-generated Date: Mon, 31 Aug 2026 17:18:38 +0000 Message-Id: <6a95b76e.369bd.a357734@gitrepo.freebsd.org> The branch stable/15 has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=239718d5f48ef113e05654bcdc0390782d10244a commit 239718d5f48ef113e05654bcdc0390782d10244a Author: Nick Price AuthorDate: 2026-07-19 16:41:37 +0000 Commit: Ed Maste CommitDate: 2026-08-31 17:17:13 +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 (cherry picked from commit 9b4585afd31384573fcebd156d0e4af32bcddf9e) --- 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. */