All of lore.kernel.org
 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 15/22] e1000: simplify msi specific interrupt handler
Date: Fri, 08 Dec 2006 15:03:18 -0800	[thread overview]
Message-ID: <20061208230318.30109.63413.stgit@gitlost.site> (raw)
In-Reply-To: <20061208230209.30109.49157.stgit@gitlost.site>


Simplify the msi interrupt handler to avoid issues with delayed ICR reads.
This avoids adapter specific problems at the cost of some performance.

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

 drivers/net/e1000/e1000.h      |    1 -
 drivers/net/e1000/e1000_main.c |   60 +++++++++++++---------------------------
 2 files changed, 19 insertions(+), 42 deletions(-)

diff --git a/drivers/net/e1000/e1000.h b/drivers/net/e1000/e1000.h
index f091042..8e7acb0 100644
--- a/drivers/net/e1000/e1000.h
+++ b/drivers/net/e1000/e1000.h
@@ -257,7 +257,6 @@ struct e1000_adapter {
 	spinlock_t tx_queue_lock;
 #endif
 	atomic_t irq_sem;
-	unsigned int detect_link;
 	unsigned int total_tx_bytes;
 	unsigned int total_tx_packets;
 	unsigned int total_rx_bytes;
diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c
index 67fc379..cb6b732 100644
--- a/drivers/net/e1000/e1000_main.c
+++ b/drivers/net/e1000/e1000_main.c
@@ -3778,8 +3778,8 @@ e1000_update_stats(struct e1000_adapter 
  * @data: pointer to a network interface device structure
  **/
 
-static
-irqreturn_t e1000_intr_msi(int irq, void *data)
+static irqreturn_t
+e1000_intr_msi(int irq, void *data)
 {
 	struct net_device *netdev = data;
 	struct e1000_adapter *adapter = netdev_priv(netdev);
@@ -3787,49 +3787,27 @@ irqreturn_t e1000_intr_msi(int irq, void
 #ifndef CONFIG_E1000_NAPI
 	int i;
 #endif
+	uint32_t icr = E1000_READ_REG(hw, ICR);
 
-	/* this code avoids the read of ICR but has to get 1000 interrupts
-	 * at every link change event before it will notice the change */
-	if (++adapter->detect_link >= 1000) {
-		uint32_t icr = E1000_READ_REG(hw, ICR);
 #ifdef CONFIG_E1000_NAPI
-		/* read ICR disables interrupts using IAM, so keep up with our
-		 * enable/disable accounting */
-		atomic_inc(&adapter->irq_sem);
+	/* read ICR disables interrupts using IAM, so keep up with our
+	 * enable/disable accounting */
+	atomic_inc(&adapter->irq_sem);
 #endif
-		adapter->detect_link = 0;
-		if ((icr & (E1000_ICR_RXSEQ | E1000_ICR_LSC)) &&
-		    (icr & E1000_ICR_INT_ASSERTED)) {
-			hw->get_link_status = 1;
-			/* 80003ES2LAN workaround--
-			* For packet buffer work-around on link down event;
-			* disable receives here in the ISR and
-			* reset adapter in watchdog
-			*/
-			if (netif_carrier_ok(netdev) &&
-			    (adapter->hw.mac_type == e1000_80003es2lan)) {
-				/* disable receives */
-				uint32_t rctl = E1000_READ_REG(hw, RCTL);
-				E1000_WRITE_REG(hw, RCTL, rctl & ~E1000_RCTL_EN);
-			}
-			/* guard against interrupt when we're going down */
-			if (!test_bit(__E1000_DOWN, &adapter->flags))
-				mod_timer(&adapter->watchdog_timer,
-				          jiffies + 1);
+	if (icr & (E1000_ICR_RXSEQ | E1000_ICR_LSC)) {
+		hw->get_link_status = 1;
+		/* 80003ES2LAN workaround-- For packet buffer work-around on
+		 * link down event; disable receives here in the ISR and reset
+		 * adapter in watchdog */
+		if (netif_carrier_ok(netdev) &&
+		    (adapter->hw.mac_type == e1000_80003es2lan)) {
+			/* disable receives */
+			uint32_t rctl = E1000_READ_REG(hw, RCTL);
+			E1000_WRITE_REG(hw, RCTL, rctl & ~E1000_RCTL_EN);
 		}
-	} else {
-		E1000_WRITE_REG(hw, ICR, (0xffffffff & ~(E1000_ICR_RXSEQ |
-		                                         E1000_ICR_LSC)));
-		/* bummer we have to flush here, but things break otherwise as
-		 * some event appears to be lost or delayed and throughput
-		 * drops.  In almost all tests this flush is un-necessary */
-		E1000_WRITE_FLUSH(hw);
-#ifdef CONFIG_E1000_NAPI
-		/* Interrupt Auto-Mask (IAM)...upon writing ICR, interrupts are
-		 * masked.  No need for the IMC write, but it does mean we
-		 * should account for it ASAP. */
-		atomic_inc(&adapter->irq_sem);
-#endif
+		/* guard against interrupt when we're going down */
+		if (!test_bit(__E1000_DOWN, &adapter->flags))
+			mod_timer(&adapter->watchdog_timer, jiffies + 1);
 	}
 
 #ifdef CONFIG_E1000_NAPI



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

  parent reply	other threads:[~2006-12-08 22:53 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 ` [PATCH 05/22] e1000: dynamic itr code fixes Kok, Auke
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 ` Kok, Auke [this message]
2006-12-11 14:48   ` [PATCH 15/22] e1000: simplify msi specific interrupt handler 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=20061208230318.30109.63413.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.