Commit 32d9b70a authored by David S. Miller's avatar David S. Miller

Merge branch 'hv_netvsc-channel-settings-cleanups-and-fixes'

Haiyang Zhang says:

====================
hv_netvsc: cleanups and fixes of channel settings

This patch set cleans up some unused variables, unnecessary checks.
Also fixed some limit checking of channel number.
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 864150df db3cd7af
...@@ -213,7 +213,7 @@ void rndis_filter_update(struct netvsc_device *nvdev); ...@@ -213,7 +213,7 @@ void rndis_filter_update(struct netvsc_device *nvdev);
void rndis_filter_device_remove(struct hv_device *dev, void rndis_filter_device_remove(struct hv_device *dev,
struct netvsc_device *nvdev); struct netvsc_device *nvdev);
int rndis_filter_set_rss_param(struct rndis_device *rdev, int rndis_filter_set_rss_param(struct rndis_device *rdev,
const u8 *key, int num_queue); const u8 *key);
int rndis_filter_receive(struct net_device *ndev, int rndis_filter_receive(struct net_device *ndev,
struct netvsc_device *net_dev, struct netvsc_device *net_dev,
struct hv_device *dev, struct hv_device *dev,
......
...@@ -830,9 +830,6 @@ static int netvsc_set_channels(struct net_device *net, ...@@ -830,9 +830,6 @@ static int netvsc_set_channels(struct net_device *net,
channels->rx_count || channels->tx_count || channels->other_count) channels->rx_count || channels->tx_count || channels->other_count)
return -EINVAL; return -EINVAL;
if (count > net->num_tx_queues || count > VRSS_CHANNEL_MAX)
return -EINVAL;
if (!nvdev || nvdev->destroy) if (!nvdev || nvdev->destroy)
return -ENODEV; return -ENODEV;
...@@ -1410,7 +1407,7 @@ static int netvsc_set_rxfh(struct net_device *dev, const u32 *indir, ...@@ -1410,7 +1407,7 @@ static int netvsc_set_rxfh(struct net_device *dev, const u32 *indir,
rndis_dev = ndev->extension; rndis_dev = ndev->extension;
if (indir) { if (indir) {
for (i = 0; i < ITAB_NUM; i++) for (i = 0; i < ITAB_NUM; i++)
if (indir[i] >= VRSS_CHANNEL_MAX) if (indir[i] >= ndev->num_chn)
return -EINVAL; return -EINVAL;
for (i = 0; i < ITAB_NUM; i++) for (i = 0; i < ITAB_NUM; i++)
...@@ -1424,7 +1421,7 @@ static int netvsc_set_rxfh(struct net_device *dev, const u32 *indir, ...@@ -1424,7 +1421,7 @@ static int netvsc_set_rxfh(struct net_device *dev, const u32 *indir,
key = rndis_dev->rss_key; key = rndis_dev->rss_key;
} }
return rndis_filter_set_rss_param(rndis_dev, key, ndev->num_chn); return rndis_filter_set_rss_param(rndis_dev, key);
} }
/* Hyper-V RNDIS protocol does not have ring in the HW sense. /* Hyper-V RNDIS protocol does not have ring in the HW sense.
......
...@@ -717,7 +717,7 @@ rndis_filter_set_offload_params(struct net_device *ndev, ...@@ -717,7 +717,7 @@ rndis_filter_set_offload_params(struct net_device *ndev,
} }
int rndis_filter_set_rss_param(struct rndis_device *rdev, int rndis_filter_set_rss_param(struct rndis_device *rdev,
const u8 *rss_key, int num_queue) const u8 *rss_key)
{ {
struct net_device *ndev = rdev->ndev; struct net_device *ndev = rdev->ndev;
struct rndis_request *request; struct rndis_request *request;
...@@ -1067,7 +1067,7 @@ struct netvsc_device *rndis_filter_device_add(struct hv_device *dev, ...@@ -1067,7 +1067,7 @@ struct netvsc_device *rndis_filter_device_add(struct hv_device *dev,
struct ndis_recv_scale_cap rsscap; struct ndis_recv_scale_cap rsscap;
u32 rsscap_size = sizeof(struct ndis_recv_scale_cap); u32 rsscap_size = sizeof(struct ndis_recv_scale_cap);
unsigned int gso_max_size = GSO_MAX_SIZE; unsigned int gso_max_size = GSO_MAX_SIZE;
u32 mtu, size, num_rss_qs; u32 mtu, size;
const struct cpumask *node_cpu_mask; const struct cpumask *node_cpu_mask;
u32 num_possible_rss_qs; u32 num_possible_rss_qs;
int i, ret; int i, ret;
...@@ -1215,8 +1215,8 @@ struct netvsc_device *rndis_filter_device_add(struct hv_device *dev, ...@@ -1215,8 +1215,8 @@ struct netvsc_device *rndis_filter_device_add(struct hv_device *dev,
net_device->num_chn); net_device->num_chn);
atomic_set(&net_device->open_chn, 1); atomic_set(&net_device->open_chn, 1);
num_rss_qs = net_device->num_chn - 1;
if (num_rss_qs == 0) if (net_device->num_chn == 1)
return net_device; return net_device;
for (i = 1; i < net_device->num_chn; i++) { for (i = 1; i < net_device->num_chn; i++) {
...@@ -1258,8 +1258,7 @@ struct netvsc_device *rndis_filter_device_add(struct hv_device *dev, ...@@ -1258,8 +1258,7 @@ struct netvsc_device *rndis_filter_device_add(struct hv_device *dev,
atomic_read(&net_device->open_chn) == net_device->num_chn); atomic_read(&net_device->open_chn) == net_device->num_chn);
/* ignore failues from setting rss parameters, still have channels */ /* ignore failues from setting rss parameters, still have channels */
rndis_filter_set_rss_param(rndis_device, netvsc_hash_key, rndis_filter_set_rss_param(rndis_device, netvsc_hash_key);
net_device->num_chn);
out: out:
if (ret) { if (ret) {
net_device->max_chn = 1; net_device->max_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