Skip to content

Commit 410b0ac

Browse files
gal-pressmankuba-moo
authored andcommitted
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: 7279246 ("net: ethtool: don't mux RXFH via rxnfc callbacks") Reviewed-by: Dragos Tatulea <[email protected]> Signed-off-by: Gal Pressman <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 3047957 commit 410b0ac

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

net/ethtool/common.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -812,6 +812,8 @@ int ethtool_check_ops(const struct ethtool_ops *ops)
812812
return -EINVAL;
813813
if (WARN_ON(ops->rxfh_max_num_contexts == 1))
814814
return -EINVAL;
815+
if (WARN_ON(ops->supported_input_xfrm && !ops->get_rxfh_fields))
816+
return -EINVAL;
815817
/* NOTE: sufficiently insane drivers may swap ethtool_ops at runtime,
816818
* the fact that ops are checked at registration time does not
817819
* mean the ops attached to a netdev later on are sane.

net/ethtool/ioctl.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1041,6 +1041,9 @@ static int ethtool_check_flow_types(struct net_device *dev, u32 input_xfrm)
10411041
int err;
10421042
u32 i;
10431043

1044+
if (!input_xfrm || input_xfrm == RXH_XFRM_NO_CHANGE)
1045+
return 0;
1046+
10441047
for (i = 0; i < __FLOW_TYPE_COUNT; i++) {
10451048
struct ethtool_rxfh_fields fields = {
10461049
.flow_type = i,
@@ -1523,7 +1526,7 @@ static noinline_for_stack int ethtool_set_rxfh(struct net_device *dev,
15231526
u8 *rss_config;
15241527
int ret;
15251528

1526-
if (!ops->get_rxnfc || !ops->get_rxfh_fields || !ops->set_rxfh)
1529+
if (!ops->get_rxnfc || !ops->set_rxfh)
15271530
return -EOPNOTSUPP;
15281531

15291532
if (ops->get_rxfh_indir_size)

0 commit comments

Comments
 (0)