netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mike McCormack <mikem@ring3k.org>
To: netdev@vger.kernel.org, shemminger@linux-foundation.org
Subject: [PATCH] sky2: Avoid races in sky2_down
Date: Sun, 12 Jul 2009 14:28:04 +0900	[thread overview]
Message-ID: <392fb48f0907112228v52624339x4f6c418ed0ee07a5@mail.gmail.com> (raw)
In-Reply-To: <392fb48f0907072016i14cd650fv3524b345c79e498d@mail.gmail.com>

Hi Stephen,

Resending with sign off. (You may have this in your tree already, but
just in case...)
I ran some overnight tests with this patch in, and my machine manages
to stay up all night, where it crashed within minutes before.

Mike

---

Reset rx chain before trying to drain it.
Shut interrupts off last, incase there's something to report.

Signed-off-by: Mike McCormack <mikem@ring3k.org>
---
 drivers/net/sky2.c |   16 ++++++++--------
 1 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/net/sky2.c b/drivers/net/sky2.c
index daf961a..23a26d6 100644
--- a/drivers/net/sky2.c
+++ b/drivers/net/sky2.c
@@ -1825,12 +1825,6 @@ static int sky2_down(struct net_device *dev)
 	if (netif_msg_ifdown(sky2))
 		printk(KERN_INFO PFX "%s: disabling interface\n", dev->name);

-	/* Disable port IRQ */
-	imask = sky2_read32(hw, B0_IMSK);
-	imask &= ~portirq_msk[port];
-	sky2_write32(hw, B0_IMSK, imask);
-	sky2_read32(hw, B0_IMSK);
-
 	/* Force flow control off */
 	sky2_write8(hw, SK_REG(port, GMAC_CTRL), GMC_PAUSE_OFF);

@@ -1870,8 +1864,6 @@ static int sky2_down(struct net_device *dev)

 	sky2_write32(hw, RB_ADDR(txqaddr[port], RB_CTRL), RB_RST_SET);

-	sky2_rx_stop(sky2);
-
 	sky2_write8(hw, SK_REG(port, RX_GMF_CTRL_T), GMF_RST_SET);
 	sky2_write8(hw, SK_REG(port, TX_GMF_CTRL_T), GMF_RST_SET);

@@ -1881,6 +1873,14 @@ static int sky2_down(struct net_device *dev)
 	sky2_write32(hw, STAT_ISR_TIMER_CNT, 0);
 	sky2_read8(hw, STAT_ISR_TIMER_CTRL);

+	sky2_rx_stop(sky2);
+
+	/* Disable port IRQ */
+	imask = sky2_read32(hw, B0_IMSK);
+	imask &= ~portirq_msk[port];
+	sky2_write32(hw, B0_IMSK, imask);
+	sky2_read32(hw, B0_IMSK);
+
 	synchronize_irq(hw->pdev->irq);
 	napi_synchronize(&hw->napi);

-- 
1.5.6.5

  parent reply	other threads:[~2009-07-12  5:28 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-20  8:02 [PATCH] sky2: Avoid races in sky2_down Mike McCormack
     [not found] ` <20090707181807.5b69a926@nehalam>
     [not found]   ` <392fb48f0907072016i14cd650fv3524b345c79e498d@mail.gmail.com>
2009-07-12  5:28     ` Mike McCormack [this message]
2009-07-16 23:21       ` Stephen Hemminger
  -- strict thread matches above, loose matches on Subject: below --
2009-07-22  0:50 Mike McCormack
2009-07-22  4:00 ` David Miller

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=392fb48f0907112228v52624339x4f6c418ed0ee07a5@mail.gmail.com \
    --to=mikem@ring3k.org \
    --cc=netdev@vger.kernel.org \
    --cc=shemminger@linux-foundation.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).