Commit d3e2c7ba authored by Jakub Kicinski's avatar Jakub Kicinski
Browse files

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: default avatarGal Pressman <gal@nvidia.com>
Link: https://patch.msgid.link/20250716000331.1378807-10-kuba@kernel.org


Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent c1b27f06
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -2678,6 +2678,7 @@ operations:
            - hfunc
            - indir
            - hkey
            - input-xfrm
    -
      name: rss-ntf
      doc: |
+1 −3
Original line number Diff line number Diff line
@@ -2002,6 +2002,7 @@ Request contents:
  ``ETHTOOL_A_RSS_HFUNC``              u32     RSS hash func
  ``ETHTOOL_A_RSS_INDIR``              binary  Indir table bytes
  ``ETHTOOL_A_RSS_HKEY``               binary  Hash key bytes
  ``ETHTOOL_A_RSS_INPUT_XFRM``         u32     RSS input data transformation
=====================================  ======  ==============================

``ETHTOOL_A_RSS_INDIR`` is the minimal RSS table the user expects. Kernel and
@@ -2012,9 +2013,6 @@ device needs at least 8 entries - the real table in use will end up being
of 2, so tables which size is not a power of 2 will likely be rejected.
Using table of size 0 will reset the indirection table to the default.

Note that, at present, only a subset of RSS configuration can be accomplished
over Netlink.

PLCA_GET_CFG
============

+15 −0
Original line number Diff line number Diff line
@@ -806,6 +806,21 @@ int ethtool_check_rss_ctx_busy(struct net_device *dev, u32 rss_context)
	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))
+1 −0
Original line number Diff line number Diff line
@@ -44,6 +44,7 @@ int ethtool_check_max_channel(struct net_device *dev,
			      struct ethtool_channels channels,
			      struct genl_info *info);
int ethtool_check_rss_ctx_busy(struct net_device *dev, u32 rss_context);
int ethtool_rxfh_config_is_sym(u64 rxfh);

void ethtool_ringparam_get_cfg(struct net_device *dev,
			       struct ethtool_ringparam *param,
+1 −3
Original line number Diff line number Diff line
@@ -1027,9 +1027,7 @@ static int ethtool_check_xfrm_rxfh(u32 input_xfrm, u64 rxfh)
	 */
	if ((input_xfrm != RXH_XFRM_NO_CHANGE &&
	     input_xfrm & (RXH_XFRM_SYM_XOR | RXH_XFRM_SYM_OR_XOR)) &&
	    ((rxfh & ~(RXH_IP_SRC | RXH_IP_DST | RXH_L4_B_0_1 | RXH_L4_B_2_3)) ||
	     (!!(rxfh & RXH_IP_SRC) ^ !!(rxfh & RXH_IP_DST)) ||
	     (!!(rxfh & RXH_L4_B_0_1) ^ !!(rxfh & RXH_L4_B_2_3))))
	    !ethtool_rxfh_config_is_sym(rxfh))
		return -EINVAL;

	return 0;
Loading