git: e71bd1775af0 - stable/15 - mlx5en: Report the configured RSS tuple selections

From: Kevin Bowling <kbowling_at_FreeBSD.org>
Date: Fri, 13 Nov 2026 00:39:35 UTC
The branch stable/15 has been updated by kbowling:

URL: https://cgit.FreeBSD.org/src/commit/?id=e71bd1775af01f884489d18acaf38b44f7f5f97e

commit e71bd1775af01f884489d18acaf38b44f7f5f97e
Author:     Kevin Bowling <kbowling@FreeBSD.org>
AuthorDate: 2026-09-18 10:23:19 +0000
Commit:     Kevin Bowling <kbowling@FreeBSD.org>
CommitDate: 2026-11-13 00:39:26 +0000

    mlx5en: Report the configured RSS tuple selections
    
    Derive SIOCGIFRSSHASH's TCP and UDP selections from the same boot-time
    hash configuration used by mlx5e_build_tir_ctx().  The query previously
    advertised all six IPv4/IPv6 hash types even when the transport-specific
    TIRs selected only the IP addresses.  In particular, the default RSS
    configuration disables UDP four-tuple hashing.
    
    Continue reporting IPv4 and IPv6 two-tuple hashing unconditionally,
    matching the driver's IP-only TIRs.  Do not report IPv6 extension-header
    variants which the query did not previously claim.  Leave key selection,
    TIR programming, and the receive datapath unchanged.  This lets consumers
    such as hn(4) match the VF's hash inputs instead of enabling incompatible
    UDP four-tuple hashes on their own receive path.
    
    Fixes:          a00718e1dfcd ("Implement SIOCGIFRSSKEY and SIOCGIFRSSHASH and mlx5en(4).")
    Sponsored by:   BBOX.io
    Differential Revision:  https://reviews.freebsd.org/D59807
    
    (cherry picked from commit 0f111a802f6beb88f3edad9fa48d3721f8b3ec7b)
---
 sys/dev/mlx5/mlx5_en/mlx5_en_main.c | 27 ++++++++++++++++++++-------
 1 file changed, 20 insertions(+), 7 deletions(-)

diff --git a/sys/dev/mlx5/mlx5_en/mlx5_en_main.c b/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
index c12cecb1064d..64fb3d7f94f2 100644
--- a/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
+++ b/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
@@ -2974,6 +2974,25 @@ mlx5e_get_rss_key(void *key_ptr)
 	rss_getkey(key_ptr);
 }
 
+static u_int
+mlx5e_get_rss_hash_types(void)
+{
+	u_int hashconfig, types;
+
+	hashconfig = rss_gethashconfig();
+	/* The IP-only TIRs are always enabled, independently of hashconfig. */
+	types = RSS_TYPE_IPV4 | RSS_TYPE_IPV6;
+	if (hashconfig & RSS_HASHTYPE_RSS_TCP_IPV4)
+		types |= RSS_TYPE_TCP_IPV4;
+	if (hashconfig & RSS_HASHTYPE_RSS_UDP_IPV4)
+		types |= RSS_TYPE_UDP_IPV4;
+	if (hashconfig & RSS_HASHTYPE_RSS_TCP_IPV6)
+		types |= RSS_TYPE_TCP_IPV6;
+	if (hashconfig & RSS_HASHTYPE_RSS_UDP_IPV6)
+		types |= RSS_TYPE_UDP_IPV6;
+	return (types);
+}
+
 static void
 mlx5e_hw_lro_set_tir_ctx_lro_max_msg_sz(struct mlx5e_priv *priv, u32 *tirc)
 {
@@ -4015,13 +4034,7 @@ err_i2c:
 	case SIOCGIFRSSHASH:
 		ifrh = (struct ifrsshash *)data;
 		ifrh->ifrh_func = RSS_FUNC_TOEPLITZ;
-		ifrh->ifrh_types =
-		    RSS_TYPE_IPV4 |
-		    RSS_TYPE_TCP_IPV4 |
-		    RSS_TYPE_UDP_IPV4 |
-		    RSS_TYPE_IPV6 |
-		    RSS_TYPE_TCP_IPV6 |
-		    RSS_TYPE_UDP_IPV6;
+		ifrh->ifrh_types = mlx5e_get_rss_hash_types();
 		break;
 
 	default: