Commit 8ebdcc52 authored by Andrew Schwartzmeyer's avatar Andrew Schwartzmeyer Committed by David S. Miller

hv_netvsc: Set vRSS with num_chn in RNDIS filter

Uses device_info->num_chn to pass user provided number of vRSS
queues (from ethtool --set-channels) to rndis_filter_device_add. If
nonzero and less than the maximum, set net_device->num_chn to the given
value; else default to prior algorithm.

Always initialize struct device_info to 0, otherwise not all its fields
are guaranteed to be 0, which is necessary when checking if num_chn has
been purposefully set.
Signed-off-by: default avatarAndrew Schwartzmeyer <andschwa@microsoft.com>
Reviewed-by: default avatarHaiyang Zhang <haiyangz@microsoft.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent d57f6232
...@@ -162,6 +162,7 @@ struct netvsc_device_info { ...@@ -162,6 +162,7 @@ struct netvsc_device_info {
bool link_state; /* 0 - link up, 1 - link down */ bool link_state; /* 0 - link up, 1 - link down */
int ring_size; int ring_size;
u32 max_num_vrss_chns; u32 max_num_vrss_chns;
u32 num_chn;
}; };
enum rndis_device_state { enum rndis_device_state {
......
...@@ -799,6 +799,8 @@ static int netvsc_change_mtu(struct net_device *ndev, int mtu) ...@@ -799,6 +799,8 @@ static int netvsc_change_mtu(struct net_device *ndev, int mtu)
ndevctx->device_ctx = hdev; ndevctx->device_ctx = hdev;
hv_set_drvdata(hdev, ndev); hv_set_drvdata(hdev, ndev);
memset(&device_info, 0, sizeof(device_info));
device_info.ring_size = ring_size; device_info.ring_size = ring_size;
device_info.max_num_vrss_chns = max_num_vrss_chns; device_info.max_num_vrss_chns = max_num_vrss_chns;
rndis_filter_device_add(hdev, &device_info); rndis_filter_device_add(hdev, &device_info);
...@@ -1022,6 +1024,7 @@ static int netvsc_probe(struct hv_device *dev, ...@@ -1022,6 +1024,7 @@ static int netvsc_probe(struct hv_device *dev,
net->needed_headroom = max_needed_headroom; net->needed_headroom = max_needed_headroom;
/* Notify the netvsc driver of the new device */ /* Notify the netvsc driver of the new device */
memset(&device_info, 0, sizeof(device_info));
device_info.ring_size = ring_size; device_info.ring_size = ring_size;
device_info.max_num_vrss_chns = max_num_vrss_chns; device_info.max_num_vrss_chns = max_num_vrss_chns;
ret = rndis_filter_device_add(dev, &device_info); ret = rndis_filter_device_add(dev, &device_info);
......
...@@ -1125,6 +1125,11 @@ int rndis_filter_device_add(struct hv_device *dev, ...@@ -1125,6 +1125,11 @@ int rndis_filter_device_add(struct hv_device *dev,
*/ */
node_cpu_mask = cpumask_of_node(cpu_to_node(dev->channel->target_cpu)); node_cpu_mask = cpumask_of_node(cpu_to_node(dev->channel->target_cpu));
num_possible_rss_qs = cpumask_weight(node_cpu_mask); num_possible_rss_qs = cpumask_weight(node_cpu_mask);
/* We will use the given number of channels if available. */
if (device_info->num_chn && device_info->num_chn < net_device->max_chn)
net_device->num_chn = device_info->num_chn;
else
net_device->num_chn = min(num_possible_rss_qs, num_rss_qs); net_device->num_chn = min(num_possible_rss_qs, num_rss_qs);
num_rss_qs = net_device->num_chn - 1; num_rss_qs = net_device->num_chn - 1;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment