git: 0f111a802f6b - main - mlx5en: Report the configured RSS tuple selections

From: Kevin Bowling <kbowling_at_FreeBSD.org>
Date: Fri, 30 Oct 2026 22:41:35 UTC
The branch main has been updated by kbowling:

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

commit 0f111a802f6beb88f3edad9fa48d3721f8b3ec7b
Author:     Kevin Bowling <kbowling@FreeBSD.org>
AuthorDate: 2026-09-18 10:23:19 +0000
Commit:     Kevin Bowling <kbowling@FreeBSD.org>
CommitDate: 2026-10-30 22:40:58 +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).")
    MFC after:      2 weeks
    Sponsored by:   BBOX.io
    Differential Revision:  https://reviews.freebsd.org/D59807
---
 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 f912e69819dd..b20ce65385fb 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)
 {
@@ -4020,13 +4039,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: