[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240807132541.3460386-1-gal@nvidia.com>
Date: Wed, 7 Aug 2024 16:25:41 +0300
From: Gal Pressman <gal@...dia.com>
To: "David S. Miller" <davem@...emloft.net>, Jakub Kicinski <kuba@...nel.org>
CC: <netdev@...r.kernel.org>, Eric Dumazet <edumazet@...gle.com>, Paolo Abeni
<pabeni@...hat.com>, Gal Pressman <gal@...dia.com>, Dragos Tatulea
<dtatulea@...dia.com>, Jianbo Liu <jianbol@...dia.com>
Subject: [PATCH net] ethtool: Fix context creation with no parameters
The 'at least one change' requirement is not applicable for context
creation, skip the check in such case.
This allows a command such as 'ethtool -X eth0 context new' to work.
The command works by mistake when using older versions of userspace
ethtool due to an incompatibility issue where rxfh.input_xfrm is passed
as zero (unset) instead of RXH_XFRM_NO_CHANGE as done with recent
userspace. This patch does not try to solve the incompatibility issue.
Link: https://lore.kernel.org/netdev/05ae8316-d3aa-4356-98c6-55ed4253c8a7@nvidia.com/
Fixes: 84a1d9c48200 ("net: ethtool: extend RXNFC API to support RSS spreading of filter matches")
Reviewed-by: Dragos Tatulea <dtatulea@...dia.com>
Reviewed-by: Jianbo Liu <jianbol@...dia.com>
Signed-off-by: Gal Pressman <gal@...dia.com>
---
net/ethtool/ioctl.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/net/ethtool/ioctl.c b/net/ethtool/ioctl.c
index 8ca13208d240..2fdbdcfa1506 100644
--- a/net/ethtool/ioctl.c
+++ b/net/ethtool/ioctl.c
@@ -1372,14 +1372,15 @@ static noinline_for_stack int ethtool_set_rxfh(struct net_device *dev,
/* If either indir, hash key or function is valid, proceed further.
* Must request at least one change: indir size, hash key, function
* or input transformation.
+ * There's no need for any of it in case of context creation.
*/
- if ((rxfh.indir_size &&
+ if (!create && ((rxfh.indir_size &&
rxfh.indir_size != ETH_RXFH_INDIR_NO_CHANGE &&
rxfh.indir_size != dev_indir_size) ||
(rxfh.key_size && (rxfh.key_size != dev_key_size)) ||
(rxfh.indir_size == ETH_RXFH_INDIR_NO_CHANGE &&
rxfh.key_size == 0 && rxfh.hfunc == ETH_RSS_HASH_NO_CHANGE &&
- rxfh.input_xfrm == RXH_XFRM_NO_CHANGE))
+ rxfh.input_xfrm == RXH_XFRM_NO_CHANGE)))
return -EINVAL;
indir_bytes = dev_indir_size * sizeof(rxfh_dev.indir[0]);
--
2.40.1
Powered by blists - more mailing lists