netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Kok, Auke" <auke-jan.h.kok@intel.com>
To: "Garzik, Jeff" <jgarzik@pobox.com>
Cc: netdev@vger.kernel.org, "Brandeburg,
	Jesse" <jesse.brandeburg@intel.com>,
	"Kok, Auke" <auke-jan.h.kok@intel.com>,
	"Kok, Auke" <auke@foo-projects.org>,
	"Ronciak, John" <john.ronciak@intel.com>
Subject: [PATCH 05/22] e1000: dynamic itr code fixes
Date: Fri, 08 Dec 2006 15:02:55 -0800	[thread overview]
Message-ID: <20061208230255.30109.93522.stgit@gitlost.site> (raw)
In-Reply-To: <20061208230209.30109.49157.stgit@gitlost.site>


The dynamic interrupt rate control patches omitted proper counting
for jumbo's and TSO. We also & out the lower bits of a user-provided
hardcoded itr setting beccause they are used for control.

Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
Signed-off-by: Auke Kok <auke-jan.h.kok@intel.com>
---

 drivers/net/e1000/e1000_main.c  |   52 ++++++++++++++++++++++++++-------------
 drivers/net/e1000/e1000_param.c |    4 ++-
 2 files changed, 37 insertions(+), 19 deletions(-)

diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c
index fae30c7..f39b244 100644
--- a/drivers/net/e1000/e1000_main.c
+++ b/drivers/net/e1000/e1000_main.c
@@ -2635,29 +2635,38 @@ static unsigned int e1000_update_itr(str
 	if (packets == 0)
 		goto update_itr_done;
 
-
 	switch (itr_setting) {
 	case lowest_latency:
-		if ((packets < 5) && (bytes > 512))
+		/* handle TSO and jumbo frames */
+		if (bytes/packets > 8000)
+			retval = bulk_latency;
+		else if ((packets < 5) && (bytes > 512)) {
 			retval = low_latency;
+		}
 		break;
 	case low_latency:  /* 50 usec aka 20000 ints/s */
 		if (bytes > 10000) {
-			if ((packets < 10) ||
-			     ((bytes/packets) > 1200))
+			/* this if handles the TSO accounting */
+			if (bytes/packets > 8000) {
 				retval = bulk_latency;
-			else if ((packets > 35))
+			} else if ((packets < 10) || ((bytes/packets) > 1200)) {
+				retval = bulk_latency;
+			} else if ((packets > 35)) {
 				retval = lowest_latency;
-		} else if (packets <= 2 && bytes < 512)
+			}
+		} else if (bytes/packets > 2000) {
+			retval = bulk_latency;
+		} else if (packets <= 2 && bytes < 512) {
 			retval = lowest_latency;
+		}
 		break;
 	case bulk_latency: /* 250 usec aka 4000 ints/s */
 		if (bytes > 25000) {
-			if (packets > 35)
-				retval = low_latency;
-		} else {
-			if (bytes < 6000)
+			if (packets > 35) {
 				retval = low_latency;
+			}
+		} else if (bytes < 6000) {
+			retval = low_latency;
 		}
 		break;
 	}
@@ -2686,17 +2695,20 @@ static void e1000_set_itr(struct e1000_a
 	                            adapter->tx_itr,
 	                            adapter->total_tx_packets,
 	                            adapter->total_tx_bytes);
+	/* conservative mode (itr 3) eliminates the lowest_latency setting */
+	if (adapter->itr_setting == 3 && adapter->tx_itr == lowest_latency)
+		adapter->tx_itr = low_latency;
+
 	adapter->rx_itr = e1000_update_itr(adapter,
 	                            adapter->rx_itr,
 	                            adapter->total_rx_packets,
 	                            adapter->total_rx_bytes);
+	/* conservative mode (itr 3) eliminates the lowest_latency setting */
+	if (adapter->itr_setting == 3 && adapter->rx_itr == lowest_latency)
+		adapter->rx_itr = low_latency;
 
 	current_itr = max(adapter->rx_itr, adapter->tx_itr);
 
-	/* conservative mode eliminates the lowest_latency setting */
-	if (current_itr == lowest_latency && (adapter->itr_setting == 3))
-		current_itr = low_latency;
-
 	switch (current_itr) {
 	/* counts and packets in update_itr are dependent on these numbers */
 	case lowest_latency:
@@ -3875,11 +3887,15 @@ e1000_clean_tx_irq(struct e1000_adapter 
 			cleaned = (i == eop);
 
 			if (cleaned) {
-				/* this packet count is wrong for TSO but has a
-				 * tendency to make dynamic ITR change more
-				 * towards bulk */
+				struct sk_buff *skb = buffer_info->skb;
+#ifdef NETIF_F_TSO
+				unsigned int segs = skb_shinfo(skb)->gso_segs;
+				if (segs)
+					total_tx_packets += segs;
+#endif
+
 				total_tx_packets++;
-				total_tx_bytes += buffer_info->skb->len;
+				total_tx_bytes += skb->len;
 			}
 			e1000_unmap_and_free_tx_resource(adapter, buffer_info);
 			tx_desc->upper.data = 0;
diff --git a/drivers/net/e1000/e1000_param.c b/drivers/net/e1000/e1000_param.c
index cbfcd7f..cf2a279 100644
--- a/drivers/net/e1000/e1000_param.c
+++ b/drivers/net/e1000/e1000_param.c
@@ -487,7 +487,9 @@ e1000_check_options(struct e1000_adapter
 				e1000_validate_option(&adapter->itr, &opt,
 				        adapter);
 				/* save the setting, because the dynamic bits change itr */
-				adapter->itr_setting = adapter->itr;
+				/* clear the lower two bits because they are
+				 * used as control */
+				adapter->itr_setting = adapter->itr & ~3;
 				break;
 			}
 		} else {



---
Auke Kok <auke-jan.h.kok@intel.com>

  parent reply	other threads:[~2006-12-08 22:52 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-12-08 23:02 [PATCH 00/22] ixgb, e1000 fixes Kok, Auke
2006-12-08 23:02 ` [PATCH 01/22] e1000: Fix early TSO completion Kok, Auke
2006-12-11 14:36   ` Jeff Garzik
2006-12-08 23:02 ` [PATCH 02/22] ixgb: Maybe stop TX if not enough free descriptors Kok, Auke
2006-12-11 14:37   ` Jeff Garzik
2006-12-08 23:02 ` [PATCH 03/22] ixgb: Write RA register high word first, increment version Kok, Auke
2006-12-11 14:37   ` Jeff Garzik
2006-12-08 23:02 ` [PATCH 04/22] e1000: display FC link properties Kok, Auke
2006-12-08 23:02 ` Kok, Auke [this message]
2006-12-08 23:02 ` [PATCH 06/22] e1000: minor tso ipv6 cleanups Kok, Auke
2006-12-11 14:42   ` Jeff Garzik
2006-12-08 23:02 ` [PATCH 07/22] e1000: omit stats for broken counter in 82543 Kok, Auke
2006-12-11 14:42   ` Jeff Garzik
2006-12-08 23:03 ` [PATCH 08/22] e1000: Fix all manageability workarounds Kok, Auke
2006-12-11 14:41   ` Jeff Garzik
2006-12-08 23:03 ` [PATCH 09/22] e1000: Fix PBA allocation calculations Kok, Auke
2006-12-08 23:03 ` [PATCH 10/22] e1000: Make copybreak parameter changeable by user Kok, Auke
2006-12-08 23:03 ` [PATCH 11/22] e1000: Fire a link even interrupt instead of a watchdog at init Kok, Auke
2006-12-11 22:48   ` Shaw Vrana
2006-12-08 23:03 ` [PATCH 12/22] e1000: Fix powerdown link loss when forced to gig speed Kok, Auke
2006-12-11 14:46   ` Jeff Garzik
2006-12-08 23:03 ` [PATCH 13/22] e1000: disable TSO when debugging slab Kok, Auke
2006-12-11 14:47   ` Jeff Garzik
2006-12-15  2:42     ` Herbert Xu
2006-12-08 23:03 ` [PATCH 14/22] e1000: always turn on receives on esb2 Kok, Auke
2006-12-11 14:47   ` Jeff Garzik
2006-12-08 23:03 ` [PATCH 15/22] e1000: simplify msi specific interrupt handler Kok, Auke
2006-12-11 14:48   ` Jeff Garzik
2006-12-08 23:03 ` [PATCH 16/22] e1000: Rewrite parm handling code to warn when forcing autoneg to gig only Kok, Auke
2006-12-08 23:03 ` [PATCH 17/22] e1000: set max frame size before enabling new link settings Kok, Auke
2006-12-08 23:03 ` [PATCH 18/22] e1000: For older adapters, we know that the pci bus type is pci Kok, Auke
2006-12-08 23:03 ` [PATCH 19/22] e1000: Don't set tipg (fiber) timings for pci-e adapters to fix fiber output Kok, Auke
2006-12-08 23:03 ` [PATCH 20/22] e1000: Fix poor quad port performance with NAPI Kok, Auke
2006-12-11 14:49   ` Jeff Garzik
2006-12-08 23:03 ` [PATCH 21/22] e1000: Version increment 7.3.20-k2 and minor cleanups Kok, Auke
2006-12-11 14:50   ` Jeff Garzik
2006-12-08 23:03 ` [PATCH 22/22] # This series applies on GIT commit 0ae851352a87db3f829511816a2da227860bf585 Kok, Auke

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20061208230255.30109.93522.stgit@gitlost.site \
    --to=auke-jan.h.kok@intel.com \
    --cc=auke@foo-projects.org \
    --cc=jesse.brandeburg@intel.com \
    --cc=jgarzik@pobox.com \
    --cc=john.ronciak@intel.com \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).