Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 11 Sep 2023 22:35:39 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: 6cb4a544e00f - stable/13 - iflib: invert default restart on VLAN changes
Message-ID:  <202309112235.38BMZd3B056977@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=6cb4a544e00f834d3fa956aca61b0f71c04a4ad5

commit 6cb4a544e00f834d3fa956aca61b0f71c04a4ad5
Author:     Kevin Bowling <kbowling@FreeBSD.org>
AuthorDate: 2023-08-24 20:42:23 +0000
Commit:     Kevin Bowling <kbowling@FreeBSD.org>
CommitDate: 2023-09-11 22:34:21 +0000

    iflib: invert default restart on VLAN changes
    
    In rS360398, a new iflib device method was added to opt out of VLAN
    events needing an interface reset.
    
    I am switching the default to not requiring a restart for:
    * VLAN events
    * unknown events
    
    After fixing various bugs, I do not think this would be a common need
    of hardware and it is undesirable from the user's perspective causing
    link flaps and much slower VLAN configuration. Currently, there are no
    other restart events besides VLAN events, and setting the
    ifdi_needs_restart default to false will alleviate the need to churn
    every driver if an odd event is added in the future for specific
    hardware.
    
    markj points out this could cause churn in the other direction; I will
    solve that problem with an event registration system as he mentions in
    the review should we need it in the future.
    
    These drivers will opt into restart and need further inspection or work:
    * ixv (needs code audit, 61a8231 fixed principal issue; re-init probably
    not necessary)
    * axgbe (needs code audit; re-init probably not necessary)
    * iavf - (needs code audit; interaction with Malicious Driver Detection
    mentioned in rS360398)
    * mgb - no VLAN functions are currently implemented. Left a comment.
    
    Sponsored by:   BBOX.io
    Differential Revision:  https://reviews.freebsd.org/D41558
    
    (cherry picked from commit 725e4008efef32dfbe57b3e21635fa80dde8ee38)
---
 sys/dev/e1000/if_em.c | 5 ++---
 sys/dev/igc/if_igc.c  | 5 ++---
 sys/dev/ixgbe/if_ix.c | 5 ++---
 sys/dev/mgb/if_mgb.c  | 1 +
 sys/net/ifdi_if.m     | 2 +-
 5 files changed, 8 insertions(+), 10 deletions(-)

diff --git a/sys/dev/e1000/if_em.c b/sys/dev/e1000/if_em.c
index 3aae0ef4377e..8cf130048128 100644
--- a/sys/dev/e1000/if_em.c
+++ b/sys/dev/e1000/if_em.c
@@ -4385,7 +4385,7 @@ em_if_get_counter(if_ctx_t ctx, ift_counter cnt)
  * @ctx: iflib context
  * @event: event code to check
  *
- * Defaults to returning true for unknown events.
+ * Defaults to returning false for unknown events.
  *
  * @returns true if iflib needs to reinit the interface
  */
@@ -4394,9 +4394,8 @@ em_if_needs_restart(if_ctx_t ctx __unused, enum iflib_restart_event event)
 {
 	switch (event) {
 	case IFLIB_RESTART_VLAN_CONFIG:
-		return (false);
 	default:
-		return (true);
+		return (false);
 	}
 }
 
diff --git a/sys/dev/igc/if_igc.c b/sys/dev/igc/if_igc.c
index 4680dd434174..82fb0d72070b 100644
--- a/sys/dev/igc/if_igc.c
+++ b/sys/dev/igc/if_igc.c
@@ -2403,7 +2403,7 @@ igc_if_get_counter(if_ctx_t ctx, ift_counter cnt)
  * @ctx: iflib context
  * @event: event code to check
  *
- * Defaults to returning true for unknown events.
+ * Defaults to returning false for unknown events.
  *
  * @returns true if iflib needs to reinit the interface
  */
@@ -2412,9 +2412,8 @@ igc_if_needs_restart(if_ctx_t ctx __unused, enum iflib_restart_event event)
 {
 	switch (event) {
 	case IFLIB_RESTART_VLAN_CONFIG:
-		return (false);
 	default:
-		return (true);
+		return (false);
 	}
 }
 
diff --git a/sys/dev/ixgbe/if_ix.c b/sys/dev/ixgbe/if_ix.c
index db54b0edf7be..b1cba9f24929 100644
--- a/sys/dev/ixgbe/if_ix.c
+++ b/sys/dev/ixgbe/if_ix.c
@@ -1257,7 +1257,7 @@ ixgbe_if_i2c_req(if_ctx_t ctx, struct ifi2creq *req)
  * @ctx: iflib context
  * @event: event code to check
  *
- * Defaults to returning true for unknown events.
+ * Defaults to returning false for unknown events.
  *
  * @returns true if iflib needs to reinit the interface
  */
@@ -1266,9 +1266,8 @@ ixgbe_if_needs_restart(if_ctx_t ctx __unused, enum iflib_restart_event event)
 {
 	switch (event) {
 	case IFLIB_RESTART_VLAN_CONFIG:
-		return (false);
 	default:
-		return (true);
+		return (false);
 	}
 }
 
diff --git a/sys/dev/mgb/if_mgb.c b/sys/dev/mgb/if_mgb.c
index b2962d5ff3d8..e3806300ed9a 100644
--- a/sys/dev/mgb/if_mgb.c
+++ b/sys/dev/mgb/if_mgb.c
@@ -252,6 +252,7 @@ static device_method_t mgb_iflib_methods[] = {
 	 */
 	DEVMETHOD(ifdi_vlan_register, mgb_vlan_register),
 	DEVMETHOD(ifdi_vlan_unregister, mgb_vlan_unregister),
+	DEVMETHOD(ifdi_needs_restart, mgb_if_needs_restart),
 
 	/*
 	 * Needed for WOL support
diff --git a/sys/net/ifdi_if.m b/sys/net/ifdi_if.m
index 6e8661920394..fb36b898c1d0 100644
--- a/sys/net/ifdi_if.m
+++ b/sys/net/ifdi_if.m
@@ -172,7 +172,7 @@ CODE {
 	static bool
 	null_needs_restart(if_ctx_t _ctx __unused, enum iflib_restart_event _event __unused)
 	{
-		return (true);
+		return (false);
 	}
 };
 



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