From nobody Sat Oct 31 18:58:45 2026 X-Original-To: dev-commits-src-branches@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 4jH6gn50GMz6x5xL for ; Sat, 31 Oct 2026 18:58:45 +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) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 4jH6gn419Jz3J9j for ; Sat, 31 Oct 2026 18:58:45 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1793473125; 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=SNT0bnNpazD2+mZSHudbYoBD74EhA3xUXWDkvezE6hc=; b=Zzy2GqYfLJmLAfll7GSIp63ZMfgoPg4kva/ZQltDml78uLaLykUjR9aEThuS+HZOBKp2Ll fzXDvrv6ZG32kMkUboYxh0hxezOcuKdwgtQ2zehTu6md0HDcHaROOTaBM/a39L/2gIM24i b0cbEjaKPzhVPTi0GD4lzVsi9kivwucnhQ3dJNyUswjA/PteQyKrGKbM85//XK3UnGk4e3 lERBPGu1Imj2lSBAyTJxUXBo9t8tQ9RLgzh6C0FoeRMqa/cOJDUG99xL3OfQF1u330jXsi QeiWw79Mt0HmoDv/A4THroWkMfGnLdNtjx7p4Vo0S2WFypQRITyLNDK3vG61Pg== ARC-Seal: i=1; a=rsa-sha256; d=freebsd.org; s=dkim; cv=none; t=1793473125; b=rpSJk0ajluLQ2hl0QbG/lJvVD672ckDCT8o4EJ+3sMO0BZnKWWqRQAaJronunirJHbfm5b 7Qq9K9sNfpITSqT6U5RY0UE/Yk/IWpCT9qU2wi4XQS0TLKKWe7SunZKWUjSSl54D95TZ17 fRwel5PS6eo9Ye13WjeF/bTTxVzcST6M2LdlCZSU4s9IKMfskSgQvh5vsb7wXChBAOXwE7 oqeN1fSAF/kS+zs35vxIRwHlFC3mxqL3eq2SvzErI5qoxacDITnuUQDDB5uFKdgVEPWLvJ flGbwZoaXRt6g+YvbNY0jzuHbfsWaEmLRYzOnOGqbWqBMwDxvmvPXkmv2ZtAng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1793473125; 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=SNT0bnNpazD2+mZSHudbYoBD74EhA3xUXWDkvezE6hc=; b=e3ARQdy9uIY7iQQbrmMMaV4UM58mxrcv5gJ/6g4dW+8mqg6QYe9rk9dUA4yEcYvciNMWMl Tn8dMC5Pm33MxDP8ngURoxzxkgmUYRVP8bB9AYUZuxkdZsT0LzUq99y2WTLbj5WhRXrGxO gAS94JqorAUhMOFSvlVaetLShQ3zP58UePBVXZrLD/6KxWlChLseCzmZI0XBjCufJ9EH9q c069aoT3V4ln6v2SCDfmpQ3wUnRNE5N/oVToBxwHVvjEhhaq69L9KKGGiud6a/V2qUOyyh VvCin8qAxcb7PAfEdSEgADSK810GDHeTarM1U6qZM7uzLDFGb4LirtIzkiagMg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4jH6gn3fzszPCQ for ; Sat, 31 Oct 2026 18:58:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 24483 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Sat, 31 Oct 2026 18:58:45 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kevin Bowling Subject: git: b2fe18e78db4 - stable/15 - ixgbe: Report SR-IOV VF status List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@FreeBSD.org List-Id: Commits to the stable branches of the FreeBSD src repository 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/stable/15 X-Git-Reftype: branch X-Git-Commit: b2fe18e78db4bcde3e3101204f4f105ca1267226 Auto-Submitted: auto-generated Date: Sat, 31 Oct 2026 18:58:45 +0000 Message-Id: <6ae63a65.24483.371c81e2@gitrepo.freebsd.org> The branch stable/15 has been updated by kbowling: URL: https://cgit.FreeBSD.org/src/commit/?id=b2fe18e78db4bcde3e3101204f4f105ca1267226 commit b2fe18e78db4bcde3e3101204f4f105ca1267226 Author: Kevin Bowling AuthorDate: 2026-08-10 22:29:37 +0000 Commit: Kevin Bowling CommitDate: 2026-10-31 18:57:04 +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, transmit and receive queue counts selected by the current virtualization mode, negotiated mailbox API, PF traffic permission, fault containment, and quarantine state. Initialize every cached API version before VF enumeration so an unconfigured slot cannot be mistaken for API 1.0. The query does not issue mailbox requests or read hardware registers. Place the new attachment flag in existing padding on stable/15 to retain the softc size and all existing member offsets. Sponsored by: BBOX.io (cherry picked from commit 049331b20657cf0e7723c071efb75fda53a655fd) --- sys/dev/ixgbe/if_ix.c | 3 +- sys/dev/ixgbe/if_sriov.c | 105 +++++++++++++++++++++++++++++++++++++++++++- sys/dev/ixgbe/ixgbe.h | 1 + sys/dev/ixgbe/ixgbe_sriov.h | 4 +- 4 files changed, 110 insertions(+), 3 deletions(-) diff --git a/sys/dev/ixgbe/if_ix.c b/sys/dev/ixgbe/if_ix.c index 518d4da52cb9..e5b1fdecd4f4 100644 --- a/sys/dev/ixgbe/if_ix.c +++ b/sys/dev/ixgbe/if_ix.c @@ -389,6 +389,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 }; @@ -1379,7 +1380,7 @@ ixgbe_if_attach_post(if_ctx_t ctx) sc->advertise = ixgbe_get_default_advertise(sc); if (sc->feat_cap & IXGBE_FEATURE_SRIOV) - ixgbe_define_iov_schemas(dev, &error); + ixgbe_define_iov_schemas(sc, &error); /* Add sysctls */ ixgbe_add_device_sysctls(ctx); diff --git a/sys/dev/ixgbe/if_sriov.c b/sys/dev/ixgbe/if_sriov.c index 13ba3cdaf132..7f2689f39459 100644 --- a/sys/dev/ixgbe/if_sriov.c +++ b/sys/dev/ixgbe/if_sriov.c @@ -39,6 +39,8 @@ #include #include +#include + MALLOC_DEFINE(M_IXGBE_SRIOV, "ix_sriov", "ix SR-IOV allocations"); #define IXGBE_VF_MBX_CLEANUP_GRACE (2 * SBT_1S) @@ -59,10 +61,12 @@ ixgbe_has_legacy_iov_recovery(const struct ixgbe_hw *hw) * ixgbe_define_iov_schemas ************************************************************************/ void -ixgbe_define_iov_schemas(device_t dev, int *error) +ixgbe_define_iov_schemas(struct ixgbe_softc *sc, int *error) { + device_t dev; nvlist_t *pf_schema, *vf_schema; + dev = sc->dev; pf_schema = pci_iov_schema_alloc_node(); vf_schema = pci_iov_schema_alloc_node(); pci_iov_schema_add_unicast_mac(vf_schema, "mac-addr", 0, NULL); @@ -78,6 +82,8 @@ ixgbe_define_iov_schemas(device_t dev, int *error) if (*error != 0) { device_printf(dev, "Error %d setting up SR-IOV\n", *error); + } else { + sc->iov_attached = true; } } /* ixgbe_define_iov_schemas */ @@ -1743,6 +1749,101 @@ 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_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"); + case ixgbe_mbox_api_20: + return ("2.0"); + default: + return (NULL); + } +} + +int +ixgbe_if_vf_status(if_ctx_t ctx, struct if_vf_status **statusp) +{ + struct ixgbe_softc *sc; + struct ixgbe_vf *vf; + struct if_vf_info *info; + struct if_vf_status *status; + const char *api_ver; + int i; + + sc = iflib_get_softc(ctx); + if (!sc->iov_attached) + return (EOPNOTSUPP); + status = if_vf_status_alloc(sc->num_vfs); + if (status == NULL) + return (ENOMEM); + for (i = 0; i < sc->num_vfs; i++) { + vf = &sc->vfs[i]; + info = &status->vfs[i]; + info->fields = IFVF_F_CONFIGURED | IFVF_F_INITIALIZED | + IFVF_F_VLAN_MODE | IFVF_F_VLAN_COUNT | + IFVF_F_NUM_TX_QUEUES | IFVF_F_NUM_RX_QUEUES | + IFVF_F_ALLOW_SET_MAC | + IFVF_F_ALLOW_SET_VLAN | IFVF_F_MAC_ANTI_SPOOF | + IFVF_F_ALLOW_PROMISC | IFVF_F_TRAFFIC_ALLOWED | + IFVF_F_FAULT_BLOCKED | IFVF_F_QUARANTINED; + info->index = i; + info->configured = (vf->flags & IXGBE_VF_ACTIVE) != 0; + info->initialized = + (vf->flags & (IXGBE_VF_CTS | IXGBE_VF_INIT_DONE)) == + (IXGBE_VF_CTS | IXGBE_VF_INIT_DONE); + if (!ETHER_IS_ZERO(vf->ether_addr)) { + memcpy(info->mac, vf->ether_addr, sizeof(info->mac)); + info->fields |= IFVF_F_MAC; + } + if (vf->default_vlan == 0) + info->vlan_mode = IFVF_VLAN_TRUNK; + else { + info->vlan_mode = IFVF_VLAN_ACCESS; + info->vlan = vf->default_vlan; + info->vlan_pcp = 0; + info->vlan_proto = ETHERTYPE_VLAN; + info->fields |= IFVF_F_VLAN | IFVF_F_VLAN_PCP | + IFVF_F_VLAN_PROTO; + } + info->vlan_count = vf->num_vlans; + info->tx_queue_count = ixgbe_vf_queues(sc->iov_mode); + info->rx_queue_count = ixgbe_vf_queues(sc->iov_mode); + info->allow_set_mac = (vf->flags & IXGBE_VF_CAP_MAC) != 0; + info->allow_set_vlan = (vf->flags & IXGBE_VF_CAP_VLAN) != 0; + info->mac_anti_spoof = + (vf->flags & IXGBE_VF_ANTI_SPOOF) != 0; + info->allow_promisc = + (vf->flags & IXGBE_VF_ALLOW_PROMISC) != 0; + info->traffic_allowed = info->configured && + (vf->flags & IXGBE_VF_TRAFFIC_DISABLED) == 0; + info->fault_blocked = + (vf->flags & IXGBE_VF_TRAFFIC_DISABLED) != 0; + info->quarantined = (vf->flags & IXGBE_VF_QUARANTINED) != 0; + api_ver = ixgbe_vf_api_version(vf->api_ver); + if (api_ver != NULL) { + strlcpy(info->api_version, api_ver, + sizeof(info->api_version)); + info->fields |= IFVF_F_API_VERSION; + } + } + *statusp = status; + return (0); +} + int ixgbe_iov_validate(struct ixgbe_softc *sc, u16 num_vfs) { @@ -1817,6 +1918,8 @@ ixgbe_if_iov_init(if_ctx_t ctx, u16 num_vfs, const nvlist_t *config) retval = ENOMEM; goto err_init_iov; } + for (i = 0; i < num_vfs; i++) + sc->vfs[i].api_ver = IXGBE_API_VER_UNKNOWN; num_filters = sc->hw.mac.num_rar_entries - num_vfs - 1 - IXGBE_MAX_PF_MAC_FILTERS; if (num_filters > 0) { diff --git a/sys/dev/ixgbe/ixgbe.h b/sys/dev/ixgbe/ixgbe.h index 46b84dd948c3..499c9a5bf056 100644 --- a/sys/dev/ixgbe/ixgbe.h +++ b/sys/dev/ixgbe/ixgbe.h @@ -497,6 +497,7 @@ struct ixgbe_softc { sbintime_t iov_recovery_time; bool iov_recovery_stop; uint8_t iov_recovery_cursor; + bool iov_attached; uint64_t iov_dma_abort_events; uint64_t iov_dma_abort_flr_failures; uint64_t iov_dma_abort_quarantines; diff --git a/sys/dev/ixgbe/ixgbe_sriov.h b/sys/dev/ixgbe/ixgbe_sriov.h index 0a1eeb642366..9f1a1eb65aab 100644 --- a/sys/dev/ixgbe/ixgbe_sriov.h +++ b/sys/dev/ixgbe/ixgbe_sriov.h @@ -86,6 +86,8 @@ 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 *); +struct if_vf_status; +int ixgbe_if_vf_status(if_ctx_t, struct if_vf_status **); int ixgbe_iov_validate(struct ixgbe_softc *, u16); void ixgbe_if_iov_uninit(if_ctx_t); void ixgbe_initialize_iov(struct ixgbe_softc *); @@ -96,7 +98,7 @@ void ixgbe_ping_all_vfs(struct ixgbe_softc *); void ixgbe_init_iov_recovery(struct ixgbe_softc *); void ixgbe_schedule_iov_recovery(struct ixgbe_softc *); u_int ixgbe_iov_rebuild_mta(struct ixgbe_softc *); -void ixgbe_define_iov_schemas(device_t, int *); +void ixgbe_define_iov_schemas(struct ixgbe_softc *, int *); void ixgbe_align_all_queue_indices(struct ixgbe_softc *); int ixgbe_vf_que_index(int, int, int); u32 ixgbe_get_mtqc(int);