lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250522155518.47ab81d3@kernel.org>
Date: Thu, 22 May 2025 15:55:18 -0700
From: Jakub Kicinski <kuba@...nel.org>
To: Tariq Toukan <tariqt@...dia.com>
Cc: "David S. Miller" <davem@...emloft.net>, Paolo Abeni
 <pabeni@...hat.com>, Eric Dumazet <edumazet@...gle.com>, "Andrew Lunn"
 <andrew+netdev@...n.ch>, Saeed Mahameed <saeedm@...dia.com>, Leon
 Romanovsky <leon@...nel.org>, Richard Cochran <richardcochran@...il.com>,
 Alexei Starovoitov <ast@...nel.org>, Daniel Borkmann
 <daniel@...earbox.net>, Jesper Dangaard Brouer <hawk@...nel.org>, John
 Fastabend <john.fastabend@...il.com>, <netdev@...r.kernel.org>,
 <linux-rdma@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
 <bpf@...r.kernel.org>, Moshe Shemesh <moshe@...dia.com>, Mark Bloch
 <mbloch@...dia.com>, Gal Pressman <gal@...dia.com>, Cosmin Ratiu
 <cratiu@...dia.com>, Dragos Tatulea <dtatulea@...dia.com>
Subject: Re: [PATCH net-next V2 11/11] net/mlx5e: Support ethtool
 tcp-data-split settings

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.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ