netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: Praveen Kaligineedi <pkaligineedi@google.com>
Cc: netdev@vger.kernel.org, davem@davemloft.net, edumazet@google.com,
	pabeni@redhat.com, shailend@google.com, andrew+netdev@lunn.ch,
	willemb@google.com, hramamurthy@google.com, ziweixiao@google.com,
	horms@kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next] gve: Add RSS cache for non RSS device option scenario
Date: Tue, 14 Jan 2025 18:02:37 -0800	[thread overview]
Message-ID: <20250114180237.33e61fef@kernel.org> (raw)
In-Reply-To: <20250113211139.4137621-1-pkaligineedi@google.com>

On Mon, 13 Jan 2025 13:11:39 -0800 Praveen Kaligineedi wrote:
>  static int gve_set_rxfh(struct net_device *netdev, struct ethtool_rxfh_param *rxfh,
>  			struct netlink_ext_ack *extack)
>  {
>  	struct gve_priv *priv = netdev_priv(netdev);
> +	int err;
>  
>  	if (!priv->rss_key_size || !priv->rss_lut_size)
>  		return -EOPNOTSUPP;
>  
> -	return gve_adminq_configure_rss(priv, rxfh);
> +	if (priv->cache_rss_config && !priv->rss_cache_configured) {
> +		err = gve_init_rss_config(priv);

I don't understand why this is here.
Why are you programming the default config the first time user asks 
to set rxfh? And just to immediately overwrite it.

Shouldn't you be doing this on probe or first open?

Oh and in gve_setup_device_resources() you call gve_init_rss_config()

> +	if (priv->rss_cache_configured) {

so you reset what user wanted to defaults, only if user wanted
something explicitly _not_ default. Hm.

> +		if (err) {
> +			dev_err(&priv->pdev->dev, "Fail to init RSS config\n");

use extack, please

> +			return err;
> +		}
> +	}

> +int gve_init_rss_config(struct gve_priv *priv)
> +{
> +	struct gve_rss_config *rss_config = &priv->rss_config;
> +	struct ethtool_rxfh_param rxfh;
> +	u16 i;
> +
> +	for (i = 0; i < priv->rss_lut_size; i++)
> +		rss_config->hash_lut[i] = i % priv->rx_cfg.num_queues;

nit: ethtool_rxfh_indir_default()

> +
> +	netdev_rss_key_fill(rss_config->hash_key, priv->rss_key_size);
> +
> +	rxfh.hfunc = ETH_RSS_HASH_TOP;
> +
> +	return gve_adminq_configure_rss(priv, &rxfh);
> +}
-- 
pw-bot: cr

  reply	other threads:[~2025-01-15  2:02 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-13 21:11 [PATCH net-next] gve: Add RSS cache for non RSS device option scenario Praveen Kaligineedi
2025-01-15  2:02 ` Jakub Kicinski [this message]
2025-01-21 18:05   ` Ziwei Xiao

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250114180237.33e61fef@kernel.org \
    --to=kuba@kernel.org \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=hramamurthy@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=pkaligineedi@google.com \
    --cc=shailend@google.com \
    --cc=willemb@google.com \
    --cc=ziweixiao@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).