Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 11 Sep 2023 22:35:37 GMT
From:      Kevin Bowling <kbowling@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 08647a110843 - stable/13 - iavf: Add explicit ifdi_needs_reset for VLAN changes
Message-ID:  <202309112235.38BMZb6G056875@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by kbowling:

URL: https://cgit.FreeBSD.org/src/commit/?id=08647a110843ab7f4b09917413ed9cb1c3d4a7ca

commit 08647a110843ab7f4b09917413ed9cb1c3d4a7ca
Author:     Kevin Bowling <kbowling@FreeBSD.org>
AuthorDate: 2023-08-24 20:36:00 +0000
Commit:     Kevin Bowling <kbowling@FreeBSD.org>
CommitDate: 2023-09-11 22:34:20 +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.
    
    Sponsored by:   BBOX.io
    Differential Revision:  https://reviews.freebsd.org/D41558
    
    (cherry picked from commit 1d6c12c511ae2a394d3ca1998a10f3d3bd25d313)
---
 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 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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202309112235.38BMZb6G056875>