Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

ethtool: Don't check for RXFH fields conflict when no input_xfrm is requested

The requirement of ->get_rxfh_fields() in ethtool_set_rxfh() is there to
verify that we have no conflict of input_xfrm with the RSS fields
options, there is no point in doing it if input_xfrm is not
supported/requested.

This is under the assumption that a driver that supports input_xfrm will
also support ->get_rxfh_fields(), so add a WARN_ON() to
ethtool_check_ops() to verify it, and remove the op NULL check.

This fixes the following error in mlx4_en, which doesn't support
getting/setting RXFH fields.
$ ethtool --set-rxfh-indir eth2 hfunc xor
Cannot set RX flow hash configuration: Operation not supported

Fixes: 72792461c8e8 ("net: ethtool: don't mux RXFH via rxnfc callbacks")
Reviewed-by: Dragos Tatulea <dtatulea@nvidia.com>
Signed-off-by: Gal Pressman <gal@nvidia.com>
Link: https://patch.msgid.link/20250715140754.489677-1-gal@nvidia.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Gal Pressman and committed by
Jakub Kicinski
410b0ace 3047957c

+6 -1
+2
net/ethtool/common.c
··· 812 812 return -EINVAL; 813 813 if (WARN_ON(ops->rxfh_max_num_contexts == 1)) 814 814 return -EINVAL; 815 + if (WARN_ON(ops->supported_input_xfrm && !ops->get_rxfh_fields)) 816 + return -EINVAL; 815 817 /* NOTE: sufficiently insane drivers may swap ethtool_ops at runtime, 816 818 * the fact that ops are checked at registration time does not 817 819 * mean the ops attached to a netdev later on are sane.
+4 -1
net/ethtool/ioctl.c
··· 1041 1041 int err; 1042 1042 u32 i; 1043 1043 1044 + if (!input_xfrm || input_xfrm == RXH_XFRM_NO_CHANGE) 1045 + return 0; 1046 + 1044 1047 for (i = 0; i < __FLOW_TYPE_COUNT; i++) { 1045 1048 struct ethtool_rxfh_fields fields = { 1046 1049 .flow_type = i, ··· 1526 1523 u8 *rss_config; 1527 1524 int ret; 1528 1525 1529 - if (!ops->get_rxnfc || !ops->get_rxfh_fields || !ops->set_rxfh) 1526 + if (!ops->get_rxnfc || !ops->set_rxfh) 1530 1527 return -EOPNOTSUPP; 1531 1528 1532 1529 if (ops->get_rxfh_indir_size)