* [PATCH net-next] net: ethtool: Fix set RXNFC call on drivers with no RXFH support
@ 2024-01-03 19:16 Gal Pressman
2024-01-03 21:39 ` Jakub Kicinski
0 siblings, 1 reply; 3+ messages in thread
From: Gal Pressman @ 2024-01-03 19:16 UTC (permalink / raw)
To: David S. Miller, Jakub Kicinski
Cc: netdev, Eric Dumazet, Paolo Abeni, Gal Pressman, Ahmed Zaki
Some interfaces support get/set_rxnfc but not get/set_rxfh (mlx5 IPoIB
for example).
Instead of failing the RXNFC command, do the symmetric xor sanity check
for interfaces that support get_rxfh only.
Fixes: dcd8dbf9e734 ("net: ethtool: get rid of get/set_rxfh_context functions")
Cc: Ahmed Zaki <ahmed.zaki@intel.com>
Signed-off-by: Gal Pressman <gal@nvidia.com>
---
net/ethtool/ioctl.c | 24 +++++++++++++-----------
1 file changed, 13 insertions(+), 11 deletions(-)
diff --git a/net/ethtool/ioctl.c b/net/ethtool/ioctl.c
index 86d47425038b..42d02cf3a4b3 100644
--- a/net/ethtool/ioctl.c
+++ b/net/ethtool/ioctl.c
@@ -978,27 +978,29 @@ static noinline_for_stack int ethtool_set_rxnfc(struct net_device *dev,
size_t info_size = sizeof(info);
int rc;
- if (!ops->set_rxnfc || !ops->get_rxfh)
+ if (!ops->set_rxnfc)
return -EOPNOTSUPP;
rc = ethtool_rxnfc_copy_struct(cmd, &info, &info_size, useraddr);
if (rc)
return rc;
- rc = ops->get_rxfh(dev, &rxfh);
- if (rc)
- return rc;
-
/* Sanity check: if symmetric-xor is set, then:
* 1 - no other fields besides IP src/dst and/or L4 src/dst
* 2 - If src is set, dst must also be set
*/
- if ((rxfh.input_xfrm & RXH_XFRM_SYM_XOR) &&
- ((info.data & ~(RXH_IP_SRC | RXH_IP_DST |
- RXH_L4_B_0_1 | RXH_L4_B_2_3)) ||
- (!!(info.data & RXH_IP_SRC) ^ !!(info.data & RXH_IP_DST)) ||
- (!!(info.data & RXH_L4_B_0_1) ^ !!(info.data & RXH_L4_B_2_3))))
- return -EINVAL;
+ if (ops->get_rxfh) {
+ rc = ops->get_rxfh(dev, &rxfh);
+ if (rc)
+ return rc;
+
+ if ((rxfh.input_xfrm & RXH_XFRM_SYM_XOR) &&
+ ((info.data & ~(RXH_IP_SRC | RXH_IP_DST |
+ RXH_L4_B_0_1 | RXH_L4_B_2_3)) ||
+ (!!(info.data & RXH_IP_SRC) ^ !!(info.data & RXH_IP_DST)) ||
+ (!!(info.data & RXH_L4_B_0_1) ^ !!(info.data & RXH_L4_B_2_3))))
+ return -EINVAL;
+ }
rc = ops->set_rxnfc(dev, &info);
if (rc)
--
2.40.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH net-next] net: ethtool: Fix set RXNFC call on drivers with no RXFH support
2024-01-03 19:16 [PATCH net-next] net: ethtool: Fix set RXNFC call on drivers with no RXFH support Gal Pressman
@ 2024-01-03 21:39 ` Jakub Kicinski
2024-01-04 6:51 ` Gal Pressman
0 siblings, 1 reply; 3+ messages in thread
From: Jakub Kicinski @ 2024-01-03 21:39 UTC (permalink / raw)
To: Gal Pressman
Cc: David S. Miller, netdev, Eric Dumazet, Paolo Abeni, Ahmed Zaki
On Wed, 3 Jan 2024 21:16:20 +0200 Gal Pressman wrote:
> Some interfaces support get/set_rxnfc but not get/set_rxfh (mlx5 IPoIB
> for example).
> Instead of failing the RXNFC command, do the symmetric xor sanity check
> for interfaces that support get_rxfh only.
>
> Fixes: dcd8dbf9e734 ("net: ethtool: get rid of get/set_rxfh_context functions")
> Cc: Ahmed Zaki <ahmed.zaki@intel.com>
> Signed-off-by: Gal Pressman <gal@nvidia.com>
Thanks, we got a similar patch from Gerhard, applied yesterday:
501869fecfbc ("net: ethtool: Fix symmetric-xor RSS RX flow hash check")
--
pw-bot: nap
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH net-next] net: ethtool: Fix set RXNFC call on drivers with no RXFH support
2024-01-03 21:39 ` Jakub Kicinski
@ 2024-01-04 6:51 ` Gal Pressman
0 siblings, 0 replies; 3+ messages in thread
From: Gal Pressman @ 2024-01-04 6:51 UTC (permalink / raw)
To: Jakub Kicinski
Cc: David S. Miller, netdev, Eric Dumazet, Paolo Abeni, Ahmed Zaki
On 03/01/2024 23:39, Jakub Kicinski wrote:
> On Wed, 3 Jan 2024 21:16:20 +0200 Gal Pressman wrote:
>> Some interfaces support get/set_rxnfc but not get/set_rxfh (mlx5 IPoIB
>> for example).
>> Instead of failing the RXNFC command, do the symmetric xor sanity check
>> for interfaces that support get_rxfh only.
>>
>> Fixes: dcd8dbf9e734 ("net: ethtool: get rid of get/set_rxfh_context functions")
>> Cc: Ahmed Zaki <ahmed.zaki@intel.com>
>> Signed-off-by: Gal Pressman <gal@nvidia.com>
>
> Thanks, we got a similar patch from Gerhard, applied yesterday:
> 501869fecfbc ("net: ethtool: Fix symmetric-xor RSS RX flow hash check")
Thanks, slipped under my radar, nice to see that we fixed it the same way.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-01-04 6:52 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-01-03 19:16 [PATCH net-next] net: ethtool: Fix set RXNFC call on drivers with no RXFH support Gal Pressman
2024-01-03 21:39 ` Jakub Kicinski
2024-01-04 6:51 ` Gal Pressman
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).