Page MenuHomeFreeBSD

D58739.1794746307.diff
No OneTemporary

Authored By
Unknown
Size
7 KB
Referenced Files
None
Subscribers
None

D58739.1794746307.diff

diff --git a/share/man/man4/ice.4 b/share/man/man4/ice.4
--- a/share/man/man4/ice.4
+++ b/share/man/man4/ice.4
@@ -32,7 +32,7 @@
.\"
.\" * Other names and brands may be claimed as the property of others.
.\"
-.Dd November 5, 2025
+.Dd August 8, 2026
.Dt ICE 4
.Os
.Sh NAME
@@ -1139,6 +1139,35 @@
By default, this is set to 64.
.El
.Pp
+For each configured VF,
+.Xr ifconfig 8
+with the
+.Fl v
+option displays a
+.Cm driver.ice
+status group.
+The group reports whether mirroring is configured, the source VSI when
+configured, and whether the ingress and egress hardware mirror rules are
+active.
+.Pp
+Structured status consumers receive this information in the version 1
+.Cm driver.ice
+driver namespace of the
+.Xr rtnetlink 4
+VF status response:
+.Bl -tag -width "mirror-ingress-active"
+.It Cm version
+Namespace version number, currently 1.
+.It Cm mirror-configured
+Boolean indicating whether a mirror source VSI is configured.
+.It Cm mirror-source-vsi
+The source VSI number; omitted when no mirror is configured.
+.It Cm mirror-ingress-active
+Boolean indicating whether the ingress hardware mirror rule is installed.
+.It Cm mirror-egress-active
+Boolean indicating whether the egress hardware mirror rule is installed.
+.El
+.Pp
An up to date list of parameters and their defaults can be found by using
.Xr iovctl 8
with the
diff --git a/sys/dev/ice/ice_iov.h b/sys/dev/ice/ice_iov.h
--- a/sys/dev/ice/ice_iov.h
+++ b/sys/dev/ice/ice_iov.h
@@ -69,6 +69,7 @@
VF_FLAG_VLAN_CAP = BIT(2),
VF_FLAG_PROMISC_CAP = BIT(3),
VF_FLAG_MAC_ANTI_SPOOF = BIT(4),
+ VF_FLAG_INITIALIZED = BIT(5),
};
/**
@@ -114,6 +115,8 @@
int ice_iov_init(struct ice_softc *sc, uint16_t num_vfs, const nvlist_t *params);
int ice_iov_add_vf(struct ice_softc *sc, uint16_t vfnum, const nvlist_t *params);
+struct if_vf_status;
+int ice_iov_vf_status(struct ice_softc *sc, struct if_vf_status **statusp);
void ice_iov_uninit(struct ice_softc *sc);
void ice_iov_handle_vflr(struct ice_softc *sc);
@@ -122,4 +125,3 @@
void ice_vc_notify_all_vfs_link_state(struct ice_softc *sc);
#endif /* _ICE_IOV_H_ */
-
diff --git a/sys/dev/ice/ice_iov.c b/sys/dev/ice/ice_iov.c
--- a/sys/dev/ice/ice_iov.c
+++ b/sys/dev/ice/ice_iov.c
@@ -39,6 +39,16 @@
#include "ice_iov.h"
+#include <net/if_vf_status.h>
+
+/* Version 1 driver.ice extension schema; documented in ice(4). */
+#define ICE_VF_STATUS_NAMESPACE "driver.ice"
+#define ICE_VF_STATUS_VERSION 1
+#define ICE_VF_STATUS_MIRROR_CONFIGURED "mirror-configured"
+#define ICE_VF_STATUS_MIRROR_SOURCE_VSI "mirror-source-vsi"
+#define ICE_VF_STATUS_MIRROR_INGRESS_ACTIVE "mirror-ingress-active"
+#define ICE_VF_STATUS_MIRROR_EGRESS_ACTIVE "mirror-egress-active"
+
static struct ice_vf *ice_iov_get_vf(struct ice_softc *sc, int vf_num);
static void ice_iov_ready_vf(struct ice_softc *sc, struct ice_vf *vf);
static void ice_reset_vf(struct ice_softc *sc, struct ice_vf *vf,
@@ -413,6 +423,84 @@
return (error);
}
+/**
+ * ice_iov_vf_status - report configured VF state
+ * @sc: device private structure
+ * @statusp: returned status snapshot
+ *
+ * The iflib context lock protects the VF array and VSI lifetime while this
+ * method constructs the report. VF policy flags are atomic because mailbox
+ * processing also reads them without the context lock.
+ */
+int
+ice_iov_vf_status(struct ice_softc *sc, struct if_vf_status **statusp)
+{
+ struct ice_vf *vf;
+ struct ice_vsi *vsi;
+ struct if_vf_extension *extension;
+ struct if_vf_info *info;
+ struct if_vf_status *status;
+ u32 vf_flags;
+ bool mirror_configured;
+ uint32_t field;
+ int i;
+
+ if (sc->num_vfs == 0)
+ return (ENXIO);
+ 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];
+ vsi = vf->vsi;
+ vf_flags = atomic_load_acq_32(&vf->vf_flags);
+ info = &status->vfs[i];
+ info->fields = IFVF_F_CONFIGURED | IFVF_F_INITIALIZED |
+ IFVF_F_MAC | IFVF_F_VLAN_MODE | IFVF_F_VLAN_COUNT |
+ IFVF_F_VLAN_LIMIT | IFVF_F_ALLOW_SET_MAC |
+ IFVF_F_ALLOW_SET_VLAN | IFVF_F_MAC_ANTI_SPOOF |
+ IFVF_F_ALLOW_PROMISC;
+ info->index = vf->vf_num;
+ info->configured =
+ (vf_flags & VF_FLAG_ENABLED) != 0 && vsi != NULL;
+ info->initialized = (vf_flags & VF_FLAG_INITIALIZED) != 0;
+ memcpy(info->mac, vf->mac, sizeof(info->mac));
+ info->vlan_mode = IFVF_VLAN_TRUNK;
+ info->vlan_count = vf->vlan_cnt;
+ info->vlan_limit = vf->vlan_limit;
+ if (vsi != NULL) {
+ info->num_queues = vsi->num_rx_queues;
+ info->fields |= IFVF_F_NUM_QUEUES;
+
+ mirror_configured = vsi->mirror_src_vsi !=
+ ICE_INVALID_MIRROR_VSI;
+ extension = if_vf_status_add_extension(info,
+ ICE_VF_STATUS_NAMESPACE, ICE_VF_STATUS_VERSION,
+ mirror_configured ? 4 : 3);
+ field = 0;
+ if_vf_extension_set_bool(extension, field++,
+ ICE_VF_STATUS_MIRROR_CONFIGURED, mirror_configured);
+ if (mirror_configured)
+ if_vf_extension_set_number(extension, field++,
+ ICE_VF_STATUS_MIRROR_SOURCE_VSI,
+ vsi->mirror_src_vsi);
+ if_vf_extension_set_bool(extension, field++,
+ ICE_VF_STATUS_MIRROR_INGRESS_ACTIVE,
+ vsi->rule_mir_ingress != ICE_INVAL_MIRROR_RULE_ID);
+ if_vf_extension_set_bool(extension, field,
+ ICE_VF_STATUS_MIRROR_EGRESS_ACTIVE,
+ vsi->rule_mir_egress != ICE_INVAL_MIRROR_RULE_ID);
+ }
+ info->allow_set_mac = (vf_flags & VF_FLAG_SET_MAC_CAP) != 0;
+ info->allow_set_vlan = (vf_flags & VF_FLAG_VLAN_CAP) != 0;
+ info->mac_anti_spoof =
+ (vf_flags & VF_FLAG_MAC_ANTI_SPOOF) != 0;
+ info->allow_promisc = (vf_flags & VF_FLAG_PROMISC_CAP) != 0;
+ }
+ *statusp = status;
+ return (0);
+}
+
/**
* ice_iov_uninit - Called by the OS when VFs are destroyed
* @sc: device softc structure
@@ -547,6 +635,7 @@
int i;
global_vf_num = vf->vf_num + hw->func_caps.vf_base_id;
+ atomic_clear_32(&vf->vf_flags, VF_FLAG_INITIALIZED);
if (trigger_vflr) {
reg = rd32(hw, VPGEN_VFRTRIG(vf->vf_num));
@@ -655,6 +744,7 @@
ice_aq_send_msg_to_vf(hw, vf->vf_num, VIRTCHNL_OP_GET_VF_RESOURCES,
VIRTCHNL_STATUS_SUCCESS, (u8 *)vf_res, vf_res_len, NULL);
+ atomic_set_32(&vf->vf_flags, VF_FLAG_INITIALIZED);
free(vf_res, M_ICE);
}
diff --git a/sys/dev/ice/if_ice_iflib.c b/sys/dev/ice/if_ice_iflib.c
--- a/sys/dev/ice/if_ice_iflib.c
+++ b/sys/dev/ice/if_ice_iflib.c
@@ -92,6 +92,7 @@
static int ice_if_iov_init(if_ctx_t ctx, uint16_t num_vfs, const nvlist_t *params);
static void ice_if_iov_uninit(if_ctx_t ctx);
static int ice_if_iov_vf_add(if_ctx_t ctx, uint16_t vfnum, const nvlist_t *params);
+static int ice_if_vf_status(if_ctx_t ctx, struct if_vf_status **statusp);
static void ice_if_vflr_handle(if_ctx_t ctx);
#endif
static int ice_setup_mirror_vsi(struct ice_mirr_if *mif);
@@ -216,6 +217,7 @@
DEVMETHOD(ifdi_iov_vf_add, ice_if_iov_vf_add),
DEVMETHOD(ifdi_iov_init, ice_if_iov_init),
DEVMETHOD(ifdi_iov_uninit, ice_if_iov_uninit),
+ DEVMETHOD(ifdi_vf_status, ice_if_vf_status),
DEVMETHOD(ifdi_vflr_handle, ice_if_vflr_handle),
#endif
DEVMETHOD_END
@@ -3481,6 +3483,19 @@
return ice_iov_add_vf(sc, vfnum, params);
}
+/**
+ * ice_if_vf_status - report configured VF state
+ * @ctx: iflib context pointer
+ * @statusp: returned VF status snapshot
+ */
+static int
+ice_if_vf_status(if_ctx_t ctx, struct if_vf_status **statusp)
+{
+ struct ice_softc *sc = (struct ice_softc *)iflib_get_softc(ctx);
+
+ return (ice_iov_vf_status(sc, statusp));
+}
+
/**
* ice_if_vflr_handle - iov VFLR handler
* @ctx: iflib context pointer
@@ -4627,4 +4642,3 @@
{
return (0);
}
-

File Metadata

Mime Type
text/plain
Expires
Sun, Nov 15, 12:38 PM (11 h, 8 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
41742820
Default Alt Text
D58739.1794746307.diff (7 KB)

Event Timeline