Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp206540imj; Thu, 14 Feb 2019 18:41:10 -0800 (PST) X-Google-Smtp-Source: AHgI3IZl3250tmH9p0P7D9zQne2Rqe0Mh3psxr9bHNvBAHX3X1csXCqLK8oLc9Qpxd0tgxe0O6Qy X-Received: by 2002:a17:902:6508:: with SMTP id b8mr7836333plk.17.1550198470058; Thu, 14 Feb 2019 18:41:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550198470; cv=none; d=google.com; s=arc-20160816; b=Hw3P5Y0H4aD3hgTOU25LNEPzpqkv0PXXgCjdv92GsZNrfe6nJ/vpzc7yVgE7maPRuV uNzREIwVZrT3eBv9+XqvM6jjF2Nmdhx86csVtmoU+AUpRbZ5yqlwL5aA6zj405VsBBT5 v/1K6QMRiU8boHpfNaEfDEHhCo2cKt3imP75xrRhNsXhQIE7IkJbbTWBzr5uFigWih3F pr+6lxWenS/oRqivu34iLV9sEAF4Zr/dBkLjxwwCBdLS3cjLXWPhvi2FKVkm/wQ+DgYi COqR6Z3dvliUa8ucxwpXqR/vhIxxdBzt2M0KcuXlTjmlW0SMpSjUa6OrYyKT5BOfhX6r nvfg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=kU7z45l2ILDkzdaLrU1IxmVfeubyRHpD99vM3yY0pSM=; b=S+6gw3kVRF+vfTzXiGfdsooutVor05Q7wCvzqcP+i0PtuDcwJBZkivyKFltht7rj0L Yeu9zNNB3PaiIyX4QhT9hxyNaonJO6kEKF0ojJSLRBxDnalAWEkaRUGsx0MtpYunhi+q 7PhtYKNcLLclVdVeyzOpyYi8iXCkvOTQGsVfRqWZ5apDAHlpOQqwvohNaJIf3fu8WGlF OCMc8CiUgEqBE6Vkq5Ei6BjxWuBmY9005DbFuz8JBdudXMk3GYJdzohbV6eQrUu83kE2 w6S893sdQPS1VN5HNoSIYZFyIpibk4bxqB3W1tz5rjiEeSQYMCC/MCZX/Wdes7BQezgL A88A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=jcYowg+A; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c12si608262pgh.257.2019.02.14.18.40.54; Thu, 14 Feb 2019 18:41:10 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=jcYowg+A; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390524AbfBOCKd (ORCPT + 99 others); Thu, 14 Feb 2019 21:10:33 -0500 Received: from mail.kernel.org ([198.145.29.99]:50652 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390464AbfBOCKa (ORCPT ); Thu, 14 Feb 2019 21:10:30 -0500 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 75AA42229F; Fri, 15 Feb 2019 02:10:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1550196629; bh=QZ9HM5CjjkWjWL/SbDhN3izHTKvs5MEIqt31fW8Errw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jcYowg+AiXseMMXwR7BTAlSkwlJ07lURnsBLspBgRtua6UpFBIsiDhM7rWy7qhhO7 7jGO8h14sEj+N9+3ahtYZoOztoAL4JnzoGVkJXDtZesRSaPjaYeZRGmyhC3+gl0q5l r4ZAv5RO8ZXVu2A7hrlPRKc/6eSwvM8XGE+DFAuo= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Haiyang Zhang , Sasha Levin , devel@linuxdriverproject.org, netdev@vger.kernel.org Subject: [PATCH AUTOSEL 4.20 55/77] hv_netvsc: Fix ethtool change hash key error Date: Thu, 14 Feb 2019 21:08:33 -0500 Message-Id: <20190215020855.176727-55-sashal@kernel.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190215020855.176727-1-sashal@kernel.org> References: <20190215020855.176727-1-sashal@kernel.org> MIME-Version: 1.0 X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Haiyang Zhang [ 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 Signed-off-by: Haiyang Zhang Reviewed-by: Michael Kelley [sl: fix up subject line] Signed-off-by: Sasha Levin --- 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 8b537a049c1e..a4661d396e3c 100644 --- a/drivers/net/hyperv/rndis_filter.c +++ b/drivers/net/hyperv/rndis_filter.c @@ -774,8 +774,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; @@ -804,7 +804,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; @@ -829,9 +829,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; @@ -842,6 +845,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