Skip to content

Commit d797469

Browse files
committed
ethtool: mark ETHER_FLOW as usable for Rx hash
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>
1 parent f7c595c commit d797469

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

include/uapi/linux/ethtool.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2314,7 +2314,7 @@ enum {
23142314
IPV6_USER_FLOW = 0x0e, /* spec only (usr_ip6_spec; nfc only) */
23152315
IPV4_FLOW = 0x10, /* hash only */
23162316
IPV6_FLOW = 0x11, /* hash only */
2317-
ETHER_FLOW = 0x12, /* spec only (ether_spec) */
2317+
ETHER_FLOW = 0x12, /* hash or spec (ether_spec) */
23182318

23192319
/* Used for GTP-U IPv4 and IPv6.
23202320
* The format of GTP packets only includes
@@ -2371,7 +2371,7 @@ enum {
23712371
/* Flag to enable RSS spreading of traffic matching rule (nfc only) */
23722372
#define FLOW_RSS 0x20000000
23732373

2374-
/* L3-L4 network traffic flow hash options */
2374+
/* L2-L4 network traffic flow hash options */
23752375
#define RXH_L2DA (1 << 1)
23762376
#define RXH_VLAN (1 << 2)
23772377
#define RXH_L3_PROTO (1 << 3)

net/ethtool/ioctl.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -981,6 +981,7 @@ static int ethtool_rxnfc_copy_to_user(void __user *useraddr,
981981
static bool flow_type_hashable(u32 flow_type)
982982
{
983983
switch (flow_type) {
984+
case ETHER_FLOW:
984985
case TCP_V4_FLOW:
985986
case UDP_V4_FLOW:
986987
case SCTP_V4_FLOW:

0 commit comments

Comments
 (0)