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:	1ccf543b21 ("ifconfig: Add SR-IOV VF status output")
This commit is contained in:
Kevin Bowling committed 2026-08-09 03:07:35 -07:00
1 parent 185a03ad8a
commit 8696cc600f
1 file changed
+17
+17
View File
@@ -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;