net: ethtool: Fix RSS setting
Subsystems (3)
PATCH 1/1 net: ethtool: Fix RSS setting
From: Saeed Mahameed <[email protected]>
When user submits a rxfh set command without touching XFRM_SYM_XOR, rxfh.input_xfrm is set to RXH_XFRM_NO_CHANGE, which is equal to 0xff.
Testing if (rxfh.input_xfrm & RXH_XFRM_SYM_XOR &&
!ops->cap_rss_sym_xor_supported) return -EOPNOTSUPP;
Will always be true on devices that don't set cap_rss_sym_xor_supported, since rxfh.input_xfrm & RXH_XFRM_SYM_XOR is always true, if input_xfrm was not set, i.e RXH_XFRM_NO_CHANGE=0xff, which will result in failure of any command that doesn't require any change of XFRM, e.g RSS context or hash function changes.
To avoid this breakage, test if rxfh.input_xfrm != RXH_XFRM_NO_CHANGE before testing other conditions.
--- net/ethtool/ioctl.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
net/ethtool/ioctl.c +2 -1
@@ -1306,7 +1306,8 @@ static noinline_for_stack int ethtool_set_rxfh(struct net_device *dev,if (rxfh.input_xfrm && rxfh.input_xfrm !=RXH_XFRM_SYM_XOR && rxfh.input_xfrm !=RXH_XFRM_NO_CHANGE )return -EINVAL ; -if ((rxfh.input_xfrm &RXH_XFRM_SYM_XOR ) && +if (rxfh.input_xfrm !=RXH_XFRM_NO_CHANGE && + (rxfh.input_xfrm &RXH_XFRM_SYM_XOR ) && !ops->cap_rss_sym_xor_supported)return -EOPNOTSUPP ;
Signature · 1 line
2.45.2
Quoted 32 lines · Saeed Mahameed
From: Saeed Mahameed <[email protected]>
When user submits a rxfh set command without touching
XFRM_SYM_XOR, rxfh.input_xfrm is set toRXH_XFRM_NO_CHANGE, which is equal to0xff.Testing if (rxfh.input_xfrm &
RXH_XFRM_SYM_XOR&&!ops->cap_rss_sym_xor_supported) return -EOPNOTSUPP;Will always be true on devices that don't set
cap_rss_sym_xor_supported, since rxfh.input_xfrm &RXH_XFRM_SYM_XORis always true, ifinput_xfrmwas not set, i.e RXH_XFRM_NO_CHANGE=0xff, which will result in failure of any command that doesn't require any change of XFRM, e.g RSS context or hash function changes.To avoid this breakage, test if rxfh.input_xfrm !=
RXH_XFRM_NO_CHANGEbefore testing other conditions.Fixes 13e59344fb9d ("net: ethtool: add support for symmetric-xor RSS hash")CC Ahmed Zaki <[email protected]>CC David Wei <[email protected]>,CC Pavel Begunkov <[email protected]>Signed-off-by Saeed Mahameed <[email protected]>--- net/ethtool/ioctl.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)net/ethtool/ioctl.c +0
-0
net/ethtool/ioctl.c static noinline_for_stack int ethtool_set_rxfh(struct net_device *dev, · line 1313
Quoted 9 lines
net/ethtool/ioctl.c +2
-1@@ -1306,7 +1306,8 @@ static noinline_for_stack int ethtool_set_rxfh(struct net_device *dev,if (rxfh.input_xfrm && rxfh.input_xfrm !=RXH_XFRM_SYM_XOR && rxfh.input_xfrm !=RXH_XFRM_NO_CHANGE )return -EINVAL ; -if ((rxfh.input_xfrm &RXH_XFRM_SYM_XOR ) && +if (rxfh.input_xfrm !=RXH_XFRM_NO_CHANGE && + (rxfh.input_xfrm &RXH_XFRM_SYM_XOR ) && !ops->cap_rss_sym_xor_supported)return -EOPNOTSUPP ;
LGTM, thank you for catching this.
Jakub Kicinski
maintainerQuoted 1 line · On Wed, 10 Jul 2024 15:55:38 -0700 Saeed Mahameed wrote:
Fixes 13e59344fb9d ("net: ethtool: add support for symmetric-xor RSS hash")
I think :
will swap when applying.
This patch was applied to netdev/net.git (main) by Jakub Kicinski <[email protected]>:
Hello:
This patch was applied to netdev/net.git (main)
by Jakub Kicinski <[email protected]>:
Quoted 10 lines · On Wed, 10 Jul 2024 15:55:38 -0700 you wrote:
From: Saeed Mahameed <[email protected]>
When user submits a rxfh set command without touching
XFRM_SYM_XOR, rxfh.input_xfrm is set toRXH_XFRM_NO_CHANGE, which is equal to0xff.Testing if (rxfh.input_xfrm &
RXH_XFRM_SYM_XOR&&!ops->cap_rss_sym_xor_supported) return -EOPNOTSUPP;[...]
Here is the summary with links:
- [net] net: ethtool: Fix RSS setting
https://git.kernel.org/netdev/net/c/503757c80928
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html