Skip to contentSkip to conversation

ixgbe: add LRO support

PATCH In review Jeff Kirsher 2 participants 3 messages Jun 13, 2008

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

PATCH 1/1 ixgbe: add LRO support

From: Mallikarjuna R Chilakala <[email protected]>

Support for in-kernel LRO with the ability to enable/disable via ethtool based on comments from Ben Hutchings and Randy Dunlap.

---

 drivers/net/Kconfig               |    1 
 drivers/net/ixgbe/ixgbe.h         |    9 +++
 drivers/net/ixgbe/ixgbe_ethtool.c |   11 ++++
 drivers/net/ixgbe/ixgbe_main.c    |  111 ++++++++++++++++++++++++++++++-------
 4 files changed, 111 insertions(+), 21 deletions(-)
drivers/net/Kconfig +1 -0
index af46341..f6a15ed 100644
@@ -2451,6 +2451,7 @@ config EHEA
 config IXGBE
 	tristate "Intel(R) 10GbE PCI Express adapters support"
 	depends on PCI
+	select INET_LRO
 	---help---
 	  This driver supports Intel(R) 10GbE PCI Express family of
 	  adapters.  For more information on how to identify your adapter, go
drivers/net/ixgbe/ixgbe.h +9 -0
index d981134..956914a 100644
@@ -32,6 +32,7 @@
 #include <linux/types.h>
 #include <linux/pci.h>
 #include <linux/netdevice.h>
+#include <linux/inet_lro.h>
 
 #include "ixgbe_type.h"
 #include "ixgbe_common.h"
@@ -100,6 +101,9 @@
 #define IXGBE_TX_FLAGS_VLAN_MASK	0xffff0000
 #define IXGBE_TX_FLAGS_VLAN_SHIFT	16
 
+#define IXGBE_MAX_LRO_DESCRIPTORS       8
+#define IXGBE_MAX_LRO_AGGREGATE         32
+
 /* wrapper around a pointer to a socket buffer,
  * so a DMA handle can be stored along with the buffer */
 struct ixgbe_tx_buffer {
@@ -150,6 +154,8 @@ struct ixgbe_ring {
 	/* cpu for tx queue */
 	int cpu;
 #endif
+	struct net_lro_mgr lro_mgr;
+	bool lro_used;
 	struct ixgbe_queue_stats stats;
 	u8 v_idx; /* maps directly to the index for this ring in the hardware
 		   * vector array, can also be used for finding the bit in EICR
@@ -287,6 +293,9 @@ struct ixgbe_adapter {
 
 	unsigned long state;
 	u64 tx_busy;
+	u64 lro_aggregated;
+	u64 lro_flushed;
+	u64 lro_no_desc;
 };
 
 enum ixbge_state_t {
drivers/net/ixgbe/ixgbe_ethtool.c +11 -0
index 4e46377..12990b1 100644
@@ -90,6 +90,8 @@ static struct ixgbe_stats ixgbe_gstrings_stats[] = {
 	{"rx_header_split", IXGBE_STAT(rx_hdr_split)},
 	{"alloc_rx_page_failed", IXGBE_STAT(alloc_rx_page_failed)},
 	{"alloc_rx_buff_failed", IXGBE_STAT(alloc_rx_buff_failed)},
+	{"lro_aggregated", IXGBE_STAT(lro_aggregated)},
+	{"lro_flushed", IXGBE_STAT(lro_flushed)},
 };
 
 #define IXGBE_QUEUE_STATS_LEN \
@@ -787,6 +789,7 @@ static void ixgbe_get_ethtool_stats(struct net_device *netdev,
 	int stat_count = sizeof(struct ixgbe_queue_stats) / sizeof(u64);
 	int j, k;
 	int i;
+	u64 aggregated = 0, flushed = 0, no_desc = 0;
 
 	ixgbe_update_stats(adapter);
 	for (i = 0; i < IXGBE_GLOBAL_STATS_LEN; i++) {
@@ -801,11 +804,17 @@ static void ixgbe_get_ethtool_stats(struct net_device *netdev,
 		i += k;
 	}
 	for (j = 0; j < adapter->num_rx_queues; j++) {
+		aggregated += adapter->rx_ring[j].lro_mgr.stats.aggregated;
+		flushed += adapter->rx_ring[j].lro_mgr.stats.flushed;
+		no_desc += adapter->rx_ring[j].lro_mgr.stats.no_desc;
 		queue_stat = (u64 *)&adapter->rx_ring[j].stats;
 		for (k = 0; k < stat_count; k++)
 			data[i + k] = queue_stat[k];
 		i += k;
 	}
+	adapter->lro_aggregated = aggregated;
+	adapter->lro_flushed = flushed;
+	adapter->lro_no_desc = no_desc;
 }
 
 static void ixgbe_get_strings(struct net_device *netdev, u32 stringset,
@@ -973,6 +982,8 @@ static struct ethtool_ops ixgbe_ethtool_ops = {
 	.get_ethtool_stats      = ixgbe_get_ethtool_stats,
 	.get_coalesce           = ixgbe_get_coalesce,
 	.set_coalesce           = ixgbe_set_coalesce,
+	.get_flags              = ethtool_op_get_flags,
+	.set_flags              = ethtool_op_set_flags,
 };
 
 void ixgbe_set_ethtool_ops(struct net_device *netdev)
drivers/net/ixgbe/ixgbe_main.c +90 -21

194 lines not on this page · raw message

#1 lore raw
Quoted 22 lines · On Fri, 13 Jun 2008 09:30:29 -0700 Jeff Kirsher wrote:

From: Mallikarjuna R Chilakala <[email protected]>

Support for in-kernel LRO with the ability to enable/disable via ethtool based on comments from Ben Hutchings and Randy Dunlap.

---

 drivers/net/Kconfig               |    1 
 drivers/net/ixgbe/ixgbe.h         |    9 +++
 drivers/net/ixgbe/ixgbe_ethtool.c |   11 ++++
 drivers/net/ixgbe/ixgbe_main.c    |  111 ++++++++++++++++++++++++++++++-------
 4 files changed, 111 insertions(+), 21 deletions(-)
drivers/net/Kconfig +0 -0
index af46341..f6a15ed 100644

drivers/net/Kconfig config EHEA · line 2453

Quoted 3 lines
drivers/net/Kconfig +0 -0
@@ -2451,6 +2451,7 @@ config EHEA
 config IXGBE
 	tristate "Intel(R) 10GbE PCI Express adapters support"
 	depends on PCI

+ depends on PCI && INET

drivers/net/Kconfig config EHEA · line 2454

Quoted 1 line
drivers/net/Kconfig +1 -0
+	select INET_LRO

If INET is not enabled, selecting INET_LRO still won't enable INET and build errors will result. See the other drivers that select INET_LRO...

drivers/net/Kconfig config EHEA · line 2457

Quoted 3 lines
drivers/net/Kconfig +0 -0
 	---help---
 	  This driver supports Intel(R) 10GbE PCI Express family of
 	  adapters.  For more information on how to identify your adapter, go

---
~Randy
'"Daemon' is an old piece of jargon from the UNIX operating system, where it referred to a piece of low-level utility software, a fundamental part of the operating system."

#2 lore raw
Quoted 9 lines · Randy Dunlap

+ depends on PCI && INET

Quoted 1 line

+ select INET_LRO

If INET is not enabled, selecting INET_LRO still won't enable INET and build errors will result. See the other drivers that select INET_LRO...

Thanks for the catch Randy. I have updated the patch and will send it out.

Signature · 2 lines
Cheers,
Jeff