From: olof@lixom.net (Olof Johansson)
To: jgarzik@pobox.com
Cc: netdev@vger.kernel.org, linuxppc-dev@ozlabs.org
Subject: [PATCH] [1/4] pasemi_mac: minor bugfixes
Date: Mon, 16 Apr 2007 01:17:33 -0500 [thread overview]
Message-ID: <20070416061733.GC19783@lixom.net> (raw)
In-Reply-To: <20070416061654.GB19783@lixom.net>
Ethernet bugfixes:
* Move the was_full/wake_queue logic from tx_intr to clean_tx
* Fix polarity in checks in pasemi_mac_close
Signed-off-by: Olof Johansson <olof@lixom.net>
Index: linux-2.6/drivers/net/pasemi_mac.c
===================================================================
--- linux-2.6.orig/drivers/net/pasemi_mac.c
+++ linux-2.6/drivers/net/pasemi_mac.c
@@ -451,9 +451,12 @@ static int pasemi_mac_clean_tx(struct pa
struct pas_dma_xct_descr *dp;
int start, count;
int flags;
+ int was_full;
spin_lock_irqsave(&mac->tx->lock, flags);
+ was_full = mac->tx->next_to_clean - mac->tx->next_to_use == TX_RING_SIZE;
+
start = mac->tx->next_to_clean;
count = 0;
@@ -478,6 +481,9 @@ static int pasemi_mac_clean_tx(struct pa
mac->tx->next_to_clean += count;
spin_unlock_irqrestore(&mac->tx->lock, flags);
+ if (was_full)
+ netif_wake_queue(mac->netdev);
+
return count;
}
@@ -512,9 +518,6 @@ static irqreturn_t pasemi_mac_tx_intr(in
struct net_device *dev = data;
struct pasemi_mac *mac = netdev_priv(dev);
unsigned int reg;
- int was_full;
-
- was_full = mac->tx->next_to_clean - mac->tx->next_to_use == TX_RING_SIZE;
if (!(*mac->tx_status & PAS_STATUS_INT))
return IRQ_NONE;
@@ -528,9 +531,6 @@ static irqreturn_t pasemi_mac_tx_intr(in
pci_write_config_dword(mac->iob_pdev, PAS_IOB_DMA_TXCH_RESET(mac->dma_txch),
reg);
- if (was_full)
- netif_wake_queue(dev);
-
return IRQ_HANDLED;
}
@@ -662,40 +665,37 @@ static int pasemi_mac_close(struct net_d
pci_read_config_dword(mac->dma_pdev,
PAS_DMA_TXCHAN_TCMDSTA(mac->dma_txch),
&stat);
- if (stat & PAS_DMA_TXCHAN_TCMDSTA_ACT)
+ if (!(stat & PAS_DMA_TXCHAN_TCMDSTA_ACT))
break;
cond_resched();
}
- if (!(stat & PAS_DMA_TXCHAN_TCMDSTA_ACT)) {
+ if (stat & PAS_DMA_TXCHAN_TCMDSTA_ACT)
dev_err(&mac->dma_pdev->dev, "Failed to stop tx channel\n");
- }
for (retries = 0; retries < MAX_RETRIES; retries++) {
pci_read_config_dword(mac->dma_pdev,
PAS_DMA_RXCHAN_CCMDSTA(mac->dma_rxch),
&stat);
- if (stat & PAS_DMA_RXCHAN_CCMDSTA_ACT)
+ if (!(stat & PAS_DMA_RXCHAN_CCMDSTA_ACT))
break;
cond_resched();
}
- if (!(stat & PAS_DMA_RXCHAN_CCMDSTA_ACT)) {
+ if (stat & PAS_DMA_RXCHAN_CCMDSTA_ACT)
dev_err(&mac->dma_pdev->dev, "Failed to stop rx channel\n");
- }
for (retries = 0; retries < MAX_RETRIES; retries++) {
pci_read_config_dword(mac->dma_pdev,
PAS_DMA_RXINT_RCMDSTA(mac->dma_if),
&stat);
- if (stat & PAS_DMA_RXINT_RCMDSTA_ACT)
+ if (!(stat & PAS_DMA_RXINT_RCMDSTA_ACT))
break;
cond_resched();
}
- if (!(stat & PAS_DMA_RXINT_RCMDSTA_ACT)) {
+ if (stat & PAS_DMA_RXINT_RCMDSTA_ACT)
dev_err(&mac->dma_pdev->dev, "Failed to stop rx interface\n");
- }
/* Then, disable the channel. This must be done separately from
* stopping, since you can't disable when active.
next prev parent reply other threads:[~2007-04-16 5:59 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-04-16 6:16 [PATCH] [0/4] pasemi_mac: fixes and enhancements Olof Johansson
2007-04-16 6:17 ` Olof Johansson [this message]
2007-04-16 6:18 ` [PATCH] [2/4] pasemi_mac: irq mapping changes Olof Johansson
2007-04-16 6:32 ` Michael Ellerman
2007-04-16 6:32 ` Michael Ellerman
2007-04-16 6:19 ` [PATCH] [3/4] pasemi_mac: cleanups and rx performance improvements Olof Johansson
2007-04-16 6:20 ` [PATCH] [4/4] pasemi_mac: phy support Olof Johansson
2007-04-16 7:05 ` [PATCH] [0/4] pasemi_mac: fixes and enhancements Olof Johansson
2007-04-18 6:24 ` [PATCH] [0/5] [v2] " Olof Johansson
2007-04-18 6:25 ` [PATCH] [0/5] [v2] pasemi_mac: minor bugfixes Olof Johansson
2007-04-18 6:25 ` [PATCH] [2/5] [v2] pasemi_mac: irq mapping changes Olof Johansson
2007-04-18 6:26 ` [PATCH] [3/5] [v2] pasemi_mac: cleanups and rx performance improvements Olof Johansson
2007-04-18 6:27 ` [PATCH] [4/5] [v2] pasemi_mac: phy support Olof Johansson
2007-04-18 6:27 ` [PATCH] [5/5] [v2] pasemi_mac: use local-mac-address 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=20070416061733.GC19783@lixom.net \
--to=olof@lixom.net \
--cc=jgarzik@pobox.com \
--cc=linuxppc-dev@ozlabs.org \
--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.