Re: [PATCH net-next V2 11/11] net/mlx5e: Support ethtool tcp-data-split settings

Jakub Kicinski
2025-05-22T22:55:20Z

On Fri, 23 May 2025 00:41:26 +0300 Tariq Toukan wrote:
> + /* if HW GRO is not enabled due to external limitations but is wanted,
> + * report HDS state as unknown so it won't get turned off explicitly.
> + */
> + if (kernel_param->tcp_data_split == ETHTOOL_TCP_DATA_SPLIT_DISABLED &&
> + priv->netdev->wanted_features & NETIF_F_GRO_HW)
> + kernel_param->tcp_data_split = ETHTOOL_TCP_DATA_SPLIT_UNKNOWN;

The kernel_param->tcp_data_split here is the user config, right?
It would be cleaner to not support setting SPLIT_DISABLED.
Nothing requires that, you can support just setting AUTO and ENABLED.

> +

nit: extra empty line, please run checkpatch

> }
>
> static void mlx5e_get_ringparam(struct net_device *dev,
> @@ -383,6 +391,43 @@ static void mlx5e_get_ringparam(struct net_device *dev,
> mlx5e_ethtool_get_ringparam(priv, param, kernel_param);
> }
>
> +static bool mlx5e_ethtool_set_tcp_data_split(struct mlx5e_priv *priv,
> + u8 tcp_data_split)
> +{
> + bool enable = (tcp_data_split == ETHTOOL_TCP_DATA_SPLIT_ENABLED);
> + struct net_device *dev = priv->netdev;
> +
> + if (tcp_data_split == ETHTOOL_TCP_DATA_SPLIT_UNKNOWN)
> + return true;
> +
> + if (enable && !(dev->hw_features & NETIF_F_GRO_HW)) {
> + netdev_warn(dev, "TCP-data-split is not supported when GRO HW is not supported\n");
> + return false; /* GRO HW is not supported */
> + }
> +
> + if (enable && (dev->features & NETIF_F_GRO_HW)) {
> + /* Already enabled */
> + dev->wanted_features |= NETIF_F_GRO_HW;
> + return true;
> + }
> +
> + if (!enable && !(dev->features & NETIF_F_GRO_HW)) {
> + /* Already disabled */
> + dev->wanted_features &= ~NETIF_F_GRO_HW;
> + return true;
> + }
> +
> + /* Try enable or disable GRO HW */
> + if (enable)
> + dev->wanted_features |= NETIF_F_GRO_HW;
> + else
> + dev->wanted_features &= ~NETIF_F_GRO_HW;

Why are you modifying wanted_features? wanted_features is what
*user space* wanted! You should probably operate on hw_features ?
Tho, may be cleaner to return an error and an extack if the user
tries to set HDS and GRO to conflicting values.