Skip to contentSkip to conversation

ethtool: Add LRO support

PATCH In review Auke Kok 4 participants 7 messages Aug 9, 2007 – Aug 10, 2007

Subsystems (3)
lore
Share & tools
lore

Auke Kok

author
#0 lore raw

PATCH 1/1 ethtool: Add LRO support

---

 include/linux/ethtool.h   |    8 +++++++
 include/linux/netdevice.h |    1 +
 net/core/ethtool.c        |   53 +++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 62 insertions(+), 0 deletions(-)
include/linux/ethtool.h +8 -0
index 23ccea8..a97248e 100644
@@ -272,6 +272,8 @@ u32 ethtool_op_get_tso(struct net_device *dev);
 int ethtool_op_set_tso(struct net_device *dev, u32 data);
 u32 ethtool_op_get_ufo(struct net_device *dev);
 int ethtool_op_set_ufo(struct net_device *dev, u32 data);
+u32 ethtool_op_get_lro(struct net_device *dev);
+int ethtool_op_set_lro(struct net_device *dev, u32 data);
 
 /**
  * &ethtool_ops - Alter and report network device settings
@@ -303,6 +305,8 @@ int ethtool_op_set_ufo(struct net_device *dev, u32 data);
  * set_tso: Turn TCP segmentation offload on or off
  * get_ufo: Report whether UDP fragmentation offload is enabled
  * set_ufo: Turn UDP fragmentation offload on or off
+ * get_lro: Report whether large receive offload is enabled
+ * set_lro: Turn large receive offload on or off
  * self_test: Run specified self-tests
  * get_strings: Return a set of strings that describe the requested objects 
  * phys_id: Identify the device
@@ -369,6 +373,8 @@ struct ethtool_ops {
 	void	(*complete)(struct net_device *);
 	u32     (*get_ufo)(struct net_device *);
 	int     (*set_ufo)(struct net_device *, u32);
+	u32     (*get_lro)(struct net_device *);
+	int     (*set_lro)(struct net_device *, u32);
 };
 #endif /* __KERNEL__ */
 
@@ -410,6 +416,8 @@ struct ethtool_ops {
 #define ETHTOOL_SUFO		0x00000022 /* Set UFO enable (ethtool_value) */
 #define ETHTOOL_GGSO		0x00000023 /* Get GSO enable (ethtool_value) */
 #define ETHTOOL_SGSO		0x00000024 /* Set GSO enable (ethtool_value) */
+#define ETHTOOL_GLRO		0x00000025 /* Get LRO enable (ethtool_value) */
+#define ETHTOOL_SLRO		0x00000026 /* Set LRO enable (ethtool_value) */
 
 /* compatibility with older code */
 #define SPARC_ETH_GSET		ETHTOOL_GSET
include/linux/netdevice.h +1 -0
index 4a616d7..4863ffc 100644
@@ -341,6 +341,7 @@ struct net_device
 #define NETIF_F_GSO		2048	/* Enable software GSO. */
 #define NETIF_F_LLTX		4096	/* LockLess TX */
 #define NETIF_F_MULTI_QUEUE	16384	/* Has multiple TX/RX queues */
+#define NETIF_F_LRO		32768	/* Has large receive offload */
 
 	/* Segmentation offload features */
 #define NETIF_F_GSO_SHIFT	16
net/core/ethtool.c +53 -0

86 lines not on this page · raw message

maintainer
#1 lore raw

From: Auke Kok <[email protected]>
Date: Thu, 09 Aug 2007 09:41:17 -0700

Quoted 1 line

I think this is definitely how we should handle LRO configuration instead of the ad-hoc module parameters current LRO drivers use now.

I'll put this infrastructure into net-2.6.24, it would be nice if the EHEA and myri10g folks submitted conversions.

Thanks.

#2 lore raw

Hi

Quoted 12 lines · David Miller

From: Auke Kok <[email protected]>
Date: Thu, 09 Aug 2007 09:41:17 -0700

Quoted 1 line

I think this is definitely how we should handle LRO configuration instead of the ad-hoc module parameters current LRO drivers use now.

I'll put this infrastructure into net-2.6.24, it would be nice if the EHEA and myri10g folks submitted conversions.

yes, I'll submit a patch soon

#3 lore raw
In reply to Auke Kok
Quoted 13 lines · Auke Kok

---

 include/linux/ethtool.h   |    8 +++++++
 include/linux/netdevice.h |    1 +
 net/core/ethtool.c        |   53 +++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 62 insertions(+), 0 deletions(-)
include/linux/ethtool.h +0 -0
index 23ccea8..a97248e 100644

include/linux/ethtool.h u32 ethtool_op_get_tso(struct net_device *dev); · line 276

Quoted 5 lines
include/linux/ethtool.h +2 -0
@@ -272,6 +272,8 @@ u32 ethtool_op_get_tso(struct net_device *dev);
 int ethtool_op_set_tso(struct net_device *dev, u32 data);
 u32 ethtool_op_get_ufo(struct net_device *dev);
 int ethtool_op_set_ufo(struct net_device *dev, u32 data);
+u32 ethtool_op_get_lro(struct net_device *dev);
+int ethtool_op_set_lro(struct net_device *dev, u32 data);

I'm thinking we don't need to keep adding two function pointers for each boolean choice.

I propose adding two operations:

get-flags: return 32-bit (even on 64-bit platforms) flags bitmap
set-flags: set 32-bit flags bitmap

The 32 bits shall be divided as follows:

bits 0-23: ETHTOOL_FLAG_xxx defined in linux/ethtool.h
bits 24-31: driver-specific boolean flags

The driver-specific flags are first enumerated by userland via an ETHTOOL_GSTRINGS call, using new string set ETH_SS_FLAGS. The first string returned names the first driver-private flag (bit 24). This also indicates that driver-private bit 24 is a valid flag for this driver and network interface.

The overall goal is to replace get-LRO/set-LRO operations with the setting/clearing of ETH_FLAG_LRO, and as well, provide a more-scalable ethtool interface.

I'll code this up, along with the associated generic helpers (net/core/ethtool.c), if there are no objections.

Jeff

maintainer
#4 lore raw

From: Jeff Garzik <[email protected]>
Date: Fri, 10 Aug 2007 04:42:44 -0400

Quoted 2 lines

I'll code this up, along with the associated generic helpers (net/core/ethtool.c), if there are no objections.

No objections except I would give the driver private it's own set of flags.

Otherwise the number of bits you choose is arbitrary and the potential for mistakes is definitely there is you mix the two uses.

#5 lore raw
Quoted 7 lines · David Miller

From: Jeff Garzik <[email protected]>
Date: Fri, 10 Aug 2007 04:42:44 -0400

Quoted 1 line

I'll code this up, along with the associated generic helpers (net/core/ethtool.c), if there are no objections.

No objections except I would give the driver private it's own set of flags.

Great minds think alike, I started leaning towards that as I coded up ETHTOOL_[GS]FLAGS...

Jeff

author
#6 lore raw
In reply to Jeff Garzik
Quoted 29 lines · Jeff Garzik
Quoted 13 lines · Auke Kok

---

 include/linux/ethtool.h   |    8 +++++++
 include/linux/netdevice.h |    1 +
 net/core/ethtool.c        |   53 +++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 62 insertions(+), 0 deletions(-)
include/linux/ethtool.h +0 -0
index 23ccea8..a97248e 100644

include/linux/ethtool.h u32 ethtool_op_get_tso(struct net_device *dev); · line 276

Quoted 5 lines
include/linux/ethtool.h +2 -0
@@ -272,6 +272,8 @@ u32 ethtool_op_get_tso(struct net_device *dev);
 int ethtool_op_set_tso(struct net_device *dev, u32 data);
 u32 ethtool_op_get_ufo(struct net_device *dev);
 int ethtool_op_set_ufo(struct net_device *dev, u32 data);
+u32 ethtool_op_get_lro(struct net_device *dev);
+int ethtool_op_set_lro(struct net_device *dev, u32 data);

I'm thinking we don't need to keep adding two function pointers for each boolean choice.

I propose adding two operations:

get-flags: return 32-bit (even on 64-bit platforms) flags bitmap
set-flags: set 32-bit flags bitmap

The 32 bits shall be divided as follows:

Quoted 8 lines

bits 0-23: ETHTOOL_FLAG_xxx defined in linux/ethtool.h
bits 24-31: driver-specific boolean flags

The driver-specific flags are first enumerated by userland via an ETHTOOL_GSTRINGS call, using new string set ETH_SS_FLAGS. The first string returned names the first driver-private flag (bit 24). This also indicates that driver-private bit 24 is a valid flag for this driver and network interface.

The overall goal is to replace get-LRO/set-LRO operations with the setting/clearing of ETH_FLAG_LRO, and as well, provide a more-scalable ethtool interface.

I'll code this up, along with the associated generic helpers (net/core/ethtool.c), if there are no objections.

absolutely not. While going over the flags in netdevice.h I can already see that the room for more flags is rapidly becoming smaller. Unfortunately we're stuck with the current flags for compatiblity :)

The above idea sounds good to me and should give that room.

Auke