git: 001332bdc11e - main - hn: Handle unavailable VF RSS configuration

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

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

commit 001332bdc11e2d72408bb5b815dcc9ffe8b6f5d3
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:25:58 +0000

    hn: Handle unavailable VF RSS configuration
    
    Treat unsupported RSS queries and RSS_FUNC_NONE as normal reasons to
    suppress synthetic receive hash metadata.  Keep diagnostics for other
    errors and invalid configurations.  Also suppress hash metadata when
    reconfiguring synthetic RSS fails, since the VF and synthetic settings
    cannot then be assumed to agree.  Correct the hash-query diagnostic name.
    
    MFC after:      2 weeks
    Sponsored by:   BBOX.io
    Differential Revision:  https://reviews.freebsd.org/D59691
---
 sys/dev/hyperv/netvsc/if_hn.c | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/sys/dev/hyperv/netvsc/if_hn.c b/sys/dev/hyperv/netvsc/if_hn.c
index 6d9953dd2217..08551ea02ab1 100644
--- a/sys/dev/hyperv/netvsc/if_hn.c
+++ b/sys/dev/hyperv/netvsc/if_hn.c
@@ -1590,10 +1590,13 @@ hn_vf_rss_fixup(struct hn_softc *sc, bool reconf)
 	strlcpy(ifrk.ifrk_name, if_name(vf_ifp), sizeof(ifrk.ifrk_name));
 	error = ifhwioctl(SIOCGIFRSSKEY, vf_ifp, (caddr_t)&ifrk, curthread);
 	if (error) {
-		if_printf(ifp, "%s SIOCGIFRSSKEY failed: %d\n",
-		    if_name(vf_ifp), error);
+		if (error != EOPNOTSUPP)
+			if_printf(ifp, "%s SIOCGIFRSSKEY failed: %d\n",
+			    if_name(vf_ifp), error);
 		goto done;
 	}
+	if (ifrk.ifrk_func == RSS_FUNC_NONE)
+		goto done;
 	if (ifrk.ifrk_func != RSS_FUNC_TOEPLITZ) {
 		if_printf(ifp, "%s RSS function %u is not Toeplitz\n",
 		    if_name(vf_ifp), ifrk.ifrk_func);
@@ -1612,10 +1615,13 @@ hn_vf_rss_fixup(struct hn_softc *sc, bool reconf)
 	strlcpy(ifrh.ifrh_name, if_name(vf_ifp), sizeof(ifrh.ifrh_name));
 	error = ifhwioctl(SIOCGIFRSSHASH, vf_ifp, (caddr_t)&ifrh, curthread);
 	if (error) {
-		if_printf(ifp, "%s SIOCGRSSHASH failed: %d\n",
-		    if_name(vf_ifp), error);
+		if (error != EOPNOTSUPP)
+			if_printf(ifp, "%s SIOCGIFRSSHASH failed: %d\n",
+			    if_name(vf_ifp), error);
 		goto done;
 	}
+	if (ifrh.ifrh_func == RSS_FUNC_NONE)
+		goto done;
 	if (ifrh.ifrh_func != RSS_FUNC_TOEPLITZ) {
 		if_printf(ifp, "%s RSS function %u is not Toeplitz\n",
 		    if_name(vf_ifp), ifrh.ifrh_func);
@@ -1713,11 +1719,11 @@ hn_vf_rss_fixup(struct hn_softc *sc, bool reconf)
 		if (error) {
 			/* XXX roll-back? */
 			if_printf(ifp, "hn_rss_reconfig failed: %d\n", error);
-			/* XXX keep going. */
+			mbuf_types = 0;
 		}
 	}
 done:
-	/* Hash deliverability for mbufs. */
+	/* Do not expose hashes unless the VF and synthetic settings agree. */
 	hn_rss_mbuf_hash(sc, hn_rss_type_tondis(mbuf_types));
 }