Commit b4a10c75 authored by Haiyang Zhang's avatar Haiyang Zhang Committed by Sasha Levin

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: ff4a4419 ("netvsc: allow get/set of RSS indirection table")
Reported-by: default avatarWei Hu <weh@microsoft.com>
Signed-off-by: default avatarHaiyang Zhang <haiyangz@microsoft.com>
Reviewed-by: default avatarMichael Kelley <mikelley@microsoft.com>
[sl: fix up subject line]
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent bfeffd15
...@@ -774,8 +774,8 @@ rndis_filter_set_offload_params(struct net_device *ndev, ...@@ -774,8 +774,8 @@ rndis_filter_set_offload_params(struct net_device *ndev,
return ret; return ret;
} }
int rndis_filter_set_rss_param(struct rndis_device *rdev, static int rndis_set_rss_param_msg(struct rndis_device *rdev,
const u8 *rss_key) const u8 *rss_key, u16 flag)
{ {
struct net_device *ndev = rdev->ndev; struct net_device *ndev = rdev->ndev;
struct rndis_request *request; struct rndis_request *request;
...@@ -804,7 +804,7 @@ int rndis_filter_set_rss_param(struct rndis_device *rdev, ...@@ -804,7 +804,7 @@ int rndis_filter_set_rss_param(struct rndis_device *rdev,
rssp->hdr.type = NDIS_OBJECT_TYPE_RSS_PARAMETERS; rssp->hdr.type = NDIS_OBJECT_TYPE_RSS_PARAMETERS;
rssp->hdr.rev = NDIS_RECEIVE_SCALE_PARAMETERS_REVISION_2; rssp->hdr.rev = NDIS_RECEIVE_SCALE_PARAMETERS_REVISION_2;
rssp->hdr.size = sizeof(struct ndis_recv_scale_param); rssp->hdr.size = sizeof(struct ndis_recv_scale_param);
rssp->flag = 0; rssp->flag = flag;
rssp->hashinfo = NDIS_HASH_FUNC_TOEPLITZ | NDIS_HASH_IPV4 | rssp->hashinfo = NDIS_HASH_FUNC_TOEPLITZ | NDIS_HASH_IPV4 |
NDIS_HASH_TCP_IPV4 | NDIS_HASH_IPV6 | NDIS_HASH_TCP_IPV4 | NDIS_HASH_IPV6 |
NDIS_HASH_TCP_IPV6; NDIS_HASH_TCP_IPV6;
...@@ -829,9 +829,12 @@ int rndis_filter_set_rss_param(struct rndis_device *rdev, ...@@ -829,9 +829,12 @@ int rndis_filter_set_rss_param(struct rndis_device *rdev,
wait_for_completion(&request->wait_event); wait_for_completion(&request->wait_event);
set_complete = &request->response_msg.msg.set_complete; set_complete = &request->response_msg.msg.set_complete;
if (set_complete->status == RNDIS_STATUS_SUCCESS) 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); memcpy(rdev->rss_key, rss_key, NETVSC_HASH_KEYLEN);
else {
} else {
netdev_err(ndev, "Fail to set RSS parameters:0x%x\n", netdev_err(ndev, "Fail to set RSS parameters:0x%x\n",
set_complete->status); set_complete->status);
ret = -EINVAL; ret = -EINVAL;
...@@ -842,6 +845,16 @@ int rndis_filter_set_rss_param(struct rndis_device *rdev, ...@@ -842,6 +845,16 @@ int rndis_filter_set_rss_param(struct rndis_device *rdev,
return ret; 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, static int rndis_filter_query_device_link_status(struct rndis_device *dev,
struct netvsc_device *net_device) struct netvsc_device *net_device)
{ {
......
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