All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stephen Hemminger <shemminger@vyatta.com>
To: davem@davemloft.net
Cc: netdev@vger.kernel.org
Subject: [PATCH 4/9] sky2: fix shutdown synchronization
Date: Wed, 17 Jun 2009 10:30:35 -0700	[thread overview]
Message-ID: <20090617173139.828049268@vyatta.com> (raw)
In-Reply-To: 20090617173031.703636683@vyatta.com

[-- Attachment #1: sky2-rxsync-shut.patch --]
[-- Type: text/plain, Size: 1586 bytes --]

The logic in sky2_down was incorrect. Receiver could report status
after rx_stop was called.

The steps need to be:
   * stop new frames from being transmitted
   * shut off transmit/receive logic
   * synchronize with NAPI to process status info about transmitter
     and receiver

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>

--- a/drivers/net/sky2.c	2009-06-17 10:29:53.382997969 -0700
+++ b/drivers/net/sky2.c	2009-06-17 10:29:55.361810536 -0700
@@ -1815,8 +1815,6 @@ static int sky2_down(struct net_device *
 	sky2_write32(hw, B0_IMSK, imask);
 	sky2_read32(hw, B0_IMSK);
 
-	synchronize_irq(hw->pdev->irq);
-
 	/* Force flow control off */
 	sky2_write8(hw, SK_REG(port, GMAC_CTRL), GMC_PAUSE_OFF);
 
@@ -1831,9 +1829,6 @@ static int sky2_down(struct net_device *
 	ctrl &= ~(GM_GPCR_TX_ENA | GM_GPCR_RX_ENA);
 	gma_write16(hw, port, GM_GP_CTRL, ctrl);
 
-	/* Make sure no packets are pending */
-	napi_synchronize(&hw->napi);
-
 	sky2_write8(hw, SK_REG(port, GPHY_CTRL), GPC_RST_SET);
 
 	/* Workaround shared GMAC reset */
@@ -1864,6 +1859,15 @@ static int sky2_down(struct net_device *
 	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);
 
+	/* Force any delayed status interrrupt and NAPI */
+	sky2_write32(hw, STAT_LEV_TIMER_CNT, 0);
+	sky2_write32(hw, STAT_TX_TIMER_CNT, 0);
+	sky2_write32(hw, STAT_ISR_TIMER_CNT, 0);
+	sky2_read8(hw, STAT_ISR_TIMER_CTRL);
+
+	synchronize_irq(hw->pdev->irq);
+	napi_synchronize(&hw->napi);
+
 	sky2_phy_power_down(hw, port);
 
 	/* turn off LED's */

-- 


  parent reply	other threads:[~2009-06-17 17:34 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-17 17:30 [PATCH 0/9] sky2 driver patches Stephen Hemminger
2009-06-17 17:30 ` [PATCH 1/9] sky2: turn off pause during shutdown Stephen Hemminger
2009-06-18  1:50   ` David Miller
2009-06-17 17:30 ` [PATCH 2/9] sky2: more receive shutdown Stephen Hemminger
2009-06-18  1:50   ` David Miller
2009-06-20  7:14   ` Graham Murray
2009-06-22  5:13     ` Graham Murray
2009-06-17 17:30 ` [PATCH 3/9] sky2: PCI irq issues Stephen Hemminger
2009-06-18  1:50   ` David Miller
2009-06-17 17:30 ` Stephen Hemminger [this message]
2009-06-18  1:50   ` [PATCH 4/9] sky2: fix shutdown synchronization David Miller
2009-06-18 23:25   ` Mike McCormack
2009-06-18 23:41     ` Stephen Hemminger
2009-06-18 23:53       ` Mike McCormack
2009-06-17 17:30 ` [PATCH 5/9] sky2: receive counter update Stephen Hemminger
2009-06-18  1:51   ` David Miller
2009-06-17 17:30 ` [PATCH 6/9] sky2: reduce default transmit ring Stephen Hemminger
2009-06-18  1:51   ` David Miller
2009-06-17 17:30 ` [PATCH 7/9] sky2: skb recycling Stephen Hemminger
2009-06-18  1:51   ` David Miller
2009-06-18 21:13   ` Brandeburg, Jesse
2009-06-18 21:22     ` Stephen Hemminger
2009-06-17 17:30 ` [PATCH 8/9] sky2: add GRO support Stephen Hemminger
2009-06-18  1:52   ` David Miller
2009-06-17 17:30 ` [PATCH 9/9] sky2: version 1.23 Stephen Hemminger
2009-06-18  1:52   ` 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=20090617173139.828049268@vyatta.com \
    --to=shemminger@vyatta.com \
    --cc=davem@davemloft.net \
    --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.