git: 14a14e36aee2 - main - ice: Don't restart on VLAN changes

From: Kevin Bowling <kbowling_at_FreeBSD.org>
Date: Thu, 24 Aug 2023 20:52:01 UTC
The branch main has been updated by kbowling:

URL: https://cgit.FreeBSD.org/src/commit/?id=14a14e36aee2e6b848c239ac29090ad4cb66fbf7

commit 14a14e36aee2e6b848c239ac29090ad4cb66fbf7
Author:     Kevin Bowling <kbowling@FreeBSD.org>
AuthorDate: 2023-08-24 20:40:35 +0000
Commit:     Kevin Bowling <kbowling@FreeBSD.org>
CommitDate: 2023-08-24 20:46:57 +0000

    ice: Don't restart on VLAN changes
    
    In rS360398, a new iflib device method was added with default of opt out
    for VLAN events needing an interface reset.
    
    This re-init is unnecessary for ice(4).
    
    MFC after:      2 weeks
    Sponsored by:   BBOX.io
    Differential Revision:  https://reviews.freebsd.org/D41558
---
 sys/dev/ice/if_ice_iflib.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/sys/dev/ice/if_ice_iflib.c b/sys/dev/ice/if_ice_iflib.c
index 2397fce11596..8d03bdfd23fb 100644
--- a/sys/dev/ice/if_ice_iflib.c
+++ b/sys/dev/ice/if_ice_iflib.c
@@ -83,6 +83,7 @@ static int ice_if_priv_ioctl(if_ctx_t ctx, u_long command, caddr_t data);
 static int ice_if_i2c_req(if_ctx_t ctx, struct ifi2creq *req);
 static int ice_if_suspend(if_ctx_t ctx);
 static int ice_if_resume(if_ctx_t ctx);
+static bool ice_if_needs_restart(if_ctx_t, enum iflib_restart_event);
 
 static int ice_msix_que(void *arg);
 static int ice_msix_admin(void *arg);
@@ -170,6 +171,7 @@ static device_method_t ice_iflib_methods[] = {
 	DEVMETHOD(ifdi_i2c_req, ice_if_i2c_req),
 	DEVMETHOD(ifdi_suspend, ice_if_suspend),
 	DEVMETHOD(ifdi_resume, ice_if_resume),
+	DEVMETHOD(ifdi_needs_restart, ice_if_needs_restart),
 	DEVMETHOD_END
 };
 
@@ -3076,3 +3078,21 @@ ice_if_resume(if_ctx_t ctx)
 	return (0);
 }
 
+/* ice_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
+ice_if_needs_restart(if_ctx_t ctx __unused, enum iflib_restart_event event)
+{
+	switch (event) {
+	case IFLIB_RESTART_VLAN_CONFIG:
+	default:
+		return (false);
+	}
+}
+