git: 8696cc600f44 - main - iflib: Avoid locking for unsupported VF status queries

Kevin Bowling <[email protected]>
Newsgroups gmane.os.freebsd.devel.cvs.src
Message-ID <6a785197.36326.2e30a61c__44835.3625646391$1786270125$gmane$org@gitrepo.freebsd.org>
The branch main has been updated by kbowling:

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

commit 8696cc600f44767e7988a92c8e6fb943e97d4cc7
Author:     Kevin Bowling <[email protected]>
AuthorDate: 2026-08-09 09:12:38 +0000
Commit:     Kevin Bowling <[email protected]>
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;
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.