Skip to contentSkip to conversation

ehea: add the correct LRO status at dev->features

PATCH In review [email protected] 4 participants 8 messages Dec 6, 2010

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

PATCH 1/1 ehea: add the correct LRO status at dev->features

Currently ehea is not setting NETIF_F_LRO, and it is not providing a callback for get_flags on ethtool. This patch fixes it.

---
 drivers/net/ehea/ehea_ethtool.c |    1 +
 drivers/net/ehea/ehea_main.c    |    3 +++
 2 files changed, 4 insertions(+), 0 deletions(-)
drivers/net/ehea/ehea_ethtool.c +1 -0
index 75b099c..b0892b0 100644
@@ -273,6 +273,7 @@ const struct ethtool_ops ehea_ethtool_ops = {
 	.get_ethtool_stats = ehea_get_ethtool_stats,
 	.get_rx_csum = ehea_get_rx_csum,
 	.set_settings = ehea_set_settings,
+	.get_flags = ethtool_op_get_flags,
 	.nway_reset = ehea_nway_reset,		/* Restart autonegotiation */
 };
 
drivers/net/ehea/ehea_main.c +3 -0
index a84c389..da75846 100644
@@ -3266,6 +3266,9 @@ struct ehea_port *ehea_setup_single_port(struct ehea_adapter *adapter,
 		      | NETIF_F_LLTX;
 	dev->watchdog_timeo = EHEA_WATCH_DOG_TIMEOUT;
 
+	if (use_lro)
+		dev->features |= NETIF_F_LRO;
+
 	INIT_WORK(&port->reset_task, ehea_reset_port);
 
 	ret = register_netdev(dev);
Signature · 1 line
1.7.3.2
#1 lore raw
Quoted 4 lines · On Mon, 6 Dec 2010 14:39:42 -0200 [email protected] wrote:

Currently ehea is not setting NETIF_F_LRO, and it is not providing a callback for get_flags on ethtool. This patch fixes it.

More importantly, ehea does not support set_flags to disable LRO.

I will be more blunt. Any device that supports LRO and does not have the necessary interface to disable it is broken and should not be used.

#2 lore raw
Quoted 9 lines · Stephen Hemminger
Quoted 4 lines · On Mon, 6 Dec 2010 14:39:42 -0200 [email protected] wrote:

Currently ehea is not setting NETIF_F_LRO, and it is not providing a callback for get_flags on ethtool. This patch fixes it.

More importantly, ehea does not support set_flags to disable LRO.

Correct, currently LRO is a module parameter. I have an item in my TODO list to implement set_flags, and thus, the LRO scheme.

So, if you prefer I can send this patch with the future set_flags ones. But, for now, this patch allows the user to check when LRO is enabled. As it is today, it shows that LRO is disabled all the time.

Anyway, you choose what is the best option.

Thanks,
Breno

#3 lore raw

RFC 1/1 mark devices with broken LRO implementation

The kernel uses dev_disable_lro to disable Large Receive Offload for cases where it is inappropriate. But several drivers do not implement the required hook. This is a "penalty box" patch to encourage those drivers to add support for the necessary ethtool set_flags.

---
I only found three drivers that are broken. Normally, I would just fix them; but since changing state in the device is hardware specific, and I don't have the hardware or specs to do anything useful to fix it.

drivers/net/Kconfig +10 -3
@@ -28,6 +28,13 @@ menuconfig NETDEVICES
 # that for each of the symbols.
 if NETDEVICES
 
+config BROKEN_LRO
+       bool
+       ---help---
+         Allow drivers with partial Large Receive Offload support. These drivers
+	 do not implement the necessary feature of disabling LRO support via
+	 the ethtool set_flags operation.
+
 config IFB
 	tristate "Intermediate Functional Block support"
 	depends on NET_CLS_ACT
@@ -2675,7 +2682,7 @@ config CHELSIO_T4VF
 
 config EHEA
 	tristate "eHEA Ethernet support"
-	depends on IBMEBUS && INET && SPARSEMEM
+	depends on IBMEBUS && INET && SPARSEMEM && BROKEN_LRO
 	select INET_LRO
 	---help---
 	  This driver supports the IBM pSeries eHEA ethernet adapter.
@@ -2848,7 +2855,7 @@ config NIU
 
 config PASEMI_MAC
 	tristate "PA Semi 1/10Gbit MAC"
-	depends on PPC_PASEMI && PCI && INET
+	depends on PPC_PASEMI && PCI && INET && BROKEN_LRO
 	select PHYLIB
 	select INET_LRO
 	help
@@ -2857,7 +2864,7 @@ config PASEMI_MAC
 
 config MLX4_EN
 	tristate "Mellanox Technologies 10Gbit Ethernet support"
-	depends on PCI && INET
+	depends on PCI && INET && BROKEN_LRO
 	select MLX4_CORE
 	select INET_LRO
 	help
Acked-by on v1 1/1
#4 lore raw

Re: [RFC] mark devices with broken LRO implementation

Quoted 6 lines · Stephen Hemminger

The kernel uses dev_disable_lro to disable Large Receive Offload for cases where it is inappropriate. But several drivers do not implement the required hook. This is a "penalty box" patch to encourage those drivers to add support for the necessary ethtool set_flags.

pasemi_mac:

Quoted 3 lines

I only found three drivers that are broken. Normally, I would just fix them; but since changing state in the device is hardware specific, and I don't have the hardware or specs to do anything useful to fix it.

Thanks. All my hardware is currently in storage due to my relocation, but I'll take a look at it when I have something to run on back. :-)

-Olof

maintainer
#5 lore raw

Re: [RFC] mark devices with broken LRO implementation

From: Olof Johansson <[email protected]>
Date: Mon, 6 Dec 2010 11:18:16 -0600

Quoted 10 lines · Stephen Hemminger
Quoted 6 lines

The kernel uses dev_disable_lro to disable Large Receive Offload for cases where it is inappropriate. But several drivers do not implement the required hook. This is a "penalty box" patch to encourage those drivers to add support for the necessary ethtool set_flags.

pasemi_mac:

Quoted 8 lines
Quoted 3 lines

I only found three drivers that are broken. Normally, I would just fix them; but since changing state in the device is hardware specific, and I don't have the hardware or specs to do anything useful to fix it.

Thanks. All my hardware is currently in storage due to my relocation, but I'll take a look at it when I have something to run on back. :-)

I don't think we can do what this patch does.

It serves no purpose, as it just means the user is going to have an extra headache to turn their driver on.

And %99 of them won't see it, the distribution folks will.

So this is all for nothing.

Better to just work on fixing the problem in the few drivers for which the issue exists.

And I'm always happy to receive patches that just plain rip LRO support out of such drivers. That's a real legitimate patch unlike this one because it keeps the user able to get their driver enabled with no fuss and it removes only the improperly functioning feature.

#6 lore raw

Re: [RFC] mark devices with broken LRO implementation

Quoted 31 lines · On Mon, 06 Dec 2010 09:28:55 -0800 (PST) David Miller <[email protected]>…

From: Olof Johansson <[email protected]>
Date: Mon, 6 Dec 2010 11:18:16 -0600

Quoted 10 lines · Stephen Hemminger
Quoted 6 lines

The kernel uses dev_disable_lro to disable Large Receive Offload for cases where it is inappropriate. But several drivers do not implement the required hook. This is a "penalty box" patch to encourage those drivers to add support for the necessary ethtool set_flags.

pasemi_mac:

Quoted 8 lines
Quoted 3 lines

I only found three drivers that are broken. Normally, I would just fix them; but since changing state in the device is hardware specific, and I don't have the hardware or specs to do anything useful to fix it.

Thanks. All my hardware is currently in storage due to my relocation, but I'll take a look at it when I have something to run on back. :-)

I don't think we can do what this patch does.

It serves no purpose, as it just means the user is going to have an extra headache to turn their driver on.

And %99 of them won't see it, the distribution folks will.

So this is all for nothing.

Quoted 7 lines

Better to just work on fixing the problem in the few drivers for which the issue exists.

And I'm always happy to receive patches that just plain rip LRO support out of such drivers. That's a real legitimate patch unlike this one because it keeps the user able to get their driver enabled with no fuss and it removes only the improperly functioning feature.

I am less worried about the drivers for embedded devices, the one that surprises me the mellanox driver. But it looks like that driver doesn't really do LRO (only GRO).

Subject: mlx4: remove reference to LRO

This device does not do LRO, the current version does GRO. This patch removes unused inline and changes the configuration and comments to reflect that. Compile tested only.

---
 drivers/net/Kconfig        |    1 -
 drivers/net/mlx4/en_rx.c   |    6 +++---
 drivers/net/mlx4/mlx4_en.h |   17 -----------------
 3 files changed, 3 insertions(+), 21 deletions(-)
drivers/net/Kconfig +0 -1
@@ -2859,7 +2859,6 @@ config MLX4_EN
 	tristate "Mellanox Technologies 10Gbit Ethernet support"
 	depends on PCI && INET
 	select MLX4_CORE
-	select INET_LRO
 	help
 	  This driver supports Mellanox Technologies ConnectX Ethernet
 	  devices.
drivers/net/mlx4/en_rx.c +3 -3
@@ -584,7 +584,7 @@ int mlx4_en_process_rx_cq(struct net_dev
 			if ((cqe->status & cpu_to_be16(MLX4_CQE_STATUS_IPOK)) &&
 			    (cqe->checksum == cpu_to_be16(0xffff))) {
 				priv->port_stats.rx_chksum_good++;
-				/* This packet is eligible for LRO if it is:
+				/* This packet is eligible for GRO if it is:
 				 * - DIX Ethernet (type interpretation)
 				 * - TCP/IP (v4)
 				 * - without IP options
@@ -616,7 +616,7 @@ int mlx4_en_process_rx_cq(struct net_dev
 					goto next;
 				}
 
-				/* LRO not possible, complete processing here */
+				/* GRO not possible, complete processing here */
 				ip_summed = CHECKSUM_UNNECESSARY;
 			} else {
 				ip_summed = CHECKSUM_NONE;
@@ -657,7 +657,7 @@ next:
 		cqe = &cq->buf[index];
 		if (++polled == budget) {
 			/* We are here because we reached the NAPI budget -
-			 * flush only pending LRO sessions */
+			 * flush only pending GRO sessions */
 			goto out;
 		}
 	}
drivers/net/mlx4/mlx4_en.h +0 -17
@@ -83,8 +83,6 @@
 #define MLX4_EN_ALLOC_ORDER	2
 #define MLX4_EN_ALLOC_SIZE	(PAGE_SIZE << MLX4_EN_ALLOC_ORDER)
 
-#define MLX4_EN_MAX_LRO_DESCRIPTORS	32
-
 /* Receive fragment sizes; we use at most 4 fragments (for 9600 byte MTU
  * and 4K allocations) */
 enum {
@@ -268,21 +266,6 @@ struct mlx4_en_rx_ring {
 	unsigned long packets;
 };
 
-
-static inline int mlx4_en_can_lro(__be16 status)
-{
-	return (status & cpu_to_be16(MLX4_CQE_STATUS_IPV4	|
-				     MLX4_CQE_STATUS_IPV4F	|
-				     MLX4_CQE_STATUS_IPV6	|
-				     MLX4_CQE_STATUS_IPV4OPT	|
-				     MLX4_CQE_STATUS_TCP	|
-				     MLX4_CQE_STATUS_UDP	|
-				     MLX4_CQE_STATUS_IPOK)) ==
-		cpu_to_be16(MLX4_CQE_STATUS_IPV4 |
-			    MLX4_CQE_STATUS_IPOK |
-			    MLX4_CQE_STATUS_TCP);
-}
-
 struct mlx4_en_cq {
 	struct mlx4_cq          mcq;
 	struct mlx4_hwq_resources wqres;
maintainer
#7 lore raw
In reply to Breno Leitao

From: Breno Leitao <[email protected]>
Date: Mon, 06 Dec 2010 14:57:26 -0200

Quoted 10 lines · Stephen Hemminger
Quoted 9 lines
Quoted 4 lines · On Mon, 6 Dec 2010 14:39:42 -0200 [email protected] wrote:

Currently ehea is not setting NETIF_F_LRO, and it is not providing a callback for get_flags on ethtool. This patch fixes it.

More importantly, ehea does not support set_flags to disable LRO.

Quoted 8 lines

Correct, currently LRO is a module parameter. I have an item in my TODO list to implement set_flags, and thus, the LRO scheme.

So, if you prefer I can send this patch with the future set_flags ones. But, for now, this patch allows the user to check when LRO is enabled. As it is today, it shows that LRO is disabled all the time.

Anyway, you choose what is the best option.

Your options are: 1) send a set_flags patch now 2) rip LRO support completely out of the ehea driver.

The feature is implemented improperly, and as such we have every right to forcefully disable it or remove it until it is fixed to function correctly.