Skip to contentSkip to conversation

lro: eHEA example how to use LRO

PATCH In review Jan-Bernd Themann 2 participants 3 messages Aug 3, 2007 – Aug 6, 2007

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

PATCH 1/1 lro: eHEA example how to use LRO

This patch shows how the generic LRO interface is used for SKB mode

---
 drivers/net/Kconfig             |    1 +
 drivers/net/ehea/ehea.h         |    9 ++++-
 drivers/net/ehea/ehea_ethtool.c |   15 +++++++
 drivers/net/ehea/ehea_main.c    |   84 +++++++++++++++++++++++++++++++++++---
 4 files changed, 101 insertions(+), 8 deletions(-)
drivers/net/Kconfig +1 -0
index f8a602c..fec4004 100644
@@ -2399,6 +2399,7 @@ config CHELSIO_T3
 config EHEA
 	tristate "eHEA Ethernet support"
 	depends on IBMEBUS
+	select INET_LRO
 	---help---
 	  This driver supports the IBM pSeries eHEA ethernet adapter.
 
drivers/net/ehea/ehea.h +8 -1
index d67f97b..70e33fe 100644
@@ -33,13 +33,14 @@
 #include <linux/ethtool.h>
 #include <linux/vmalloc.h>
 #include <linux/if_vlan.h>
+#include <linux/inet_lro.h>
 
 #include <asm/ibmebus.h>
 #include <asm/abs_addr.h>
 #include <asm/io.h>
 
 #define DRV_NAME	"ehea"
-#define DRV_VERSION	"EHEA_0073"
+#define DRV_VERSION	"EHEA_0074"
 
 /* eHEA capability flags */
 #define DLPAR_PORT_ADD_REM 1
@@ -58,6 +59,7 @@
 
 #define EHEA_SMALL_QUEUES
 #define EHEA_NUM_TX_QP 1
+#define EHEA_LRO_MAX_AGGR 64
 
 #ifdef EHEA_SMALL_QUEUES
 #define EHEA_MAX_CQE_COUNT      1023
@@ -84,6 +86,8 @@
 #define EHEA_RQ2_PKT_SIZE       1522
 #define EHEA_L_PKT_SIZE         256	/* low latency */
 
+#define MAX_LRO_DESCRIPTORS 8
+
 /* Send completion signaling */
 
 /* Protection Domain Identifier */
@@ -376,6 +380,8 @@ struct ehea_port_res {
 	u64 tx_packets;
 	u64 rx_packets;
 	u32 poll_counter;
+	struct net_lro_mgr lro_mgr;
+	struct net_lro_desc lro_desc[MAX_LRO_DESCRIPTORS];
 };
 
 
@@ -427,6 +433,7 @@ struct ehea_port {
 	u32 msg_enable;
 	u32 sig_comp_iv;
 	u32 state;
+	u32 lro_max_aggr;
 	u8 full_duplex;
 	u8 autoneg;
 	u8 num_def_qps;
drivers/net/ehea/ehea_ethtool.c +15 -0
index decec8c..29ef7a9 100644
@@ -183,6 +183,9 @@ static char ehea_ethtool_stats_keys[][ETH_GSTRING_LEN] = {
 	{"PR5 free_swqes"},
 	{"PR6 free_swqes"},
 	{"PR7 free_swqes"},
+	{"LRO aggregated"},
+	{"LRO flushed"},
+	{"LRO no_desc"},
 };
 
 static void ehea_get_strings(struct net_device *dev, u32 stringset, u8 *data)
@@ -239,6 +242,18 @@ static void ehea_get_ethtool_stats(struct net_device *dev,
 	for (k = 0; k < 8; k++)
 		data[i++] = atomic_read(&port->port_res[k].swqe_avail);
 
+	for (k = 0, tmp = 0; k < EHEA_MAX_PORT_RES; k++)
+		tmp |= port->port_res[k].lro_mgr.stats.aggregated;
+	data[i++] = tmp;
+
+	for (k = 0, tmp = 0; k < EHEA_MAX_PORT_RES; k++)
+		tmp |= port->port_res[k].lro_mgr.stats.flushed;
+	data[i++] = tmp;
+
+	for (k = 0, tmp = 0; k < EHEA_MAX_PORT_RES; k++)
+		tmp |= port->port_res[k].lro_mgr.stats.no_desc;
+	data[i++] = tmp;
+
 }
 
 const struct ethtool_ops ehea_ethtool_ops = {
drivers/net/ehea/ehea_main.c +77 -7

138 lines not on this page · raw message

Signature · 1 line
1.5.2
#1 lore raw
Quoted 15 lines · Jan-Bernd Themann

This patch shows how the generic LRO interface is used for SKB mode

---
 drivers/net/Kconfig             |    1 +
 drivers/net/ehea/ehea.h         |    9 ++++-
 drivers/net/ehea/ehea_ethtool.c |   15 +++++++
 drivers/net/ehea/ehea_main.c    |   84 +++++++++++++++++++++++++++++++++++---
 4 files changed, 101 insertions(+), 8 deletions(-)
drivers/net/Kconfig +0 -0
index f8a602c..fec4004 100644

<snip>

Quoted 1 line

+module_param(use_lro, int, 0);

Have you looked at my generic lro get/set patch that I posted this week? this adds a useless module parameter while ethtool has all the structure already to accomodate setting lro on/off.

Auke

#2 lore raw

Hi Auke,

Quoted 19 lines · Auke
Quoted 15 lines · Jan-Bernd Themann

This patch shows how the generic LRO interface is used for SKB mode

---
 drivers/net/Kconfig             |    1 +
 drivers/net/ehea/ehea.h         |    9 ++++-
 drivers/net/ehea/ehea_ethtool.c |   15 +++++++
 drivers/net/ehea/ehea_main.c    |   84 +++++++++++++++++++++++++++++++++++---
 4 files changed, 101 insertions(+), 8 deletions(-)
drivers/net/Kconfig +0 -0
index f8a602c..fec4004 100644

<snip>

Quoted 6 lines
Quoted 1 line

+module_param(use_lro, int, 0);

Have you looked at my generic lro get/set patch that I posted this week? this adds a useless module parameter while ethtool has all the structure already to accomodate setting lro on/off.

Yes, I saw your patch. Looks very good to me. I will modify our driver soon to use ethtool instead of this module parameter.

Thanks for adding this support to the ethtool interface.