Skip to contentSkip to conversation

netdev: add support for Receive Side Scaling hash control

PATCH Applied Stephen Hemminger 3 participants 14 messages Mar 28, 2010 – Mar 31, 2010

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

PATCH 1/2 netdev: add support for Receive Side Scaling hash control

This adds ethtool and device feature flag to allow control of Receive Side Scaling hashing supported by many modern controllers.

---
I am working on RSS for sky2 device, but the hardware isn't fully cooperating but thought others might want to use same API.

include/linux/ethtool.h +1 -0
@@ -310,6 +310,7 @@ struct ethtool_perm_addr {
 enum ethtool_flags {
 	ETH_FLAG_LRO		= (1 << 15),	/* LRO is enabled */
 	ETH_FLAG_NTUPLE		= (1 << 27),	/* N-tuple filters enabled */
+	ETH_FLAG_RSS		= (1 << 28),	/* RSS is enabled */
 };
 
 /* The following structures are for supporting RX network flow
include/linux/netdevice.h +1 -0
@@ -785,6 +785,7 @@ struct net_device {
 #define NETIF_F_SCTP_CSUM	(1 << 25) /* SCTP checksum offload */
 #define NETIF_F_FCOE_MTU	(1 << 26) /* Supports max FCoE MTU, 2158 bytes*/
 #define NETIF_F_NTUPLE		(1 << 27) /* N-tuple filters supported */
+#define NETIF_F_RSS		(1 << 28) /* Receive Side Scaling hash */
 
 	/* Segmentation offload features */
 #define NETIF_F_GSO_SHIFT	16
net/core/ethtool.c +6 -1
@@ -121,7 +121,7 @@ int ethtool_op_set_ufo(struct net_device
  * NETIF_F_xxx values in include/linux/netdevice.h
  */
 static const u32 flags_dup_features =
-	(ETH_FLAG_LRO | ETH_FLAG_NTUPLE);
+	(ETH_FLAG_LRO | ETH_FLAG_NTUPLE | ETH_FLAG_RSS);
 
 u32 ethtool_op_get_flags(struct net_device *dev)
 {
@@ -152,6 +152,11 @@ int ethtool_op_set_flags(struct net_devi
 		features &= ~NETIF_F_NTUPLE;
 	}
 
+	if (data & ETH_FLAG_RSS)
+		features |= NETIF_F_RSS;
+	else
+		features &= ~NETIF_F_RSS;
+
 	dev->features = features;
 	return 0;
 }
#1 lore raw

PATCH 1/2 netdev: ethtool RXHASH flag

This adds ethtool and device feature flag to allow control of receive hashing offload.

---
Supersedes earlier patch, decided to call it RXHASH not RSS since we don't care about other vendors acronyms

include/linux/ethtool.h +1 -0
@@ -310,6 +310,7 @@ struct ethtool_perm_addr {
 enum ethtool_flags {
 	ETH_FLAG_LRO		= (1 << 15),	/* LRO is enabled */
 	ETH_FLAG_NTUPLE		= (1 << 27),	/* N-tuple filters enabled */
+	ETH_FLAG_RXHASH		= (1 << 28),
 };
 
 /* The following structures are for supporting RX network flow
include/linux/netdevice.h +1 -0
@@ -785,6 +785,7 @@ struct net_device {
 #define NETIF_F_SCTP_CSUM	(1 << 25) /* SCTP checksum offload */
 #define NETIF_F_FCOE_MTU	(1 << 26) /* Supports max FCoE MTU, 2158 bytes*/
 #define NETIF_F_NTUPLE		(1 << 27) /* N-tuple filters supported */
+#define NETIF_F_RXHASH		(1 << 28) /* Receive hashing offload */
 
 	/* Segmentation offload features */
 #define NETIF_F_GSO_SHIFT	16
net/core/ethtool.c +6 -1
@@ -121,7 +121,7 @@ int ethtool_op_set_ufo(struct net_device
  * NETIF_F_xxx values in include/linux/netdevice.h
  */
 static const u32 flags_dup_features =
-	(ETH_FLAG_LRO | ETH_FLAG_NTUPLE);
+	(ETH_FLAG_LRO | ETH_FLAG_NTUPLE | ETH_FLAG_RXHASH);
 
 u32 ethtool_op_get_flags(struct net_device *dev)
 {
@@ -152,6 +152,11 @@ int ethtool_op_set_flags(struct net_devi
 		features &= ~NETIF_F_NTUPLE;
 	}
 
+	if (data & ETH_FLAG_RXHASH)
+		features |= NETIF_F_RXHASH;
+	else
+		features &= ~NETIF_F_RXHASH;
+
 	dev->features = features;
 	return 0;
 }
#2 lore raw

PATCH 2/2 ethtool: RXHASH flag support

Add support for RXHASH flag in ethtool offload. Update to current net-next sanitized version of ethtool.h

---
 ethtool-copy.h |   32 +++++++++++++++++++++++++-------
 ethtool.8      |    4 ++++
 ethtool.c      |   42 +++++++++++++++++++++++++++++++++++++-----
 3 files changed, 66 insertions(+), 12 deletions(-)
ethtool-copy.h +25 -7
index 8681f5e..0cf8f33 100644
@@ -36,7 +36,7 @@ struct ethtool_cmd {
 	__u32	reserved[2];
 };
 
-static inline void ethtool_cmd_speed_set(struct ethtool_cmd *ep,
+static __inline__ void ethtool_cmd_speed_set(struct ethtool_cmd *ep,
 						__u32 speed)
 {
 
@@ -44,7 +44,7 @@ static inline void ethtool_cmd_speed_set(struct ethtool_cmd *ep,
 	ep->speed_hi = (__u16)(speed >> 16);
 }
 
-static inline __u32 ethtool_cmd_speed(struct ethtool_cmd *ep)
+static __inline__ __u32 ethtool_cmd_speed(struct ethtool_cmd *ep)
 {
 	return (ep->speed_hi << 16) | ep->speed;
 }
@@ -61,6 +61,13 @@ struct ethtool_drvinfo {
 				/* For PCI devices, use pci_name(pci_dev). */
 	char	reserved1[32];
 	char	reserved2[12];
+				/*
+				 * Some struct members below are filled in
+				 * using ops->get_sset_count().  Obtaining
+				 * this info from ethtool_drvinfo is now
+				 * deprecated; Use ETHTOOL_GSSET_INFO
+				 * instead.
+				 */
 	__u32	n_priv_flags;	/* number of flags valid in ETHTOOL_GPFLAGS */
 	__u32	n_stats;	/* number of u64's from ETHTOOL_GSTATS */
 	__u32	testinfo_len;
@@ -253,6 +260,17 @@ struct ethtool_gstrings {
 	__u8	data[0];
 };
 
+struct ethtool_sset_info {
+	__u32	cmd;		/* ETHTOOL_GSSET_INFO */
+	__u32	reserved;
+	__u64	sset_mask;	/* input: each bit selects an sset to query */
+				/* output: each bit a returned sset */
+	__u32	data[0];	/* ETH_SS_xxx count, in order, based on bits
+				   in sset_mask.  One bit implies one
+				   __u32, two bits implies two
+				   __u32's, etc. */
+};
+
 enum ethtool_test_flags {
 	ETH_TEST_FL_OFFLINE	= (1 << 0),	/* online / offline */
 	ETH_TEST_FL_FAILED	= (1 << 1),	/* test passed / failed */
@@ -292,6 +310,7 @@ struct ethtool_perm_addr {
 enum ethtool_flags {
 	ETH_FLAG_LRO		= (1 << 15),	/* LRO is enabled */
 	ETH_FLAG_NTUPLE		= (1 << 27),	/* N-tuple filters enabled */
+	ETH_FLAG_RXHASH		= (1 << 28),
 };
 
 /* The following structures are for supporting RX network flow
@@ -389,8 +408,6 @@ struct ethtool_rx_ntuple_flow_spec {
 #define ETHTOOL_RXNTUPLE_ACTION_DROP -1
 };
 
-#define ETHTOOL_MAX_NTUPLE_LIST_ENTRY 1024
-#define ETHTOOL_MAX_NTUPLE_STRING_PER_ENTRY 14
 struct ethtool_rx_ntuple {
 	__u32					cmd;
 	struct ethtool_rx_ntuple_flow_spec	fs;
@@ -408,6 +425,7 @@ struct ethtool_flash {
 	char	data[ETHTOOL_FLASH_MAX_FILENAME];
 };
 
+
 /* CMDs currently supported */
 #define ETHTOOL_GSET		0x00000001 /* Get settings. */
 #define ETHTOOL_SSET		0x00000002 /* Set settings. */
@@ -463,9 +481,9 @@ struct ethtool_flash {
 #define	ETHTOOL_SRXCLSRLINS	0x00000032 /* Insert RX classification rule */
 #define	ETHTOOL_FLASHDEV	0x00000033 /* Flash firmware to device */
 #define	ETHTOOL_RESET		0x00000034 /* Reset hardware */
-
-#define ETHTOOL_SRXNTUPLE	0x00000035 /* Add an n-tuple filter to device */
-#define ETHTOOL_GRXNTUPLE	0x00000036 /* Get n-tuple filters from device */
+#define	ETHTOOL_SRXNTUPLE	0x00000035 /* Add an n-tuple filter to device */
+#define	ETHTOOL_GRXNTUPLE	0x00000036 /* Get n-tuple filters from device */
+#define	ETHTOOL_GSSET_INFO	0x00000037 /* Get string set info */
 
 /* compatibility with older code */
 #define SPARC_ETH_GSET		ETHTOOL_GSET
ethtool.8 +4 -0
index eb6430b..a7b43d5 100644
@@ -170,6 +170,7 @@ ethtool \- Display or change ethernet card settings
 .B2 gso on off
 .B2 gro on off
 .B2 lro on off
+.B2 rxhash on off
 
 .B ethtool \-p|\-\-identify
 .I ethX
@@ -362,6 +363,9 @@ Specifies whether generic receive offload should be enabled
 .A2 lro on off
 Specifies whether large receive offload should be enabled
 .TP
+.A2 rxhash on off
+Specifies whether receive hashing offload should be enabled
+.TP
 .B \-p \-\-identify
 Initiates adapter-specific action intended to enable an operator to
 easily identify the adapter by sight.  Typically this involves
ethtool.c +37 -5

108 lines not on this page · raw message

Signature · 1 line
1.6.3.3
#3 lore raw

Re: [PATCH 2/2] ethtool: RXHASH flag support

Quoted 90 lines · Stephen Hemminger

Add support for RXHASH flag in ethtool offload. Update to current net-next sanitized version of ethtool.h

---
  ethtool-copy.h |   32 +++++++++++++++++++++++++-------
  ethtool.8      |    4 ++++
  ethtool.c      |   42 +++++++++++++++++++++++++++++++++++++-----
  3 files changed, 66 insertions(+), 12 deletions(-)
ethtool-copy.h +22 -4
index 8681f5e..0cf8f33 100644
@@ -36,7 +36,7 @@ struct ethtool_cmd {
  	__u32	reserved[2];
  };
 
-static inline void ethtool_cmd_speed_set(struct ethtool_cmd *ep,
+static __inline__ void ethtool_cmd_speed_set(struct ethtool_cmd *ep,
  						__u32 speed)
  {
 
@@ -44,7 +44,7 @@ static inline void ethtool_cmd_speed_set(struct ethtool_cmd *ep,
  	ep->speed_hi = (__u16)(speed>>  16);
  }
 
-static inline __u32 ethtool_cmd_speed(struct ethtool_cmd *ep)
+static __inline__ __u32 ethtool_cmd_speed(struct ethtool_cmd *ep)
  {
  	return (ep->speed_hi<<  16) | ep->speed;
  }
@@ -61,6 +61,13 @@ struct ethtool_drvinfo {
  				/* For PCI devices, use pci_name(pci_dev). */
  	char	reserved1[32];
  	char	reserved2[12];
+				/*
+				 * Some struct members below are filled in
+				 * using ops->get_sset_count().  Obtaining
+				 * this info from ethtool_drvinfo is now
+				 * deprecated; Use ETHTOOL_GSSET_INFO
+				 * instead.
+				 */
  	__u32	n_priv_flags;	/* number of flags valid in ETHTOOL_GPFLAGS */
  	__u32	n_stats;	/* number of u64's from ETHTOOL_GSTATS */
  	__u32	testinfo_len;
@@ -253,6 +260,17 @@ struct ethtool_gstrings {
  	__u8	data[0];
  };
 
+struct ethtool_sset_info {
+	__u32	cmd;		/* ETHTOOL_GSSET_INFO */
+	__u32	reserved;
+	__u64	sset_mask;	/* input: each bit selects an sset to query */
+				/* output: each bit a returned sset */
+	__u32	data[0];	/* ETH_SS_xxx count, in order, based on bits
+				   in sset_mask.  One bit implies one
+				   __u32, two bits implies two
+				   __u32's, etc. */
+};
+
  enum ethtool_test_flags {
  	ETH_TEST_FL_OFFLINE	= (1<<  0),	/* online / offline */
  	ETH_TEST_FL_FAILED	= (1<<  1),	/* test passed / failed */
@@ -292,6 +310,7 @@ struct ethtool_perm_addr {
  enum ethtool_flags {
  	ETH_FLAG_LRO		= (1<<  15),	/* LRO is enabled */
  	ETH_FLAG_NTUPLE		= (1<<  27),	/* N-tuple filters enabled */
+	ETH_FLAG_RXHASH		= (1<<  28),
  };
 
  /* The following structures are for supporting RX network flow
@@ -389,8 +408,6 @@ struct ethtool_rx_ntuple_flow_spec {
  #define ETHTOOL_RXNTUPLE_ACTION_DROP -1
  };
 
-#define ETHTOOL_MAX_NTUPLE_LIST_ENTRY 1024
-#define ETHTOOL_MAX_NTUPLE_STRING_PER_ENTRY 14
  struct ethtool_rx_ntuple {
  	__u32					cmd;
  	struct ethtool_rx_ntuple_flow_spec	fs;
@@ -408,6 +425,7 @@ struct ethtool_flash {
  	char	data[ETHTOOL_FLASH_MAX_FILENAME];
  };
 
+
  /* CMDs currently supported */
  #define ETHTOOL_GSET		0x00000001 /* Get settings. */
  #define ETHTOOL_SSET		0x00000002 /* Set settings. */

ethtool-copy.h struct ethtool_flash { · line 487

Quoted 10 lines
ethtool-copy.h +3 -3
@@ -463,9 +481,9 @@ struct ethtool_flash {
  #define	ETHTOOL_SRXCLSRLINS	0x00000032 /* Insert RX classification rule */
  #define	ETHTOOL_FLASHDEV	0x00000033 /* Flash firmware to device */
  #define	ETHTOOL_RESET		0x00000034 /* Reset hardware */
-
-#define ETHTOOL_SRXNTUPLE	0x00000035 /* Add an n-tuple filter to device */
-#define ETHTOOL_GRXNTUPLE	0x00000036 /* Get n-tuple filters from device */
+#define	ETHTOOL_SRXNTUPLE	0x00000035 /* Add an n-tuple filter to device */
+#define	ETHTOOL_GRXNTUPLE	0x00000036 /* Get n-tuple filters from device */
+#define	ETHTOOL_GSSET_INFO	0x00000037 /* Get string set info */
 

NAK - you broke the build. You should also know not to combine patches like this. Linux 101: separate changes, separate patches.

By blindly sync'ing the ethtool.h header, ETHTOOL_MAX_NTUPLE_LIST_ENTRY and its sibling ETHTOOL_MAX_NTUPLE_STRING_PER_ENTRY were removed, breaking the ethtool build.

Furthermore, I just pulled net-next and did my own sync, and those s/inline/__inline__/ substitutions are not present.

I went ahead and made sure everything is sync'd correctly and building correctly, in the ethtool git repo. Please resubmit a patch DIRECTLY and ONLY related to RXHASH flag support. If you decide to do any other work, that belongs in a separate patch.

Jeff

#4 lore raw

Re: [PATCH 2/2] ethtool: RXHASH flag support

Quoted 3 lines · On Tue, 30 Mar 2010 13:29:01 -0400 Jeff Garzik <[email protected]> wrote:

By blindly sync'ing the ethtool.h header, ETHTOOL_MAX_NTUPLE_LIST_ENTRY and its sibling ETHTOOL_MAX_NTUPLE_STRING_PER_ENTRY were removed, breaking the ethtool build.

In the patch I moved it to ethtool.c to have local entries.

I believe that all cloned headers should only come from the result of kernel "make install_headers". Not locally different vrsions.

#5 lore raw

Re: [PATCH 2/2] ethtool: RXHASH flag support

Quoted 11 lines · Stephen Hemminger
Quoted 3 lines · On Tue, 30 Mar 2010 13:29:01 -0400 Jeff Garzik<[email protected]> wrote:

By blindly sync'ing the ethtool.h header, ETHTOOL_MAX_NTUPLE_LIST_ENTRY and its sibling ETHTOOL_MAX_NTUPLE_STRING_PER_ENTRY were removed, breaking the ethtool build.

In the patch I moved it to ethtool.c to have local entries.

I believe that all cloned headers should only come from the result of kernel "make install_headers". Not locally different vrsions.

There is nothing locally different about ethtool-copy.h.

Jeff

#6 lore raw

Re: [PATCH 2/2] ethtool: RXHASH flag support

Quoted 8 lines · On Tue, 30 Mar 2010 13:37:13 -0400 Jeff Garzik <[email protected]> wrote:
Quoted 7 lines · Stephen Hemminger
Quoted 3 lines · On Tue, 30 Mar 2010 13:29:01 -0400 Jeff Garzik<[email protected]> wrote:

By blindly sync'ing the ethtool.h header, ETHTOOL_MAX_NTUPLE_LIST_ENTRY and its sibling ETHTOOL_MAX_NTUPLE_STRING_PER_ENTRY were removed, breaking the ethtool build.

Quoted 8 lines
Quoted 4 lines

In the patch I moved it to ethtool.c to have local entries.

I believe that all cloned headers should only come from the result of kernel "make install_headers". Not locally different vrsions.

There is nothing locally different about ethtool-copy.h.

Jeff

home/shemminger/kernel/net-next-2.6/usr/include/linux/ethtool.h renamed from ethtool-copy.h +3 -2
diff -u ethtool-copy.h ~/kernel/net-next-2.6/usr/include/linux/ethtool.h
@@ -36,7 +36,7 @@
 	__u32	reserved[2];
 };
 
-static inline void ethtool_cmd_speed_set(struct ethtool_cmd *ep,
+static __inline__ void ethtool_cmd_speed_set(struct ethtool_cmd *ep,
 						__u32 speed)
 {
 
@@ -44,7 +44,7 @@
 	ep->speed_hi = (__u16)(speed >> 16);
 }
 
-static inline __u32 ethtool_cmd_speed(struct ethtool_cmd *ep)
+static __inline__ __u32 ethtool_cmd_speed(struct ethtool_cmd *ep)
 {
 	return (ep->speed_hi << 16) | ep->speed;
 }
@@ -424,6 +424,7 @@
 	char	data[ETHTOOL_FLASH_MAX_FILENAME];
 };
 
+
 /* CMDs currently supported */
 #define ETHTOOL_GSET		0x00000001 /* Get settings. */
 #define ETHTOOL_SSET		0x00000002 /* Set settings. */
#7 lore raw

Re: [PATCH 2/2] ethtool: RXHASH flag support

home/shemminger/kernel/net-next-2.6/usr/include/linux/ethtool.h

Quoted 23 lines · Stephen Hemminger
Quoted 8 lines · On Tue, 30 Mar 2010 13:37:13 -0400 Jeff Garzik<[email protected]> wrote:
Quoted 7 lines · Stephen Hemminger
Quoted 3 lines · On Tue, 30 Mar 2010 13:29:01 -0400 Jeff Garzik<[email protected]> wrote:

By blindly sync'ing the ethtool.h header, ETHTOOL_MAX_NTUPLE_LIST_ENTRY and its sibling ETHTOOL_MAX_NTUPLE_STRING_PER_ENTRY were removed, breaking the ethtool build.

Quoted 8 lines
Quoted 4 lines

In the patch I moved it to ethtool.c to have local entries.

I believe that all cloned headers should only come from the result of kernel "make install_headers". Not locally different vrsions.

There is nothing locally different about ethtool-copy.h.

Jeff

diff -u ethtool-copy.h ~/kernel/net-next-2.6/usr/include/linux/ethtool.h

home/shemminger/kernel/net-next-2.6/usr/include/linux/ethtool.h renamed from ethtool-copy.h +0 -0

The canonical copy of ethtool-copy.h comes from the kernel tree's include/linux/ethtool.h.

Jeff

#8 lore raw

Re: [PATCH 2/2] ethtool: RXHASH flag support

Quoted 19 lines · On Tue, 30 Mar 2010 17:08:48 -0400 Jeff Garzik <[email protected]> wrote:
Quoted 18 lines · Stephen Hemminger
Quoted 15 lines · On Tue, 30 Mar 2010 13:37:13 -0400 Jeff Garzik<[email protected]> wrote:
Quoted 11 lines · Stephen Hemminger
Quoted 3 lines · On Tue, 30 Mar 2010 13:29:01 -0400 Jeff Garzik<[email protected]> wrote:

By blindly sync'ing the ethtool.h header, ETHTOOL_MAX_NTUPLE_LIST_ENTRY and its sibling ETHTOOL_MAX_NTUPLE_STRING_PER_ENTRY were removed, breaking the ethtool build.

In the patch I moved it to ethtool.c to have local entries.

I believe that all cloned headers should only come from the result of kernel "make install_headers". Not locally different vrsions.

There is nothing locally different about ethtool-copy.h.

Quoted 9 lines

home/shemminger/kernel/net-next-2.6/usr/include/linux/ethtool.h

Quoted 5 lines
Quoted 1 line

Jeff

diff -u ethtool-copy.h ~/kernel/net-next-2.6/usr/include/linux/ethtool.h

home/shemminger/kernel/net-next-2.6/usr/include/linux/ethtool.h renamed from ethtool-copy.h +0 -0

The canonical copy of ethtool-copy.h comes from the kernel tree's include/linux/ethtool.h.

The difference comes because scripts/headers_install.pl decides to change inline to __inline__. I think Kbuild is the proper place to do any exported headers cleanup, so I would rather the automated process work.

#9 lore raw

Re: [PATCH 2/2] ethtool: RXHASH flag support

Quoted 32 lines · Stephen Hemminger
Quoted 19 lines · On Tue, 30 Mar 2010 17:08:48 -0400 Jeff Garzik<[email protected]> wrote:
Quoted 18 lines · Stephen Hemminger
Quoted 15 lines · On Tue, 30 Mar 2010 13:37:13 -0400 Jeff Garzik<[email protected]> wrote:
Quoted 11 lines · Stephen Hemminger
Quoted 3 lines · On Tue, 30 Mar 2010 13:29:01 -0400 Jeff Garzik<[email protected]> wrote:

By blindly sync'ing the ethtool.h header, ETHTOOL_MAX_NTUPLE_LIST_ENTRY and its sibling ETHTOOL_MAX_NTUPLE_STRING_PER_ENTRY were removed, breaking the ethtool build.

In the patch I moved it to ethtool.c to have local entries.

I believe that all cloned headers should only come from the result of kernel "make install_headers". Not locally different vrsions.

There is nothing locally different about ethtool-copy.h.

Quoted 9 lines

home/shemminger/kernel/net-next-2.6/usr/include/linux/ethtool.h

Quoted 5 lines
Quoted 1 line

Jeff

diff -u ethtool-copy.h ~/kernel/net-next-2.6/usr/include/linux/ethtool.h

home/shemminger/kernel/net-next-2.6/usr/include/linux/ethtool.h renamed from ethtool-copy.h +0 -0

The canonical copy of ethtool-copy.h comes from the kernel tree's include/linux/ethtool.h.

Quoted 3 lines

The difference comes because scripts/headers_install.pl decides to change inline to __inline__. I think Kbuild is the proper place to do any exported headers cleanup, so I would rather the automated process work.

Either way, it's a manual process to sync up -- except that grabbing from $somewhere/usr/include/linux/ethtool.h involves more steps and is potentially more error-prone.

And regardless of any of this, none of the sync-up stuff should have been in the same patch as your RXHASH additions.

Now that ethtool.git has the latest from net-next, it's a moot point anyway.

Jeff

maintainer Applied
#11 lore raw

Re: [PATCH 1/2] netdev: ethtool RXHASH flag

In reply to Stephen Hemminger

From: Stephen Hemminger <[email protected]>
Date: Mon, 29 Mar 2010 17:47:27 -0700

Quoted 7 lines

This adds ethtool and device feature flag to allow control of receive hashing offload.

---
Supersedes earlier patch, decided to call it RXHASH not RSS since we don't care about other vendors acronyms

Ah, now I understand, ignore my other email.

Applied, thanks everyone.

#12 lore raw

PATCH 2/2 ethtool: add RSS command flag

In reply to Stephen Hemminger

Add RSS offload option to ethtool command.

Also, fix ethtool header to be pure version from net-next. ethtool-copy.h should be generated by kernel 'make install_headers' to ensure that all fields match exactly.

---
 ethtool-copy.h |   32 +++++++++++++++++++++++++-------
 ethtool.8      |    4 ++++
 ethtool.c      |   43 ++++++++++++++++++++++++++++++++++++++-----
 3 files changed, 67 insertions(+), 12 deletions(-)
ethtool-copy.h +25 -7
index 8681f5e..a20fe84 100644
@@ -36,7 +36,7 @@ struct ethtool_cmd {
 	__u32	reserved[2];
 };
 
-static inline void ethtool_cmd_speed_set(struct ethtool_cmd *ep,
+static __inline__ void ethtool_cmd_speed_set(struct ethtool_cmd *ep,
 						__u32 speed)
 {
 
@@ -44,7 +44,7 @@ static inline void ethtool_cmd_speed_set(struct ethtool_cmd *ep,
 	ep->speed_hi = (__u16)(speed >> 16);
 }
 
-static inline __u32 ethtool_cmd_speed(struct ethtool_cmd *ep)
+static __inline__ __u32 ethtool_cmd_speed(struct ethtool_cmd *ep)
 {
 	return (ep->speed_hi << 16) | ep->speed;
 }
@@ -61,6 +61,13 @@ struct ethtool_drvinfo {
 				/* For PCI devices, use pci_name(pci_dev). */
 	char	reserved1[32];
 	char	reserved2[12];
+				/*
+				 * Some struct members below are filled in
+				 * using ops->get_sset_count().  Obtaining
+				 * this info from ethtool_drvinfo is now
+				 * deprecated; Use ETHTOOL_GSSET_INFO
+				 * instead.
+				 */
 	__u32	n_priv_flags;	/* number of flags valid in ETHTOOL_GPFLAGS */
 	__u32	n_stats;	/* number of u64's from ETHTOOL_GSTATS */
 	__u32	testinfo_len;
@@ -253,6 +260,17 @@ struct ethtool_gstrings {
 	__u8	data[0];
 };
 
+struct ethtool_sset_info {
+	__u32	cmd;		/* ETHTOOL_GSSET_INFO */
+	__u32	reserved;
+	__u64	sset_mask;	/* input: each bit selects an sset to query */
+				/* output: each bit a returned sset */
+	__u32	data[0];	/* ETH_SS_xxx count, in order, based on bits
+				   in sset_mask.  One bit implies one
+				   __u32, two bits implies two
+				   __u32's, etc. */
+};
+
 enum ethtool_test_flags {
 	ETH_TEST_FL_OFFLINE	= (1 << 0),	/* online / offline */
 	ETH_TEST_FL_FAILED	= (1 << 1),	/* test passed / failed */
@@ -292,6 +310,7 @@ struct ethtool_perm_addr {
 enum ethtool_flags {
 	ETH_FLAG_LRO		= (1 << 15),	/* LRO is enabled */
 	ETH_FLAG_NTUPLE		= (1 << 27),	/* N-tuple filters enabled */
+	ETH_FLAG_RSS		= (1 << 28),
 };
 
 /* The following structures are for supporting RX network flow
@@ -389,8 +408,6 @@ struct ethtool_rx_ntuple_flow_spec {
 #define ETHTOOL_RXNTUPLE_ACTION_DROP -1
 };
 
-#define ETHTOOL_MAX_NTUPLE_LIST_ENTRY 1024
-#define ETHTOOL_MAX_NTUPLE_STRING_PER_ENTRY 14
 struct ethtool_rx_ntuple {
 	__u32					cmd;
 	struct ethtool_rx_ntuple_flow_spec	fs;
@@ -408,6 +425,7 @@ struct ethtool_flash {
 	char	data[ETHTOOL_FLASH_MAX_FILENAME];
 };
 
+
 /* CMDs currently supported */
 #define ETHTOOL_GSET		0x00000001 /* Get settings. */
 #define ETHTOOL_SSET		0x00000002 /* Set settings. */
@@ -463,9 +481,9 @@ struct ethtool_flash {
 #define	ETHTOOL_SRXCLSRLINS	0x00000032 /* Insert RX classification rule */
 #define	ETHTOOL_FLASHDEV	0x00000033 /* Flash firmware to device */
 #define	ETHTOOL_RESET		0x00000034 /* Reset hardware */
-
-#define ETHTOOL_SRXNTUPLE	0x00000035 /* Add an n-tuple filter to device */
-#define ETHTOOL_GRXNTUPLE	0x00000036 /* Get n-tuple filters from device */
+#define	ETHTOOL_SRXNTUPLE	0x00000035 /* Add an n-tuple filter to device */
+#define	ETHTOOL_GRXNTUPLE	0x00000036 /* Get n-tuple filters from device */
+#define	ETHTOOL_GSSET_INFO	0x00000037 /* Get string set info */
 
 /* compatibility with older code */
 #define SPARC_ETH_GSET		ETHTOOL_GSET
ethtool.8 +4 -0
index eb6430b..a5afe13 100644
@@ -170,6 +170,7 @@ ethtool \- Display or change ethernet card settings
 .B2 gso on off
 .B2 gro on off
 .B2 lro on off
+.B2 rss on off
 
 .B ethtool \-p|\-\-identify
 .I ethX
@@ -362,6 +363,9 @@ Specifies whether generic receive offload should be enabled
 .A2 lro on off
 Specifies whether large receive offload should be enabled
 .TP
+.A2 rss on off
+Specifies whether Receive Side Scaling hashing should be enabled
+.TP
 .B \-p \-\-identify
 Initiates adapter-specific action intended to enable an operator to
 easily identify the adapter by sight.  Typically this involves
ethtool.c +38 -5

109 lines not on this page · raw message

Signature · 1 line
1.6.3.3
maintainer
#13 lore raw
In reply to Stephen Hemminger

From: Stephen Hemminger <[email protected]>
Date: Sun, 28 Mar 2010 15:44:48 -0700

Quoted 8 lines

This adds ethtool and device feature flag to allow control of Receive Side Scaling hashing supported by many modern controllers.

---
I am working on RSS for sky2 device, but the hardware isn't fully cooperating but thought others might want to use same API.

I assume you didn't intend this to be applied because it uses the same value as you choose for RXHASH.

If you want this applied, resubmit against your RXHASH changes.

Thanks!