From nobody Mon Aug 10 22:50:02 2026 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4hJqhc0ypDz6m6m3 for ; Mon, 10 Aug 2026 22:50:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4hJqhc0Jbcz3ts0 for ; Mon, 10 Aug 2026 22:50:08 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1786402208; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=DZgaF9YJrZVgPvpkMlUsPnwQPGFxt4uE/XTV8/hBshA=; b=eKeUf769UgmpBuxnIsSq+T6G3WNOXWqARpE9g2NQCBHGjZbkWPqw+SWKR2Rze9qZ9MG0jb w+4ndzKNCXGFUoTzwoO2f+8yF8qvBSqN2XIM04Gf75IAtDosBGyACyXx1TJnamB1HLm8tD gi7SeAxxs0tO6heD3flljWhvKKNWQ9hz73rUE1sk262svJLlRzUKUAMt0+ctioL98Zq9xt rA2+LqfWm8f1VT9RPrJa1uGhkxQR/Y1LZis+3ZgWF8vAUhFC+zY7T4I4Ej5WlWpAr9U4Vi ywqxyoiaYb1FVqXRx7xqD/TX3iLBJ9xq6ThyO+XIwnPa/OWLeD/h9WDNL7nxng== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1786402208; a=rsa-sha256; cv=none; b=fua81zPKHojo+exJivm3TbiBK/KtX3jZesde+SsXJRUvQyvEYcZjgT2/yqNr3SM6tqbA6J 6b8cTK60o2ncfwtT9OZUR3ehz01QosABI/sINMKGGQA2aMYFcvBacWgfWf2GWt9nUMr0jM e2+w6siO9iaHj3BxMwgXJ2fibiuk2fhxWPUHjLzyLF+PHd0S9Pd63KMF6ql/6uehQYukhP OAFBuGKGi9uex36a9dcv6WYGwGmahbGrnW0SXCiOT1JFKdv6sao6XAjzc4osZ3/x2cc2HD nb1HvXWMLjZk29LiL/rT6aZseE6bkvmPsKyuebDVHlg4ZMWP3THRUVCcWev6nw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1786402208; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=DZgaF9YJrZVgPvpkMlUsPnwQPGFxt4uE/XTV8/hBshA=; b=BNUHmBQR/51BssRYXoFD7gNkM2/E4T/V3TieEuttLYRXlztx1+gdI0fkcOaU/njwHnyKJY JJT2qbyf4KWuPFNGrT6dGNMl8ENgcqiywYesdgLX/eMXcEzD1YTeNouq88LYELVjKuPmUs q3VVHJpxhnBHwW6ZXVDDU8HgqxIrHa0+gT6jZNRazTRDLHDeN5Qy3lU+jo91q3xCz6I9ho FCq2iiXY9rqI2s3V9S3mh0UERqtYL+273PYBsYJi31fY/uKtkJgjqayNQ6ivTDmdTa7h0A gf211DC0RvgOVV0Jj6SePAn+5yqb3aQuWDaIVUaTazkTEeK7P2wwIUT8M17MEg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4hJqhb6R2gzCq0 for ; Mon, 10 Aug 2026 22:50:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 39d23 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Mon, 10 Aug 2026 22:50:02 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kevin Bowling Subject: git: a6999a1c947f - main - net: Revert the ioctl SR-IOV VF status interface List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kbowling X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a6999a1c947f3dc8b7491c903231efc2d78538d5 Auto-Submitted: auto-generated Date: Mon, 10 Aug 2026 22:50:02 +0000 Message-Id: <6a7a559a.39d23.7828612@gitrepo.freebsd.org> The branch main has been updated by kbowling: URL: https://cgit.FreeBSD.org/src/commit/?id=a6999a1c947f3dc8b7491c903231efc2d78538d5 commit a6999a1c947f3dc8b7491c903231efc2d78538d5 Author: Kevin Bowling AuthorDate: 2026-08-10 22:19:30 +0000 Commit: Kevin Bowling CommitDate: 2026-08-10 22:49:55 +0000 net: Revert the ioctl SR-IOV VF status interface A native route Netlink interface will replace this stack. Requested by: glebius This reverts commit 1ccf543b21eff6e0828142e5c1d09519247143f4. This reverts commit 2c04cfa148ec4dd5cef7e228aaea6a05957fcb15. This reverts commit 2d6114f6d26bf7dfa5ad94e1db9b09ee7108dc7a. This reverts commit d15f2551b25f79ddcbe289faa95e655100b952da. This reverts commit ceb282bbd62eed5e84df9abaede0dd183f66997a. This reverts commit c30021fe0df9e045a17292dbe50dfc054b69871f. This reverts commit fb1820d23a04856a6d3047b4c088cc8df8f76da1. This reverts commit 8696cc600f44767e7988a92c8e6fb943e97d4cc7. --- lib/libifconfig/Makefile | 2 +- lib/libifconfig/Symbol.map | 4 - lib/libifconfig/libifconfig.c | 129 ------------ lib/libifconfig/libifconfig.h | 11 - rescue/rescue/Makefile | 7 +- sbin/ifconfig/Makefile | 1 - sbin/ifconfig/ifconfig.8 | 56 +---- sbin/ifconfig/ifconfig.c | 2 - sbin/ifconfig/ifconfig.h | 1 - sbin/ifconfig/ifconfig_netlink.c | 2 - sbin/ifconfig/ifvfstatus.c | 212 ------------------- share/man/man4/rtnetlink.4 | 118 +---------- share/mk/src.libnames.mk | 4 +- sys/dev/e1000/if_em.c | 1 - sys/dev/e1000/if_igb_iov.c | 58 ------ sys/dev/e1000/if_igb_iov.h | 1 - sys/dev/ixgbe/if_ix.c | 1 - sys/dev/ixgbe/if_sriov.c | 90 -------- sys/dev/ixgbe/ixgbe_sriov.h | 1 - sys/dev/ixl/if_ixl.c | 65 ------ sys/net/if.c | 174 +--------------- sys/net/if.h | 71 ------- sys/net/if_var.h | 1 - sys/net/ifdi_if.m | 11 - sys/net/iflib.c | 22 -- sys/netlink/netlink_snl_route_parsers.h | 112 ---------- sys/netlink/route/iface.c | 284 +------------------------- sys/netlink/route/interface.h | 82 +------- sys/netlink/route/route_var.h | 1 - sys/sys/sockio.h | 2 - tests/atf_python/sys/netlink/attrs.py | 28 --- tests/atf_python/sys/netlink/netlink_route.py | 117 ----------- tests/sys/netlink/test_rtnl_iface.py | 13 +- tests/sys/netlink/test_snl.c | 89 -------- tools/bsdbox/Makefile | 1 - tools/bsdbox/Makefile.net | 1 + usr.sbin/iovctl/iovctl.8 | 12 +- usr.sbin/iovctl/iovctl.conf.5 | 10 +- 38 files changed, 32 insertions(+), 1765 deletions(-) diff --git a/lib/libifconfig/Makefile b/lib/libifconfig/Makefile index 48fc39d921bc..02629eb88f25 100644 --- a/lib/libifconfig/Makefile +++ b/lib/libifconfig/Makefile @@ -1,7 +1,7 @@ LIB= ifconfig INTERNALLIB= true -LIBADD= m nv +LIBADD= m SHLIBDIR?= /lib SHLIB_MAJOR= 2 diff --git a/lib/libifconfig/Symbol.map b/lib/libifconfig/Symbol.map index a793fcdefbda..2e11ff963909 100644 --- a/lib/libifconfig/Symbol.map +++ b/lib/libifconfig/Symbol.map @@ -84,7 +84,3 @@ FBSD_1.6 { ifconfig_sfp_rev_description; ifconfig_sfp_rev_symbol; }; - -FBSD_1.9 { - ifconfig_get_vf_status; -}; diff --git a/lib/libifconfig/libifconfig.c b/lib/libifconfig/libifconfig.c index 3818cb689dbf..b450c15180db 100644 --- a/lib/libifconfig/libifconfig.c +++ b/lib/libifconfig/libifconfig.c @@ -529,135 +529,6 @@ ifconfig_get_ifstatus(ifconfig_handle_t *h, const char *name, return (ifconfig_ioctlwrap(h, AF_LOCAL, SIOCGIFSTATUS, ifs)); } -static int -ifconfig_vf_status_validate(const nvlist_t *status) -{ - const nvlist_t * const *vfs; - const nvlist_t *extensions, *vf; - const char *name; - void *cookie; - size_t i, num_vfs; - int type; - - if (!nvlist_exists_number(status, IFVF_STATUS_VERSION_KEY)) - return (EBADMSG); - if (nvlist_get_number(status, IFVF_STATUS_VERSION_KEY) != - IFVF_STATUS_VERSION) - return (EPROTONOSUPPORT); - if (!nvlist_exists_nvlist_array(status, IFVF_STATUS_VFS)) - return (EBADMSG); - - vfs = nvlist_get_nvlist_array(status, IFVF_STATUS_VFS, &num_vfs); - for (i = 0; i < num_vfs; i++) { - vf = vfs[i]; - if (!nvlist_exists_number(vf, IFVF_STATUS_INDEX)) - return (EBADMSG); - if (!nvlist_exists(vf, IFVF_STATUS_EXTENSIONS)) - continue; - if (!nvlist_exists_nvlist(vf, IFVF_STATUS_EXTENSIONS)) - return (EBADMSG); - extensions = nvlist_get_nvlist(vf, IFVF_STATUS_EXTENSIONS); - cookie = NULL; - while ((name = nvlist_next(extensions, &type, &cookie)) != NULL) { - if (type != NV_TYPE_NVLIST) - return (EBADMSG); - if (!nvlist_exists_number(nvlist_get_nvlist(extensions, - name), IFVF_STATUS_EXT_VERSION)) - return (EBADMSG); - } - } - return (0); -} - -int -ifconfig_get_vf_status(ifconfig_handle_t *h, const char *name, - nvlist_t **statusp) -{ - struct ifreq ifr; - nvlist_t *status; - void *buf, *newbuf; - size_t namelen; - u_int buflen, nextlen; - int error; - - if (h == NULL || name == NULL || statusp == NULL) { - if (h != NULL) - ifconfig_error(h, OTHER, EINVAL); - return (-1); - } - *statusp = NULL; - namelen = strnlen(name, IFNAMSIZ); - if (namelen == IFNAMSIZ) { - ifconfig_error(h, OTHER, ENAMETOOLONG); - return (-1); - } - - /* - * ioctl(2) does not copy an _IOWR argument back to userspace when the - * command returns EFBIG, so the kernel's required length is not - * observable on a short-buffer error. Start with enough space for the - * common case and grow geometrically instead of relying on length. - */ - buflen = 16 * 1024; - buf = malloc(buflen); - if (buf == NULL) { - ifconfig_error(h, OTHER, ENOMEM); - return (-1); - } - for (;;) { - memset(&ifr, 0, sizeof(ifr)); - memcpy(ifr.ifr_name, name, namelen + 1); - ifr.ifr_vf_status_nv.buffer = buf; - ifr.ifr_vf_status_nv.buf_length = buflen; - if (ifconfig_ioctlwrap(h, AF_LOCAL, SIOCGIFVFSTATUS, &ifr) == 0) - break; - if (ifconfig_err_errno(h) != EFBIG || - buflen == IFR_VF_STATUS_NV_MAXBUFSIZE || - ifr.ifr_vf_status_nv.length > - IFR_VF_STATUS_NV_MAXBUFSIZE) { - free(buf); - return (-1); - } - if (ifr.ifr_vf_status_nv.length > buflen) - nextlen = ifr.ifr_vf_status_nv.length; - else if (buflen > IFR_VF_STATUS_NV_MAXBUFSIZE / 2) - nextlen = IFR_VF_STATUS_NV_MAXBUFSIZE; - else - nextlen = buflen * 2; - newbuf = realloc(buf, nextlen); - if (newbuf == NULL) { - free(buf); - ifconfig_error(h, OTHER, ENOMEM); - return (-1); - } - buf = newbuf; - buflen = nextlen; - } - - if (ifr.ifr_vf_status_nv.length == 0 || - ifr.ifr_vf_status_nv.length > buflen) { - free(buf); - ifconfig_error(h, OTHER, EBADMSG); - return (-1); - } - status = nvlist_unpack(buf, ifr.ifr_vf_status_nv.length, 0); - free(buf); - if (status == NULL) { - ifconfig_error(h, OTHER, EBADMSG); - return (-1); - } - error = ifconfig_vf_status_validate(status); - if (error != 0) { - nvlist_destroy(status); - ifconfig_error(h, OTHER, error); - return (-1); - } - - ifconfig_error_clear(h); - *statusp = status; - return (0); -} - int ifconfig_destroy_interface(ifconfig_handle_t *h, const char *name) { diff --git a/lib/libifconfig/libifconfig.h b/lib/libifconfig/libifconfig.h index 130b002252c5..817f52bd094e 100644 --- a/lib/libifconfig/libifconfig.h +++ b/lib/libifconfig/libifconfig.h @@ -26,7 +26,6 @@ #pragma once -#include #include #include @@ -199,16 +198,6 @@ int ifconfig_get_groups(ifconfig_handle_t *h, const char *name, int ifconfig_get_ifstatus(ifconfig_handle_t *h, const char *name, struct ifstat *stat); -/** Retrieve structured SR-IOV VF status for an interface. - * @param h An open ifconfig state object - * @param name The PF interface name - * @param statusp Return argument. The caller owns the returned nvlist and - * must destroy it with nvlist_destroy(). - * @return 0 on success, -1 on failure - */ -int ifconfig_get_vf_status(ifconfig_handle_t *h, const char *name, - nvlist_t **statusp); - /** Retrieve the interface media information * @param h An open ifconfig state object * @param name The interface name diff --git a/rescue/rescue/Makefile b/rescue/rescue/Makefile index e65ad75d54af..2ac475cca10c 100644 --- a/rescue/rescue/Makefile +++ b/rescue/rescue/Makefile @@ -124,7 +124,7 @@ CRUNCH_PROGS_sbin+= ipfw .if ${MK_PF} != "no" CRUNCH_PROGS_sbin+= pfctl -CRUNCH_LIBS_pfctl+= ${LIBPFCTL} +CRUNCH_LIBS_pfctl+= ${LIBPFCTL} ${LIBNV} .endif .if ${MK_ROUTED} != "no" @@ -143,7 +143,7 @@ CRUNCH_PROGS_usr.sbin+= zdb # CRUNCH_PROGS+= devd CRUNCH_LIBS+= -l80211 -lalias -lcam -lncursesw -ldevstat -lipsec -llzma -CRUNCH_LIBS_camcontrol+= ${LIBNVMF} +CRUNCH_LIBS_camcontrol+= ${LIBNVMF} ${LIBNV} .if ${MK_ZFS} != "no" CRUNCH_LIBS+= -lavl -lpthread -lumem -lspl -lrt CRUNCH_LIBS_zfs+= ${LIBBE} \ @@ -261,9 +261,10 @@ CRUNCH_ALIAS_chown= chgrp ################################################################## CRUNCH_LIBS+= ${OBJTOP}/lib/libifconfig/libifconfig.a -CRUNCH_LIBS+= -lnv CRUNCH_BUILDOPTS+= CRUNCH_CFLAGS+=-I${OBJTOP}/lib/libifconfig +CRUNCH_LIBS_ifconfig+= ${LIBNV} + CRUNCH_LIBS+= -lm .if ${MK_ISCSI} != "no" diff --git a/sbin/ifconfig/Makefile b/sbin/ifconfig/Makefile index 759b5d6f1438..26391023d54a 100644 --- a/sbin/ifconfig/Makefile +++ b/sbin/ifconfig/Makefile @@ -35,7 +35,6 @@ SRCS+= ifgif.c # GIF reversed header workaround SRCS+= ifipsec.c # IPsec VTI SRCS+= sfp.c # SFP/SFP+ information -SRCS+= ifvfstatus.c # VF status information LIBADD+= ifconfig m util CFLAGS+= -I${SRCTOP}/lib/libifconfig -I${OBJTOP}/lib/libifconfig diff --git a/sbin/ifconfig/ifconfig.8 b/sbin/ifconfig/ifconfig.8 index f92393586b63..7a85ba314f43 100644 --- a/sbin/ifconfig/ifconfig.8 +++ b/sbin/ifconfig/ifconfig.8 @@ -28,7 +28,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd August 8, 2026 +.Dd August 10, 2026 .Dt IFCONFIG 8 .Os .Sh NAME @@ -325,60 +325,6 @@ will attempt to load it. Display only the interfaces that are up. .It Fl v Get more verbose status for an interface. -When supported, this includes the status of configured SR-IOV virtual -functions. -Fields that the PF driver cannot observe are omitted; an omitted field does -not mean false or zero. -The status begins with the PF link state and speed normally advertised to -VFs, followed by the number of VFs and one record for each VF. -PF link status does not demonstrate that a VF driver is operational. -.Pp -Per-VF fields are arranged in the following groups: -.Bl -tag -width "resources" -.It Cm identity -The primary MAC address known to the PF. -.It Cm state -.Cm configured=yes -means that the PF accepted the VF configuration. -.Cm initialized=yes -means that the VF completed its driver or mailbox handshake since its last -reset. -When available, this group also reports whether traffic is enabled, whether -malicious-driver detection blocked the VF, and whether it is quarantined. -.It Cm resources -The number of symmetric RX/TX queue pairs allocated to the VF. -This is not necessarily the number of queue pairs currently used by its -driver. -.It Cm vlan -An access VLAN is imposed by the PF; trunk mode means that no access VLAN is -imposed and does not promise unlimited filter capacity. -The filter count includes explicit filters recorded by the PF and excludes -implicit untagged and priority-tag membership. -.It Cm policy -Administrative permissions for VF requests, MAC anti-spoofing state, and an -optional per-VF link-state policy. -Permissions describe what the VF may request, not its current requests. -.It Cm protocol -The negotiated PF/VF mailbox API version, when known. -.El -.Pp -For example: -.Bd -literal -offset indent -VF-visible PF link: state=up speed=10000Mbps -virtual functions: 1 - vf 0: - identity: mac=02:00:00:00:00:01 - state: configured=yes initialized=yes traffic=enabled - resources: queue-pairs=4 - vlan: mode=trunk filters=0 - policy: set-mac=denied set-vlan=allowed anti-spoof=on -.Ed -.Pp -See -.Xr iovctl.conf 5 -for VF configuration and -.Xr iovctl 8 -for PCI attachment and passthrough status. .It Ar address For the inet family, the address is either a host name present in the host name data diff --git a/sbin/ifconfig/ifconfig.c b/sbin/ifconfig/ifconfig.c index 52aa5696804e..0e839eeafc5b 100644 --- a/sbin/ifconfig/ifconfig.c +++ b/sbin/ifconfig/ifconfig.c @@ -1891,8 +1891,6 @@ status(if_ctx *ctx, const struct sockaddr_dl *sdl __unused, struct ifaddrs *ifa) args->afp->af_other_status(ctx); print_ifstatus(ctx); - if (args->verbose > 0) - vf_status(ctx); if (args->verbose > 0) sfp_status(ctx); diff --git a/sbin/ifconfig/ifconfig.h b/sbin/ifconfig/ifconfig.h index 75778e27a340..672020443b8c 100644 --- a/sbin/ifconfig/ifconfig.h +++ b/sbin/ifconfig/ifconfig.h @@ -281,7 +281,6 @@ void clone_setdefcallback_prefix(const char *, clone_callback_func *); void clone_setdefcallback_filter(clone_match_func *, clone_callback_func *); void sfp_status(if_ctx *ctx); -void vf_status(if_ctx *ctx); struct sockaddr_dl; bool match_ether(const struct sockaddr_dl *sdl); diff --git a/sbin/ifconfig/ifconfig_netlink.c b/sbin/ifconfig/ifconfig_netlink.c index 565a1ac91e20..c37108737379 100644 --- a/sbin/ifconfig/ifconfig_netlink.c +++ b/sbin/ifconfig/ifconfig_netlink.c @@ -414,8 +414,6 @@ status_nl(if_ctx *ctx, struct iface *iface) args->afp->af_other_status(ctx); print_ifstatus(ctx); - if (args->verbose > 0) - vf_status(ctx); if (args->drivername || args->verbose) { if (ifconfig_get_orig_name(lifh, link->ifla_ifname, &drivername) != 0) { diff --git a/sbin/ifconfig/ifvfstatus.c b/sbin/ifconfig/ifvfstatus.c deleted file mode 100644 index 12f495450260..000000000000 --- a/sbin/ifconfig/ifvfstatus.c +++ /dev/null @@ -1,212 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause - * - * Copyright (c) 2019 Intel Corporation - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include - -#include -#include - -#include -#include -#include -#include - -#include "ifconfig.h" - -static void -vf_group_begin(bool *printed, const char *name) -{ - if (!*printed) { - printf("\t\t\t%s:", name); - *printed = true; - } -} - -static void -vf_group_end(bool printed) -{ - if (printed) - putchar('\n'); -} - -void -vf_status(if_ctx *ctx) -{ - const nvlist_t * const *vfs; - const nvlist_t *vf; - const void *mac; - nvlist_t *status; - const char *mode, *state; - size_t maclen, num_vfs; - uint64_t speed; - bool printed; - int error; - - if (ifconfig_get_vf_status(lifh, ctx->ifname, &status) != 0) { - error = ifconfig_err_errno(lifh); - if (error == EINVAL || error == ENOTTY || error == ENXIO || - error == ENOTSUP || error == EOPNOTSUPP) - return; - errno = error; - warn("SIOCGIFVFSTATUS"); - return; - } - - if (nvlist_exists_string(status, IFVF_STATUS_PF_LINK_STATE)) { - state = nvlist_get_string(status, IFVF_STATUS_PF_LINK_STATE); - printf("\tVF-visible PF link: state=%s", state); - if (nvlist_exists_number(status, IFVF_STATUS_PF_LINK_SPEED)) { - speed = nvlist_get_number(status, - IFVF_STATUS_PF_LINK_SPEED); - if (speed % IF_Mbps(1) == 0) - printf(" speed=%juMbps", (uintmax_t)(speed / - IF_Mbps(1))); - else - printf(" speed=%jubps", (uintmax_t)speed); - } - putchar('\n'); - } - - vfs = nvlist_get_nvlist_array(status, IFVF_STATUS_VFS, &num_vfs); - printf("\tvirtual functions: %zu\n", num_vfs); - for (size_t i = 0; i < num_vfs; i++) { - vf = vfs[i]; - printf("\t\tvf %3ju:\n", - (uintmax_t)(nvlist_exists_number(vf, IFVF_STATUS_INDEX) ? - nvlist_get_number(vf, IFVF_STATUS_INDEX) : i)); - - printed = false; - if (nvlist_exists_binary(vf, IFVF_STATUS_MAC)) { - mac = nvlist_get_binary(vf, IFVF_STATUS_MAC, &maclen); - if (maclen == ETHER_ADDR_LEN) { - vf_group_begin(&printed, "identity"); - printf(" mac=%s", ether_ntoa(mac)); - } - } - vf_group_end(printed); - - printed = false; - if (nvlist_exists_bool(vf, IFVF_STATUS_CONFIGURED)) { - vf_group_begin(&printed, "state"); - printf(" configured=%s", - nvlist_get_bool(vf, IFVF_STATUS_CONFIGURED) ? - "yes" : "no"); - } - if (nvlist_exists_bool(vf, IFVF_STATUS_INITIALIZED)) { - vf_group_begin(&printed, "state"); - printf(" initialized=%s", nvlist_get_bool(vf, - IFVF_STATUS_INITIALIZED) ? "yes" : "no"); - } - if (nvlist_exists_bool(vf, IFVF_STATUS_TRAFFIC_ENABLED)) { - vf_group_begin(&printed, "state"); - printf(" traffic=%s", nvlist_get_bool(vf, - IFVF_STATUS_TRAFFIC_ENABLED) ? "enabled" : "disabled"); - } - if (nvlist_exists_bool(vf, IFVF_STATUS_MDD_BLOCKED)) { - vf_group_begin(&printed, "state"); - printf(" mdd-blocked=%s", nvlist_get_bool(vf, - IFVF_STATUS_MDD_BLOCKED) ? "yes" : "no"); - } - if (nvlist_exists_bool(vf, IFVF_STATUS_QUARANTINED)) { - vf_group_begin(&printed, "state"); - printf(" quarantined=%s", nvlist_get_bool(vf, - IFVF_STATUS_QUARANTINED) ? "yes" : "no"); - } - vf_group_end(printed); - - printed = false; - if (nvlist_exists_number(vf, IFVF_STATUS_NUM_QUEUES)) { - vf_group_begin(&printed, "resources"); - printf(" queue-pairs=%ju", - (uintmax_t)nvlist_get_number(vf, - IFVF_STATUS_NUM_QUEUES)); - } - vf_group_end(printed); - - printed = false; - if (nvlist_exists_string(vf, IFVF_STATUS_VLAN_MODE)) { - mode = nvlist_get_string(vf, IFVF_STATUS_VLAN_MODE); - vf_group_begin(&printed, "vlan"); - printf(" mode=%s", mode); - if (strcmp(mode, IFVF_VLAN_MODE_ACCESS) == 0 && - nvlist_exists_number(vf, IFVF_STATUS_VLAN)) - printf(" vid=%ju", (uintmax_t)nvlist_get_number(vf, - IFVF_STATUS_VLAN)); - } - if (nvlist_exists_number(vf, IFVF_STATUS_VLAN_COUNT)) { - vf_group_begin(&printed, "vlan"); - printf(" filters=%ju", (uintmax_t)nvlist_get_number(vf, - IFVF_STATUS_VLAN_COUNT)); - } - if (nvlist_exists_number(vf, IFVF_STATUS_VLAN_LIMIT)) { - vf_group_begin(&printed, "vlan"); - printf(" limit=%ju", (uintmax_t)nvlist_get_number(vf, - IFVF_STATUS_VLAN_LIMIT)); - } - vf_group_end(printed); - - printed = false; - if (nvlist_exists_bool(vf, IFVF_STATUS_ALLOW_SET_MAC)) { - vf_group_begin(&printed, "policy"); - printf(" set-mac=%s", nvlist_get_bool(vf, - IFVF_STATUS_ALLOW_SET_MAC) ? "allowed" : "denied"); - } - if (nvlist_exists_bool(vf, IFVF_STATUS_ALLOW_SET_VLAN)) { - vf_group_begin(&printed, "policy"); - printf(" set-vlan=%s", nvlist_get_bool(vf, - IFVF_STATUS_ALLOW_SET_VLAN) ? "allowed" : "denied"); - } - if (nvlist_exists_bool(vf, IFVF_STATUS_MAC_ANTI_SPOOF)) { - vf_group_begin(&printed, "policy"); - printf(" anti-spoof=%s", nvlist_get_bool(vf, - IFVF_STATUS_MAC_ANTI_SPOOF) ? "on" : "off"); - } - if (nvlist_exists_bool(vf, IFVF_STATUS_ALLOW_PROMISC)) { - vf_group_begin(&printed, "policy"); - printf(" promisc=%s", nvlist_get_bool(vf, - IFVF_STATUS_ALLOW_PROMISC) ? "allowed" : "denied"); - } - if (nvlist_exists_string(vf, IFVF_STATUS_LINK_STATE_POLICY)) { - vf_group_begin(&printed, "policy"); - printf(" link-state=%s", nvlist_get_string(vf, - IFVF_STATUS_LINK_STATE_POLICY)); - } - vf_group_end(printed); - - printed = false; - if (nvlist_exists_string(vf, IFVF_STATUS_API_VERSION)) { - vf_group_begin(&printed, "protocol"); - printf(" api=%s", nvlist_get_string(vf, - IFVF_STATUS_API_VERSION)); - } - vf_group_end(printed); - - } - nvlist_destroy(status); -} diff --git a/share/man/man4/rtnetlink.4 b/share/man/man4/rtnetlink.4 index 5d5e69cdbbf0..3d76c66c1917 100644 --- a/share/man/man4/rtnetlink.4 +++ b/share/man/man4/rtnetlink.4 @@ -22,7 +22,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd August 8, 2026 +.Dd July 28, 2026 .Dt RTNETLINK 4 .Os .Sh NAME @@ -325,17 +325,7 @@ The following filters are recognised by the kernel: ifi_index interface index IFLA_IFNAME interface name IFLA_ALT_IFNAME interface name -IFLA_EXT_MASK extended information selection bitmap .Ed -.Pp -Setting the -.Dv RTEXT_FILTER_VF -bit in -.Dv IFLA_EXT_MASK -requests SR-IOV VF status. -The query is opt-in because obtaining status can require entering the PF -driver. -VF status is not included in unsolicited link notifications. .Ss TLVs .Bl -tag -width indent .It Dv IFLA_ADDRESS @@ -350,112 +340,6 @@ VF status is not included in unsolicited link notifications. (uint32_t) (readonly) Interface index. .It Dv IFLA_MASTER (uint32_t) Parent interface index. -.It Dv IFLA_NUM_VF -(uint32_t) (readonly) Number of active VFs. -This attribute is returned with a successful -.Dv RTEXT_FILTER_VF -query. -.It Dv IFLA_FREEBSD -(nested) Local interface attributes. -When requested, -.Dv IFLAF_VF_STATUS -contains the following nested attributes: -.Bd -literal -offset indent -compact -IFLAF_VFS_VERSION (uint32_t) VF status schema version -IFLAF_VFS_ERROR (uint32_t) errno if the PF query failed -IFLAF_VFS_PF_LINK_STATE (uint8_t) IFLAF_VF_LINK_* -IFLAF_VFS_PF_LINK_SPEED (uint64_t) bits per second -IFLAF_VFS_LIST (nested) repeated IFLAF_VF_LIST_ENTRY -.Ed -.Pp -On a successful query, -.Dv IFLAF_VFS_VERSION -and -.Dv IFLAF_VFS_LIST -are present. -If the PF status query fails, -.Dv IFLAF_VFS_ERROR -contains the errno value and the other status attributes are omitted. -.Pp -Each -.Dv IFLAF_VF_LIST_ENTRY -may contain the following attributes: -.Bd -literal -offset indent -compact -IFLAF_VF_INDEX (uint32_t) PF-local VF index -IFLAF_VF_CONFIGURED (uint8_t) PF accepted configuration -IFLAF_VF_INITIALIZED (uint8_t) VF handshake completed -IFLAF_VF_MAC (binary) PF-known primary MAC address -IFLAF_VF_VLAN_MODE (uint8_t) IFLAF_VF_VLAN_* -IFLAF_VF_VLAN (uint16_t) access VLAN identifier -IFLAF_VF_VLAN_COUNT (uint32_t) explicit VLAN filters -IFLAF_VF_VLAN_LIMIT (uint32_t) explicit VLAN-filter limit -IFLAF_VF_NUM_QUEUES (uint32_t) allocated RX/TX queue pairs -IFLAF_VF_ALLOW_SET_MAC (uint8_t) administrative permission -IFLAF_VF_ALLOW_SET_VLAN (uint8_t) administrative permission -IFLAF_VF_MAC_ANTI_SPOOF (uint8_t) MAC anti-spoofing enabled -IFLAF_VF_ALLOW_PROMISC (uint8_t) administrative permission -IFLAF_VF_TRAFFIC_ENABLED (uint8_t) VF traffic enabled -IFLAF_VF_MDD_BLOCKED (uint8_t) malicious-driver block active -IFLAF_VF_QUARANTINED (uint8_t) persistent quarantine active -IFLAF_VF_API_VERSION (string) negotiated mailbox API -IFLAF_VF_LINK_STATE_POLICY (uint8_t) IFLAF_VF_LINK_* -IFLAF_VF_EXTENSIONS (nested) driver-specific namespaces -.Ed -.Pp -.Dv IFLAF_VF_INDEX -is required in every list entry. -Other fields are optional and are omitted when the PF driver cannot observe -them; omission does not mean false or zero. -Boolean attributes contain zero or one. -.Dv IFLAF_VF_CONFIGURED -means that the PF accepted the VF configuration, while -.Dv IFLAF_VF_INITIALIZED -means that the VF completed its driver or mailbox handshake since its last -reset. -.Pp -.Dv IFLAF_VF_NUM_QUEUES -is the number of allocated symmetric RX/TX queue pairs, not necessarily the -number currently used by the VF driver. -Access VLAN mode means that the PF imposes -.Dv IFLAF_VF_VLAN ; -trunk mode means that no access VLAN is imposed and does not promise unlimited -filter capacity. -.Dv IFLAF_VF_VLAN_COUNT -counts explicit filters recorded by the PF and excludes implicit untagged and -priority-tag membership. -The permission attributes describe requests the VF may make, not requests it -has made. -The top-level PF link state and speed are values normally advertised to VFs, -not evidence that a VF driver is operational. -.Pp -Link-state values are: -.Bd -literal -offset indent -compact -IFLAF_VF_LINK_UNKNOWN state is unavailable -IFLAF_VF_LINK_DOWN link is forced or observed down -IFLAF_VF_LINK_UP link is forced or observed up -IFLAF_VF_LINK_AUTO VF follows PF link state -.Ed -.Pp -VLAN-mode values are: -.Bd -literal -offset indent -compact -IFLAF_VF_VLAN_UNKNOWN mode is unavailable -IFLAF_VF_VLAN_ACCESS PF imposes an access VLAN -IFLAF_VF_VLAN_TRUNK no access VLAN is imposed -.Ed -.Pp -Driver-specific data is returned under -.Dv IFLAF_VF_EXTENSIONS -as repeated -.Dv IFLAF_VF_EXT_LIST_ENTRY -objects. -Each object contains a stable namespace string in -.Dv IFLAF_VF_EXT_NAME -and its packed, versioned -.Xr nvlist 9 -in -.Dv IFLAF_VF_EXT_DATA . -Each namespace contains a version number. -Consumers must ignore unknown namespaces and fields. .It Dv IFLA_LINKINFO (nested) Interface type-specific attributes: .Bd -literal -offset indent -compact diff --git a/share/mk/src.libnames.mk b/share/mk/src.libnames.mk index 589049bea777..b3c4e1861e24 100644 --- a/share/mk/src.libnames.mk +++ b/share/mk/src.libnames.mk @@ -379,7 +379,7 @@ _DP_gmock= gtest _DP_gmock_main= gmock _DP_gtest= pthread regex _DP_gtest_main= gtest -_DP_ifconfig= m nv +_DP_ifconfig= m _DP_ipf= kvm _DP_iscsiutil= md _DP_kldelf= elf @@ -512,7 +512,7 @@ _DP_zpool= md pthread z icp spl nvpair avl umem _DP_zutil= avl geom m _DP_be= zfs spl nvpair zfsbootenv _DP_netmap= -_DP_ifconfig= m nv +_DP_ifconfig= m _DP_pfctl= nv _DP_krb5ss= edit diff --git a/sys/dev/e1000/if_em.c b/sys/dev/e1000/if_em.c index a3523315d5c7..80ee8095fb83 100644 --- a/sys/dev/e1000/if_em.c +++ b/sys/dev/e1000/if_em.c @@ -665,7 +665,6 @@ static device_method_t igb_if_methods[] = { DEVMETHOD(ifdi_iov_init, igb_if_iov_init), DEVMETHOD(ifdi_iov_uninit, igb_if_iov_uninit), DEVMETHOD(ifdi_iov_vf_add, igb_if_iov_vf_add), - DEVMETHOD(ifdi_vf_status, igb_if_vf_status), #endif DEVMETHOD_END }; diff --git a/sys/dev/e1000/if_igb_iov.c b/sys/dev/e1000/if_igb_iov.c index e62ca8aa029c..dc4b23397431 100644 --- a/sys/dev/e1000/if_igb_iov.c +++ b/sys/dev/e1000/if_igb_iov.c @@ -1995,64 +1995,6 @@ igb_iov_validate(struct e1000_softc *sc, u16 num_vfs) return (0); } -int -igb_if_vf_status(if_ctx_t ctx, nvlist_t *status) -{ - struct e1000_softc *sc; - struct igb_vf *vf; - nvlist_t **vfs; - u_int num_queues; - int error, i; - - sc = iflib_get_softc(ctx); - if (sc->num_vfs == 0) - return (ENXIO); - num_queues = sc->hw.mac.type == e1000_82576 ? - IGB_82576_VF_QUEUES : IGB_I350_VF_QUEUES; - vfs = mallocarray(sc->num_vfs, sizeof(*vfs), M_IGB_IOV, - M_WAITOK | M_ZERO); - for (i = 0; i < sc->num_vfs; i++) { - vf = &sc->vfs[i]; - vfs[i] = nvlist_create(0); - nvlist_add_number(vfs[i], IFVF_STATUS_INDEX, i); - nvlist_add_bool(vfs[i], IFVF_STATUS_CONFIGURED, - (vf->flags & IGB_VF_ACTIVE) != 0); - nvlist_add_bool(vfs[i], IFVF_STATUS_INITIALIZED, - (vf->flags & IGB_VF_CTS) != 0); - nvlist_add_binary(vfs[i], IFVF_STATUS_MAC, vf->mac, - ETHER_ADDR_LEN); - if (vf->default_vlan == 0) - nvlist_add_string(vfs[i], IFVF_STATUS_VLAN_MODE, - IFVF_VLAN_MODE_TRUNK); - else { - nvlist_add_string(vfs[i], IFVF_STATUS_VLAN_MODE, - IFVF_VLAN_MODE_ACCESS); - nvlist_add_number(vfs[i], IFVF_STATUS_VLAN, - vf->default_vlan); - } - nvlist_add_number(vfs[i], IFVF_STATUS_VLAN_COUNT, - vf->vlan_count); - nvlist_add_number(vfs[i], IFVF_STATUS_NUM_QUEUES, num_queues); - nvlist_add_bool(vfs[i], IFVF_STATUS_ALLOW_SET_MAC, - (vf->flags & IGB_VF_CAP_MAC) != 0); - nvlist_add_bool(vfs[i], IFVF_STATUS_ALLOW_SET_VLAN, - vf->default_vlan == 0); - nvlist_add_bool(vfs[i], IFVF_STATUS_MAC_ANTI_SPOOF, - (vf->flags & IGB_VF_MAC_ANTI_SPOOF) != 0); - nvlist_add_bool(vfs[i], IFVF_STATUS_ALLOW_PROMISC, - (vf->flags & IGB_VF_ALLOW_PROMISC) != 0); - nvlist_add_bool(vfs[i], IFVF_STATUS_MDD_BLOCKED, - (vf->flags & IGB_VF_MDD_BLOCKED) != 0); - } - nvlist_add_nvlist_array(status, IFVF_STATUS_VFS, - (const nvlist_t * const *)vfs, sc->num_vfs); - error = nvlist_error(status); - for (i = 0; i < sc->num_vfs; i++) - nvlist_destroy(vfs[i]); - free(vfs, M_IGB_IOV); - return (error); -} - int igb_if_iov_init(if_ctx_t ctx, u16 num_vfs, const nvlist_t *config) { diff --git a/sys/dev/e1000/if_igb_iov.h b/sys/dev/e1000/if_igb_iov.h index 390e63175c7a..8bd576d47649 100644 --- a/sys/dev/e1000/if_igb_iov.h +++ b/sys/dev/e1000/if_igb_iov.h @@ -24,7 +24,6 @@ int igb_iov_validate(struct e1000_softc *, u16); int igb_if_iov_init(if_ctx_t, u16, const nvlist_t *); void igb_if_iov_uninit(if_ctx_t); int igb_if_iov_vf_add(if_ctx_t, u16, const nvlist_t *); -int igb_if_vf_status(if_ctx_t, nvlist_t *); void igb_iov_initialize(struct e1000_softc *); void igb_iov_handle_mbx(struct e1000_softc *); void igb_iov_handle_mdd(struct e1000_softc *); diff --git a/sys/dev/ixgbe/if_ix.c b/sys/dev/ixgbe/if_ix.c index 02472ae04444..8165d18998fd 100644 --- a/sys/dev/ixgbe/if_ix.c +++ b/sys/dev/ixgbe/if_ix.c @@ -380,7 +380,6 @@ static device_method_t ixgbe_if_methods[] = { DEVMETHOD(ifdi_iov_init, ixgbe_if_iov_init), DEVMETHOD(ifdi_iov_uninit, ixgbe_if_iov_uninit), DEVMETHOD(ifdi_iov_vf_add, ixgbe_if_iov_vf_add), - DEVMETHOD(ifdi_vf_status, ixgbe_if_vf_status), #endif /* PCI_IOV */ DEVMETHOD_END }; diff --git a/sys/dev/ixgbe/if_sriov.c b/sys/dev/ixgbe/if_sriov.c index 4ca61d078c8e..9fc3437a2cf3 100644 --- a/sys/dev/ixgbe/if_sriov.c +++ b/sys/dev/ixgbe/if_sriov.c @@ -1686,96 +1686,6 @@ ixgbe_mbx_pending(struct ixgbe_softc *sc) return (false); } -static const char * -ixgbe_vf_api_version(uint16_t api_ver) -{ - switch (api_ver) { - case ixgbe_mbox_api_10: - return ("1.0"); - case ixgbe_mbox_api_20: - return ("2.0"); - case ixgbe_mbox_api_11: - return ("1.1"); - case ixgbe_mbox_api_12: - return ("1.2"); - case ixgbe_mbox_api_13: - return ("1.3"); - case ixgbe_mbox_api_14: - return ("1.4"); - case ixgbe_mbox_api_15: - return ("1.5"); - case ixgbe_mbox_api_16: - return ("1.6"); - default: - return (NULL); - } -} - -int -ixgbe_if_vf_status(if_ctx_t ctx, nvlist_t *status) -{ - struct ixgbe_softc *sc; - struct ixgbe_vf *vf; - const char *api_ver; - nvlist_t **vfs; - int error, i; - - sc = iflib_get_softc(ctx); - if (sc->num_vfs == 0) - return (ENXIO); - vfs = mallocarray(sc->num_vfs, sizeof(*vfs), M_IXGBE_SRIOV, - M_WAITOK | M_ZERO); - for (i = 0; i < sc->num_vfs; i++) { - vf = &sc->vfs[i]; - vfs[i] = nvlist_create(0); - nvlist_add_number(vfs[i], IFVF_STATUS_INDEX, i); - nvlist_add_bool(vfs[i], IFVF_STATUS_CONFIGURED, - (vf->flags & IXGBE_VF_ACTIVE) != 0); - nvlist_add_bool(vfs[i], IFVF_STATUS_INITIALIZED, - (vf->flags & IXGBE_VF_CTS) != 0); - nvlist_add_binary(vfs[i], IFVF_STATUS_MAC, vf->ether_addr, - ETHER_ADDR_LEN); - if (vf->default_vlan == 0) - nvlist_add_string(vfs[i], IFVF_STATUS_VLAN_MODE, - IFVF_VLAN_MODE_TRUNK); - else { - nvlist_add_string(vfs[i], IFVF_STATUS_VLAN_MODE, - IFVF_VLAN_MODE_ACCESS); - nvlist_add_number(vfs[i], IFVF_STATUS_VLAN, - vf->default_vlan); - } - nvlist_add_number(vfs[i], IFVF_STATUS_VLAN_COUNT, - vf->num_vlans); - nvlist_add_number(vfs[i], IFVF_STATUS_NUM_QUEUES, - ixgbe_vf_queues(sc->iov_mode)); - nvlist_add_bool(vfs[i], IFVF_STATUS_ALLOW_SET_MAC, - (vf->flags & IXGBE_VF_CAP_MAC) != 0); - nvlist_add_bool(vfs[i], IFVF_STATUS_ALLOW_SET_VLAN, - (vf->flags & IXGBE_VF_CAP_VLAN) != 0); *** 1642 LINES SKIPPED ***