From: Stephen Hemminger <shemminger@vyatta•com>
To: Sven Joachim <svenjoac@gmx•de>
Cc: davem@davemloft•net, netdev@vger•kernel.org
Subject: [PATCH net-next] sky2: fix hang in napi_disable
Date: Thu, 17 Nov 2011 16:37:35 -0800 [thread overview]
Message-ID: <20111117163735.0a16660b@nehalam.linuxnetplumber.net> (raw)
In-Reply-To: <87r517w2z0.fsf@turtle.gmx.de>
If IRQ was never initialized, then calling napi_disable() would hang.
Add more bookkeeping to track whether IRQ was ever initialized.
Signed-off-by: Stephen Hemminger <shemminger@vyatta•com>
--- a/drivers/net/ethernet/marvell/sky2.c 2011-11-17 11:10:35.938076778 -0800
+++ b/drivers/net/ethernet/marvell/sky2.c 2011-11-17 11:15:49.527882932 -0800
@@ -1723,6 +1723,8 @@ static int sky2_setup_irq(struct sky2_hw
if (err)
dev_err(&pdev->dev, "cannot assign irq %d\n", pdev->irq);
else {
+ hw->flags |= SKY2_HW_IRQ_SETUP;
+
napi_enable(&hw->napi);
sky2_write32(hw, B0_IMSK, Y2_IS_BASE);
sky2_read32(hw, B0_IMSK);
@@ -2120,6 +2122,7 @@ static int sky2_close(struct net_device
napi_disable(&hw->napi);
free_irq(hw->pdev->irq, hw);
+ hw->flags &= ~SKY2_HW_IRQ_SETUP;
} else {
u32 imask;
@@ -3423,12 +3426,13 @@ static void sky2_all_down(struct sky2_hw
{
int i;
- sky2_read32(hw, B0_IMSK);
- sky2_write32(hw, B0_IMSK, 0);
+ if (hw->flags & SKY2_HW_IRQ_SETUP) {
+ sky2_read32(hw, B0_IMSK);
+ sky2_write32(hw, B0_IMSK, 0);
- if (hw->ports > 1 || netif_running(hw->dev[0]))
synchronize_irq(hw->pdev->irq);
- napi_disable(&hw->napi);
+ napi_disable(&hw->napi);
+ }
for (i = 0; i < hw->ports; i++) {
struct net_device *dev = hw->dev[i];
@@ -3445,7 +3449,7 @@ static void sky2_all_down(struct sky2_hw
static void sky2_all_up(struct sky2_hw *hw)
{
- u32 imask = 0;
+ u32 imask = Y2_IS_BASE;
int i;
for (i = 0; i < hw->ports; i++) {
@@ -3461,8 +3465,7 @@ static void sky2_all_up(struct sky2_hw *
netif_wake_queue(dev);
}
- if (imask || hw->ports > 1) {
- imask |= Y2_IS_BASE;
+ if (hw->flags & SKY2_HW_IRQ_SETUP) {
sky2_write32(hw, B0_IMSK, imask);
sky2_read32(hw, B0_IMSK);
sky2_read32(hw, B0_Y2_SP_LISR);
--- a/drivers/net/ethernet/marvell/sky2.h 2011-11-16 15:15:40.964280527 -0800
+++ b/drivers/net/ethernet/marvell/sky2.h 2011-11-17 11:13:00.154858718 -0800
@@ -2287,6 +2287,7 @@ struct sky2_hw {
#define SKY2_HW_RSS_BROKEN 0x00000100
#define SKY2_HW_VLAN_BROKEN 0x00000200
#define SKY2_HW_RSS_CHKSUM 0x00000400 /* RSS requires chksum */
+#define SKY2_HW_IRQ_SETUP 0x00000800
u8 chip_id;
u8 chip_rev;
next prev parent reply other threads:[~2011-11-18 0:37 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-11-16 23:42 [PATCH 0/6] sky2 patches for net-next Stephen Hemminger
2011-11-16 23:42 ` [PATCH 1/6] sky2: fix hang on shutdown (and other irq issues) Stephen Hemminger
2011-11-17 8:46 ` Sven Joachim
2011-11-17 17:01 ` Stephen Hemminger
2011-11-17 18:37 ` Sven Joachim
2011-11-17 19:18 ` Stephen Hemminger
2011-11-17 20:57 ` Sven Joachim
2011-11-18 0:37 ` Stephen Hemminger [this message]
2011-11-18 1:52 ` [PATCH net-next] sky2: fix hang in napi_disable David Miller
2011-11-18 2:10 ` Stephen Hemminger
2011-11-18 2:15 ` David Miller
2011-11-18 2:44 ` David Miller
2011-11-16 23:42 ` [PATCH 2/6] sky2: pci posting issues Stephen Hemminger
2011-11-16 23:42 ` [PATCH 3/6] sky2: rename up/down functions Stephen Hemminger
2011-11-16 23:42 ` [PATCH 4/6] sky2: reduce default Tx ring size Stephen Hemminger
2011-11-17 21:07 ` Sven Joachim
2011-11-17 22:41 ` Stephen Hemminger
2011-11-18 0:37 ` [PATCH net-next] sky2: enforce minimum " Stephen Hemminger
2011-11-18 2:44 ` David Miller
2011-11-16 23:42 ` [PATCH 5/6] sky2: used fixed RSS key Stephen Hemminger
2011-11-16 23:43 ` [PATCH 6/6] sky2: version 1.30 Stephen Hemminger
2011-11-17 1:36 ` [PATCH 0/6] sky2 patches for net-next 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=20111117163735.0a16660b@nehalam.linuxnetplumber.net \
--to=shemminger@vyatta$(echo .)com \
--cc=davem@davemloft$(echo .)net \
--cc=netdev@vger$(echo .)kernel.org \
--cc=svenjoac@gmx$(echo .)de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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