git: 1d6c12c511ae - main - iavf: Add explicit ifdi_needs_reset for VLAN changes
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 24 Aug 2023 20:52:00 UTC
The branch main has been updated by kbowling: URL: https://cgit.FreeBSD.org/src/commit/?id=1d6c12c511ae2a394d3ca1998a10f3d3bd25d313 commit 1d6c12c511ae2a394d3ca1998a10f3d3bd25d313 Author: Kevin Bowling <kbowling@FreeBSD.org> AuthorDate: 2023-08-24 20:36:00 +0000 Commit: Kevin Bowling <kbowling@FreeBSD.org> CommitDate: 2023-08-24 20:46:56 +0000 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. MFC after: 2 weeks Sponsored by: BBOX.io Differential Revision: https://reviews.freebsd.org/D41558 --- sys/dev/iavf/if_iavf_iflib.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/sys/dev/iavf/if_iavf_iflib.c b/sys/dev/iavf/if_iavf_iflib.c index b2531b797941..714d34eeebe5 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 *); @@ -169,6 +170,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