]> www.infradead.org Git - users/jedix/linux-maple.git/commit
ethtool: Block setting of symmetric RSS when non-symmetric rx-flow-hash is requested
authorGal Pressman <gal@nvidia.com>
Thu, 8 May 2025 10:30:34 +0000 (13:30 +0300)
committerJakub Kicinski <kuba@kernel.org>
Fri, 9 May 2025 23:24:28 +0000 (16:24 -0700)
commit1b2900db0119c02e6445bb61ec3fba982d10cc8d
tree696a5da055f0a3ef2074748faa042e745b2dc134
parent179542a98730ba40aef6806c7480c85ce731e588
ethtool: Block setting of symmetric RSS when non-symmetric rx-flow-hash is requested

Symmetric RSS hash requires that:
* No other fields besides IP src/dst and/or L4 src/dst are set
* If src is set, dst must also be set

This restriction was only enforced when RXNFC was configured after
symmetric hash was enabled. In the opposite order of operations (RXNFC
then symmetric enablement) the check was not performed.

Perform the sanity check on set_rxfh as well, by iterating over all flow
types hash fields and making sure they are all symmetric.

Introduce a function that returns whether a flow type is hashable (not
spec only) and needs to be iterated over. To make sure that no one
forgets to update the list of hashable flow types when adding new flow
types, a static assert is added to draw the developer's attention.

The conversion of uapi #defines to enum is not ideal, but as Jakub
mentioned [1], we have precedent for that.

[1] https://lore.kernel.org/netdev/20250324073509.6571ade3@kernel.org/

Reviewed-by: Tariq Toukan <tariqt@nvidia.com>
Signed-off-by: Gal Pressman <gal@nvidia.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://patch.msgid.link/20250508103034.885536-1-gal@nvidia.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
include/uapi/linux/ethtool.h
net/ethtool/ioctl.c