netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Haiyang Zhang <haiyangz@microsoft.com>,
	Sasha Levin <sashal@kernel.org>,
	devel@linuxdriverproject.org, netdev@vger.kernel.org
Subject: [PATCH AUTOSEL 4.19 47/65] hv_netvsc: Fix ethtool change hash key error
Date: Thu, 14 Feb 2019 21:11:03 -0500	[thread overview]
Message-ID: <20190215021121.177674-47-sashal@kernel.org> (raw)
In-Reply-To: <20190215021121.177674-1-sashal@kernel.org>

From: Haiyang Zhang <haiyangz@microsoft.com>

[ Upstream commit b4a10c750424e01b5e37372fef0a574ebf7b56c3 ]

Hyper-V hosts require us to disable RSS before changing RSS key,
otherwise the changing request will fail. This patch fixes the
coding error.

Fixes: ff4a44199012 ("netvsc: allow get/set of RSS indirection table")
Reported-by: Wei Hu <weh@microsoft.com>
Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
Reviewed-by: Michael Kelley <mikelley@microsoft.com>
[sl: fix up subject line]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/net/hyperv/rndis_filter.c | 25 +++++++++++++++++++------
 1 file changed, 19 insertions(+), 6 deletions(-)

diff --git a/drivers/net/hyperv/rndis_filter.c b/drivers/net/hyperv/rndis_filter.c
index 2a5209f23f29..0b05f7ebeb01 100644
--- a/drivers/net/hyperv/rndis_filter.c
+++ b/drivers/net/hyperv/rndis_filter.c
@@ -715,8 +715,8 @@ rndis_filter_set_offload_params(struct net_device *ndev,
 	return ret;
 }
 
-int rndis_filter_set_rss_param(struct rndis_device *rdev,
-			       const u8 *rss_key)
+static int rndis_set_rss_param_msg(struct rndis_device *rdev,
+				   const u8 *rss_key, u16 flag)
 {
 	struct net_device *ndev = rdev->ndev;
 	struct rndis_request *request;
@@ -745,7 +745,7 @@ int rndis_filter_set_rss_param(struct rndis_device *rdev,
 	rssp->hdr.type = NDIS_OBJECT_TYPE_RSS_PARAMETERS;
 	rssp->hdr.rev = NDIS_RECEIVE_SCALE_PARAMETERS_REVISION_2;
 	rssp->hdr.size = sizeof(struct ndis_recv_scale_param);
-	rssp->flag = 0;
+	rssp->flag = flag;
 	rssp->hashinfo = NDIS_HASH_FUNC_TOEPLITZ | NDIS_HASH_IPV4 |
 			 NDIS_HASH_TCP_IPV4 | NDIS_HASH_IPV6 |
 			 NDIS_HASH_TCP_IPV6;
@@ -770,9 +770,12 @@ int rndis_filter_set_rss_param(struct rndis_device *rdev,
 
 	wait_for_completion(&request->wait_event);
 	set_complete = &request->response_msg.msg.set_complete;
-	if (set_complete->status == RNDIS_STATUS_SUCCESS)
-		memcpy(rdev->rss_key, rss_key, NETVSC_HASH_KEYLEN);
-	else {
+	if (set_complete->status == RNDIS_STATUS_SUCCESS) {
+		if (!(flag & NDIS_RSS_PARAM_FLAG_DISABLE_RSS) &&
+		    !(flag & NDIS_RSS_PARAM_FLAG_HASH_KEY_UNCHANGED))
+			memcpy(rdev->rss_key, rss_key, NETVSC_HASH_KEYLEN);
+
+	} else {
 		netdev_err(ndev, "Fail to set RSS parameters:0x%x\n",
 			   set_complete->status);
 		ret = -EINVAL;
@@ -783,6 +786,16 @@ int rndis_filter_set_rss_param(struct rndis_device *rdev,
 	return ret;
 }
 
+int rndis_filter_set_rss_param(struct rndis_device *rdev,
+			       const u8 *rss_key)
+{
+	/* Disable RSS before change */
+	rndis_set_rss_param_msg(rdev, rss_key,
+				NDIS_RSS_PARAM_FLAG_DISABLE_RSS);
+
+	return rndis_set_rss_param_msg(rdev, rss_key, 0);
+}
+
 static int rndis_filter_query_device_link_status(struct rndis_device *dev,
 						 struct netvsc_device *net_device)
 {
-- 
2.19.1


  parent reply	other threads:[~2019-02-15  2:31 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20190215021121.177674-1-sashal@kernel.org>
2019-02-15  2:10 ` [PATCH AUTOSEL 4.19 29/65] mac80211: fix miscounting of ttl-dropped frames Sasha Levin
2019-02-15  2:10 ` [PATCH AUTOSEL 4.19 34/65] libceph: avoid KEEPALIVE_PENDING races in ceph_con_keepalive() Sasha Levin
2019-02-15  2:11 ` [PATCH AUTOSEL 4.19 46/65] net: altera_tse: fix connect_local_phy error path Sasha Levin
2019-02-15  2:11 ` Sasha Levin [this message]
2019-02-15  2:11 ` [PATCH AUTOSEL 4.19 48/65] hv_netvsc: Refactor assignments of struct netvsc_device_info Sasha Levin
2019-02-15  2:11 ` [PATCH AUTOSEL 4.19 49/65] hv_netvsc: Fix hash key value reset after other ops Sasha Levin
2019-02-15  2:11 ` [PATCH AUTOSEL 4.19 50/65] sfc: suppress duplicate nvmem partition types in efx_ef10_mtd_probe Sasha Levin
2019-02-15  2:11 ` [PATCH AUTOSEL 4.19 51/65] ax25: fix possible use-after-free Sasha Levin
2019-02-15  2:11 ` [PATCH AUTOSEL 4.19 56/65] net: usb: asix: ax88772_bind return error when hw_reset fail Sasha Levin
2019-02-15  2:11 ` [PATCH AUTOSEL 4.19 57/65] net: dev_is_mac_header_xmit() true for ARPHRD_RAWIP Sasha Levin
2019-02-15  2:11 ` [PATCH AUTOSEL 4.19 58/65] ibmveth: Do not process frames after calling napi_reschedule Sasha Levin
2019-02-15  2:11 ` [PATCH AUTOSEL 4.19 59/65] mac80211: don't initiate TDLS connection if station is not associated to AP Sasha Levin
2019-02-15  2:11 ` [PATCH AUTOSEL 4.19 60/65] mac80211: Add attribute aligned(2) to struct 'action' Sasha Levin
2019-02-15  2:11 ` [PATCH AUTOSEL 4.19 61/65] cfg80211: extend range deviation for DMG Sasha Levin

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=20190215021121.177674-47-sashal@kernel.org \
    --to=sashal@kernel.org \
    --cc=devel@linuxdriverproject.org \
    --cc=haiyangz@microsoft.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    /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 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).