net/mlx5e: Update netdev features only after a successful ringparam set
PATCH 1/1 net/mlx5e: Update netdev features only after a successful ringparam set
From: Dimitri Daskalakis <[email protected]>
mlx5 couples HW-GRO with tcp-data-split. If a user sets rx-gro-hw on -> tcp-data-split on -> rx-gro-hw off, the driver will leave HW-GRO on. mlx5e_ethtool_set_tcp_data_split() calls netdev_update_features() when tcp-data-split goes from enabled to disabled in case HW-GRO needs to be released. mlx5e_fix_features() reads the new HDS config from dev->cfg_pending, so HW-GRO is released before all ring parameters are validated.
If the subsequent call to mlx5e_ethtool_set_ringparam() fails, the ethtool core discards the pending change and reports tcp-data-split enabled. The device is no longer splitting, and subsequent ring changes are blocked.
Move the call to netdev_update_features() aftermlx5e_ethtool_set_ringparam() exits successfully.
The issue was discovered by manual code inspection during review of a change that stops mlx5 users from disabling tcp-data-split. It was reproduced on a ConnectX-7 with ethtool alone.
Steps to reproduce:
ethtool -K eth0 rx-gro-hw on
ethtool -G eth0 tcp-data-split on
ethtool -K eth0 rx-gro-hw off # HW-GRO kept on for tcp-data-split
ethtool -G eth0 tcp-data-split off rx 1 # de-sync driver & kernel state
netlink error: mlx5_core: rx (1) < min (16)
netlink error: Invalid argument
ethtool -G eth0 rx 1024 # valid ring changes are now blocked
netlink error: mlx5_core: TCP-data-split is not supported when GRO HW is disabled netlink error: Invalid argument
This is not a terminal state, users can recover by setting rx-gro-hw on. With the fix, the failing ringparam set leaves rx-gro-hw on and later ring changes succeed.
--- .../ethernet/mellanox/mlx5/core/en_ethtool.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c +11 -6
@@ -403,11 +403,6 @@ static bool mlx5e_ethtool_set_tcp_data_split(struct mlx5e_priv *priv,return false; } -/* Might need to disable HW-GRO if it was kept on due to hds. */ -if (tcp_data_split ==ETHTOOL_TCP_DATA_SPLIT_DISABLED && - dev->cfg->hds_config ==ETHTOOL_TCP_DATA_SPLIT_ENABLED ) -netdev_update_features (priv->netdev); -return true; }
@@ -468,13 +463,23 @@ static int mlx5e_set_ringparam(struct net_device *dev, struct netlink_ext_ack *extack) {struct mlx5e_priv *priv =netdev_priv (dev); +int err;if (!mlx5e_ethtool_set_tcp_data_split (priv, kernel_param->tcp_data_split, extack))return -EINVAL ; -return mlx5e_ethtool_set_ringparam (priv, param, extack); + err =mlx5e_ethtool_set_ringparam (priv, param, extack); +if (err) +return err; + +/* Might need to disable HW-GRO if it was kept on due to hds. */ +if (kernel_param->tcp_data_split ==ETHTOOL_TCP_DATA_SPLIT_DISABLED && + dev->cfg->hds_config ==ETHTOOL_TCP_DATA_SPLIT_ENABLED ) +netdev_update_features (priv->netdev); + +return 0 ; } void mlx5e_ethtool_get_channels(struct mlx5e_priv *priv,
Signature · 1 line
2.52.0
Quoted 35 lines · Dimitri Daskalakis
From: Dimitri Daskalakis <[email protected]>
mlx5 couples HW-GRO with tcp-data-split. If a user sets rx-gro-hw on -> tcp-data-split on -> rx-gro-hw off, the driver will leave HW-GRO on.
mlx5e_ethtool_set_tcp_data_split()callsnetdev_update_features()when tcp-data-split goes from enabled to disabled in case HW-GRO needs to be released.mlx5e_fix_features()reads the new HDS config fromdev->cfg_pending, so HW-GRO is released before all ring parameters are validated.If the subsequent call to
mlx5e_ethtool_set_ringparam()fails, the ethtool core discards the pending change and reports tcp-data-split enabled. The device is no longer splitting, and subsequent ring changes are blocked.Move the call to
netdev_update_features()aftermlx5e_ethtool_set_ringparam()exits successfully.The issue was discovered by manual code inspection during review of a change that stops mlx5 users from disabling tcp-data-split. It was reproduced on a ConnectX-7 with ethtool alone.
Steps to reproduce:
ethtool -K eth0 rx-gro-hw on
ethtool -G eth0 tcp-data-split on
ethtool -K eth0 rx-gro-hw off # HW-GRO kept on for tcp-data-splitethtool -G eth0 tcp-data-split off rx 1 # de-sync driver & kernel state
netlink error:mlx5_core: rx (1) < min (16)
netlink error: Invalid argumentethtool -G eth0 rx 1024 # valid ring changes are now blocked
netlink error:mlx5_core: TCP-data-split is not supported when GRO HW is disabled netlink error: Invalid argument
Quoted 8 lines
This is not a terminal state, users can recover by setting rx-gro-hw on. With the fix, the failing ringparam set leaves rx-gro-hw on and later ring changes succeed.
Fixes 46bcce5dfd33 ("net/mlx5e: Support ethtool tcp-data-split settings")Reported-by Björn Töpel <[email protected]>Signed-off-by Dimitri Daskalakis <[email protected]>
Quoted 35 lines · Dimitri Daskalakis
From: Dimitri Daskalakis <[email protected]>
mlx5 couples HW-GRO with tcp-data-split. If a user sets rx-gro-hw on -> tcp-data-split on -> rx-gro-hw off, the driver will leave HW-GRO on.
mlx5e_ethtool_set_tcp_data_split()callsnetdev_update_features()when tcp-data-split goes from enabled to disabled in case HW-GRO needs to be released.mlx5e_fix_features()reads the new HDS config fromdev->cfg_pending, so HW-GRO is released before all ring parameters are validated.If the subsequent call to
mlx5e_ethtool_set_ringparam()fails, the ethtool core discards the pending change and reports tcp-data-split enabled. The device is no longer splitting, and subsequent ring changes are blocked.Move the call to
netdev_update_features()aftermlx5e_ethtool_set_ringparam()exits successfully.The issue was discovered by manual code inspection during review of a change that stops mlx5 users from disabling tcp-data-split. It was reproduced on a ConnectX-7 with ethtool alone.
Steps to reproduce:
ethtool -K eth0 rx-gro-hw on
ethtool -G eth0 tcp-data-split on
ethtool -K eth0 rx-gro-hw off # HW-GRO kept on for tcp-data-splitethtool -G eth0 tcp-data-split off rx 1 # de-sync driver & kernel state
netlink error:mlx5_core: rx (1) < min (16)
netlink error: Invalid argumentethtool -G eth0 rx 1024 # valid ring changes are now blocked
netlink error:mlx5_core: TCP-data-split is not supported when GRO HW is disabled netlink error: Invalid argument
Quoted 8 lines
This is not a terminal state, users can recover by setting rx-gro-hw on. With the fix, the failing ringparam set leaves rx-gro-hw on and later ring changes succeed.
Fixes 46bcce5dfd33 ("net/mlx5e: Support ethtool tcp-data-split settings")Reported-by Björn Töpel <[email protected]>Signed-off-by Dimitri Daskalakis <[email protected]>
Quoted 40 lines · Nimrod Oren
Quoted 39 lines · Dimitri Daskalakis
From: Dimitri Daskalakis <[email protected]>
mlx5 couples HW-GRO with tcp-data-split. If a user sets rx-gro-hw on -> tcp-data-split on -> rx-gro-hw off, the driver will leave HW-GRO on.
mlx5e_ethtool_set_tcp_data_split()callsnetdev_update_features()when tcp-data-split goes from enabled to disabled in case HW-GRO needs to be released.mlx5e_fix_features()reads the new HDS config fromdev->cfg_pending, so HW-GRO is released before all ring parameters are validated.If the subsequent call to
mlx5e_ethtool_set_ringparam()fails, the ethtool core discards the pending change and reports tcp-data-split enabled. The device is no longer splitting, and subsequent ring changes are blocked.Move the call to
netdev_update_features()aftermlx5e_ethtool_set_ringparam()exits successfully.The issue was discovered by manual code inspection during review of a change that stops mlx5 users from disabling tcp-data-split. It was reproduced on a ConnectX-7 with ethtool alone.
Steps to reproduce:
ethtool -K eth0 rx-gro-hw on
ethtool -G eth0 tcp-data-split on
ethtool -K eth0 rx-gro-hw off # HW-GRO kept on for tcp-data-splitethtool -G eth0 tcp-data-split off rx 1 # de-sync driver & kernel state
netlink error:mlx5_core: rx (1) < min (16)
netlink error: Invalid argumentethtool -G eth0 rx 1024 # valid ring changes are now blocked
netlink error:mlx5_core: TCP-data-split is not supported when GRO HW is disabled netlink error: Invalid argumentThis is not a terminal state, users can recover by setting rx-gro-hw on. With the fix, the failing ringparam set leaves rx-gro-hw on and later ring changes succeed.
Quoted 6 lines
Quoted 4 lines
Fixes 46bcce5dfd33 ("net/mlx5e: Support ethtool tcp-data-split settings")Reported-by Björn Töpel <[email protected]>Signed-off-by Dimitri Daskalakis <[email protected]>Reviewed-by Nimrod Oren <[email protected]>
This patch was applied to netdev/net.git (main) by Jakub Kicinski <[email protected]>:
Hello:
This patch was applied to netdev/net.git (main)
by Jakub Kicinski <[email protected]>:
Quoted 11 lines · On Fri, 16 Oct 2026 17:54:01 -0700 you wrote:
From: Dimitri Daskalakis <[email protected]>
mlx5 couples HW-GRO with tcp-data-split. If a user sets rx-gro-hw on -> tcp-data-split on -> rx-gro-hw off, the driver will leave HW-GRO on.
mlx5e_ethtool_set_tcp_data_split()callsnetdev_update_features()when tcp-data-split goes from enabled to disabled in case HW-GRO needs to be released.mlx5e_fix_features()reads the new HDS config fromdev->cfg_pending, so HW-GRO is released before all ring parameters are validated.[...]
Here is the summary with links:
- [net] net/mlx5e: Update netdev features only after a successful ringparam set
https://git.kernel.org/netdev/net/c/23dd5be7e19c
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html