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: <14654215-aa09-48c5-a12d-9fa99bb9e2cc@nvidia.com>
Date: Tue, 1 Jul 2025 09:25:41 +0300
From: Gal Pressman <gal@...dia.com>
To: Jakub Kicinski <kuba@...nel.org>, davem@...emloft.net
Cc: netdev@...r.kernel.org, edumazet@...gle.com, pabeni@...hat.com,
 andrew+netdev@...n.ch, horms@...nel.org, andrew@...n.ch,
 przemyslaw.kitszel@...el.com, anthony.l.nguyen@...el.com,
 sgoutham@...vell.com, gakula@...vell.com, sbhatta@...vell.com,
 bbhushan2@...vell.com, tariqt@...dia.com, mbloch@...dia.com,
 leon@...nel.org, ecree.xilinx@...il.com
Subject: Re: [PATCH net-next 3/5] eth: mlx5: migrate to the *_rxfh_context ops

On 30/06/2025 19:09, Jakub Kicinski wrote:
> Convert mlx5 to dedicated RXFH ops. This is a fairly shallow
> conversion, TBH, most of the driver code stays as is, but we
> let the core allocate the context ID for the driver.
> 
> Tested with drivers/net/hw/rss_ctx.py on MCX6.
> 
> Signed-off-by: Jakub Kicinski <kuba@...nel.org>
> ---
> +static int mlx5e_rxfh_hfunc_check(struct mlx5e_priv *priv,
> +				  const struct ethtool_rxfh_param *rxfh)
>  {
> -	bool symmetric = rxfh->input_xfrm == RXH_XFRM_SYM_OR_XOR;
> -	struct mlx5e_priv *priv = netdev_priv(dev);
> -	u32 *rss_context = &rxfh->rss_context;
>  	u8 hfunc = rxfh->hfunc;

This variable is kinda redundant now.

>  	unsigned int count;
> -	int err;
> -
> -	mutex_lock(&priv->state_lock);
>  
>  	count = priv->channels.params.num_channels;
>  
> +static int mlx5e_create_rxfh_context(struct net_device *dev,
> +				     struct ethtool_rxfh_context *ctx,
> +				     const struct ethtool_rxfh_param *rxfh,
> +				     struct netlink_ext_ack *extack)
> +{
> +	bool symmetric = rxfh->input_xfrm == RXH_XFRM_SYM_OR_XOR;
> +	struct mlx5e_priv *priv = netdev_priv(dev);
> +	u8 hfunc = rxfh->hfunc;
> +	int err;
> +
> +	mutex_lock(&priv->state_lock);
> +
> +	err = mlx5e_rxfh_hfunc_check(priv, rxfh);
> +	if (err)
> +		goto unlock;
> +
> +	err = mlx5e_rx_res_rss_init(priv->rx_res, rxfh->rss_context,
> +				    priv->channels.params.num_channels);
> +	if (err)
> +		goto unlock;
> +
> +	err = mlx5e_rx_res_rss_set_rxfh(priv->rx_res, rxfh->rss_context,
> +					rxfh->indir, rxfh->key,
> +					hfunc == ETH_RSS_HASH_NO_CHANGE ? NULL : &hfunc,
> +					rxfh->input_xfrm == RXH_XFRM_NO_CHANGE ? NULL : &symmetric);
> +	if (err)
> +		goto unlock;
> +
> +	mlx5e_rx_res_rss_get_rxfh(priv->rx_res, rxfh->rss_context,
> +				  ethtool_rxfh_context_indir(ctx),
> +				  ethtool_rxfh_context_key(ctx),
> +				  &ctx->hfunc, &symmetric);

We don't expect it to fail so no return value check here, but maybe a
WARN_ON_ONCE() should be added?

> +	if (symmetric)
> +		ctx->input_xfrm = RXH_XFRM_SYM_OR_XOR;
> +
> +unlock:
> +	mutex_unlock(&priv->state_lock);
> +	return err;
> +}

Thanks Jakub!
Reviewed-by: Gal Pressman <gal@...dia.com>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ