]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
ethtool: mark ETHER_FLOW as usable for Rx hash
authorJakub Kicinski <kuba@kernel.org>
Tue, 8 Jul 2025 22:06:38 +0000 (15:06 -0700)
committerJakub Kicinski <kuba@kernel.org>
Fri, 11 Jul 2025 00:57:49 +0000 (17:57 -0700)
Looks like some drivers (ena, enetc, fbnic.. there's probably more)
consider ETHER_FLOW to be legitimate target for flow hashing.
I'm not sure how intentional that is from the uAPI perspective
vs just an effect of ethtool IOCTL doing minimal input validation.
But Netlink will do strict validation, so we need to decide whether
we allow this use case or not. I don't see a strong reason against
it, and rejecting it would potentially regress a number of drivers.
So update the comments and flow_type_hashable().

Link: https://patch.msgid.link/20250708220640.2738464-4-kuba@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
include/uapi/linux/ethtool.h
net/ethtool/ioctl.c

index 707c1844010cdb77e32e92285626f73678804ab8..9e9afdd1238a975b645695c8f8876c5214cb6569 100644 (file)
@@ -2314,7 +2314,7 @@ enum {
        IPV6_USER_FLOW  = 0x0e, /* spec only (usr_ip6_spec; nfc only) */
        IPV4_FLOW       = 0x10, /* hash only */
        IPV6_FLOW       = 0x11, /* hash only */
-       ETHER_FLOW      = 0x12, /* spec only (ether_spec) */
+       ETHER_FLOW      = 0x12, /* hash or spec (ether_spec) */
 
        /* Used for GTP-U IPv4 and IPv6.
         * The format of GTP packets only includes
@@ -2371,7 +2371,7 @@ enum {
 /* Flag to enable RSS spreading of traffic matching rule (nfc only) */
 #define        FLOW_RSS        0x20000000
 
-/* L3-L4 network traffic flow hash options */
+/* L2-L4 network traffic flow hash options */
 #define        RXH_L2DA        (1 << 1)
 #define        RXH_VLAN        (1 << 2)
 #define        RXH_L3_PROTO    (1 << 3)
index 139f95620cddb552b97374cb689c3495e1c70492..67f6d900a4ee482e6e5d170892ad7138716c0d19 100644 (file)
@@ -981,6 +981,7 @@ static int ethtool_rxnfc_copy_to_user(void __user *useraddr,
 static bool flow_type_hashable(u32 flow_type)
 {
        switch (flow_type) {
+       case ETHER_FLOW:
        case TCP_V4_FLOW:
        case UDP_V4_FLOW:
        case SCTP_V4_FLOW: