From: Stephen Hemminger <stephen@networkplumber.org>
To: davem@davemloft.net, kys@microsoft.com
Cc: netdev@vger.kernel.org, Stephen Hemminger <sthemmin@microsoft.com>
Subject: [PATCH 07/18] netvsc: allow get/set of RSS indirection table
Date: Tue, 24 Jan 2017 13:06:04 -0800 [thread overview]
Message-ID: <20170124210615.18628-8-sthemmin@microsoft.com> (raw)
In-Reply-To: <20170124210615.18628-1-sthemmin@microsoft.com>
Allow setting receive indirection table. Also uses the system standard
for initialization.
Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com>
---
drivers/net/hyperv/hyperv_net.h | 1 +
drivers/net/hyperv/netvsc_drv.c | 26 +++++++++++++++++++++++---
drivers/net/hyperv/rndis_filter.c | 9 +++++++--
3 files changed, 31 insertions(+), 5 deletions(-)
diff --git a/drivers/net/hyperv/hyperv_net.h b/drivers/net/hyperv/hyperv_net.h
index 5a652eb8a619..db11f7ab67a8 100644
--- a/drivers/net/hyperv/hyperv_net.h
+++ b/drivers/net/hyperv/hyperv_net.h
@@ -170,6 +170,7 @@ struct rndis_device {
u8 hw_mac_adr[ETH_ALEN];
u8 rss_key[NETVSC_HASH_KEYLEN];
+ u16 ind_table[ITAB_NUM];
};
diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c
index ead472150742..a09602e59cf5 100644
--- a/drivers/net/hyperv/netvsc_drv.c
+++ b/drivers/net/hyperv/netvsc_drv.c
@@ -1035,7 +1035,7 @@ static u32 netvsc_get_rxfh_key_size(struct net_device *dev)
static u32 netvsc_rss_indir_size(struct net_device *dev)
{
- return 0;
+ return ITAB_NUM;
}
static int netvsc_get_rxfh(struct net_device *dev, u32 *indir, u8 *key,
@@ -1044,10 +1044,16 @@ static int netvsc_get_rxfh(struct net_device *dev, u32 *indir, u8 *key,
struct net_device_context *ndc = netdev_priv(dev);
struct netvsc_device *ndev = ndc->nvdev;
struct rndis_device *rndis_dev = ndev->extension;
+ int i;
if (hfunc)
*hfunc = ETH_RSS_HASH_TOP; /* Toeplitz */
+ if (indir) {
+ for (i = 0; i < ITAB_NUM; i++)
+ indir[i] = rndis_dev->ind_table[i];
+ }
+
if (key)
memcpy(key, rndis_dev->rss_key, NETVSC_HASH_KEYLEN);
@@ -1060,12 +1066,26 @@ static int netvsc_set_rxfh(struct net_device *dev, const u32 *indir,
struct net_device_context *ndc = netdev_priv(dev);
struct netvsc_device *ndev = ndc->nvdev;
struct rndis_device *rndis_dev = ndev->extension;
+ int i;
if (hfunc != ETH_RSS_HASH_NO_CHANGE && hfunc != ETH_RSS_HASH_TOP)
return -EOPNOTSUPP;
- if (!key || memcmp(key, rndis_dev->rss_key, NETVSC_HASH_KEYLEN) == 0)
- return 0; /* no change */
+ if (indir) {
+ for (i = 0; i < ITAB_NUM; i++)
+ if (indir[i] >= dev->num_rx_queues)
+ return -EINVAL;
+
+ for (i = 0; i < ITAB_NUM; i++)
+ rndis_dev->ind_table[i] = indir[i];
+ }
+
+ if (!key) {
+ if (!indir)
+ return 0;
+
+ key = rndis_dev->rss_key;
+ }
return rndis_filter_set_rss_param(rndis_dev, key, ndev->num_chn);
}
diff --git a/drivers/net/hyperv/rndis_filter.c b/drivers/net/hyperv/rndis_filter.c
index ac08aa1b089a..8d2b078403de 100644
--- a/drivers/net/hyperv/rndis_filter.c
+++ b/drivers/net/hyperv/rndis_filter.c
@@ -780,7 +780,7 @@ int rndis_filter_set_rss_param(struct rndis_device *rdev,
/* Set indirection table entries */
itab = (u32 *)(rssp + 1);
for (i = 0; i < ITAB_NUM; i++)
- itab[i] = i % num_queue;
+ itab[i] = rdev->ind_table[i];
/* Set hask key values */
keyp = (u8 *)((unsigned long)rssp + rssp->kashkey_offset);
@@ -1035,7 +1035,6 @@ static void netvsc_sc_open(struct vmbus_channel *new_sc)
int rndis_filter_device_add(struct hv_device *dev,
void *additional_info)
{
- int ret;
struct net_device *net = hv_get_drvdata(dev);
struct net_device_context *net_device_ctx = netdev_priv(net);
struct netvsc_device *net_device;
@@ -1053,6 +1052,7 @@ int rndis_filter_device_add(struct hv_device *dev,
const struct cpumask *node_cpu_mask;
u32 num_possible_rss_qs;
unsigned long flags;
+ int i, ret;
rndis_device = get_rndis_device();
if (!rndis_device)
@@ -1206,6 +1206,11 @@ int rndis_filter_device_add(struct hv_device *dev,
net_device->num_chn = min(num_possible_rss_qs, num_rss_qs);
num_rss_qs = net_device->num_chn - 1;
+
+ for (i = 0; i < ITAB_NUM; i++)
+ rndis_device->ind_table[i] = ethtool_rxfh_indir_default(i,
+ net_device->num_chn);
+
net_device->num_sc_offered = num_rss_qs;
if (net_device->num_chn == 1)
--
2.11.0
next prev parent reply other threads:[~2017-01-24 21:06 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-24 21:05 [PATCH net-next 00/18] netvsc driver enhancements for net-next Stephen Hemminger
2017-01-24 21:05 ` [PATCH 01/18] netvsc: remove no longer needed receive staging buffers Stephen Hemminger
2017-01-24 21:05 ` [PATCH 02/18] netvsc: negotiate checksum and segmentation parameters Stephen Hemminger
2017-01-24 21:06 ` [PATCH 03/18] netvsc: report number of rx queues in ethtool Stephen Hemminger
2017-01-24 21:06 ` [PATCH 04/18] netvsc: report rss field values Stephen Hemminger
2017-01-24 21:06 ` [PATCH 05/18] netvsc: add ethtool ops to get/set RSS key Stephen Hemminger
2017-01-24 21:06 ` [PATCH 06/18] netvsc: allow more flexible setting of number of channels Stephen Hemminger
2017-01-24 21:06 ` Stephen Hemminger [this message]
2017-01-24 21:06 ` [PATCH 08/18] netvsc: enhance transmit select_queue Stephen Hemminger
2017-01-24 21:06 ` [PATCH 09/18] netvsc: remove unused variables Stephen Hemminger
2017-01-24 21:06 ` [PATCH 10/18] netvsc: group all per-channel state together Stephen Hemminger
2017-01-24 21:06 ` [PATCH 11/18] netvsc: optimize receive path Stephen Hemminger
2017-01-24 21:06 ` [PATCH 12/18] netvsc: don't pass void * to internal device_add Stephen Hemminger
2017-01-24 21:06 ` [PATCH 13/18] netvsc: simplify rndis_filter_remove Stephen Hemminger
2017-01-24 21:06 ` [PATCH 14/18] netvsc: eliminate per-device outstanding send counter Stephen Hemminger
2017-01-24 21:06 ` [PATCH 15/18] netvsc: account for packets/bytes transmitted after completion Stephen Hemminger
2017-01-24 21:06 ` [PATCH 16/18] netvsc: report per-channel stats in ethtool statistics Stephen Hemminger
2017-01-24 21:06 ` [PATCH 17/18] netvsc: simplify get next send section Stephen Hemminger
2017-01-24 21:06 ` [PATCH 18/18] netvsc: call netif_receive_skb Stephen Hemminger
2017-01-24 22:39 ` Eric Dumazet
2017-01-24 23:00 ` Stephen Hemminger
2017-01-24 23:07 ` Eric Dumazet
2017-01-24 21:30 ` [PATCH net-next 00/18] netvsc driver enhancements for net-next David Miller
2017-01-24 22:00 ` Stephen Hemminger
2017-01-24 22:50 ` Stephen Hemminger
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170124210615.18628-8-sthemmin@microsoft.com \
--to=stephen@networkplumber.org \
--cc=davem@davemloft.net \
--cc=kys@microsoft.com \
--cc=netdev@vger.kernel.org \
--cc=sthemmin@microsoft.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.