netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/6] sky2: update
@ 2010-05-13 16:12 Stephen Hemminger
  2010-05-13 16:12 ` [PATCH 1/6] sky2: Restore multicast after restart Stephen Hemminger
                   ` (6 more replies)
  0 siblings, 7 replies; 10+ messages in thread
From: Stephen Hemminger @ 2010-05-13 16:12 UTC (permalink / raw)
  To: David Miller, Mike McCormack; +Cc: netdev

Bunch of patches from Mike, with some additional comments.



^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH 1/6] sky2: Restore multicast after restart
  2010-05-13 16:12 [PATCH 0/6] sky2: update Stephen Hemminger
@ 2010-05-13 16:12 ` Stephen Hemminger
  2010-05-13 16:12 ` [PATCH 2/6] sky2: Avoid race in sky2_change_mtu Stephen Hemminger
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 10+ messages in thread
From: Stephen Hemminger @ 2010-05-13 16:12 UTC (permalink / raw)
  To: David Miller, Mike McCormack; +Cc: netdev

[-- Attachment #1: sky2-mike2.patch --]
[-- Type: text/plain, Size: 744 bytes --]

From: Mike McCormack <mikem@ring3k.org>

Multicast settings will be lost on reset, so restore them.

Signed-off-by: Mike McCormack <mikem@ring3k.org>
Acked-by: Stephen Hemminger <shemminger@vyatta.com>
---
This regression was introduced in 2.6.34 by
  commit 8a0c9228f110218f443d9ef8f9ab629251959733
  sky2: Avoid down and up during sky2_reset

So please apply to -net as well.


 drivers/net/sky2.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

--- a/drivers/net/sky2.c	2010-05-13 09:02:37.756960274 -0700
+++ b/drivers/net/sky2.c	2010-05-13 09:02:53.528209351 -0700
@@ -3347,6 +3347,7 @@ static void sky2_restart(struct work_str
 			continue;
 
 		sky2_hw_up(sky2);
+		sky2_set_multicast(dev);
 		netif_wake_queue(dev);
 	}
 



^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH 2/6] sky2: Avoid race in sky2_change_mtu
  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 ` Stephen Hemminger
  2010-05-13 16:12 ` [PATCH 3/6] sky2: Shut off interrupts before NAPI Stephen Hemminger
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 10+ messages in thread
From: Stephen Hemminger @ 2010-05-13 16:12 UTC (permalink / raw)
  To: David Miller, Mike McCormack; +Cc: netdev

[-- Attachment #1: sky2-mike1.patch --]
[-- Type: text/plain, Size: 888 bytes --]

From: Mike McCormack <mikem@ring3k.org>

netif_stop_queue does not ensure all in-progress transmits are complete,
 so use netif_tx_disable() instead.

Secondly, make sure NAPI polls are disabled before stopping the tx queue,
 otherwise sky2_status_intr might trigger a TX queue wakeup between when
 we stop the queue and NAPI is disabled.

Signed-off-by: Mike McCormack <mikem@ring3k.org>
Acked-by: Stephen Hemminger <shemminger@vyatta.com>

---
This is not a regression, so only apply to -next


--- a/drivers/net/sky2.c	2010-05-13 08:57:20.186332415 -0700
+++ b/drivers/net/sky2.c	2010-05-13 08:57:22.526983099 -0700
@@ -2275,8 +2275,8 @@ static int sky2_change_mtu(struct net_de
 	sky2_write32(hw, B0_IMSK, 0);
 
 	dev->trans_start = jiffies;	/* prevent tx timeout */
-	netif_stop_queue(dev);
 	napi_disable(&hw->napi);
+	netif_tx_disable(dev);
 
 	synchronize_irq(hw->pdev->irq);
 



^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH 3/6] sky2: Shut off interrupts before NAPI
  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 ` Stephen Hemminger
  2010-05-13 16:12 ` [PATCH 4/6] sky2: Refactor down/up code out of sky2_restart() Stephen Hemminger
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 10+ messages in thread
From: Stephen Hemminger @ 2010-05-13 16:12 UTC (permalink / raw)
  To: David Miller, Mike McCormack; +Cc: netdev

[-- Attachment #1: sky2-mike3.patch --]
[-- Type: text/plain, Size: 749 bytes --]

From: Mike McCormack <mikem@ring3k.org>

Interrupts should be masked, then synchronized, and
finally NAPI should be disabled.

Signed-off-by: Mike McCormack <mikem@ring3k.org>
Acked-by: Stephen Hemminger <shemminger@vyatta.com>

---
Not a regression, only apply to -next


--- a/drivers/net/sky2.c	2010-05-13 08:57:31.127627401 -0700
+++ b/drivers/net/sky2.c	2010-05-13 08:57:32.736962641 -0700
@@ -3320,10 +3320,10 @@ static void sky2_restart(struct work_str
 
 	rtnl_lock();
 
-	napi_disable(&hw->napi);
-	synchronize_irq(hw->pdev->irq);
 	imask = sky2_read32(hw, B0_IMSK);
 	sky2_write32(hw, B0_IMSK, 0);
+	synchronize_irq(hw->pdev->irq);
+	napi_disable(&hw->napi);
 
 	for (i = 0; i < hw->ports; i++) {
 		struct net_device *dev = hw->dev[i];



^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH 4/6] sky2: Refactor down/up code out of sky2_restart()
  2010-05-13 16:12 [PATCH 0/6] sky2: update Stephen Hemminger
                   ` (2 preceding siblings ...)
  2010-05-13 16:12 ` [PATCH 3/6] sky2: Shut off interrupts before NAPI Stephen Hemminger
@ 2010-05-13 16:12 ` Stephen Hemminger
  2010-05-13 16:12 ` [PATCH 5/6] sky2: Avoid allocating memory in sky2_resume Stephen Hemminger
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 10+ messages in thread
From: Stephen Hemminger @ 2010-05-13 16:12 UTC (permalink / raw)
  To: David Miller, Mike McCormack; +Cc: netdev

[-- 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();
 }



^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH 5/6] sky2: Avoid allocating memory in sky2_resume
  2010-05-13 16:12 [PATCH 0/6] sky2: update Stephen Hemminger
                   ` (3 preceding siblings ...)
  2010-05-13 16:12 ` [PATCH 4/6] sky2: Refactor down/up code out of sky2_restart() Stephen Hemminger
@ 2010-05-13 16:12 ` 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
  6 siblings, 0 replies; 10+ messages in thread
From: Stephen Hemminger @ 2010-05-13 16:12 UTC (permalink / raw)
  To: David Miller, Mike McCormack; +Cc: netdev

[-- Attachment #1: sky2-mike5.patch --]
[-- Type: text/plain, Size: 1988 bytes --]

From: Mike McCormack <mikem@ring3k.org>

Allocating memory can fail, and since we have the memory we need
in sky2_resume when sky2_suspend is called, just stop the hardware
without freeing the memory it's using.

This avoids the possibility of failing because we can't allocate
memory in sky2_resume(), and allows sharing code with sky2_restart().

Signed-off-by: Mike McCormack <mikem@ring3k.org>
Acked-by: Stephen Hemminger <shemminger@vyatta.com>

---
Not a regression

 drivers/net/sky2.c |   20 +++++---------------
 1 files changed, 5 insertions(+), 15 deletions(-)

--- a/drivers/net/sky2.c	2010-05-13 08:57:33.337275609 -0700
+++ b/drivers/net/sky2.c	2010-05-13 08:57:33.907302370 -0700
@@ -4926,12 +4926,12 @@ static int sky2_suspend(struct pci_dev *
 	cancel_work_sync(&hw->restart_work);
 
 	rtnl_lock();
+
+	sky2_all_down(hw);
 	for (i = 0; i < hw->ports; i++) {
 		struct net_device *dev = hw->dev[i];
 		struct sky2_port *sky2 = netdev_priv(dev);
 
-		sky2_detach(dev);
-
 		if (sky2->wol)
 			sky2_wol_init(sky2);
 
@@ -4940,8 +4940,6 @@ static int sky2_suspend(struct pci_dev *
 
 	device_set_wakeup_enable(&pdev->dev, wol != 0);
 
-	sky2_write32(hw, B0_IMSK, 0);
-	napi_disable(&hw->napi);
 	sky2_power_aux(hw);
 	rtnl_unlock();
 
@@ -4956,12 +4954,11 @@ static int sky2_suspend(struct pci_dev *
 static int sky2_resume(struct pci_dev *pdev)
 {
 	struct sky2_hw *hw = pci_get_drvdata(pdev);
-	int i, err;
+	int err;
 
 	if (!hw)
 		return 0;
 
-	rtnl_lock();
 	err = pci_set_power_state(pdev, PCI_D0);
 	if (err)
 		goto out;
@@ -4979,20 +4976,13 @@ static int sky2_resume(struct pci_dev *p
 		goto out;
 	}
 
+	rtnl_lock();
 	sky2_reset(hw);
-	sky2_write32(hw, B0_IMSK, Y2_IS_BASE);
-	napi_enable(&hw->napi);
-
-	for (i = 0; i < hw->ports; i++) {
-		err = sky2_reattach(hw->dev[i]);
-		if (err)
-			goto out;
-	}
+	sky2_all_up(hw);
 	rtnl_unlock();
 
 	return 0;
 out:
-	rtnl_unlock();
 
 	dev_err(&pdev->dev, "resume failed (%d)\n", err);
 	pci_disable_device(pdev);



^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH 6/6] sky2: version 1.28
  2010-05-13 16:12 [PATCH 0/6] sky2: update Stephen Hemminger
                   ` (4 preceding siblings ...)
  2010-05-13 16:12 ` [PATCH 5/6] sky2: Avoid allocating memory in sky2_resume Stephen Hemminger
@ 2010-05-13 16:12 ` Stephen Hemminger
  2010-05-14 10:15 ` [PATCH 0/6] sky2: update David Miller
  6 siblings, 0 replies; 10+ messages in thread
From: Stephen Hemminger @ 2010-05-13 16:12 UTC (permalink / raw)
  To: David Miller, Mike McCormack; +Cc: netdev

[-- Attachment #1: sky2-1.28.patch --]
[-- Type: text/plain, Size: 401 bytes --]

Version 1.28

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

--- a/drivers/net/sky2.c	2010-05-13 09:11:26.947584759 -0700
+++ b/drivers/net/sky2.c	2010-05-13 09:11:35.827269492 -0700
@@ -53,7 +53,7 @@
 #include "sky2.h"
 
 #define DRV_NAME		"sky2"
-#define DRV_VERSION		"1.27"
+#define DRV_VERSION		"1.28"
 
 /*
  * The Yukon II chipset takes 64 bit command blocks (called list elements)



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 0/6] sky2: update
  2010-05-13 16:12 [PATCH 0/6] sky2: update Stephen Hemminger
                   ` (5 preceding siblings ...)
  2010-05-13 16:12 ` [PATCH 6/6] sky2: version 1.28 Stephen Hemminger
@ 2010-05-14 10:15 ` David Miller
  2010-05-14 15:19   ` Stephen Hemminger
  6 siblings, 1 reply; 10+ messages in thread
From: David Miller @ 2010-05-14 10:15 UTC (permalink / raw)
  To: shemminger; +Cc: mikem, netdev

From: Stephen Hemminger <shemminger@vyatta.com>
Date: Thu, 13 May 2010 09:12:47 -0700

> Bunch of patches from Mike, with some additional comments.

All applied to net-next-2.6, thanks.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 0/6] sky2: update
  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
  0 siblings, 1 reply; 10+ messages in thread
From: Stephen Hemminger @ 2010-05-14 15:19 UTC (permalink / raw)
  To: David Miller; +Cc: mikem, netdev

On Fri, 14 May 2010 03:15:01 -0700 (PDT)
David Miller <davem@davemloft.net> wrote:

> From: Stephen Hemminger <shemminger@vyatta.com>
> Date: Thu, 13 May 2010 09:12:47 -0700
> 
> > Bunch of patches from Mike, with some additional comments.
> 
> All applied to net-next-2.6, thanks.

The first one needs to go to net-2.6 because it a regression:
Current code will lose multicast addresses when the automatic
recovery from stuck chip happens. Auto recovery happens a lot
under load on some configurations.

-- 

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 0/6] sky2: update
  2010-05-14 15:19   ` Stephen Hemminger
@ 2010-05-17 16:55     ` David Miller
  0 siblings, 0 replies; 10+ messages in thread
From: David Miller @ 2010-05-17 16:55 UTC (permalink / raw)
  To: shemminger; +Cc: mikem, netdev

From: Stephen Hemminger <shemminger@vyatta.com>
Date: Fri, 14 May 2010 08:19:57 -0700

> On Fri, 14 May 2010 03:15:01 -0700 (PDT)
> David Miller <davem@davemloft.net> wrote:
> 
>> From: Stephen Hemminger <shemminger@vyatta.com>
>> Date: Thu, 13 May 2010 09:12:47 -0700
>> 
>> > Bunch of patches from Mike, with some additional comments.
>> 
>> All applied to net-next-2.6, thanks.
> 
> The first one needs to go to net-2.6 because it a regression:
> Current code will lose multicast addresses when the automatic
> recovery from stuck chip happens. Auto recovery happens a lot
> under load on some configurations.

2.6.34 got released yesterday, so it is a moot point.

Just submit it to -stable.

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2010-05-17 16:54 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 ` [PATCH 4/6] sky2: Refactor down/up code out of sky2_restart() Stephen Hemminger
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

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).