netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] hv_netvsc: Use the num_online_cpus() for channel limit
@ 2018-01-19 20:26 Haiyang Zhang
  2018-01-19 20:35 ` Haiyang Zhang
  2018-01-22 21:24 ` David Miller
  0 siblings, 2 replies; 3+ messages in thread
From: Haiyang Zhang @ 2018-01-19 20:26 UTC (permalink / raw)
  To: davem, netdev; +Cc: olaf, sthemmin, haiyangz, linux-kernel, devel, vkuznets

From: Haiyang Zhang <haiyangz@microsoft.com>

Since we no longer localize channel/CPU affiliation within one NUMA
node, num_online_cpus() is used as the number of channel cap, instead of
the number of processors in a NUMA node.

This patch allows a bigger range for tuning the number of channels.

Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
---
 drivers/net/hyperv/rndis_filter.c | 11 ++---------
 1 file changed, 2 insertions(+), 9 deletions(-)

diff --git a/drivers/net/hyperv/rndis_filter.c b/drivers/net/hyperv/rndis_filter.c
index 91a67c5297f7..c3ca191fea7f 100644
--- a/drivers/net/hyperv/rndis_filter.c
+++ b/drivers/net/hyperv/rndis_filter.c
@@ -1221,7 +1221,6 @@ struct netvsc_device *rndis_filter_device_add(struct hv_device *dev,
 	struct ndis_recv_scale_cap rsscap;
 	u32 rsscap_size = sizeof(struct ndis_recv_scale_cap);
 	u32 mtu, size;
-	const struct cpumask *node_cpu_mask;
 	u32 num_possible_rss_qs;
 	int i, ret;
 
@@ -1290,14 +1289,8 @@ struct netvsc_device *rndis_filter_device_add(struct hv_device *dev,
 	if (ret || rsscap.num_recv_que < 2)
 		goto out;
 
-	/*
-	 * We will limit the VRSS channels to the number CPUs in the NUMA node
-	 * the primary channel is currently bound to.
-	 *
-	 * This also guarantees that num_possible_rss_qs <= num_online_cpus
-	 */
-	node_cpu_mask = cpumask_of_node(cpu_to_node(dev->channel->target_cpu));
-	num_possible_rss_qs = min_t(u32, cpumask_weight(node_cpu_mask),
+	/* This guarantees that num_possible_rss_qs <= num_online_cpus */
+	num_possible_rss_qs = min_t(u32, num_online_cpus(),
 				    rsscap.num_recv_que);
 
 	net_device->max_chn = min_t(u32, VRSS_CHANNEL_MAX, num_possible_rss_qs);
-- 
2.15.1

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

* [PATCH net-next] hv_netvsc: Use the num_online_cpus() for channel limit
  2018-01-19 20:26 [PATCH net-next] hv_netvsc: Use the num_online_cpus() for channel limit Haiyang Zhang
@ 2018-01-19 20:35 ` Haiyang Zhang
  2018-01-22 21:24 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: Haiyang Zhang @ 2018-01-19 20:35 UTC (permalink / raw)
  To: davem, netdev
  Cc: Haiyang Zhang, KY Srinivasan, Stephen Hemminger, olaf, vkuznets,
	devel, linux-kernel

From: Haiyang Zhang <haiyangz@microsoft.com>

Since we no longer localize channel/CPU affiliation within one NUMA
node, num_online_cpus() is used as the number of channel cap, instead of
the number of processors in a NUMA node.

This patch allows a bigger range for tuning the number of channels.

Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
---
 drivers/net/hyperv/rndis_filter.c | 11 ++---------
 1 file changed, 2 insertions(+), 9 deletions(-)

diff --git a/drivers/net/hyperv/rndis_filter.c b/drivers/net/hyperv/rndis_filter.c
index 91a67c5297f7..c3ca191fea7f 100644
--- a/drivers/net/hyperv/rndis_filter.c
+++ b/drivers/net/hyperv/rndis_filter.c
@@ -1221,7 +1221,6 @@ struct netvsc_device *rndis_filter_device_add(struct hv_device *dev,
        struct ndis_recv_scale_cap rsscap;
        u32 rsscap_size = sizeof(struct ndis_recv_scale_cap);
        u32 mtu, size;
-       const struct cpumask *node_cpu_mask;
        u32 num_possible_rss_qs;
        int i, ret;

@@ -1290,14 +1289,8 @@ struct netvsc_device *rndis_filter_device_add(struct hv_device *dev,
        if (ret || rsscap.num_recv_que < 2)
                goto out;

-       /*
-        * We will limit the VRSS channels to the number CPUs in the NUMA node
-        * the primary channel is currently bound to.
-        *
-        * This also guarantees that num_possible_rss_qs <= num_online_cpus
-        */
-       node_cpu_mask = cpumask_of_node(cpu_to_node(dev->channel->target_cpu));
-       num_possible_rss_qs = min_t(u32, cpumask_weight(node_cpu_mask),
+       /* This guarantees that num_possible_rss_qs <= num_online_cpus */
+       num_possible_rss_qs = min_t(u32, num_online_cpus(),
                                    rsscap.num_recv_que);

        net_device->max_chn = min_t(u32, VRSS_CHANNEL_MAX, num_possible_rss_qs);

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

* Re: [PATCH net-next] hv_netvsc: Use the num_online_cpus() for channel limit
  2018-01-19 20:26 [PATCH net-next] hv_netvsc: Use the num_online_cpus() for channel limit Haiyang Zhang
  2018-01-19 20:35 ` Haiyang Zhang
@ 2018-01-22 21:24 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2018-01-22 21:24 UTC (permalink / raw)
  To: haiyangz, haiyangz
  Cc: netdev, kys, sthemmin, olaf, vkuznets, devel, linux-kernel

From: Haiyang Zhang <haiyangz@exchange.microsoft.com>
Date: Fri, 19 Jan 2018 13:26:43 -0700

> From: Haiyang Zhang <haiyangz@microsoft.com>
> 
> Since we no longer localize channel/CPU affiliation within one NUMA
> node, num_online_cpus() is used as the number of channel cap, instead of
> the number of processors in a NUMA node.
> 
> This patch allows a bigger range for tuning the number of channels.
> 
> Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>

Applied, thanks.

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

end of thread, other threads:[~2018-01-22 21:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-19 20:26 [PATCH net-next] hv_netvsc: Use the num_online_cpus() for channel limit Haiyang Zhang
2018-01-19 20:35 ` Haiyang Zhang
2018-01-22 21:24 ` David Miller

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