From nobody Sun Aug 9 06:47:51 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 4hHpNl65sVz6n9FS for ; Sun, 09 Aug 2026 06:47:51 +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 4hHpNl1wW7z3TnB for ; Sun, 09 Aug 2026 06:47:51 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1786258071; 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=yT77XUiq2x7lbqju10eB1ZOkMuYt4OMJTlD6oJtP7nE=; b=dVTFAfL1TldHBmboca125Ey4JdNFWWnIq2lDLgLql+dDCuRoY0FoX598Ng7PpMtHN7Fe7q ZgmDmU6xLf46RhWfEsXTsb1vm5ljfLJxW91+Cxq74DrVwbOYudyMAdm2G8mklC9fb/MHcw zcaJPQ+2bEF/D5De8emkXiHr7MHMK84sEZCGLD5EAGB4jb6NJPdgw6eZzkhnyarUQThkvZ RerJZ1QiByHBmbgZXHEdyafaomuUaZsG4koTtC65bKyt4D2GU3Z9CGY/BLA9oNmV7Q9tr8 o1Jrp/xXSYrCFXn8RZPckR2g2gKPBILfxvpckTu1tBrvdYJK7M8UNXL4JHT+UA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1786258071; a=rsa-sha256; cv=none; b=Olt+Ssb/I2I6nWUBfNwmy6rghL9KTpo4LW4UJvWeSzrWNybMOkDoBi70sIkJ8eeedb8YC/ a0vgNbll5SoZ0i2eCc4iSz/B/DBMKWGHzTOiHSJj0bTRzBWik6z36GbJBVXs9Bq7mUdWEP RpQyN7xpd+RAPFpAqOJo9wd7xetd0pP/vCv3q5ejtKhePGYYqmaslWOGddCqzv/2Xsox31 y3yZ0EOVpkoJ5pYJd/4KEO5OWYyGtVPedCHSpz9QIwJXO3JC6CoWiOYUP74ZAB8TkkY9VB 9pkbQou2gMJn6CYGyTisLQnP5DmUPI7U92uYZ1DxXeC8Y9EQ2YI9NWo1DnmM8Q== 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=1786258071; 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=yT77XUiq2x7lbqju10eB1ZOkMuYt4OMJTlD6oJtP7nE=; b=B3upGj08vyKFNTmxWkHTb2cXZaX9xus6aiTYqtzwt9es5584HEhWwh4JgyF6aprZz36l36 h7z+EtbYr9uIWW8w8748xnQFUMA5OzbWA1ZuKtz+o7WkNh2u/3FgeMfT6/AmojZCtqbPZe TVBPrOB+FpWNYgZr3jWWAr5dFcZjx3kH7+WPwpM3Nv92RGaLupvAggKHZja0RWJy/eNmZj xVo6IkItlL/fEJIiVKmj+mC0oStbIqXlBhyRH1HxEfAo6iDO5e/ViE8HtbEiD+6f6R/VJR ZxndoYyLrtQC6RGhzxV2idrscur2HlPOjR9B4aqX8UHLiglD/nHGeYm5iq5p9g== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4hHpNl0g0sz1BBH for ; Sun, 09 Aug 2026 06:47:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 3fa92 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Sun, 09 Aug 2026 06:47:51 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kevin Bowling Subject: git: c30021fe0df9 - main - ixgbe: Report SR-IOV VF status 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: c30021fe0df9e045a17292dbe50dfc054b69871f Auto-Submitted: auto-generated Date: Sun, 09 Aug 2026 06:47:51 +0000 Message-Id: <6a782297.3fa92.45daf9@gitrepo.freebsd.org> The branch main has been updated by kbowling: URL: https://cgit.FreeBSD.org/src/commit/?id=c30021fe0df9e045a17292dbe50dfc054b69871f commit c30021fe0df9e045a17292dbe50dfc054b69871f Author: Kevin Bowling AuthorDate: 2026-08-08 17:37:56 +0000 Commit: Kevin Bowling CommitDate: 2026-08-09 06:46:57 +0000 ixgbe: Report SR-IOV VF status Expose cached VF configuration, policy, and runtime state through the iflib VF status method. Include access or trunk VLAN mode, the queue count selected by the current virtualization mode, negotiated mailbox API, whether traffic is enabled, and the MDD-blocked and quarantine state. The query runs under the iflib context lock and does not issue mailbox requests or read hardware registers. --- sys/dev/ixgbe/if_ix.c | 1 + sys/dev/ixgbe/if_sriov.c | 90 +++++++++++++++++++++++++++++++++++++++++++++ sys/dev/ixgbe/ixgbe_sriov.h | 1 + 3 files changed, 92 insertions(+) diff --git a/sys/dev/ixgbe/if_ix.c b/sys/dev/ixgbe/if_ix.c index 545516cb7372..2bdfc20df9bc 100644 --- a/sys/dev/ixgbe/if_ix.c +++ b/sys/dev/ixgbe/if_ix.c @@ -380,6 +380,7 @@ 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 4e98b2b5de0c..93555d11e72e 100644 --- a/sys/dev/ixgbe/if_sriov.c +++ b/sys/dev/ixgbe/if_sriov.c @@ -1686,6 +1686,96 @@ 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); + nvlist_add_bool(vfs[i], IFVF_STATUS_MAC_ANTI_SPOOF, + (vf->flags & IXGBE_VF_ANTI_SPOOF) != 0); + nvlist_add_bool(vfs[i], IFVF_STATUS_ALLOW_PROMISC, + (vf->flags & IXGBE_VF_ALLOW_PROMISC) != 0); + nvlist_add_bool(vfs[i], IFVF_STATUS_TRAFFIC_ENABLED, + (vf->flags & IXGBE_VF_TRAFFIC_DISABLED) == 0); + nvlist_add_bool(vfs[i], IFVF_STATUS_MDD_BLOCKED, + (vf->flags & IXGBE_VF_MDD_BLOCKED) != 0); + nvlist_add_bool(vfs[i], IFVF_STATUS_QUARANTINED, + (vf->flags & IXGBE_VF_QUARANTINED) != 0); + api_ver = ixgbe_vf_api_version(vf->api_ver); + if (api_ver != NULL) + nvlist_add_string(vfs[i], IFVF_STATUS_API_VERSION, + api_ver); + } + 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_IXGBE_SRIOV); + return (error); +} + int ixgbe_iov_validate(struct ixgbe_softc *sc, u16 num_vfs) { diff --git a/sys/dev/ixgbe/ixgbe_sriov.h b/sys/dev/ixgbe/ixgbe_sriov.h index de0485f6e9a2..3bd86fe06c1b 100644 --- a/sys/dev/ixgbe/ixgbe_sriov.h +++ b/sys/dev/ixgbe/ixgbe_sriov.h @@ -85,6 +85,7 @@ int ixgbe_if_iov_vf_add(if_ctx_t, u16, const nvlist_t *); int ixgbe_if_iov_init(if_ctx_t, u16, const nvlist_t *); +int ixgbe_if_vf_status(if_ctx_t, nvlist_t *); int ixgbe_iov_validate(struct ixgbe_softc *, u16); void ixgbe_if_iov_uninit(if_ctx_t); void ixgbe_initialize_iov(struct ixgbe_softc *);