netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Olof Johansson <olof@lixom.net>
To: jgarzik@pobox.com
Cc: netdev@vger.kernel.org
Subject: [PATCH v4 2/9] pasemi_mac: Abstract and fix up interrupt restart routines
Date: Tue, 8 May 2007 00:47:26 -0500	[thread overview]
Message-ID: <20070508054726.GC14321@lixom.net> (raw)
In-Reply-To: 20070508053500.358169000@localhost.localdomain

[-- Attachment #1: n-3 --]
[-- Type: text/plain, Size: 2374 bytes --]

Abstract out (and fix up) the interrupt restart routines, making
sure we start out in a consistent state.

Signed-off-by: Olof Johansson <olof@lixom.net>

Index: netdev-2.6/drivers/net/pasemi_mac.c
===================================================================
--- netdev-2.6.orig/drivers/net/pasemi_mac.c
+++ netdev-2.6/drivers/net/pasemi_mac.c
@@ -362,6 +362,42 @@ static void pasemi_mac_replenish_rx_ring
 	mac->rx->next_to_fill += count;
 }
 
+static void pasemi_mac_restart_rx_intr(struct pasemi_mac *mac)
+{
+	unsigned int reg, stat;
+	/* Re-enable packet count interrupts: finally
+	 * ack the packet count interrupt we got in rx_intr.
+	 */
+
+	pci_read_config_dword(mac->iob_pdev,
+			      PAS_IOB_DMA_RXCH_STAT(mac->dma_rxch),
+			      &stat);
+
+	reg = PAS_IOB_DMA_RXCH_RESET_PCNT(stat & PAS_IOB_DMA_RXCH_STAT_CNTDEL_M)
+		| PAS_IOB_DMA_RXCH_RESET_PINTC;
+
+	pci_write_config_dword(mac->iob_pdev,
+			       PAS_IOB_DMA_RXCH_RESET(mac->dma_rxch),
+			       reg);
+}
+
+static void pasemi_mac_restart_tx_intr(struct pasemi_mac *mac)
+{
+	unsigned int reg, stat;
+
+	/* Re-enable packet count interrupts */
+	pci_read_config_dword(mac->iob_pdev,
+			      PAS_IOB_DMA_TXCH_STAT(mac->dma_txch), &stat);
+
+	reg = PAS_IOB_DMA_TXCH_RESET_PCNT(stat & PAS_IOB_DMA_TXCH_STAT_CNTDEL_M)
+		| PAS_IOB_DMA_TXCH_RESET_PINTC;
+
+	pci_write_config_dword(mac->iob_pdev,
+			       PAS_IOB_DMA_TXCH_RESET(mac->dma_txch), reg);
+}
+
+
+
 static int pasemi_mac_clean_rx(struct pasemi_mac *mac, int limit)
 {
 	unsigned int i;
@@ -559,6 +595,10 @@ static int pasemi_mac_open(struct net_de
 	pci_write_config_dword(mac->iob_pdev, PAS_IOB_DMA_RXCH_CFG(mac->dma_rxch),
 			       PAS_IOB_DMA_RXCH_CFG_CNTTH(30));
 
+	/* Clear out any residual packet count state from firmware */
+	pasemi_mac_restart_rx_intr(mac);
+	pasemi_mac_restart_tx_intr(mac);
+
 	pci_write_config_dword(mac->iob_pdev, PAS_IOB_DMA_COM_TIMEOUTCFG,
 			       PAS_IOB_DMA_COM_TIMEOUTCFG_TCNT(1000000));
 
@@ -835,9 +875,7 @@ static int pasemi_mac_poll(struct net_de
 		/* all done, no more packets present */
 		netif_rx_complete(dev);
 
-		/* re-enable receive interrupts */
-		pci_write_config_dword(mac->iob_pdev, PAS_IOB_DMA_COM_TIMEOUTCFG,
-				       PAS_IOB_DMA_COM_TIMEOUTCFG_TCNT(1000000));
+		pasemi_mac_restart_rx_intr(mac);
 		return 0;
 	} else {
 		/* used up our quantum, so reschedule */

--

  parent reply	other threads:[~2007-05-08  6:08 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20070508053500.358169000@localhost.localdomain>
2007-05-08  5:47 ` [PATCH v4 1/9] pasemi_mac: Move the IRQ mapping from the PCI layer to the driver Olof Johansson
2007-05-08  5:48   ` Jeff Garzik
2007-05-08  5:47 ` Olof Johansson [this message]
2007-05-08  5:47 ` [PATCH v4 3/9] pasemi_mac: Timer and interrupt fixes Olof Johansson
2007-05-08  5:47 ` [PATCH v4 4/9] pasemi_mac: Add SKB reuse / copy-break Olof Johansson
2007-05-08  5:47 ` [PATCH v4 5/9] pasemi_mac: Minor cleanup / define fixes Olof Johansson
2007-05-08  5:47 ` [PATCH v4 6/9] pasemi_mac: Logic cleanup / rx performance improvements Olof Johansson
2007-05-08  5:47 ` [PATCH v4 7/9] pasemi_mac: Add msglevel support and "debug" module param Olof Johansson
2007-05-08  5:47 ` [PATCH v4 8/9] pasemi_mac: PHY support Olof Johansson
2007-05-08  5:48 ` [PATCH v4 9/9] pasemi_mac: Use local-mac-address instead of mac-address if available Olof Johansson

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=20070508054726.GC14321@lixom.net \
    --to=olof@lixom.net \
    --cc=jgarzik@pobox.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).