From d3e2c7bab12409e87bd6b20505c19f5532a727db Mon Sep 17 00:00:00 2001 From: Jakub Kicinski Date: Tue, 15 Jul 2025 17:03:29 -0700 Subject: ethtool: rss: support setting input-xfrm via Netlink Support configuring symmetric hashing via Netlink. We have the flow field config prepared as part of SET handling, so scan it for conflicts instead of querying the driver again. Reviewed-by: Gal Pressman Link: https://patch.msgid.link/20250716000331.1378807-10-kuba@kernel.org Signed-off-by: Jakub Kicinski --- net/ethtool/common.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'net/ethtool/common.c') diff --git a/net/ethtool/common.c b/net/ethtool/common.c index 459cf25e763e..4dcb4194f3ce 100644 --- a/net/ethtool/common.c +++ b/net/ethtool/common.c @@ -806,6 +806,21 @@ out_free: return rc; } +/* Check if fields configured for flow hash are symmetric - if src is included + * so is dst and vice versa. + */ +int ethtool_rxfh_config_is_sym(u64 rxfh) +{ + bool sym; + + sym = rxfh == (rxfh & (RXH_IP_SRC | RXH_IP_DST | + RXH_L4_B_0_1 | RXH_L4_B_2_3)); + sym &= !!(rxfh & RXH_IP_SRC) == !!(rxfh & RXH_IP_DST); + sym &= !!(rxfh & RXH_L4_B_0_1) == !!(rxfh & RXH_L4_B_2_3); + + return sym; +} + int ethtool_check_ops(const struct ethtool_ops *ops) { if (WARN_ON(ops->set_coalesce && !ops->supported_coalesce_params)) -- cgit v1.2.3