From: sashiko-bot@kernel.org
To: "Aditya Garg" <gargaditya@linux.microsoft.com>,
linux-hyperv@vger.kernel.org
Subject: Re: [PATCH net] net: hv_netvsc: Preserve RSS indirection table across device recreation
Date: Thu, 26 Nov 2026 06:56:48 +0000 [thread overview]
Message-ID: <sashiko-outbox-234917@kernel.org> (raw)
In-Reply-To: <20261125065620.1604647-1-gargaditya@linux.microsoft.com>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] net: hv_netvsc: zeroing rss_key and rx_table in
netvsc_attach() breaks RSS
--
commit a79f79b300587b1f53e9f4a583c55f0d45f71328
Author: Aditya Garg <gargaditya@linux.microsoft.com>
net: hv_netvsc: Preserve RSS indirection table across device recreation
This commit saves and restores a user-configured RSS indirection table
and cached RSS hash key across RNDIS device recreation, and notifies
ethtool if the custom table cannot be restored.
> diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c
> index 1d43c73fd73f1..f51e7b349d7f7 100644
> --- a/drivers/net/hyperv/netvsc_drv.c
> +++ b/drivers/net/hyperv/netvsc_drv.c
[ ... ]
> @@ -1036,6 +1054,19 @@ static int netvsc_attach(struct net_device *ndev,
> if (ret) {
> nvdev->max_chn = 1;
> nvdev->num_chn = 1;
> + } else {
> + ret = rndis_filter_set_rss_param(nvdev->extension, dev_info->rss_key);
> + }
> +
> + if (ret) {
> + netdev_err(ndev,
> + "unable to restore RSS parameters (ret %d).\n",
> + ret);
> + /* Do not report the saved parameters as restored. */
> + memset(ndev_ctx->rx_table, 0,
> + ndev_ctx->rx_table_sz * sizeof(*ndev_ctx->rx_table));
> + memset(nvdev->extension->rss_key, 0, NETVSC_HASH_KEYLEN);
> + rss_failed = true;
> }
> }
[Severity: Medium]
Does zeroing nvdev->extension->rss_key and ndev_ctx->rx_table here break
later RSS updates and re-attachments?
rndis_set_rss_param_msg() always sends both ndc->rx_table and the 40-byte
hash key to the host together, and netvsc_set_rxfh() uses the cached
values whenever userspace updates only one of them:
drivers/net/hyperv/netvsc_drv.c:netvsc_set_rxfh() {
...
if (rxfh->indir) {
for (i = 0; i < ndc->rx_table_sz; i++)
if (rxfh->indir[i] >= ndev->num_chn)
return -EINVAL;
for (i = 0; i < ndc->rx_table_sz; i++)
ndc->rx_table[i] = rxfh->indir[i];
}
if (!key) {
if (!rxfh->indir)
return 0;
key = rndis_dev->rss_key;
}
return rndis_filter_set_rss_param(rndis_dev, key);
}
If userspace responds to ethtool_rxfh_indir_lost() by setting or
resetting only the indirection table, netvsc_set_rxfh() falls back to
rndis_dev->rss_key and programs an all-zero Toeplitz key into the host,
hashing all RX traffic to queue 0; future re-attachments via
netvsc_devinfo_get() also save and program that zeroed key. Similarly,
if rndis_set_subchannel() succeeded with multiple channels but
rndis_filter_set_rss_param() failed, updating only the hash key sends the
zeroed ndev_ctx->rx_table instead of the default round-robin table.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261125065620.1604647-1-gargaditya@linux.microsoft.com?part=1
prev parent reply other threads:[~2026-11-26 6:56 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-25 6:56 [PATCH net] net: hv_netvsc: Preserve RSS indirection table across device recreation Aditya Garg
2026-11-26 6:56 ` sashiko-bot [this message]
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=sashiko-outbox-234917@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=gargaditya@linux.microsoft.com \
--cc=linux-hyperv@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/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