Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 09 Aug 2026 10:08:23 +0000
From:      Kevin Bowling <kbowling@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 8696cc600f44 - main - iflib: Avoid locking for unsupported VF status queries
Message-ID:  <6a785197.36326.2e30a61c@gitrepo.freebsd.org>

index | next in thread | raw e-mail

The branch main has been updated by kbowling:

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

commit 8696cc600f44767e7988a92c8e6fb943e97d4cc7
Author:     Kevin Bowling <kbowling@FreeBSD.org>
AuthorDate: 2026-08-09 09:12:38 +0000
Commit:     Kevin Bowling <kbowling@FreeBSD.org>
CommitDate: 2026-08-09 10:07:35 +0000

    iflib: Avoid locking for unsupported VF status queries
    
    ifconfig -v requests SR-IOV VF status from every interface.  iflib
    previously acquired the context lock before dispatching the request even
    for VFs and drivers using the default unsupported method.  Mailbox work
    on a VF could therefore delay the complete interface listing.
    
    VF status describes the children of an SR-IOV PF.  Reject requests on
    VF contexts and classes using the default method without taking the
    context lock.  Keep the lock for actual PF status providers.
    
    Fixes:  1ccf543b21ef ("ifconfig: Add SR-IOV VF status output")
---
 sys/net/iflib.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/sys/net/iflib.c b/sys/net/iflib.c
index 54001be3eae5..8322dbfb074d 100644
--- a/sys/net/iflib.c
+++ b/sys/net/iflib.c
@@ -4658,10 +4658,27 @@ iflib_if_ioctl(if_t ifp, u_long command, caddr_t data)
 		CTX_UNLOCK(ctx);
 		break;
 	case SIOCGIFVFSTATUS:
+	{
+		kobjop_desc_t kobj_desc;
+		kobj_method_t *kobj_method;
+
+		/* VF status describes children of an SR-IOV PF. */
+		if (CTX_IS_VF(ctx)) {
+			err = ENOTSUP;
+			break;
+		}
+		kobj_desc = &ifdi_vf_status_desc;
+		kobj_method = kobj_lookup_method(((kobj_t)ctx)->ops->cls,
+		    NULL, kobj_desc);
+		if (kobj_method == &kobj_desc->deflt) {
+			err = ENOTSUP;
+			break;
+		}
 		CTX_LOCK(ctx);
 		err = IFDI_VF_STATUS(ctx, (nvlist_t *)data);
 		CTX_UNLOCK(ctx);
 		break;
+	}
 	default:
 		err = ether_ioctl(ifp, command, data);
 		break;


home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?6a785197.36326.2e30a61c>