Skip to contentSkip to conversation

e1000e: increase rx fifo size to 36K on 82574 and 82583

PATCH Applied Jeff Kirsher 2 participants 4 messages May 5, 2010 – May 6, 2010

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

PATCH 1/2 e1000e: increase rx fifo size to 36K on 82574 and 82583

From: Alexander Duyck <[email protected]>

This change increases the RX fifo size to 36K for standard frames and decreases the TX fifo size to 4K. The reason for this change is that on slower systems the RX is much more likely to backfill and need space than the TX is. As long as the TX fifo is twice the size of the MTU we should have more than enough TX fifo.

---

 drivers/net/e1000e/82571.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/net/e1000e/82571.c +2 -2
index 17a25e1..1e73edd 100644
@@ -1845,7 +1845,7 @@ struct e1000_info e1000_82574_info = {
 				  | FLAG_HAS_SMART_POWER_DOWN
 				  | FLAG_HAS_AMT
 				  | FLAG_HAS_CTRLEXT_ON_LOAD,
-	.pba			= 20,
+	.pba			= 36,
 	.max_hw_frame_size	= DEFAULT_JUMBO,
 	.get_variants		= e1000_get_variants_82571,
 	.mac_ops		= &e82571_mac_ops,
@@ -1862,7 +1862,7 @@ struct e1000_info e1000_82583_info = {
 				  | FLAG_HAS_SMART_POWER_DOWN
 				  | FLAG_HAS_AMT
 				  | FLAG_HAS_CTRLEXT_ON_LOAD,
-	.pba			= 20,
+	.pba			= 36,
 	.max_hw_frame_size	= ETH_FRAME_LEN + ETH_FCS_LEN,
 	.get_variants		= e1000_get_variants_82571,
 	.mac_ops		= &e82571_mac_ops,
#1 lore raw

PATCH 2/2 e1000/e1000e: implement a simple interrupt moderation

From: Jesse Brandeburg <[email protected]>

Back before e1000-7.3.20, the e1000 driver had a simple algorithm that managed interrupt moderation. The driver was updated in 7.3.20 to have the new "adaptive" interrupt moderation but we have customer requests to redeploy the old way as an option. This patch adds the old functionality back. The new functionality can be enabled via module parameter or at runtime via ethtool.
Module parameter: (InterruptThrottleRate=4) to use this new moderation method.
Ethtool method: ethtool -C ethX rx-usecs 4

---

 drivers/net/e1000/e1000_ethtool.c |    8 +++++---
 drivers/net/e1000/e1000_main.c    |   18 +++++++++++++++++-
 drivers/net/e1000/e1000_param.c   |   10 ++++++++--
 drivers/net/e1000e/ethtool.c      |    8 +++++---
 drivers/net/e1000e/netdev.c       |   18 +++++++++++++++++-
 drivers/net/e1000e/param.c        |    5 +++++
 6 files changed, 57 insertions(+), 10 deletions(-)
drivers/net/e1000/e1000_ethtool.c +5 -3
index d6931ca..2a3b2dc 100644
@@ -1808,7 +1808,7 @@ static int e1000_get_coalesce(struct net_device *netdev,
 	if (adapter->hw.mac_type < e1000_82545)
 		return -EOPNOTSUPP;
 
-	if (adapter->itr_setting <= 3)
+	if (adapter->itr_setting <= 4)
 		ec->rx_coalesce_usecs = adapter->itr_setting;
 	else
 		ec->rx_coalesce_usecs = 1000000 / adapter->itr_setting;
@@ -1826,12 +1826,14 @@ static int e1000_set_coalesce(struct net_device *netdev,
 		return -EOPNOTSUPP;
 
 	if ((ec->rx_coalesce_usecs > E1000_MAX_ITR_USECS) ||
-	    ((ec->rx_coalesce_usecs > 3) &&
+	    ((ec->rx_coalesce_usecs > 4) &&
 	     (ec->rx_coalesce_usecs < E1000_MIN_ITR_USECS)) ||
 	    (ec->rx_coalesce_usecs == 2))
 		return -EINVAL;
 
-	if (ec->rx_coalesce_usecs <= 3) {
+	if (ec->rx_coalesce_usecs == 4) {
+		adapter->itr = adapter->itr_setting = 4;
+	} else if (ec->rx_coalesce_usecs <= 3) {
 		adapter->itr = 20000;
 		adapter->itr_setting = ec->rx_coalesce_usecs;
 	} else {
drivers/net/e1000/e1000_main.c +17 -1
index e6ebc22..4dd2c23 100644
@@ -31,7 +31,7 @@
 
 char e1000_driver_name[] = "e1000";
 static char e1000_driver_string[] = "Intel(R) PRO/1000 Network Driver";
-#define DRV_VERSION "7.3.21-k5-NAPI"
+#define DRV_VERSION "7.3.21-k6-NAPI"
 const char e1000_driver_version[] = DRV_VERSION;
 static const char e1000_copyright[] = "Copyright (c) 1999-2006 Intel Corporation.";
 
@@ -2386,6 +2386,22 @@ link_up:
 		}
 	}
 
+	/* Simple mode for Interrupt Throttle Rate (ITR) */
+	if (hw->mac_type >= e1000_82540 && adapter->itr_setting == 4) {
+		/*
+		 * Symmetric Tx/Rx gets a reduced ITR=2000;
+		 * Total asymmetrical Tx or Rx gets ITR=8000;
+		 * everyone else is between 2000-8000.
+		 */
+		u32 goc = (adapter->gotcl + adapter->gorcl) / 10000;
+		u32 dif = (adapter->gotcl > adapter->gorcl ?
+			    adapter->gotcl - adapter->gorcl :
+			    adapter->gorcl - adapter->gotcl) / 10000;
+		u32 itr = goc > 0 ? (dif * 6000 / goc + 2000) : 8000;
+
+		ew32(ITR, 1000000000 / (itr * 256));
+	}
+
 	/* Cause software interrupt to ensure rx ring is cleaned */
 	ew32(ICS, E1000_ICS_RXDMT0);
 
drivers/net/e1000/e1000_param.c +8 -2
index 543c6d1..9fbb562 100644
@@ -484,11 +484,17 @@ void __devinit e1000_check_options(struct e1000_adapter *adapter)
 				adapter->itr_setting = adapter->itr;
 				adapter->itr = 20000;
 				break;
+			case 4:
+				e_dev_info("%s set to simplified "
+				           "(2000-8000) ints mode\n", opt.name);
+				adapter->itr_setting = adapter->itr;
+				break;
 			default:
 				e1000_validate_option(&adapter->itr, &opt,
 				        adapter);
-				/* save the setting, because the dynamic bits change itr */
-				/* clear the lower two bits because they are
+				/* save the setting, because the dynamic bits
+				 * change itr.
+				 * clear the lower two bits because they are
 				 * used as control */
 				adapter->itr_setting = adapter->itr & ~3;
 				break;
drivers/net/e1000e/ethtool.c +5 -3
index 7f9915c..c81118a 100644
@@ -1891,7 +1891,7 @@ static int e1000_get_coalesce(struct net_device *netdev,
 {
 	struct e1000_adapter *adapter = netdev_priv(netdev);
 
-	if (adapter->itr_setting <= 3)
+	if (adapter->itr_setting <= 4)
 		ec->rx_coalesce_usecs = adapter->itr_setting;
 	else
 		ec->rx_coalesce_usecs = 1000000 / adapter->itr_setting;
@@ -1906,12 +1906,14 @@ static int e1000_set_coalesce(struct net_device *netdev,
 	struct e1000_hw *hw = &adapter->hw;
 
 	if ((ec->rx_coalesce_usecs > E1000_MAX_ITR_USECS) ||
-	    ((ec->rx_coalesce_usecs > 3) &&
+	    ((ec->rx_coalesce_usecs > 4) &&
 	     (ec->rx_coalesce_usecs < E1000_MIN_ITR_USECS)) ||
 	    (ec->rx_coalesce_usecs == 2))
 		return -EINVAL;
 
-	if (ec->rx_coalesce_usecs <= 3) {
+	if (ec->rx_coalesce_usecs == 4) {
+		adapter->itr = adapter->itr_setting = 4;
+	} else if (ec->rx_coalesce_usecs <= 3) {
 		adapter->itr = 20000;
 		adapter->itr_setting = ec->rx_coalesce_usecs;
 	} else {
drivers/net/e1000e/netdev.c +17 -1
index d13760d..0a16465 100644
@@ -52,7 +52,7 @@
 
 #include "e1000.h"
 
-#define DRV_VERSION "1.0.2-k2"
+#define DRV_VERSION "1.0.2-k4"
 char e1000e_driver_name[] = "e1000e";
 const char e1000e_driver_version[] = DRV_VERSION;
 
@@ -4087,6 +4087,22 @@ link_up:
 		}
 	}
 
+	/* Simple mode for Interrupt Throttle Rate (ITR) */
+	if (adapter->itr_setting == 4) {
+		/*
+		 * Symmetric Tx/Rx gets a reduced ITR=2000;
+		 * Total asymmetrical Tx or Rx gets ITR=8000;
+		 * everyone else is between 2000-8000.
+		 */
+		u32 goc = (adapter->gotc + adapter->gorc) / 10000;
+		u32 dif = (adapter->gotc > adapter->gorc ?
+			    adapter->gotc - adapter->gorc :
+			    adapter->gorc - adapter->gotc) / 10000;
+		u32 itr = goc > 0 ? (dif * 6000 / goc + 2000) : 8000;
+
+		ew32(ITR, 1000000000 / (itr * 256));
+	}
+
 	/* Cause software interrupt to ensure Rx ring is cleaned */
 	if (adapter->msix_entries)
 		ew32(ICS, adapter->rx_ring->ims_val);
drivers/net/e1000e/param.c +5 -0
index f775a48..0f4077c 100644
@@ -351,6 +351,11 @@ void __devinit e1000e_check_options(struct e1000_adapter *adapter)
 				adapter->itr_setting = adapter->itr;
 				adapter->itr = 20000;
 				break;
+			case 4:
+				e_info("%s set to simplified (2000-8000 ints) "
+				       "mode\n", opt.name);
+				adapter->itr_setting = 4;
+				break;
 			default:
 				/*
 				 * Save the setting, because the dynamic bits
maintainer Applied
#2 lore raw

Re: [net-next-2.6 PATCH 2/2] e1000/e1000e: implement a simple interrupt moderation

From: Jeff Kirsher <[email protected]>
Date: Wed, 05 May 2010 01:26:03 -0700

Quoted 12 lines

From: Jesse Brandeburg <[email protected]>

Back before e1000-7.3.20, the e1000 driver had a simple algorithm that managed interrupt moderation. The driver was updated in 7.3.20 to have the new "adaptive" interrupt moderation but we have customer requests to redeploy the old way as an option. This patch adds the old functionality back. The new functionality can be enabled via module parameter or at runtime via ethtool.
Module parameter: (InterruptThrottleRate=4) to use this new moderation method.
Ethtool method: ethtool -C ethX rx-usecs 4

Quoted 2 lines

Applied.

maintainer Applied
#3 lore raw
In reply to Jeff Kirsher

From: Jeff Kirsher <[email protected]>
Date: Wed, 05 May 2010 01:25:42 -0700

Quoted 10 lines

From: Alexander Duyck <[email protected]>

This change increases the RX fifo size to 36K for standard frames and decreases the TX fifo size to 4K. The reason for this change is that on slower systems the RX is much more likely to backfill and need space than the TX is. As long as the TX fifo is twice the size of the MTU we should have more than enough TX fifo.

Applied.