git: 9ac8af72a7c5 - stable/14 - mlx5en: control hw LRO with the driver conf sysctl, leaving IFCAP_LRO to sw

From: Konstantin Belousov <kib_at_FreeBSD.org>
Date: Thu, 20 Mar 2025 03:13:59 UTC
The branch stable/14 has been updated by kib:

URL: https://cgit.FreeBSD.org/src/commit/?id=9ac8af72a7c5f756da6ad2468958f3bd0cc976b8

commit 9ac8af72a7c5f756da6ad2468958f3bd0cc976b8
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2025-01-28 20:38:21 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2025-03-20 03:13:37 +0000

    mlx5en: control hw LRO with the driver conf sysctl, leaving IFCAP_LRO to sw
    
    (cherry picked from commit 816f27e848e549e6ff895affc29298f68e0bb644)
---
 sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c | 10 +---------
 sys/dev/mlx5/mlx5_en/mlx5_en_main.c    | 24 ++----------------------
 2 files changed, 3 insertions(+), 31 deletions(-)

diff --git a/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c b/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c
index 6a2c07addc62..459801cdf27d 100644
--- a/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c
+++ b/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c
@@ -1124,16 +1124,8 @@ mlx5e_ethtool_handler(SYSCTL_HANDLER_ARGS)
 		/* import HW LRO mode */
 		if (priv->params_ethtool.hw_lro != 0 &&
 		    MLX5_CAP_ETH(priv->mdev, lro_cap)) {
+			priv->params.hw_lro_en = true;
 			priv->params_ethtool.hw_lro = 1;
-			/* check if feature should actually be enabled */
-			if (if_getcapenable(priv->ifp) & IFCAP_LRO) {
-				priv->params.hw_lro_en = true;
-			} else {
-				priv->params.hw_lro_en = false;
-
-				mlx5_en_warn(priv->ifp, "To enable HW LRO "
-				    "please also enable LRO via ifconfig(8).\n");
-			}
 		} else {
 			/* return an error if HW does not support this feature */
 			if (priv->params_ethtool.hw_lro != 0)
diff --git a/sys/dev/mlx5/mlx5_en/mlx5_en_main.c b/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
index 051669e7f85a..fb25d2f8b40c 100644
--- a/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
+++ b/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
@@ -3651,31 +3651,11 @@ siocsifcap_driver:
 		}
 
 		VLAN_CAPABILITIES(ifp);
-		/* turn off LRO means also turn of HW LRO - if it's on */
-		if (mask & IFCAP_LRO) {
-			int was_opened = test_bit(MLX5E_STATE_OPENED, &priv->state);
-			bool need_restart = false;
 
+		/* hw_lro and IFCAP_LRO are divorsed, only toggle sw LRO. */
+		if (mask & IFCAP_LRO)
 			if_togglecapenable(ifp, IFCAP_LRO);
 
-			/* figure out if updating HW LRO is needed */
-			if (!(if_getcapenable(ifp) & IFCAP_LRO)) {
-				if (priv->params.hw_lro_en) {
-					priv->params.hw_lro_en = false;
-					need_restart = true;
-				}
-			} else {
-				if (priv->params.hw_lro_en == false &&
-				    priv->params_ethtool.hw_lro != 0) {
-					priv->params.hw_lro_en = true;
-					need_restart = true;
-				}
-			}
-			if (was_opened && need_restart) {
-				mlx5e_close_locked(ifp);
-				mlx5e_open_locked(ifp);
-			}
-		}
 		if (mask & IFCAP_HWRXTSTMP) {
 			if_togglecapenable(ifp, IFCAP_HWRXTSTMP);
 			if (if_getcapenable(ifp) & IFCAP_HWRXTSTMP) {