linux-hyperv.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Fix tx_table init in rndis_set_subchannel()
@ 2019-12-11 21:59 Haiyang Zhang
  2019-12-11 22:22 ` David Miller
  0 siblings, 1 reply; 3+ messages in thread
From: Haiyang Zhang @ 2019-12-11 21:59 UTC (permalink / raw)
  To: sashal, linux-hyperv, netdev
  Cc: haiyangz, kys, sthemmin, olaf, vkuznets, davem, linux-kernel

Host can provide send indirection table messages anytime after RSS is
enabled by calling rndis_filter_set_rss_param(). So the host provided
table values may be overwritten by the initialization in
rndis_set_subchannel().

To prevent this problem, move the tx_table initialization before calling
rndis_filter_set_rss_param().

Fixes: a6fb6aa3cfa9 ("hv_netvsc: Set tx_table to equal weight after subchannels open")
Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>

---
 drivers/net/hyperv/rndis_filter.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/hyperv/rndis_filter.c b/drivers/net/hyperv/rndis_filter.c
index 206b4e7..05bc5ec8 100644
--- a/drivers/net/hyperv/rndis_filter.c
+++ b/drivers/net/hyperv/rndis_filter.c
@@ -1171,6 +1171,9 @@ int rndis_set_subchannel(struct net_device *ndev,
 	wait_event(nvdev->subchan_open,
 		   atomic_read(&nvdev->open_chn) == nvdev->num_chn);
 
+	for (i = 0; i < VRSS_SEND_TAB_SIZE; i++)
+		ndev_ctx->tx_table[i] = i % nvdev->num_chn;
+
 	/* ignore failures from setting rss parameters, still have channels */
 	if (dev_info)
 		rndis_filter_set_rss_param(rdev, dev_info->rss_key);
@@ -1180,9 +1183,6 @@ int rndis_set_subchannel(struct net_device *ndev,
 	netif_set_real_num_tx_queues(ndev, nvdev->num_chn);
 	netif_set_real_num_rx_queues(ndev, nvdev->num_chn);
 
-	for (i = 0; i < VRSS_SEND_TAB_SIZE; i++)
-		ndev_ctx->tx_table[i] = i % nvdev->num_chn;
-
 	return 0;
 }
 
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] Fix tx_table init in rndis_set_subchannel()
  2019-12-11 21:59 [PATCH] Fix tx_table init in rndis_set_subchannel() Haiyang Zhang
@ 2019-12-11 22:22 ` David Miller
  2019-12-11 22:23   ` Haiyang Zhang
  0 siblings, 1 reply; 3+ messages in thread
From: David Miller @ 2019-12-11 22:22 UTC (permalink / raw)
  To: haiyangz
  Cc: sashal, linux-hyperv, netdev, kys, sthemmin, olaf, vkuznets,
	linux-kernel

From: Haiyang Zhang <haiyangz@microsoft.com>
Date: Wed, 11 Dec 2019 13:59:03 -0800

> Host can provide send indirection table messages anytime after RSS is
> enabled by calling rndis_filter_set_rss_param(). So the host provided
> table values may be overwritten by the initialization in
> rndis_set_subchannel().
> 
> To prevent this problem, move the tx_table initialization before calling
> rndis_filter_set_rss_param().
> 
> Fixes: a6fb6aa3cfa9 ("hv_netvsc: Set tx_table to equal weight after subchannels open")
> Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>

Please format your subject lines properly.

	[PATCH $version $GIT_TREE] $subsystem_prefix: $description

Even the Fixes: tag had the proper subsystem prefix in it.

So your next posting must be of the form:

	[PATCH v2 net] hv_netvsc: Fix tx_table init in rndis_set_subchannel().

^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: [PATCH] Fix tx_table init in rndis_set_subchannel()
  2019-12-11 22:22 ` David Miller
@ 2019-12-11 22:23   ` Haiyang Zhang
  0 siblings, 0 replies; 3+ messages in thread
From: Haiyang Zhang @ 2019-12-11 22:23 UTC (permalink / raw)
  To: David Miller
  Cc: sashal, linux-hyperv, netdev, KY Srinivasan, Stephen Hemminger,
	olaf, vkuznets, linux-kernel



> -----Original Message-----
> From: linux-hyperv-owner@vger.kernel.org <linux-hyperv-
> owner@vger.kernel.org> On Behalf Of David Miller
> Sent: Wednesday, December 11, 2019 5:22 PM
> To: Haiyang Zhang <haiyangz@microsoft.com>
> Cc: sashal@kernel.org; linux-hyperv@vger.kernel.org; netdev@vger.kernel.org;
> KY Srinivasan <kys@microsoft.com>; Stephen Hemminger
> <sthemmin@microsoft.com>; olaf@aepfle.de; vkuznets
> <vkuznets@redhat.com>; linux-kernel@vger.kernel.org
> Subject: Re: [PATCH] Fix tx_table init in rndis_set_subchannel()
> 
> From: Haiyang Zhang <haiyangz@microsoft.com>
> Date: Wed, 11 Dec 2019 13:59:03 -0800
> 
> > Host can provide send indirection table messages anytime after RSS is
> > enabled by calling rndis_filter_set_rss_param(). So the host provided
> > table values may be overwritten by the initialization in
> > rndis_set_subchannel().
> >
> > To prevent this problem, move the tx_table initialization before
> > calling rndis_filter_set_rss_param().
> >
> > Fixes: a6fb6aa3cfa9 ("hv_netvsc: Set tx_table to equal weight after
> > subchannels open")
> > Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
> 
> Please format your subject lines properly.
> 
> 	[PATCH $version $GIT_TREE] $subsystem_prefix: $description
> 
> Even the Fixes: tag had the proper subsystem prefix in it.
> 
> So your next posting must be of the form:
> 
> 	[PATCH v2 net] hv_netvsc: Fix tx_table init in rndis_set_subchannel().

Will do. Thanks.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-12-11 22:23 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-11 21:59 [PATCH] Fix tx_table init in rndis_set_subchannel() Haiyang Zhang
2019-12-11 22:22 ` David Miller
2019-12-11 22:23   ` Haiyang Zhang

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).