netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: Jiawen Wu <jiawenwu@trustnetic.com>
Cc: netdev@vger.kernel.org, Andrew Lunn <andrew+netdev@lunn.ch>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Paolo Abeni <pabeni@redhat.com>, Simon Horman <horms@kernel.org>,
	Alexander Lobakin <aleksander.lobakin@intel.com>,
	Mengyuan Lou <mengyuanlou@net-swift.com>
Subject: Re: [PATCH net-next v4 1/2] net: libwx: support multiple RSS for every pool
Date: Mon, 15 Sep 2025 18:01:33 -0700	[thread overview]
Message-ID: <20250915180133.2af67344@kernel.org> (raw)
In-Reply-To: <20250912062357.30748-2-jiawenwu@trustnetic.com>

On Fri, 12 Sep 2025 14:23:56 +0800 Jiawen Wu wrote:
> Subject: [PATCH net-next v4 1/2] net: libwx: support multiple RSS for every pool

"support multiple RSS" needs an object. Multiple RSS keys? Multiple
contexts? Multiple tables?

> -static void wx_store_reta(struct wx *wx)
> +u32 wx_rss_indir_tbl_entries(struct wx *wx)
>  {
> +	if (test_bit(WX_FLAG_SRIOV_ENABLED, wx->flags))
> +		return 64;
> +	else
> +		return 128;
> +}

Is WX_FLAG_SRIOV_ENABLED set only when VFs are created?
What if the user set a table with 128 entries?
The RSS table can't shrink once intentionally set to a specific size.

> +void wx_store_reta(struct wx *wx)
> +{
> +	u32 reta_entries = wx_rss_indir_tbl_entries(wx);
>  	u8 *indir_tbl = wx->rss_indir_tbl;
>  	u32 reta = 0;
>  	u32 i;
> @@ -2007,36 +2016,55 @@ static void wx_store_reta(struct wx *wx)
>  	/* Fill out the redirection table as follows:
>  	 *  - 8 bit wide entries containing 4 bit RSS index
>  	 */
> -	for (i = 0; i < WX_MAX_RETA_ENTRIES; i++) {
> +	for (i = 0; i < reta_entries; i++) {
>  		reta |= indir_tbl[i] << (i & 0x3) * 8;
>  		if ((i & 3) == 3) {
> -			wr32(wx, WX_RDB_RSSTBL(i >> 2), reta);
> +			if (test_bit(WX_FLAG_SRIOV_ENABLED, wx->flags) &&
> +			    test_bit(WX_FLAG_MULTI_64_FUNC, wx->flags))
> +				wr32(wx, WX_RDB_VMRSSTBL(i >> 2, wx->num_vfs), reta);

Do we need to reprogram the RSS when number of VFs change, now?

> +			else
> +				wr32(wx, WX_RDB_RSSTBL(i >> 2), reta);
>  			reta = 0;
>  		}
>  	}
>  }
>  
> +void wx_store_rsskey(struct wx *wx)
> +{
> +	u32 random_key_size = WX_RSS_KEY_SIZE / 4;

They key is just initialized to a random value, it doesn't have to be
random. Just "key_size" is better.

> +	u32 i;
> +
> +	if (test_bit(WX_FLAG_SRIOV_ENABLED, wx->flags) &&
> +	    test_bit(WX_FLAG_MULTI_64_FUNC, wx->flags)) {
> +		for (i = 0; i < random_key_size; i++)
> +			wr32(wx, WX_RDB_VMRSSRK(i, wx->num_vfs),
> +			     *(wx->rss_key + i));

Prefer normal array indexing:

			     wx->rss_key[i]

> +	} else {
> +		for (i = 0; i < random_key_size; i++)
> +			wr32(wx, WX_RDB_RSSRK(i), wx->rss_key[i]);
> +	}
> +}

> -	u32 rss_field = 0;

completely unclear to me why moving rss_field to struct wx is part of
this patch. It looks unrelated / prep for the next patch. 
-- 
pw-bot: cr

  reply	other threads:[~2025-09-16  1:01 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-12  6:23 [PATCH net-next v4 0/2] net: wangxun: support to configure RSS Jiawen Wu
2025-09-12  6:23 ` [PATCH net-next v4 1/2] net: libwx: support multiple RSS for every pool Jiawen Wu
2025-09-16  1:01   ` Jakub Kicinski [this message]
2025-09-17  1:51     ` Jiawen Wu
2025-09-17  2:25       ` Jakub Kicinski
2025-09-17  7:38         ` Jiawen Wu
2025-09-17 21:13           ` Jakub Kicinski
2025-09-12  6:23 ` [PATCH net-next v4 2/2] net: wangxun: add RSS reta and rxfh fields support Jiawen Wu

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=20250915180133.2af67344@kernel.org \
    --to=kuba@kernel.org \
    --cc=aleksander.lobakin@intel.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=jiawenwu@trustnetic.com \
    --cc=mengyuanlou@net-swift.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.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).