ethtool: rss: report which fields are configured for hashing

Implement ETHTOOL_GRXFH over Netlink. The number of flow types is
reasonable (around 20) so report all of them at once for simplicity.

Do not maintain the flow ID mapping with ioctl at the uAPI level.
This gives us a chance to clean up the confusion that come from
RxNFC vs RxFH (flow direction vs hashing) in the ioctl.
Try to align with the names used in ethtool CLI, they seem to have
stood the test of time just fine. One annoyance is that we still
call L4 ports the weird names, but I guess they also apply to IPSec
(where they cover the SPI) so it is what it is.

 $ ynl --family ethtool --dump rss-get
 {
    "header": {
	"dev-index": 1,
	"dev-name": "enp1s0"
    },
    "hfunc": 1,
    "hkey": b"...",
    "indir": [0, 1, ...],
    "flow-hash": {
        "ether": {"l2da"},
	"ah-esp4": {"ip-src", "ip-dst"},
        "ah-esp6": {"ip-src", "ip-dst"},
        "ah4": {"ip-src", "ip-dst"},
        "ah6": {"ip-src", "ip-dst"},
        "esp4": {"ip-src", "ip-dst"},
        "esp6": {"ip-src", "ip-dst"},
        "ip4": {"ip-src", "ip-dst"},
        "ip6": {"ip-src", "ip-dst"},
        "sctp4": {"ip-src", "ip-dst"},
        "sctp6": {"ip-src", "ip-dst"},
        "udp4": {"ip-src", "ip-dst"},
        "udp6": {"ip-src", "ip-dst"}
        "tcp4": {"l4-b-0-1", "l4-b-2-3", "ip-src", "ip-dst"},
        "tcp6": {"l4-b-0-1", "l4-b-2-3", "ip-src", "ip-dst"},
    },
 }

Link: https://patch.msgid.link/20250708220640.2738464-5-kuba@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
Jakub Kicinski
2025-07-10 17:57:49 -07:00
parent d7974697de
commit 178331743c
5 changed files with 291 additions and 14 deletions
@@ -678,6 +678,39 @@ enum {
ETHTOOL_A_PSE_MAX = (__ETHTOOL_A_PSE_CNT - 1)
};
enum {
ETHTOOL_A_FLOW_ETHER = 1,
ETHTOOL_A_FLOW_IP4,
ETHTOOL_A_FLOW_IP6,
ETHTOOL_A_FLOW_TCP4,
ETHTOOL_A_FLOW_TCP6,
ETHTOOL_A_FLOW_UDP4,
ETHTOOL_A_FLOW_UDP6,
ETHTOOL_A_FLOW_SCTP4,
ETHTOOL_A_FLOW_SCTP6,
ETHTOOL_A_FLOW_AH4,
ETHTOOL_A_FLOW_AH6,
ETHTOOL_A_FLOW_ESP4,
ETHTOOL_A_FLOW_ESP6,
ETHTOOL_A_FLOW_AH_ESP4,
ETHTOOL_A_FLOW_AH_ESP6,
ETHTOOL_A_FLOW_GTPU4,
ETHTOOL_A_FLOW_GTPU6,
ETHTOOL_A_FLOW_GTPC4,
ETHTOOL_A_FLOW_GTPC6,
ETHTOOL_A_FLOW_GTPC_TEID4,
ETHTOOL_A_FLOW_GTPC_TEID6,
ETHTOOL_A_FLOW_GTPU_EH4,
ETHTOOL_A_FLOW_GTPU_EH6,
ETHTOOL_A_FLOW_GTPU_UL4,
ETHTOOL_A_FLOW_GTPU_UL6,
ETHTOOL_A_FLOW_GTPU_DL4,
ETHTOOL_A_FLOW_GTPU_DL6,
__ETHTOOL_A_FLOW_CNT,
ETHTOOL_A_FLOW_MAX = (__ETHTOOL_A_FLOW_CNT - 1)
};
enum {
ETHTOOL_A_RSS_UNSPEC,
ETHTOOL_A_RSS_HEADER,
@@ -687,6 +720,7 @@ enum {
ETHTOOL_A_RSS_HKEY,
ETHTOOL_A_RSS_INPUT_XFRM,
ETHTOOL_A_RSS_START_CONTEXT,
ETHTOOL_A_RSS_FLOW_HASH,
__ETHTOOL_A_RSS_CNT,
ETHTOOL_A_RSS_MAX = (__ETHTOOL_A_RSS_CNT - 1)