summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhselasky <hselasky@FreeBSD.org>2016-01-27 15:01:08 +0000
committerhselasky <hselasky@FreeBSD.org>2016-01-27 15:01:08 +0000
commit680fa1bae4114e2d31a283cee0a9e44f41a093b4 (patch)
treec57c0122aa453f2fbe0620310a3d1a28ab7739e4
parentddb82fd9b1f706f60b81fb058dd959c6e9df798f (diff)
downloadFreeBSD-src-680fa1bae4114e2d31a283cee0a9e44f41a093b4.zip
FreeBSD-src-680fa1bae4114e2d31a283cee0a9e44f41a093b4.tar.gz
MFC r294319:
Fix an issue where the network adapter could be left in down state after changing the HW LRO sysctl when previously in up state. Sponsored by: Mellanox Technologies Differential Revision: https://reviews.freebsd.org/D4941
-rw-r--r--sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c25
1 files changed, 11 insertions, 14 deletions
diff --git a/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c b/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c
index 86d87ae..f7993e9 100644
--- a/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c
+++ b/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c
@@ -178,23 +178,21 @@ mlx5e_ethtool_handler(SYSCTL_HANDLER_ARGS)
priv->params.tx_cq_moderation_mode = priv->params_ethtool.tx_coalesce_mode;
/* we always agree to turn off HW LRO - but not always to turn on */
- if (priv->params_ethtool.hw_lro) {
- if (priv->params_ethtool.hw_lro != 1) {
- priv->params_ethtool.hw_lro = priv->params.hw_lro_en;
- error = EINVAL;
- goto done;
- }
- if (priv->ifp->if_capenable & IFCAP_LRO)
- priv->params.hw_lro_en = !!MLX5_CAP_ETH(priv->mdev, lro_cap);
- else {
- /* set the correct (0) value to params_ethtool.hw_lro, issue a warning and return error */
+ if (priv->params_ethtool.hw_lro != 0) {
+ if ((priv->ifp->if_capenable & IFCAP_LRO) &&
+ MLX5_CAP_ETH(priv->mdev, lro_cap)) {
+ priv->params.hw_lro_en = 1;
+ priv->params_ethtool.hw_lro = 1;
+ } else {
+ priv->params.hw_lro_en = 0;
priv->params_ethtool.hw_lro = 0;
error = EINVAL;
- if_printf(priv->ifp, "Can't set HW_LRO to a device with LRO turned off");
- goto done;
+
+ if_printf(priv->ifp, "Can't enable HW LRO: "
+ "The HW or SW LRO feature is disabled");
}
} else {
- priv->params.hw_lro_en = false;
+ priv->params.hw_lro_en = 0;
}
if (&priv->params_ethtool.arg[arg2] ==
@@ -208,7 +206,6 @@ mlx5e_ethtool_handler(SYSCTL_HANDLER_ARGS)
priv->params_ethtool.cqe_zipping = 0;
}
}
-
if (was_opened)
mlx5e_open_locked(priv->ifp);
done:
OpenPOWER on IntegriCloud