Skip to contentSkip to conversation

Symmetric OR-XOR RSS hash

PATCH In review Gal Pressman 2 participants 8 messages Mar 3, 2025 – Mar 30, 2025

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover Symmetric OR-XOR RSS hash

Add support for a new type of input_xfrm: Symmetric OR-XOR. Symmetric OR-XOR performs hash as follows:
(SRC_IP | DST_IP, SRC_IP ^ DST_IP, SRC_PORT | DST_PORT, SRC_PORT ^ DST_PORT)

Configuration is done through ethtool -x/X command.
Also performed some misc cleanups for things I've noticed while touching the area, see individual patches for information.

Kernel submission was merged:
https://lore.kernel.org/netdev/[email protected]/

Thanks,
Gal

Gal Pressman (6):
update UAPI header copies
Print unknown RSS hash function value when encountered Use RXH_XFRM_NO_CHANGE instead of hard-coded value Move input_xfrm outside of hfunc loop
Print unknown input_xfrm values when encountered Symmetric OR-XOR RSS hash

 ethtool.8.in                           |  14 +-
 ethtool.c                              |  20 +-
 netlink/rss.c                          |  30 +-
 uapi/linux/ethtool.h                   |  31 +
 uapi/linux/ethtool_netlink.h           | 899 +------------------------
 uapi/linux/ethtool_netlink_generated.h | 821 ++++++++++++++++++++++
 uapi/linux/if_link.h                   |  20 +
 uapi/linux/net_tstamp.h                |  11 +
 uapi/linux/rtnetlink.h                 |  22 +-
 uapi/linux/stddef.h                    |  13 +-
 uapi/linux/types.h                     |   1 +
 11 files changed, 972 insertions(+), 910 deletions(-)
 create mode 100644 uapi/linux/ethtool_netlink_generated.h
Signature · 1 line
2.40.1
#1 lore raw

PATCH 1/6 update UAPI header copies

Update to kernel commit 4d20c9f2db83.

---
 uapi/linux/ethtool.h                   |  31 +
 uapi/linux/ethtool_netlink.h           | 899 +------------------------
 uapi/linux/ethtool_netlink_generated.h | 821 ++++++++++++++++++++++
 uapi/linux/if_link.h                   |  20 +
 uapi/linux/net_tstamp.h                |  11 +
 uapi/linux/rtnetlink.h                 |  22 +-
 uapi/linux/stddef.h                    |  13 +-
 uapi/linux/types.h                     |   1 +
 8 files changed, 924 insertions(+), 894 deletions(-)
 create mode 100644 uapi/linux/ethtool_netlink_generated.h
uapi/linux/ethtool.h +31 -0
index 7022fcc5628a..506e0866cbb2 100644
@@ -679,6 +679,8 @@ enum ethtool_link_ext_substate_module {
  * @ETH_SS_STATS_ETH_MAC: names of IEEE 802.3 MAC statistics
  * @ETH_SS_STATS_ETH_CTRL: names of IEEE 802.3 MAC Control statistics
  * @ETH_SS_STATS_RMON: names of RMON statistics
+ * @ETH_SS_STATS_PHY: names of PHY(dev) statistics
+ * @ETH_SS_TS_FLAGS: hardware timestamping flags
  *
  * @ETH_SS_COUNT: number of defined string sets
  */
@@ -704,6 +706,8 @@ enum ethtool_stringset {
 	ETH_SS_STATS_ETH_MAC,
 	ETH_SS_STATS_ETH_CTRL,
 	ETH_SS_STATS_RMON,
+	ETH_SS_STATS_PHY,
+	ETH_SS_TS_FLAGS,
 
 	/* add new constants above here */
 	ETH_SS_COUNT
@@ -2053,6 +2057,24 @@ enum ethtool_link_mode_bit_indices {
 	ETHTOOL_LINK_MODE_10baseT1S_Half_BIT		 = 100,
 	ETHTOOL_LINK_MODE_10baseT1S_P2MP_Half_BIT	 = 101,
 	ETHTOOL_LINK_MODE_10baseT1BRR_Full_BIT		 = 102,
+	ETHTOOL_LINK_MODE_200000baseCR_Full_BIT		 = 103,
+	ETHTOOL_LINK_MODE_200000baseKR_Full_BIT		 = 104,
+	ETHTOOL_LINK_MODE_200000baseDR_Full_BIT		 = 105,
+	ETHTOOL_LINK_MODE_200000baseDR_2_Full_BIT	 = 106,
+	ETHTOOL_LINK_MODE_200000baseSR_Full_BIT		 = 107,
+	ETHTOOL_LINK_MODE_200000baseVR_Full_BIT		 = 108,
+	ETHTOOL_LINK_MODE_400000baseCR2_Full_BIT	 = 109,
+	ETHTOOL_LINK_MODE_400000baseKR2_Full_BIT	 = 110,
+	ETHTOOL_LINK_MODE_400000baseDR2_Full_BIT	 = 111,
+	ETHTOOL_LINK_MODE_400000baseDR2_2_Full_BIT	 = 112,
+	ETHTOOL_LINK_MODE_400000baseSR2_Full_BIT	 = 113,
+	ETHTOOL_LINK_MODE_400000baseVR2_Full_BIT	 = 114,
+	ETHTOOL_LINK_MODE_800000baseCR4_Full_BIT	 = 115,
+	ETHTOOL_LINK_MODE_800000baseKR4_Full_BIT	 = 116,
+	ETHTOOL_LINK_MODE_800000baseDR4_Full_BIT	 = 117,
+	ETHTOOL_LINK_MODE_800000baseDR4_2_Full_BIT	 = 118,
+	ETHTOOL_LINK_MODE_800000baseSR4_Full_BIT	 = 119,
+	ETHTOOL_LINK_MODE_800000baseVR4_Full_BIT	 = 120,
 
 	/* must be last entry */
 	__ETHTOOL_LINK_MODE_MASK_NBITS
@@ -2265,6 +2287,10 @@ static __inline__ int ethtool_validate_duplex(__u8 duplex)
  * be exploited to reduce the RSS queue spread.
  */
 #define	RXH_XFRM_SYM_XOR	(1 << 0)
+/* Similar to SYM_XOR, except that one copy of the XOR'ed fields is replaced by
+ * an OR of the same fields
+ */
+#define	RXH_XFRM_SYM_OR_XOR	(1 << 1)
 #define	RXH_XFRM_NO_CHANGE	0xff
 
 /* L2-L4 network traffic flow types */
@@ -2524,6 +2550,11 @@ struct ethtool_link_settings {
 	__u8	master_slave_state;
 	__u8	rate_matching;
 	__u32	reserved[7];
+	/* Linux builds with -Wflex-array-member-not-at-end but does
+	 * not use the "link_mode_masks" member. Leave it defined for
+	 * userspace for now, and when userspace wants to start using
+	 * -Wfamnae, we'll need a new solution.
+	 */
 	__u32	link_mode_masks[];
 	/* layout of link_mode_masks fields:
 	 * __u32 map_supported[link_mode_masks_nwords];
uapi/linux/ethtool_netlink.h +11 -888

947 lines not on this page · raw message

uapi/linux/ethtool_netlink_generated.h new file +821 -0

821 lines not on this page · raw message

uapi/linux/if_link.h +20 -0
index 987efeddc30e..79e97dd1fcdc 100644
@@ -377,6 +377,7 @@ enum {
 	IFLA_GSO_IPV4_MAX_SIZE,
 	IFLA_GRO_IPV4_MAX_SIZE,
 	IFLA_DPLL_PIN,
+	IFLA_MAX_PACING_OFFLOAD_HORIZON,
 	__IFLA_MAX
 };
 
@@ -1290,6 +1291,19 @@ enum netkit_mode {
 	NETKIT_L3,
 };
 
+/* NETKIT_SCRUB_NONE leaves clearing skb->{mark,priority} up to
+ * the BPF program if attached. This also means the latter can
+ * consume the two fields if they were populated earlier.
+ *
+ * NETKIT_SCRUB_DEFAULT zeroes skb->{mark,priority} fields before
+ * invoking the attached BPF program when the peer device resides
+ * in a different network namespace. This is the default behavior.
+ */
+enum netkit_scrub {
+	NETKIT_SCRUB_NONE,
+	NETKIT_SCRUB_DEFAULT,
+};
+
 enum {
 	IFLA_NETKIT_UNSPEC,
 	IFLA_NETKIT_PEER_INFO,
@@ -1297,6 +1311,10 @@ enum {
 	IFLA_NETKIT_POLICY,
 	IFLA_NETKIT_PEER_POLICY,
 	IFLA_NETKIT_MODE,
+	IFLA_NETKIT_SCRUB,
+	IFLA_NETKIT_PEER_SCRUB,
+	IFLA_NETKIT_HEADROOM,
+	IFLA_NETKIT_TAILROOM,
 	__IFLA_NETKIT_MAX,
 };
 #define IFLA_NETKIT_MAX	(__IFLA_NETKIT_MAX - 1)
@@ -1376,6 +1394,7 @@ enum {
 	IFLA_VXLAN_VNIFILTER, /* only applicable with COLLECT_METADATA mode */
 	IFLA_VXLAN_LOCALBYPASS,
 	IFLA_VXLAN_LABEL_POLICY, /* IPv6 flow label policy; ifla_vxlan_label_policy */
+	IFLA_VXLAN_RESERVED_BITS,
 	__IFLA_VXLAN_MAX
 };
 #define IFLA_VXLAN_MAX	(__IFLA_VXLAN_MAX - 1)
@@ -1940,6 +1959,7 @@ struct ifla_rmnet_flags {
 enum {
 	IFLA_MCTP_UNSPEC,
 	IFLA_MCTP_NET,
+	IFLA_MCTP_PHYS_BINDING,
 	__IFLA_MCTP_MAX,
 };
 
uapi/linux/net_tstamp.h +11 -0
index 858339d1c1c4..55b0ab51096c 100644
@@ -13,6 +13,17 @@
 #include <linux/types.h>
 #include <linux/socket.h>   /* for SO_TIMESTAMPING */
 
+/*
+ * Possible type of hwtstamp provider. Mainly "precise" the default one
+ * is for IEEE 1588 quality and "approx" is for NICs DMA point.
+ */
+enum hwtstamp_provider_qualifier {
+	HWTSTAMP_PROVIDER_QUALIFIER_PRECISE,
+	HWTSTAMP_PROVIDER_QUALIFIER_APPROX,
+
+	HWTSTAMP_PROVIDER_QUALIFIER_CNT,
+};
+
 /* SO_TIMESTAMPING flags */
 enum {
 	SOF_TIMESTAMPING_TX_HARDWARE = (1<<0),
uapi/linux/rtnetlink.h +19 -3
index 4e6c8e14cc30..085bb1397030 100644
@@ -93,10 +93,18 @@ enum {
 	RTM_NEWPREFIX	= 52,
 #define RTM_NEWPREFIX	RTM_NEWPREFIX
 
-	RTM_GETMULTICAST = 58,
+	RTM_NEWMULTICAST = 56,
+#define RTM_NEWMULTICAST RTM_NEWMULTICAST
+	RTM_DELMULTICAST,
+#define RTM_DELMULTICAST RTM_DELMULTICAST
+	RTM_GETMULTICAST,
 #define RTM_GETMULTICAST RTM_GETMULTICAST
 
-	RTM_GETANYCAST	= 62,
+	RTM_NEWANYCAST	= 60,
+#define RTM_NEWANYCAST RTM_NEWANYCAST
+	RTM_DELANYCAST,
+#define RTM_DELANYCAST RTM_DELANYCAST
+	RTM_GETANYCAST,
 #define RTM_GETANYCAST	RTM_GETANYCAST
 
 	RTM_NEWNEIGHTBL	= 64,
@@ -174,7 +182,7 @@ enum {
 #define RTM_GETLINKPROP	RTM_GETLINKPROP
 
 	RTM_NEWVLAN = 112,
-#define RTM_NEWNVLAN	RTM_NEWVLAN
+#define RTM_NEWVLAN	RTM_NEWVLAN
 	RTM_DELVLAN,
 #define RTM_DELVLAN	RTM_DELVLAN
 	RTM_GETVLAN,
@@ -299,6 +307,7 @@ enum {
 #define RTPROT_MROUTED		17	/* Multicast daemon */
 #define RTPROT_KEEPALIVED	18	/* Keepalived daemon */
 #define RTPROT_BABEL		42	/* Babel daemon */
+#define RTPROT_OVN		84	/* OVN daemon */
 #define RTPROT_OPENR		99	/* Open Routing (Open/R) Routes */
 #define RTPROT_BGP		186	/* BGP Routes */
 #define RTPROT_ISIS		187	/* ISIS Routes */
@@ -389,6 +398,7 @@ enum rtattr_type_t {
 	RTA_SPORT,
 	RTA_DPORT,
 	RTA_NH_ID,
+	RTA_FLOWLABEL,
 	__RTA_MAX
 };
 
@@ -772,6 +782,12 @@ enum rtnetlink_groups {
 #define RTNLGRP_TUNNEL		RTNLGRP_TUNNEL
 	RTNLGRP_STATS,
 #define RTNLGRP_STATS		RTNLGRP_STATS
+	RTNLGRP_IPV4_MCADDR,
+#define RTNLGRP_IPV4_MCADDR	RTNLGRP_IPV4_MCADDR
+	RTNLGRP_IPV6_MCADDR,
+#define RTNLGRP_IPV6_MCADDR	RTNLGRP_IPV6_MCADDR
+	RTNLGRP_IPV6_ACADDR,
+#define RTNLGRP_IPV6_ACADDR	RTNLGRP_IPV6_ACADDR
 	__RTNLGRP_MAX
 };
 #define RTNLGRP_MAX	(__RTNLGRP_MAX - 1)
uapi/linux/stddef.h +10 -3
index 96aa341942b0..e1416f793738 100644
@@ -8,6 +8,13 @@
 #define __always_inline __inline__
 #endif
 
+/* Not all C++ standards support type declarations inside an anonymous union */
+#ifndef __cplusplus
+#define __struct_group_tag(TAG)		TAG
+#else
+#define __struct_group_tag(TAG)
+#endif
+
 /**
  * __struct_group() - Create a mirrored named and anonyomous struct
  *
@@ -20,13 +27,13 @@
  * and size: one anonymous and one named. The former's members can be used
  * normally without sub-struct naming, and the latter can be used to
  * reason about the start, end, and size of the group of struct members.
- * The named struct can also be explicitly tagged for layer reuse, as well
- * as both having struct attributes appended.
+ * The named struct can also be explicitly tagged for layer reuse (C only),
+ * as well as both having struct attributes appended.
  */
 #define __struct_group(TAG, NAME, ATTRS, MEMBERS...) \
 	union { \
 		struct { MEMBERS } ATTRS; \
-		struct TAG { MEMBERS } ATTRS NAME; \
+		struct __struct_group_tag(TAG) { MEMBERS } ATTRS NAME; \
 	} ATTRS
 
 #ifdef __cplusplus
uapi/linux/types.h +1 -0
index e6700138c209..251874108e6a 100644
@@ -48,6 +48,7 @@ typedef __u32 __bitwise __wsum;
  * No conversions are necessary between 32-bit user-space and a 64-bit kernel.
  */
 #define __aligned_u64 __u64 __attribute__((aligned(8)))
+#define __aligned_s64 __s64 __attribute__((aligned(8)))
 #define __aligned_be64 __be64 __attribute__((aligned(8)))
 #define __aligned_le64 __le64 __attribute__((aligned(8)))
 
Signature · 1 line
2.40.1
#2 lore raw

PATCH 2/6 Print unknown RSS hash function value when encountered

In reply to Gal Pressman

It is possible for the kernel to report unknown RSS hash function, for example, when a new driver which uses a new hash function by default is used with an old userspace ethtool.

When such hash function is encountered, print its raw value so the user is at least aware that some unparsable function is used.

---
 ethtool.c     | 6 +++++-
 netlink/rss.c | 7 +++++++
 2 files changed, 12 insertions(+), 1 deletion(-)
ethtool.c +5 -1
index a1393bc14b7b..712e5b4fbceb 100644
@@ -4106,10 +4106,14 @@ static int do_grxfh(struct cmd_context *ctx)
 		return 1;
 	}
 
-	for (i = 0; i < hfuncs->len; i++)
+	for (i = 0; i < hfuncs->len; i++) {
 		printf("    %s: %s\n",
 		       (const char *)hfuncs->data + i * ETH_GSTRING_LEN,
 		       (rss->hfunc & (1 << i)) ? "on" : "off");
+		rss->hfunc &= ~(1 << i);
+	}
+	if (rss->hfunc)
+		printf("    Unknown hash function: 0x%x\n", rss->hfunc);
 
 	printf("RSS input transformation:\n");
 	printf("    symmetric-xor: %s\n",
netlink/rss.c +7 -0
index 0ee8a0dbaaa2..7a8c4e5e7379 100644
@@ -56,6 +56,9 @@ void dump_json_rss_info(struct cmd_context *ctx, u32 *indir_table,
 				break;
 			}
 		}
+
+		if (i == get_count(hash_funcs))
+			print_uint(PRINT_JSON, "rss-hash-function-raw", NULL, hfunc);
 	}
 
 	close_json_object();
@@ -163,7 +166,11 @@ int rss_reply_cb(const struct nlmsghdr *nlhdr, void *data)
 		for (unsigned int i = 0; i < get_count(hash_funcs); i++) {
 			printf("    %s: %s\n", get_string(hash_funcs, i),
 			       (rss_hfunc & (1 << i)) ? "on" : "off");
+			rss_hfunc &= ~(1 << i);
 		}
+		if (rss_hfunc)
+			printf("    Unknown hash function: 0x%x\n", rss_hfunc);
+
 		printf("RSS input transformation:\n");
 		printf("    symmetric-xor: %s\n",
 		       (input_xfrm & RXH_XFRM_SYM_XOR) ? "on" : "off");
Signature · 1 line
2.40.1
#3 lore raw

PATCH 3/6 Use RXH_XFRM_NO_CHANGE instead of hard-coded value

In reply to Gal Pressman

The default value for 'req_input_xfrm' should not assume that NO_CHANGE is 0xff, use the macro instead.

---
 ethtool.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
ethtool.c +1 -1
index 712e5b4fbceb..1c58dbf1c379 100644
@@ -4236,7 +4236,7 @@ static int do_srxfh(struct cmd_context *ctx)
 	u32 arg_num = 0, indir_bytes = 0;
 	u32 req_hfunc = 0;
 	u32 entry_size = sizeof(rss_head.rss_config[0]);
-	u32 req_input_xfrm = 0xff;
+	u32 req_input_xfrm = RXH_XFRM_NO_CHANGE;
 	u32 num_weights = 0;
 	u32 rss_context = 0;
 	int delete = 0;
Signature · 1 line
2.40.1
#4 lore raw

PATCH 4/6 Move input_xfrm outside of hfunc loop

In reply to Gal Pressman

When dumping RSS info JSON, the input_xfrm has nothing to do with the hash function, move it outside the for loop.

---
 netlink/rss.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
netlink/rss.c +6 -6
index 7a8c4e5e7379..0207931a5771 100644
@@ -47,12 +47,6 @@ void dump_json_rss_info(struct cmd_context *ctx, u32 *indir_table,
 			if (hfunc & (1 << i)) {
 				print_string(PRINT_JSON, "rss-hash-function",
 					     NULL, get_string(hash_funcs, i));
-				open_json_object("rss-input-transformation");
-				print_bool(PRINT_JSON, "symmetric-xor", NULL,
-					   (input_xfrm & RXH_XFRM_SYM_XOR) ?
-					   true : false);
-
-				close_json_object();
 				break;
 			}
 		}
@@ -61,6 +55,12 @@ void dump_json_rss_info(struct cmd_context *ctx, u32 *indir_table,
 			print_uint(PRINT_JSON, "rss-hash-function-raw", NULL, hfunc);
 	}
 
+	open_json_object("rss-input-transformation");
+	print_bool(PRINT_JSON, "symmetric-xor", NULL,
+		   (input_xfrm & RXH_XFRM_SYM_XOR) ? true : false);
+
+	close_json_object();
+
 	close_json_object();
 }
 
Signature · 1 line
2.40.1
#5 lore raw

PATCH 5/6 Print unknown input_xfrm values when encountered

In reply to Gal Pressman

It is possible for the kernel to report unknown input_xfrm values, e.g. when a new driver which enables a new transformation by default is used with an old userspace ethtool.

When such values are encountered, print the raw values so the user is at least aware that some unparsable transformations are enabled.

---
 ethtool.c     | 5 +++++
 netlink/rss.c | 6 ++++++
 2 files changed, 11 insertions(+)
ethtool.c +5 -0
index 1c58dbf1c379..f679f253d490 100644
@@ -4118,6 +4118,11 @@ static int do_grxfh(struct cmd_context *ctx)
 	printf("RSS input transformation:\n");
 	printf("    symmetric-xor: %s\n",
 	       (rss->input_xfrm & RXH_XFRM_SYM_XOR) ? "on" : "off");
+	rss->input_xfrm &= ~RXH_XFRM_SYM_XOR;
+
+	if (rss->input_xfrm)
+		printf("    Unknown bits in RSS input transformation: 0x%x\n",
+		       rss->input_xfrm);
 
 out:
 	free(hfuncs);
netlink/rss.c +6 -0
index 0207931a5771..9ce56c2c687d 100644
@@ -58,6 +58,8 @@ void dump_json_rss_info(struct cmd_context *ctx, u32 *indir_table,
 	open_json_object("rss-input-transformation");
 	print_bool(PRINT_JSON, "symmetric-xor", NULL,
 		   (input_xfrm & RXH_XFRM_SYM_XOR) ? true : false);
+	if (input_xfrm & ~RXH_XFRM_SYM_XOR)
+		print_uint(PRINT_JSON, "raw", NULL, input_xfrm);
 
 	close_json_object();
 
@@ -174,6 +176,10 @@ int rss_reply_cb(const struct nlmsghdr *nlhdr, void *data)
 		printf("RSS input transformation:\n");
 		printf("    symmetric-xor: %s\n",
 		       (input_xfrm & RXH_XFRM_SYM_XOR) ? "on" : "off");
+		input_xfrm &= ~RXH_XFRM_SYM_XOR;
+
+		if (input_xfrm)
+			printf("    Unknown bits in RSS input transformation: 0x%x\n", input_xfrm);
 	}
 
 	return MNL_CB_OK;
Signature · 1 line
2.40.1
#6 lore raw

PATCH 6/6 Symmetric OR-XOR RSS hash

In reply to Gal Pressman

Add an additional type of symmetric RSS hash type: OR-XOR. The "Symmetric-OR-XOR" algorithm transforms the input as follows:

(SRC_IP | DST_IP, SRC_IP ^ DST_IP, SRC_PORT | DST_PORT, SRC_PORT ^ DST_PORT)

Symmetric OR-XOR can be used through:
ethtool -X eth2 xfrm symmetric-or-xor

---
 ethtool.8.in  | 14 +++++++-------
 ethtool.c     |  7 ++++++-
 netlink/rss.c |  7 ++++++-
 3 files changed, 19 insertions(+), 9 deletions(-)
ethtool.8.in +7 -7
index 9e272f7056a8..ffee0fe5a3b5 100644
@@ -358,7 +358,7 @@ ethtool \- query or control network driver and hardware settings
 .RB ...\ | \ default \ ]
 .RB [ hfunc
 .IR FUNC ]
-.B2 xfrm symmetric-xor none
+.B3 xfrm symmetric-xor symmetric-or-xor none
 .RB [ context
 .I CTX
 .RB |\  new ]
@@ -1253,15 +1253,15 @@ List of RSS hash functions which kernel supports is shown as a part of the --sho
 .TP
 .BI xfrm
 Sets the RSS input transformation. Currently, only the
-.B symmetric-xor
-transformation is supported where the NIC XORs the L3 and/or L4 source and
-destination fields (as selected by
+.B symmetric-xor and symmetric-or-xor
+transformations are supported where the NIC XORs/ORs the L3 and/or L4 source
+and destination fields (as selected by
 .B --config-nfc rx-flow-hash
 ) before passing them to the hash algorithm. The RSS hash function will
 then yield the same hash for the other flow direction where the source and
-destination fields are swapped (i.e. Symmetric RSS). Note that XORing the
-input parameters reduces the entropy of the input set and the hash algorithm
-could potentially be exploited. Switch off (default) by
+destination fields are swapped (i.e. Symmetric RSS). Note that this operation
+reduces the entropy of the input set and the hash algorithm could potentially
+be exploited. Switch off (default) by
 .B xfrm none.
 .TP
 .BI start\  N
ethtool.c +6 -1
index f679f253d490..2df99eefecde 100644
@@ -4119,6 +4119,9 @@ static int do_grxfh(struct cmd_context *ctx)
 	printf("    symmetric-xor: %s\n",
 	       (rss->input_xfrm & RXH_XFRM_SYM_XOR) ? "on" : "off");
 	rss->input_xfrm &= ~RXH_XFRM_SYM_XOR;
+	printf("    symmetric-or-xor: %s\n",
+	       (rss->input_xfrm & RXH_XFRM_SYM_OR_XOR) ? "on" : "off");
+	rss->input_xfrm &= ~RXH_XFRM_SYM_OR_XOR;
 
 	if (rss->input_xfrm)
 		printf("    Unknown bits in RSS input transformation: 0x%x\n",
@@ -4291,6 +4294,8 @@ static int do_srxfh(struct cmd_context *ctx)
 				exit_bad_args();
 			if (!strcmp(ctx->argp[arg_num], "symmetric-xor"))
 				req_input_xfrm = RXH_XFRM_SYM_XOR;
+			else if (!strcmp(ctx->argp[arg_num], "symmetric-or-xor"))
+				req_input_xfrm = RXH_XFRM_SYM_OR_XOR;
 			else if (!strcmp(ctx->argp[arg_num], "none"))
 				req_input_xfrm = 0;
 			else
@@ -6001,7 +6006,7 @@ static const struct option args[] = {
 			  "		[ equal N | weight W0 W1 ... | default ]\n"
 			  "		[ hkey %x:%x:%x:%x:%x:.... ]\n"
 			  "		[ hfunc FUNC ]\n"
-			  "		[ xfrm symmetric-xor|none ]\n"
+			  "		[ xfrm symmetric-xor | symmetric-or-xor | none ]\n"
 			  "		[ delete ]\n"
 	},
 	{
netlink/rss.c +6 -1
index 9ce56c2c687d..83cc50416dc7 100644
@@ -58,7 +58,9 @@ void dump_json_rss_info(struct cmd_context *ctx, u32 *indir_table,
 	open_json_object("rss-input-transformation");
 	print_bool(PRINT_JSON, "symmetric-xor", NULL,
 		   (input_xfrm & RXH_XFRM_SYM_XOR) ? true : false);
-	if (input_xfrm & ~RXH_XFRM_SYM_XOR)
+	print_bool(PRINT_JSON, "symmetric-or-xor", NULL,
+		   (input_xfrm & RXH_XFRM_SYM_OR_XOR) ? true : false);
+	if (input_xfrm & ~(RXH_XFRM_SYM_XOR | RXH_XFRM_SYM_OR_XOR))
 		print_uint(PRINT_JSON, "raw", NULL, input_xfrm);
 
 	close_json_object();
@@ -177,6 +179,9 @@ int rss_reply_cb(const struct nlmsghdr *nlhdr, void *data)
 		printf("    symmetric-xor: %s\n",
 		       (input_xfrm & RXH_XFRM_SYM_XOR) ? "on" : "off");
 		input_xfrm &= ~RXH_XFRM_SYM_XOR;
+		printf("    symmetric-or-xor: %s\n",
+		       (input_xfrm & RXH_XFRM_SYM_OR_XOR) ? "on" : "off");
+		input_xfrm &= ~RXH_XFRM_SYM_OR_XOR;
 
 		if (input_xfrm)
 			printf("    Unknown bits in RSS input transformation: 0x%x\n", input_xfrm);
Signature · 1 line
2.40.1
#7 lore raw
In reply to Gal Pressman
Quoted 14 lines · Gal Pressman

Add support for a new type of input_xfrm: Symmetric OR-XOR. Symmetric OR-XOR performs hash as follows:
(SRC_IP | DST_IP, SRC_IP ^ DST_IP, SRC_PORT | DST_PORT, SRC_PORT ^ DST_PORT)

Configuration is done through ethtool -x/X command.
Also performed some misc cleanups for things I've noticed while touching the area, see individual patches for information.

Kernel submission was merged:
https://lore.kernel.org/netdev/[email protected]/

Thanks,
Gal

Quoted 7 lines

Gal Pressman (6):
update UAPI header copies
Print unknown RSS hash function value when encountered Use RXH_XFRM_NO_CHANGE instead of hard-coded value Move input_xfrm outside of hfunc loop
Print unknown input_xfrm values when encountered Symmetric OR-XOR RSS hash

Hello,

I applied patches 2-5 to master (they do not depend on anything not present in kernel 6.14) and 1 and 6 to next (to be merged after 6.14 release of ethtool).

Michal