Skip to contentSkip to conversation

e1000: allow ethtool coalesece to adjust interrupts per second

PATCH In review Jeff Kirsher 2 participants 4 messages Jul 6, 2009 – Jul 7, 2009

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

PATCH 1/3 e1000: allow ethtool coalesece to adjust interrupts per second

From: Jesse Brandeburg <[email protected]>

This patch allows on-the-fly adjustment of the interrupts per second generated by e1000 devices 82545/82546 (hardware support of ITR register is a requirement)

adjust using this command:
ethtool -C eth0 rx-usecs 10

where 10 is 10 microseconds per interrupt interval, so 10 = 100,000 interrupts per second, and 125 = 8000 interrupts per second.

changes should be immediate.

1,3 are special values and indicate the automatic tuning mode to the driver, where 1 is 4000-90000 interrupts per second and 3 is 4000-20000 interrupts per second and is the driver default.

---

 drivers/net/e1000/e1000.h         |    3 ++
 drivers/net/e1000/e1000_ethtool.c |   51 ++++++++++++++++++++++++++++++++++++-
 2 files changed, 53 insertions(+), 1 deletions(-)
drivers/net/e1000/e1000.h +3 -0
index e9a416f..c87f2cb 100644
@@ -111,6 +111,9 @@ do {									\
 #define E1000_MIN_RXD                       80
 #define E1000_MAX_82544_RXD               4096
 
+#define E1000_MIN_ITR_USECS		10 /* 100000 irq/sec */
+#define E1000_MAX_ITR_USECS		10000 /* 100    irq/sec */
+
 /* this is the size past which hardware will drop packets when setting LPE=0 */
 #define MAXIMUM_ETHERNET_VLAN_SIZE 1522
 
drivers/net/e1000/e1000_ethtool.c +50 -1

63 lines not on this page · raw message

#1 lore raw

PATCH 2/3 e1000: implement jumbo receive with partial descriptors

From: Jesse Brandeburg <[email protected]>

This is code extremely similar to what is committed in e1000e already.

e1000 will no longer request 32kB slab buffers to support jumbo frames on PCI/PCI-X adapters. This will significantly reduce the likelyhood of order:3 allocation failures.

This new code adds support for using pages as receive buffers, and the driver will chain multiple pages together to build a jumbo frame for OS consumption.

The hardware takes a power of two buffer size and will dump as much data as it can receive into 1 or more buffers.

The benefits of applying this are
1) stop akpm's dissing :-) of this lame e1000 behavior [1]
2) more efficient memory allocation (half) when using jumbo frames, which will also allow for much better socket utilization with jumbos since the socket is charged for the full allocation of each receive buffer, regardless of how much is used.
3) this was a feature request by a customer
4) copybreak for small packets < 256 bytes still applies

[1] http://lkml.org/lkml/2008/7/10/68

    http://article.gmane.org/gmane.linux.network/130986

---

 drivers/net/e1000/e1000.h      |    4 
 drivers/net/e1000/e1000_main.c |  425 +++++++++++++++++++++++++++++++++++++---
 2 files changed, 391 insertions(+), 38 deletions(-)
drivers/net/e1000/e1000.h +3 -1
index c87f2cb..1a4f89c 100644
@@ -140,7 +140,7 @@ do {									\
 #define E1000_FC_HIGH_DIFF 0x1638  /* High: 5688 bytes below Rx FIFO size */
 #define E1000_FC_LOW_DIFF 0x1640   /* Low:  5696 bytes below Rx FIFO size */
 
-#define E1000_FC_PAUSE_TIME 0x0680 /* 858 usec */
+#define E1000_FC_PAUSE_TIME 0xFFFF /* pause for the max or until send xon */
 
 /* How many Tx Descriptors do we need to call netif_wake_queue ? */
 #define E1000_TX_QUEUE_WAKE	16
@@ -164,6 +164,7 @@ do {									\
 struct e1000_buffer {
 	struct sk_buff *skb;
 	dma_addr_t dma;
+	struct page *page;
 	unsigned long time_stamp;
 	u16 length;
 	u16 next_to_watch;
@@ -205,6 +206,7 @@ struct e1000_rx_ring {
 	unsigned int next_to_clean;
 	/* array of buffer information structs */
 	struct e1000_buffer *buffer_info;
+	struct sk_buff *rx_skb_top;
 
 	/* cpu for rx queue */
 	int cpu;
drivers/net/e1000/e1000_main.c +388 -37

547 lines not on this page · raw message

#2 lore raw

PATCH 3/3 e1000: fix flow control thresholds

In reply to Jeff Kirsher

From: Jesse Brandeburg <[email protected]>

when testing the jumbo frames with pages patch, the stats would show rx_missed errors (dropped packets) even when connected to a link partner with flow control enabled.

this indicates that for this MTU (9000) the flow control thresholds are not adjusting correctly.

In fact, before this change, the FCRTH (xoff threshold) is 36864 when the fifo size is only 40000, with 9000 byte MTU.

fix it so that we at least have room for one frame after we send the xoff.

---

 drivers/net/e1000/e1000_hw.c   |    2 +
 drivers/net/e1000/e1000_hw.h   |    3 --
 drivers/net/e1000/e1000_main.c |   58 ++++++++++++++++++++++------------------
 3 files changed, 33 insertions(+), 30 deletions(-)
drivers/net/e1000/e1000_hw.c +1 -1
index e1a3fc1..1e5ae11 100644
@@ -1955,7 +1955,7 @@ static s32 e1000_setup_copper_link(struct e1000_hw *hw)
     s32 ret_val;
     u16 i;
     u16 phy_data;
-    u16 reg_data;
+    u16 reg_data = 0;
 
     DEBUGFUNC("e1000_setup_copper_link");
 
drivers/net/e1000/e1000_hw.h +0 -3
index 99fce2c..a8866bd 100644
@@ -523,11 +523,8 @@ s32 e1000_check_phy_reset_block(struct e1000_hw *hw);
 
 /* The sizes (in bytes) of a ethernet packet */
 #define ENET_HEADER_SIZE             14
-#define MAXIMUM_ETHERNET_FRAME_SIZE  1518 /* With FCS */
 #define MINIMUM_ETHERNET_FRAME_SIZE  64   /* With FCS */
 #define ETHERNET_FCS_SIZE            4
-#define MAXIMUM_ETHERNET_PACKET_SIZE \
-    (MAXIMUM_ETHERNET_FRAME_SIZE - ETHERNET_FCS_SIZE)
 #define MINIMUM_ETHERNET_PACKET_SIZE \
     (MINIMUM_ETHERNET_FRAME_SIZE - ETHERNET_FCS_SIZE)
 #define CRC_LENGTH                   ETHERNET_FCS_SIZE
drivers/net/e1000/e1000_main.c +32 -26

114 lines not on this page · raw message