From: Stephen Hemminger <shemminger@vyatta.com>
To: David Miller <davem@davemloft.net>, Mike McCormack <mikem@ring3k.org>
Cc: netdev@vger.kernel.org
Subject: [PATCH 4/6] sky2: Refactor down/up code out of sky2_restart()
Date: Thu, 13 May 2010 09:12:51 -0700 [thread overview]
Message-ID: <20100513161351.257776304@vyatta.com> (raw)
In-Reply-To: 20100513161247.833356588@vyatta.com
[-- Attachment #1: sky2-mike4.patch --]
[-- Type: text/plain, Size: 1894 bytes --]
From: Mike McCormack <mikem@ring3k.org>
Code to bring down all sky2 interfaces and bring it up
again can be reused in sky2_suspend and sky2_resume.
Factor the code to bring the interfaces down into
sky2_all_down and the up code into sky2_all_up.
Signed-off-by: Mike McCormack <mikem@ring3k.org>
Acked-by: Stephen Hemminger <shemminger@vyatta.com>
---
Not a regression.
drivers/net/sky2.c | 26 +++++++++++++++++++-------
1 files changed, 19 insertions(+), 7 deletions(-)
--- a/drivers/net/sky2.c 2010-05-13 08:57:32.736962641 -0700
+++ b/drivers/net/sky2.c 2010-05-13 08:57:33.337275609 -0700
@@ -3312,15 +3312,11 @@ static int sky2_reattach(struct net_devi
return err;
}
-static void sky2_restart(struct work_struct *work)
+static void sky2_all_down(struct sky2_hw *hw)
{
- struct sky2_hw *hw = container_of(work, struct sky2_hw, restart_work);
- u32 imask;
int i;
- rtnl_lock();
-
- imask = sky2_read32(hw, B0_IMSK);
+ sky2_read32(hw, B0_IMSK);
sky2_write32(hw, B0_IMSK, 0);
synchronize_irq(hw->pdev->irq);
napi_disable(&hw->napi);
@@ -3336,8 +3332,12 @@ static void sky2_restart(struct work_str
netif_tx_disable(dev);
sky2_hw_down(sky2);
}
+}
- sky2_reset(hw);
+static void sky2_all_up(struct sky2_hw *hw)
+{
+ u32 imask = Y2_IS_BASE;
+ int i;
for (i = 0; i < hw->ports; i++) {
struct net_device *dev = hw->dev[i];
@@ -3348,6 +3348,7 @@ static void sky2_restart(struct work_str
sky2_hw_up(sky2);
sky2_set_multicast(dev);
+ imask |= portirq_msk[i];
netif_wake_queue(dev);
}
@@ -3356,6 +3357,17 @@ static void sky2_restart(struct work_str
sky2_read32(hw, B0_Y2_SP_LISR);
napi_enable(&hw->napi);
+}
+
+static void sky2_restart(struct work_struct *work)
+{
+ struct sky2_hw *hw = container_of(work, struct sky2_hw, restart_work);
+
+ rtnl_lock();
+
+ sky2_all_down(hw);
+ sky2_reset(hw);
+ sky2_all_up(hw);
rtnl_unlock();
}
next prev parent reply other threads:[~2010-05-13 23:30 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-05-13 16:12 [PATCH 0/6] sky2: update Stephen Hemminger
2010-05-13 16:12 ` [PATCH 1/6] sky2: Restore multicast after restart Stephen Hemminger
2010-05-13 16:12 ` [PATCH 2/6] sky2: Avoid race in sky2_change_mtu Stephen Hemminger
2010-05-13 16:12 ` [PATCH 3/6] sky2: Shut off interrupts before NAPI Stephen Hemminger
2010-05-13 16:12 ` Stephen Hemminger [this message]
2010-05-13 16:12 ` [PATCH 5/6] sky2: Avoid allocating memory in sky2_resume Stephen Hemminger
2010-05-13 16:12 ` [PATCH 6/6] sky2: version 1.28 Stephen Hemminger
2010-05-14 10:15 ` [PATCH 0/6] sky2: update David Miller
2010-05-14 15:19 ` Stephen Hemminger
2010-05-17 16:55 ` 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=20100513161351.257776304@vyatta.com \
--to=shemminger@vyatta.com \
--cc=davem@davemloft.net \
--cc=mikem@ring3k.org \
--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.