From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796370471; b=UFSD/tduNFY01p4JDJWGGI4A4xK3Hx0zQbQoxd9fz7vUmYGyCaKeR33ImHS5MIMINRNz IXpG0a/594lEUB6wK15lvqgH+GJ+E7KPvYKNEaRmll2MYpJODEHoWRlfMlYQDCX9MW7B+ tdg+EB3Q1XtoczM0BpiI9o6/INYMKtuEKassIY5BwxPuiPdRwTOOv5jsRc9QywDrmG3J4 J4jOdi3ivxE+03ZOVbJ+3w+DAM+4Id5vqxFHsfu+npEDJGkaQSmszNVjYKaNEftpxz3Al /rSqFxgOw0jE+lyOnIQc8m40ew3tfvCe9DRbsZAEfU5ySaAMIEeXGHgXFrkQEt1hapA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796370471; h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID: In-Reply-To:References:X-sashiko-severity:Content-Type: Content-Transfer-Encoding:MIME-Version; bh=WXnaABr5M93Sa05PoWrmeWBNhbUw6fYT8XnDOSRmuVg=; b=D3F0ILWgjtm5fVkADSHOTI6uj/Jg+4p/fDNmmF9i0cYsiMbftdXJIEVPDIa/WFY7MIUi pcCD4KR9vQJdRbtCBDJm04aJ9FsGBKjE6gQm7ciB4foFrS5SgQGp1Jh8+REi7DIJRmctD 4k0d/cFQECVXMFcZfszsx/FjZE5RkLT/hvm7Bzr51nP/PL5l1tdf9ausJZJwxP6GofcWD rjgUb20eC4z1yWPoGZEahdxH+6w0CGIDUksnGyZLu7dDbBr3WtBarW72yBR4IHMBnyJaX yGfhr6WnuQH/o1CQ6U0b8ESPlpgIsJnKIgUmWTplQ44QBHh6P4LRstM7OoYhA+5wzKw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=cENzc9l+; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B9F1D606A322; Fri, 4 Dec 2026 07:47:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=cENzc9l+ Received: by smtp.kernel.org (Postfix) with ESMTPSA id 11C0E1F00897; Fri, 4 Dec 2026 07:47:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796370470; bh=WXnaABr5M93Sa05PoWrmeWBNhbUw6fYT8XnDOSRmuVg=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=cENzc9l+EIC+ezeDCi7ugczqy/+NW8Jy+qeBhpxh8QrBiBRnnntF8H1PPmV4nYfHK SO0e9wSSEAk0F3XA/OAClb5FtMhxD62+Ela5qRuZ1nPOg3YwEW6b0C1pLezkeu3tl0 qSybBKvA7Huk2CDL8u5bnS4+u4HFaMjf8X0uxO0yOKyXYYBKeksKx7iprtRUmtPnuQ Srv7Pqo4wgHhevzkJTj8cijgahADyNYnd7YOQ4r0mV//TZU2qqM9/kZTtu0UQ//tit 5wxvVgvK2Z8gV1hdk+0ZdAOXGtQsDJ+GAknGFSKRp4kkL1K81ofg6oG5/G14LxMM0M PKg/0ab3+RbSQ== Subject: Re: [PATCH net v2] net: hv_netvsc: Preserve RSS indirection table across device recreation From: netdev-bot+sashiko@kernel.org To: gargaditya@linux.microsoft.com Cc: haiyangz@microsoft.com, wei.liu@kernel.org, decui@microsoft.com, andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com, shradhagupta@linux.microsoft.com, horms@kernel.org, linux-hyperv@vger.kernel.org, netdev@vger.kernel.org, gargaditya@microsoft.com, ssengar@linux.microsoft.com, amir@boussejra.com Date: Fri, 04 Dec 2026 07:47:49 +0000 Message-ID: <179637046957.3146.6988724081260927365@kernel.org> In-Reply-To: <20261203071129.396360-1-gargaditya@linux.microsoft.com> References: <20261203071129.396360-1-gargaditya@linux.microsoft.com> X-sashiko-severity: Medium Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit X-Mailing-List: linux-hyperv@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider. Critical: 0 · High: 0 · Medium: 2 · Low: 0 If you believe none of the issues are legitimate, please reply to each issue of Medium severity or higher and explain why the AI is wrong. If any of them are legitimate and you plan to respin, please let patchwork know by including "pw-bot: cr" as a separate line at the end of your reply (one such reply per series is enough). - [Medium] When netvsc_attach() hits its multi-queue error fallback, it zeroes the only cached copy of the RSS Toeplitz key. - [Medium] If rndis_set_subchannel() succeeds and only the new rndis_filter_set_rss_param() call fails, netvsc_attach() zeroes… -- net: hv_netvsc: Preserve RSS indirection table across device recreation This patch saves a user-configured RSS indirection table in netvsc_device_info before the RNDIS device is recreated. The table is restored after subchannel negotiation if it is still valid. Otherwise defaults are used and the loss is reported with ethtool_rxfh_indir_lost(). On subchannel or RSS programming failure in netvsc_attach(), the patch also clears the cached table and key. Closes: https://lore.kernel.org/all/40fb2352-4859-4334-849b-f6a4229605a1@boussejra.com/ > diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c > index 1d43c73fd73f1..4df17d7baa30c 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)); [Severity: Medium] Suppose rndis_set_subchannel() succeeds and only the new rndis_filter_set_rss_param() call fails. This memset then zeroes rx_table, but nvdev->num_chn is still greater than 1, and rndis_set_subchannel() has already set the real rx queue count to num_chn. Is an all-zero table the intended state for a multi-queue device here? If the table was user-configured, the check further down calls ethtool_rxfh_indir_lost(). That clears rss_indir_user_size, so the ethtool core treats the device as using the default table. The driver, however, holds all zeros, not ethtool_rxfh_indir_default(i, num_chn). The same all-zero table is left behind when no custom table was configured. A later key-only update such as "ethtool -X ethX hkey ..." reaches netvsc_set_rxfh() with rxfh->indir == NULL. It leaves rx_table untouched and programs it to the host: drivers/net/hyperv/netvsc_drv.c:netvsc_set_rxfh() { ... rndis_dev = ndev->extension; if (rxfh->indir) { ... } ... return rndis_filter_set_rss_param(rndis_dev, key); } rndis_set_rss_param_msg() then copies ndc->rx_table straight into the request: for (i = 0; i < ndc->rx_table_sz; i++) itab[i] = ndc->rx_table[i]; Wouldn't that enable RSS with every entry pointing at queue 0? ethtool -x would also show an all-zero table on a multi-queue device that the core reports as unconfigured. Before this patch, rndis_set_subchannel() ignored set_rss_param failures here and rx_table kept valid entries. An all-zero table matches the num_chn == 1 case on the out: path of rndis_filter_device_add(), but this branch keeps the subchannels. When only RSS programming failed, should rx_table be filled with defaults for num_chn instead? > + memset(nvdev->extension->rss_key, 0, NETVSC_HASH_KEYLEN); [Severity: Medium] This memset runs on both the subchannel failure path and the RSS programming failure path, whether or not netif_is_rxfh_configured() is true. Is it safe to clear rdev->rss_key here, when the same cache is the source for later host programming? On the next recreation (MTU change, ethtool -L, ringparam change or suspend/resume), netvsc_devinfo_get() copies the zeroed key into dev_info: memcpy(dev_info->rss_key, nvdev->extension->rss_key, NETVSC_HASH_KEYLEN); The new memcpy in rndis_filter_device_add() carries that key into the new rndis_device: memcpy(rndis_device->rss_key, device_info->rss_key, NETVSC_HASH_KEYLEN); netvsc_attach() then calls rndis_filter_set_rss_param(nvdev->extension, dev_info->rss_key). rndis_set_rss_param_msg() copies the 40 zero bytes into the Toeplitz OID_GEN_RECEIVE_SCALE_PARAMETERS request: memcpy(keyp, rss_key, NETVSC_HASH_KEYLEN); A table-only retry such as "ethtool -X ethX equal N" without hkey takes this fallback in netvsc_set_rxfh(), so it also programs the zero key: if (!key) { if (!rxfh->indir) return 0; key = rndis_dev->rss_key; } A Toeplitz hash with an all-zero key is 0 for every input. If the host accepts the key, wouldn't every flow land on rx_table[0]? That is the all-RX-on-queue-0 symptom this patch is meant to fix. If the host rejects the key, RSS programming would fail on every recreation and the device would stay single-queue. rndis_set_rss_param_msg() refreshes rdev->rss_key only when the host reports success. netvsc_hash_key is used only on the probe path, where dev_info is NULL. So nothing seems to restore a valid key unless the user supplies an explicit hkey. The commit message says: Preserve the cached RSS key and zero table entries on single-queue error fallbacks. The out: single-queue fallback in rndis_filter_device_add() keeps the key. The single-queue fallback here, after a subchannel failure, clears it. Should these two paths behave the same way? > + rss_failed = true; > } > } [ ... ] -- Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261203071129.396360-1-gargaditya%40linux.microsoft.com