From: Stephen Hemminger <shemminger@linux-foundation.org>
To: Jeff Garzik <jgarzik@pobox.com>
Cc: netdev@vger.kernel.org
Subject: [PATCH 4/7] sky2: safer transmit timeout
Date: Tue, 06 Feb 2007 10:45:42 -0800 [thread overview]
Message-ID: <20070206184855.156031000@linux-foundation.org> (raw)
In-Reply-To: 20070206184538.675048000@linux-foundation.org
[-- Attachment #1: sky2-tx-reset.patch --]
[-- Type: text/plain, Size: 2713 bytes --]
Rather than trying to be "smart" about possible transmit timeout
causes. Just clear all pending frames and reset the PHY.
Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org>
---
drivers/net/sky2.c | 41 +++++++++++++++--------------------------
1 file changed, 15 insertions(+), 26 deletions(-)
--- sky2-dev.orig/drivers/net/sky2.c 2007-02-06 10:44:21.000000000 -0800
+++ sky2-dev/drivers/net/sky2.c 2007-02-06 10:44:23.000000000 -0800
@@ -1840,48 +1840,37 @@
}
-/* Transmit timeout is only called if we are running, carries is up
+/* Transmit timeout is only called if we are running, carrier is up
* and tx queue is full (stopped).
+ * Called with netif_tx_lock held.
*/
static void sky2_tx_timeout(struct net_device *dev)
{
struct sky2_port *sky2 = netdev_priv(dev);
struct sky2_hw *hw = sky2->hw;
- unsigned txq = txqaddr[sky2->port];
- u16 report, done;
+ u32 imask;
if (netif_msg_timer(sky2))
printk(KERN_ERR PFX "%s: tx timeout\n", dev->name);
- report = sky2_read16(hw, sky2->port == 0 ? STAT_TXA1_RIDX : STAT_TXA2_RIDX);
- done = sky2_read16(hw, Q_ADDR(txq, Q_DONE));
-
printk(KERN_DEBUG PFX "%s: transmit ring %u .. %u report=%u done=%u\n",
- dev->name,
- sky2->tx_cons, sky2->tx_prod, report, done);
-
- if (report != done) {
- printk(KERN_INFO PFX "status burst pending (irq moderation?)\n");
+ dev->name, sky2->tx_cons, sky2->tx_prod,
+ sky2_read16(hw, sky2->port == 0 ? STAT_TXA1_RIDX : STAT_TXA2_RIDX),
+ sky2_read16(hw, Q_ADDR(txqaddr[sky2->port], Q_DONE)));
- sky2_write8(hw, STAT_TX_TIMER_CTRL, TIM_STOP);
- sky2_write8(hw, STAT_TX_TIMER_CTRL, TIM_START);
- } else if (report != sky2->tx_cons) {
- printk(KERN_INFO PFX "status report lost?\n");
+ imask = sky2_read32(hw, B0_IMSK); /* block IRQ in hw */
+ sky2_write32(hw, B0_IMSK, 0);
+ sky2_read32(hw, B0_IMSK);
- netif_tx_lock_bh(dev);
- sky2_tx_complete(sky2, report);
- netif_tx_unlock_bh(dev);
- } else {
- printk(KERN_INFO PFX "hardware hung? flushing\n");
+ netif_poll_disable(hw->dev[0]); /* stop NAPI poll */
+ synchronize_irq(hw->pdev->irq);
- sky2_write32(hw, Q_ADDR(txq, Q_CSR), BMU_STOP);
- sky2_write32(hw, Y2_QADDR(txq, PREF_UNIT_CTRL), PREF_UNIT_RST_SET);
+ netif_start_queue(dev); /* don't wakeup during flush */
+ sky2_tx_complete(sky2, sky2->tx_prod); /* Flush transmit queue */
- sky2_tx_clean(dev);
+ sky2_write32(hw, B0_IMSK, imask);
- sky2_qset(hw, txq);
- sky2_prefetch_init(hw, txq, sky2->tx_le_map, TX_RING_SIZE - 1);
- }
+ sky2_phy_reinit(sky2); /* this clears flow control etc */
}
static int sky2_change_mtu(struct net_device *dev, int new_mtu)
--
Stephen Hemminger <shemminger@linux-foundation.org>
next prev parent reply other threads:[~2007-02-06 18:53 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-02-06 18:45 [PATCH 0/7] sky2 v1.12 patches Stephen Hemminger
2007-02-06 18:45 ` [PATCH 1/7] sky2: add Wake On Lan support Stephen Hemminger
2007-02-07 0:20 ` Jeff Garzik
2007-02-06 18:45 ` [PATCH 2/7] sky2: use dev_err for error reports Stephen Hemminger
2007-02-06 18:45 ` [PATCH 3/7] sky2: TSO support for EC_U Stephen Hemminger
2007-02-06 18:45 ` Stephen Hemminger [this message]
2007-02-06 18:45 ` [PATCH 5/7] sky2: Yukon Extreme support Stephen Hemminger
2007-02-06 21:52 ` Francois Romieu
2007-02-06 22:07 ` Stephen Hemminger
2007-02-06 18:45 ` [PATCH 6/7] sky2: add new chip ids Stephen Hemminger
2007-02-06 18:45 ` [PATCH 7/7] sky2: version 1.12 Stephen Hemminger
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=20070206184855.156031000@linux-foundation.org \
--to=shemminger@linux-foundation.org \
--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).