diff mbox

sky2: Serialize access to PCI config space

Message ID 4A7EB4EF.3030106@ring3k.org
State Changes Requested, archived
Delegated to: David Miller
Headers show

Commit Message

Mike McCormack Aug. 9, 2009, 11:37 a.m. UTC
Disable NAPI when powering up or down the phy, as sky2_err_intr
 may also access the PCI config space.

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

Comments

Stephen Hemminger Aug. 10, 2009, 3:23 p.m. UTC | #1
On Sun, 09 Aug 2009 20:37:19 +0900
Mike McCormack <mikem@ring3k.org> wrote:

> 
> Disable NAPI when powering up or down the phy, as sky2_err_intr
>  may also access the PCI config space.

Maybe, but any sky2_err interrupt is a serious condition that
means hardware is being used incorrectly or dead.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Stephen Hemminger Aug. 10, 2009, 3:27 p.m. UTC | #2
On Sun, 09 Aug 2009 20:37:19 +0900
Mike McCormack <mikem@ring3k.org> wrote:

> 
> Disable NAPI when powering up or down the phy, as sky2_err_intr
>  may also access the PCI config space.
> 

Also access to PCI config is done through shared memory, so each
access is atomic. The only issue is the stupid config write bit;
this bit really doesn't protect from anything useful.
Probably better to just always leave it TST_CFG_WRITE_ON.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/net/sky2.c b/drivers/net/sky2.c
index 8e05d29..824a319 100644
--- a/drivers/net/sky2.c
+++ b/drivers/net/sky2.c
@@ -1448,7 +1448,9 @@  static int sky2_up(struct net_device *dev)
 	if (!sky2->rx_ring)
 		goto err_out;
 
+	napi_disable(&hw->napi);
 	sky2_mac_init(hw, port);
+	napi_enable(&hw->napi);
 
 	/* Register is number of 4K blocks on internal RAM buffer. */
 	ramsize = sky2_read8(hw, B2_E_0) * 4;
@@ -1880,13 +1882,16 @@  static int sky2_down(struct net_device *dev)
 	sky2_write32(hw, B0_IMSK, imask);
 	sky2_read32(hw, B0_IMSK);
 
+	/* after this, there should be no more interrupts for this port */
 	synchronize_irq(hw->pdev->irq);
-	napi_synchronize(&hw->napi);
+	napi_disable(&hw->napi);
 
 	spin_lock_bh(&sky2->phy_lock);
 	sky2_phy_power_down(hw, port);
 	spin_unlock_bh(&sky2->phy_lock);
 
+	napi_enable(&hw->napi);
+
 	/* turn off LED's */
 	sky2_write16(hw, B0_Y2LED, LED_STAT_OFF);