Skip to contentSkip to conversation

ixgbe: add LRO support

PATCH In review Jeff Kirsher 3 participants 4 messages Jun 13, 2008 – Jun 18, 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               |    3 +
 drivers/net/ixgbe/ixgbe.h         |    9 +++
 drivers/net/ixgbe/ixgbe_ethtool.c |   11 ++++
 drivers/net/ixgbe/ixgbe_main.c    |  111 ++++++++++++++++++++++++++++++-------
 4 files changed, 112 insertions(+), 22 deletions(-)
drivers/net/Kconfig +2 -1
index f4182cf..8b53255 100644
@@ -2436,7 +2436,8 @@ config EHEA
 
 config IXGBE
 	tristate "Intel(R) 10GbE PCI Express adapters support"
-	depends on PCI
+	depends on PCI && INET
+	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 21 lines · On Fri, 13 Jun 2008 11:40:16 -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               |    3 +
 drivers/net/ixgbe/ixgbe.h         |    9 +++
 drivers/net/ixgbe/ixgbe_ethtool.c |   11 ++++
 drivers/net/ixgbe/ixgbe_main.c    |  111 ++++++++++++++++++++++++++++++-------
 4 files changed, 112 insertions(+), 22 deletions(-)
drivers/net/Kconfig +0 -0
index f4182cf..8b53255 100644

drivers/net/Kconfig config EHEA · line 2443

Quoted 9 lines
drivers/net/Kconfig +2 -1
@@ -2436,7 +2436,8 @@ config EHEA
 
 config IXGBE
 	tristate "Intel(R) 10GbE PCI Express adapters support"
-	depends on PCI
+	depends on PCI && INET
+	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

Yes, thanks.

---
~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
In reply to Jeff Kirsher
Quoted 8 lines · Jeff Kirsher

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.

Quoted 7 lines

---

 drivers/net/Kconfig               |    3 +
 drivers/net/ixgbe/ixgbe.h         |    9 +++
 drivers/net/ixgbe/ixgbe_ethtool.c |   11 ++++
 drivers/net/ixgbe/ixgbe_main.c    |  111 ++++++++++++++++++++++++++++++-------
 4 files changed, 112 insertions(+), 22 deletions(-)

I take that back.

This patch has a bunch of checkpatch problems, and it doesn't even compile, so it obviously was not tested:

drivers/net/ixgbe/ixgbe_main.c: In function ‘ixgbe_receive_skb’:
drivers/net/ixgbe/ixgbe_main.c:416: error: implicit declaration of function ‘vlan_nw_accel_receive_skb’

#3 lore raw
Quoted 11 lines · Jeff Garzik

I take that back.

This patch has a bunch of checkpatch problems, and it doesn't even compile, so it obviously was not tested:

drivers/net/ixgbe/ixgbe_main.c: In function 'ixgbe_receive_skb':
drivers/net/ixgbe/ixgbe_main.c:416: error: implicit declaration of function 'vlan_nw_accel_receive_skb'

--

My apologies, in the last update, the patch got altered in my tree. I will re-send the corrected patch which has been tested.

Signature · 2 lines
Cheers,
Jeff