Commit 7f7f3e1b authored by Jakub Kicinski's avatar Jakub Kicinski
Browse files

Merge branch 'ethtool-rss-support-rss_set-via-netlink'

Jakub Kicinski says:

====================
ethtool: rss: support RSS_SET via Netlink

Support configuring RSS settings via Netlink.
Creating and removing contexts remains for the following series.

v2: https://lore.kernel.org/20250714222729.743282-1-kuba@kernel.org
v1: https://lore.kernel.org/20250711015303.3688717-1-kuba@kernel.org
====================

Link: https://patch.msgid.link/20250716000331.1378807-1-kuba@kernel.org


Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parents 870bc1aa 00e6c61c
Loading
Loading
Loading
Loading
+37 −0
Original line number Diff line number Diff line
@@ -158,6 +158,26 @@ definitions:
      -
        name: pse-event-sw-pw-control-error
        doc: PSE faced an error managing the power control from software
  -
    name: input-xfrm
    doc: RSS hash function transformations.
    type: flags
    enum-name:
    name-prefix: rxh-xfrm-
    header: linux/ethtool.h
    entries:
      -
        name: sym-xor
        doc: >-
          XOR the corresponding source and destination fields of each specified
          protocol. Both copies of the XOR'ed fields are fed into the RSS and
          RXHASH calculation. Note that this XORing reduces the input set
          entropy and could be exploited to reduce the RSS queue spread.
      -
        name: sym-or-xor
        doc: >-
          Similar to SYM_XOR, except that one copy of the XOR'ed fields is
          replaced by an OR of the same fields.
  -
    name: rxfh-fields
    name-prefix: rxh-
@@ -1621,6 +1641,7 @@ attribute-sets:
      -
        name: input-xfrm
        type: u32
        enum: input-xfrm
      -
        name: start-context
        type: u32
@@ -2643,6 +2664,22 @@ operations:
        attributes:
          - header
          - events
    -
      name: rss-set
      doc: Set RSS params.

      attribute-set: rss

      do:
        request:
          attributes:
            - header
            - context
            - hfunc
            - indir
            - hkey
            - input-xfrm
            - flow-hash
    -
      name: rss-ntf
      doc: |
+27 −2
Original line number Diff line number Diff line
@@ -239,6 +239,7 @@ Userspace to kernel:
  ``ETHTOOL_MSG_PHY_GET``               get Ethernet PHY information
  ``ETHTOOL_MSG_TSCONFIG_GET``          get hw timestamping configuration
  ``ETHTOOL_MSG_TSCONFIG_SET``          set hw timestamping configuration
  ``ETHTOOL_MSG_RSS_SET``               set RSS settings
  ===================================== =================================

Kernel to userspace:
@@ -292,6 +293,7 @@ Kernel to userspace:
  ``ETHTOOL_MSG_TSCONFIG_GET_REPLY``       hw timestamping configuration
  ``ETHTOOL_MSG_TSCONFIG_SET_REPLY``       new hw timestamping configuration
  ``ETHTOOL_MSG_PSE_NTF``                  PSE events notification
  ``ETHTOOL_MSG_RSS_NTF``                  RSS settings notification
  ======================================== =================================

``GET`` requests are sent by userspace applications to retrieve device
@@ -1989,6 +1991,29 @@ hfunc. Current supported options are symmetric-xor and symmetric-or-xor.
ETHTOOL_A_RSS_FLOW_HASH carries per-flow type bitmask of which header
fields are included in the hash calculation.

RSS_SET
=======

Request contents:

=====================================  ======  ==============================
  ``ETHTOOL_A_RSS_HEADER``             nested  request header
  ``ETHTOOL_A_RSS_CONTEXT``            u32     context number
  ``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_FLOW_HASH``          nested  Header fields included in hash
=====================================  ======  ==============================

``ETHTOOL_A_RSS_INDIR`` is the minimal RSS table the user expects. Kernel and
the device driver may replicate the table if its smaller than smallest table
size supported by the device. For example if user requests ``[0, 1]`` but the
device needs at least 8 entries - the real table in use will end up being
``[0, 1, 0, 1, 0, 1, 0, 1]``. Most devices require the table size to be power
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.

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

@@ -2440,7 +2465,7 @@ are netlink only.
  ``ETHTOOL_GPFLAGS``                 ``ETHTOOL_MSG_PRIVFLAGS_GET``
  ``ETHTOOL_SPFLAGS``                 ``ETHTOOL_MSG_PRIVFLAGS_SET``
  ``ETHTOOL_GRXFH``                   ``ETHTOOL_MSG_RSS_GET``
  ``ETHTOOL_SRXFH``                   n/a
  ``ETHTOOL_SRXFH``                   ``ETHTOOL_MSG_RSS_SET``
  ``ETHTOOL_GGRO``                    ``ETHTOOL_MSG_FEATURES_GET``
  ``ETHTOOL_SGRO``                    ``ETHTOOL_MSG_FEATURES_SET``
  ``ETHTOOL_GRXRINGS``                n/a
@@ -2455,7 +2480,7 @@ are netlink only.
  ``ETHTOOL_GRXNTUPLE``               n/a
  ``ETHTOOL_GSSET_INFO``              ``ETHTOOL_MSG_STRSET_GET``
  ``ETHTOOL_GRXFHINDIR``              ``ETHTOOL_MSG_RSS_GET``
  ``ETHTOOL_SRXFHINDIR``              n/a
  ``ETHTOOL_SRXFHINDIR``              ``ETHTOOL_MSG_RSS_SET``
  ``ETHTOOL_GFEATURES``               ``ETHTOOL_MSG_FEATURES_GET``
  ``ETHTOOL_SFEATURES``               ``ETHTOOL_MSG_FEATURES_SET``
  ``ETHTOOL_GCHANNELS``               ``ETHTOOL_MSG_CHANNELS_GET``
+1 −0
Original line number Diff line number Diff line
@@ -840,6 +840,7 @@ enum {
	ETHTOOL_MSG_PHY_GET,
	ETHTOOL_MSG_TSCONFIG_GET,
	ETHTOOL_MSG_TSCONFIG_SET,
	ETHTOOL_MSG_RSS_SET,

	__ETHTOOL_MSG_USER_CNT,
	ETHTOOL_MSG_USER_MAX = (__ETHTOOL_MSG_USER_CNT - 1)
+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,
Loading