aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHaiyang Zhang <haiyangz@microsoft.com>2019-01-14 19:51:42 -0500
committerSasha Levin <sashal@kernel.org>2019-01-23 13:19:35 -0500
commitb4a10c750424e01b5e37372fef0a574ebf7b56c3 (patch)
tree1ca9b98013bdc515ce1ee633a72201bcbba5fb24
parentbfeffd155283772bbe78c6a05dec7c0128ee500c (diff)
hv_netvsc: Fix ethtool change hash key error
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>
-rw-r--r--drivers/net/hyperv/rndis_filter.c25
1 files 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 @@ cleanup:
774 return ret; 774 return ret;
775} 775}
776 776
777int rndis_filter_set_rss_param(struct rndis_device *rdev, 777static int rndis_set_rss_param_msg(struct rndis_device *rdev,
778 const u8 *rss_key) 778 const u8 *rss_key, u16 flag)
779{ 779{
780 struct net_device *ndev = rdev->ndev; 780 struct net_device *ndev = rdev->ndev;
781 struct rndis_request *request; 781 struct rndis_request *request;
@@ -804,7 +804,7 @@ int rndis_filter_set_rss_param(struct rndis_device *rdev,
804 rssp->hdr.type = NDIS_OBJECT_TYPE_RSS_PARAMETERS; 804 rssp->hdr.type = NDIS_OBJECT_TYPE_RSS_PARAMETERS;
805 rssp->hdr.rev = NDIS_RECEIVE_SCALE_PARAMETERS_REVISION_2; 805 rssp->hdr.rev = NDIS_RECEIVE_SCALE_PARAMETERS_REVISION_2;
806 rssp->hdr.size = sizeof(struct ndis_recv_scale_param); 806 rssp->hdr.size = sizeof(struct ndis_recv_scale_param);
807 rssp->flag = 0; 807 rssp->flag = flag;
808 rssp->hashinfo = NDIS_HASH_FUNC_TOEPLITZ | NDIS_HASH_IPV4 | 808 rssp->hashinfo = NDIS_HASH_FUNC_TOEPLITZ | NDIS_HASH_IPV4 |
809 NDIS_HASH_TCP_IPV4 | NDIS_HASH_IPV6 | 809 NDIS_HASH_TCP_IPV4 | NDIS_HASH_IPV6 |
810 NDIS_HASH_TCP_IPV6; 810 NDIS_HASH_TCP_IPV6;
@@ -829,9 +829,12 @@ int rndis_filter_set_rss_param(struct rndis_device *rdev,
829 829
830 wait_for_completion(&request->wait_event); 830 wait_for_completion(&request->wait_event);
831 set_complete = &request->response_msg.msg.set_complete; 831 set_complete = &request->response_msg.msg.set_complete;
832 if (set_complete->status == RNDIS_STATUS_SUCCESS) 832 if (set_complete->status == RNDIS_STATUS_SUCCESS) {
833 memcpy(rdev->rss_key, rss_key, NETVSC_HASH_KEYLEN); 833 if (!(flag & NDIS_RSS_PARAM_FLAG_DISABLE_RSS) &&
834 else { 834 !(flag & NDIS_RSS_PARAM_FLAG_HASH_KEY_UNCHANGED))
835 memcpy(rdev->rss_key, rss_key, NETVSC_HASH_KEYLEN);
836
837 } else {
835 netdev_err(ndev, "Fail to set RSS parameters:0x%x\n", 838 netdev_err(ndev, "Fail to set RSS parameters:0x%x\n",
836 set_complete->status); 839 set_complete->status);
837 ret = -EINVAL; 840 ret = -EINVAL;
@@ -842,6 +845,16 @@ cleanup:
842 return ret; 845 return ret;
843} 846}
844 847
848int rndis_filter_set_rss_param(struct rndis_device *rdev,
849 const u8 *rss_key)
850{
851 /* Disable RSS before change */
852 rndis_set_rss_param_msg(rdev, rss_key,
853 NDIS_RSS_PARAM_FLAG_DISABLE_RSS);
854
855 return rndis_set_rss_param_msg(rdev, rss_key, 0);
856}
857
845static int rndis_filter_query_device_link_status(struct rndis_device *dev, 858static int rndis_filter_query_device_link_status(struct rndis_device *dev,
846 struct netvsc_device *net_device) 859 struct netvsc_device *net_device)
847{ 860{