git: a3880af465e6 - main - iflib: Add optional RSS configuration queries

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

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

commit a3880af465e617e5ed6f1a6e49645e6a8299e3c0
Author:     Kevin Bowling <kbowling@FreeBSD.org>
AuthorDate: 2026-09-15 00:15:12 +0000
Commit:     Kevin Bowling <kbowling@FreeBSD.org>
CommitDate: 2026-09-18 22:24:29 +0000

    iflib: Add optional RSS configuration queries
    
    Dispatch SIOCGIFRSSKEY and SIOCGIFRSSHASH through typed get_rss_key and
    get_rss_hash methods under the context lock.  Drivers can report their
    programmed key and hash selections.  The default methods return EOPNOTSUPP.
    
    The common RSS key does not describe which hash selections a particular
    device actually programs.  hn(4) needs the effective VF configuration when
    synchronizing RSS between its synthetic and VF receive paths.
    
    Reviewed by:    iflib (gallatin)
    MFC after:      2 weeks
    Sponsored by:   BBOX.io
    Differential Revision:  https://reviews.freebsd.org/D59691
---
 sys/net/ifdi_if.m | 26 ++++++++++++++++++++++++++
 sys/net/iflib.c   | 10 ++++++++++
 2 files changed, 36 insertions(+)

diff --git a/sys/net/ifdi_if.m b/sys/net/ifdi_if.m
index b226a1c7b96b..50427729b877 100644
--- a/sys/net/ifdi_if.m
+++ b/sys/net/ifdi_if.m
@@ -126,6 +126,18 @@ CODE {
 		return (ENOTSUP);
 	}
 
+	static int
+	null_get_rss_key(if_ctx_t _ctx __unused, struct ifrsskey *_key __unused)
+	{
+		return (EOPNOTSUPP);
+	}
+
+	static int
+	null_get_rss_hash(if_ctx_t _ctx __unused, struct ifrsshash *_hash __unused)
+	{
+		return (EOPNOTSUPP);
+	}
+
 	static int
 	null_vf_status(if_ctx_t _ctx __unused,
 	    struct if_vf_status **_status __unused)
@@ -349,6 +361,20 @@ METHOD int priv_ioctl {
 # optional methods
 #
 
+#
+# Report the programmed RSS key and hash selections under the context lock.
+# Unsupported queries return EOPNOTSUPP; unavailable state returns an error.
+#
+METHOD int get_rss_key {
+	if_ctx_t _ctx;
+	struct ifrsskey *_key;
+} DEFAULT null_get_rss_key;
+
+METHOD int get_rss_hash {
+	if_ctx_t _ctx;
+	struct ifrsshash *_hash;
+} DEFAULT null_get_rss_hash;
+
 METHOD int i2c_req {
 	if_ctx_t _ctx;
 	struct ifi2creq *_req;
diff --git a/sys/net/iflib.c b/sys/net/iflib.c
index 1c43792c9857..c2e70d946bf6 100644
--- a/sys/net/iflib.c
+++ b/sys/net/iflib.c
@@ -4976,6 +4976,16 @@ iflib_if_ioctl(if_t ifp, u_long command, caddr_t data)
 		if_vlancap(ifp);
 		break;
 	}
+	case SIOCGIFRSSKEY:
+		CTX_LOCK(ctx);
+		err = IFDI_GET_RSS_KEY(ctx, (struct ifrsskey *)data);
+		CTX_UNLOCK(ctx);
+		break;
+	case SIOCGIFRSSHASH:
+		CTX_LOCK(ctx);
+		err = IFDI_GET_RSS_HASH(ctx, (struct ifrsshash *)data);
+		CTX_UNLOCK(ctx);
+		break;
 	case SIOCGPRIVATE_0:
 	case SIOCSDRVSPEC:
 	case SIOCGDRVSPEC: