aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKevin Bowling <kbowling@FreeBSD.org>2023-08-24 20:36:00 +0000
committerKevin Bowling <kbowling@FreeBSD.org>2023-09-11 22:34:20 +0000
commit08647a110843ab7f4b09917413ed9cb1c3d4a7ca (patch)
tree08b03309b3b80186d1f44dbca9889ea3c91b3cb8
parentca3fc7aabe3998822c6e1357df922618afb18648 (diff)
downloadsrc-08647a110843ab7f4b09917413ed9cb1c3d4a7ca.tar.gz
src-08647a110843ab7f4b09917413ed9cb1c3d4a7ca.zip
iavf: Add explicit ifdi_needs_reset for VLAN changes
In rS360398, a new iflib device method was added with default of opt out for VLAN events needing an interface reset. iavf(4) was the original need for this, because VLAN filter changes currently have negative interactions with Malicious Driver Detection. Add iavf_if_needs_restart and explicitly enable VLAN re-init. Sponsored by: BBOX.io Differential Revision: https://reviews.freebsd.org/D41558 (cherry picked from commit 1d6c12c511ae2a394d3ca1998a10f3d3bd25d313)
-rw-r--r--sys/dev/iavf/if_iavf_iflib.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/sys/dev/iavf/if_iavf_iflib.c b/sys/dev/iavf/if_iavf_iflib.c
index 5ae1b9308c1e..ef3a36674a55 100644
--- a/sys/dev/iavf/if_iavf_iflib.c
+++ b/sys/dev/iavf/if_iavf_iflib.c
@@ -74,6 +74,7 @@ static void iavf_if_vlan_unregister(if_ctx_t ctx, u16 vtag);
static uint64_t iavf_if_get_counter(if_ctx_t ctx, ift_counter cnt);
static void iavf_if_init(if_ctx_t ctx);
static void iavf_if_stop(if_ctx_t ctx);
+static bool iavf_if_needs_restart(if_ctx_t, enum iflib_restart_event);
static int iavf_allocate_pci_resources(struct iavf_sc *);
static void iavf_free_pci_resources(struct iavf_sc *);
@@ -170,6 +171,7 @@ static device_method_t iavf_if_methods[] = {
DEVMETHOD(ifdi_vlan_register, iavf_if_vlan_register),
DEVMETHOD(ifdi_vlan_unregister, iavf_if_vlan_unregister),
DEVMETHOD(ifdi_get_counter, iavf_if_get_counter),
+ DEVMETHOD(ifdi_needs_restart, iavf_if_needs_restart),
DEVMETHOD_END
};
@@ -1497,6 +1499,25 @@ iavf_if_get_counter(if_ctx_t ctx, ift_counter cnt)
}
}
+/* iavf_if_needs_restart - Tell iflib when the driver needs to be reinitialized
+ * @ctx: iflib context
+ * @event: event code to check
+ *
+ * Defaults to returning false for unknown events.
+ *
+ * @returns true if iflib needs to reinit the interface
+ */
+static bool
+iavf_if_needs_restart(if_ctx_t ctx __unused, enum iflib_restart_event event)
+{
+ switch (event) {
+ case IFLIB_RESTART_VLAN_CONFIG:
+ return (true);
+ default:
+ return (false);
+ }
+}
+
/**
* iavf_free_pci_resources - Free PCI resources
* @sc: device softc