Skip to contentSkip to conversation

Add support for rx flow hash configuration in a network device - [ethtool]

PATCH Applied Santwona Behera 2 participants 2 messages Jun 28, 2008 – Sep 14, 2008

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

PATCH 1/3 Add support for rx flow hash configuration in a network device - [ethtool]

From: Santwona Behera <[email protected]>

Added new interfaces to ethtool to configure receive network flow distribution across multiple rx rings using hashing.

Patch is against ethtool version 6.

---
 ethtool-copy.h |   33 +++++++
 ethtool.8      |   80 ++++++++++++++++++
 ethtool.c      |  254 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 367 insertions(+), 0 deletions(-)
ethtool-copy.h +33 -0
index 3a63224..e2a72f1 100644
@@ -256,6 +256,12 @@ struct ethtool_perm_addr {
 	__u8	data[0];
 };
 
+struct ethtool_rxnfc {
+	__u32		cmd;
+	__u32		flow_type;
+	__u64		data;
+};
+
 #ifdef __KERNEL__
 
 struct net_device;
@@ -373,6 +379,8 @@ struct ethtool_ops {
 	void	(*complete)(struct net_device *);
 	u32     (*get_ufo)(struct net_device *);
 	int     (*set_ufo)(struct net_device *, u32);
+	int	(*get_rxhash)(struct net_device *, struct ethtool_rxnfc *);
+	int	(*set_rxhash)(struct net_device *, struct ethtool_rxnfc *);
 };
 #endif /* __KERNEL__ */
 
@@ -415,6 +423,9 @@ struct ethtool_ops {
 #define ETHTOOL_GGSO		0x00000023 /* Get GSO enable (ethtool_value) */
 #define ETHTOOL_SGSO		0x00000024 /* Set GSO enable (ethtool_value) */
 
+#define	ETHTOOL_GRXFH		0x00000029 /* Get RX flow hash configuration */
+#define	ETHTOOL_SRXFH		0x0000002a /* Set RX flow hash configuration */
+
 /* compatibility with older code */
 #define SPARC_ETH_GSET		ETHTOOL_GSET
 #define SPARC_ETH_SSET		ETHTOOL_SSET
@@ -501,4 +512,26 @@ struct ethtool_ops {
 #define WAKE_MAGIC		(1 << 5)
 #define WAKE_MAGICSECURE	(1 << 6) /* only meaningful if WAKE_MAGIC */
 
+/* L3-L4 network traffic flow types */
+#define	TCP_V4_FLOW	0x01
+#define	UDP_V4_FLOW	0x02
+#define	SCTP_V4_FLOW	0x03
+#define	AH_ESP_V4_FLOW	0x04
+#define	TCP_V6_FLOW	0x05
+#define	UDP_V6_FLOW	0x06
+#define	SCTP_V6_FLOW	0x07
+#define	AH_ESP_V6_FLOW	0x08
+
+/* L3-L4 network traffic flow hash options */
+#define	RXH_DEV_PORT		(1 << 0)
+#define	RXH_L2DA		(1 << 1)
+#define	RXH_VLAN		(1 << 2)
+#define	RXH_L3_PROTO		(1 << 3)
+#define	RXH_IP_SRC		(1 << 4)
+#define	RXH_IP_DST		(1 << 5)
+#define	RXH_L4_BYTES_0_1	(1 << 6) /* src port in case of TCP/UDP/SCTP */
+#define	RXH_L4_BYTES_2_3	(1 << 7) /* dst port in case of TCP/UDP/SCTP */
+#define	RXH_DISCARD		(1 << 31)
+
+
 #endif /* _LINUX_ETHTOOL_H */
ethtool.8 +80 -0

98 lines not on this page · raw message

ethtool.c +254 -0

320 lines not on this page · raw message

Signature · 1 line
1.5.2