linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] ucc_geth: Some more fixes
@ 2009-12-24 15:30 Anton Vorontsov
  2009-12-24 15:31 ` [PATCH 1/3] ucc_geth: Fix empty TX queue processing Anton Vorontsov
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Anton Vorontsov @ 2009-12-24 15:30 UTC (permalink / raw)
  To: David Miller; +Cc: linuxppc-dev, netdev, Lennart Sorensen

Hi all,

Here are some more fixes and one small enhancement for the ucc_geth
driver.

Thanks,

-- 
Anton Vorontsov
email: cbouatmailru@gmail.com
irc://irc.freenode.net/bd2

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

* [PATCH 1/3] ucc_geth: Fix empty TX queue processing
  2009-12-24 15:30 [PATCH 0/3] ucc_geth: Some more fixes Anton Vorontsov
@ 2009-12-24 15:31 ` Anton Vorontsov
  2009-12-24 15:31 ` [PATCH 2/3] ucc_geth: Fix netdev watchdog triggering on link changes Anton Vorontsov
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Anton Vorontsov @ 2009-12-24 15:31 UTC (permalink / raw)
  To: David Miller; +Cc: linuxppc-dev, netdev, Lennart Sorensen

Following oops was seen with the ucc_geth driver:

 Unable to handle kernel paging request for data at address 0x00000058
 Faulting instruction address: 0xc024f2fc
 Oops: Kernel access of bad area, sig: 11 [#1]
 [...]
 NIP [c024f2fc] skb_recycle_check+0x14/0x100
 LR [e30aa0a4] ucc_geth_poll+0xd8/0x4e0 [ucc_geth_driver]
 Call Trace:
 [df857d50] [c000b03c] __ipipe_grab_irq+0x3c/0xa4 (unreliable)
 [df857d60] [e30aa0a4] ucc_geth_poll+0xd8/0x4e0 [ucc_geth_driver]
 [df857dd0] [c0258cf8] net_rx_action+0xf8/0x1b8
 [df857e10] [c0032a38] __do_softirq+0xb8/0x13c
 [df857e60] [c00065cc] do_softirq+0xa0/0xac
 [...]

This is because ucc_geth_tx() tries to process an empty queue when
queues are logically stopped. Stopping the queues doesn't disable
polling, and since nowadays ucc_geth_tx() is actually called from
the polling routine, the oops above might pop up.

Fix this by removing 'netif_queue_stopped() == 0' check.

Reported-by: Lennart Sorensen <lsorense@csclub.uwaterloo.ca>
Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
Tested-by: Lennart Sorensen <lsorense@csclub.uwaterloo.ca>
Cc: Stable <stable@vger.kernel.org> [2.6.32]
---
 drivers/net/ucc_geth.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/net/ucc_geth.c b/drivers/net/ucc_geth.c
index afaf088..0f8c99e 100644
--- a/drivers/net/ucc_geth.c
+++ b/drivers/net/ucc_geth.c
@@ -3273,7 +3273,7 @@ static int ucc_geth_tx(struct net_device *dev, u8 txQ)
 		/* Handle the transmitted buffer and release */
 		/* the BD to be used with the current frame  */
 
-		if ((bd == ugeth->txBd[txQ]) && (netif_queue_stopped(dev) == 0))
+		if (bd == ugeth->txBd[txQ]) /* queue empty? */
 			break;
 
 		dev->stats.tx_packets++;
-- 
1.6.3.3

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

* [PATCH 2/3] ucc_geth: Fix netdev watchdog triggering on link changes
  2009-12-24 15:30 [PATCH 0/3] ucc_geth: Some more fixes Anton Vorontsov
  2009-12-24 15:31 ` [PATCH 1/3] ucc_geth: Fix empty TX queue processing Anton Vorontsov
@ 2009-12-24 15:31 ` Anton Vorontsov
  2009-12-24 15:31 ` [PATCH 3/3] ucc_geth: Don't needlessly change MAC settings in adjust_link() Anton Vorontsov
  2009-12-27  4:25 ` [PATCH 0/3] ucc_geth: Some more fixes David Miller
  3 siblings, 0 replies; 5+ messages in thread
From: Anton Vorontsov @ 2009-12-24 15:31 UTC (permalink / raw)
  To: David Miller; +Cc: linuxppc-dev, netdev, Lennart Sorensen

Since commit 864fdf884e82bacbe8ca5e93bd43393a61d2e2b4 ("ucc_geth:
Fix hangs after switching from full to half duplex") ucc_geth driver
disables the controller during MAC configuration changes. Though,
disabling the controller might take quite awhile, and so the netdev
watchdog might get upset:

 NETDEV WATCHDOG: eth2 (ucc_geth): transmit queue 0 timed out
 ------------[ cut here ]------------
 Badness at c02729a8 [verbose debug info unavailable]
 NIP: c02729a8 LR: c02729a8 CTR: c01b6088
 REGS: c0451c40 TRAP: 0700   Not tainted  (2.6.32-trunk-8360e)
 [...]
 NIP [c02729a8] dev_watchdog+0x280/0x290
 LR [c02729a8] dev_watchdog+0x280/0x290
 Call Trace:
 [c0451cf0] [c02729a8] dev_watchdog+0x280/0x290 (unreliable)
 [c0451d50] [c00377c4] run_timer_softirq+0x164/0x224
 [c0451da0] [c0032a38] __do_softirq+0xb8/0x13c
 [c0451df0] [c00065cc] do_softirq+0xa0/0xac
 [c0451e00] [c003280c] irq_exit+0x7c/0x9c
 [c0451e10] [c00640c4] __ipipe_sync_stage+0x248/0x24c
 [...]

This patch fixes the issue by detaching the netdev during the
time we change the configuration.

Reported-by: Lennart Sorensen <lsorense@csclub.uwaterloo.ca>
Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
Tested-by: Lennart Sorensen <lsorense@csclub.uwaterloo.ca>
Cc: Stable <stable@vger.kernel.org> [2.6.32]
---
 drivers/net/ucc_geth.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ucc_geth.c b/drivers/net/ucc_geth.c
index 0f8c99e..7fff4c5 100644
--- a/drivers/net/ucc_geth.c
+++ b/drivers/net/ucc_geth.c
@@ -1563,7 +1563,10 @@ static int ugeth_disable(struct ucc_geth_private *ugeth, enum comm_dir mode)
 
 static void ugeth_quiesce(struct ucc_geth_private *ugeth)
 {
-	/* Wait for and prevent any further xmits. */
+	/* Prevent any further xmits, plus detach the device. */
+	netif_device_detach(ugeth->ndev);
+
+	/* Wait for any current xmits to finish. */
 	netif_tx_disable(ugeth->ndev);
 
 	/* Disable the interrupt to avoid NAPI rescheduling. */
@@ -1577,7 +1580,7 @@ static void ugeth_activate(struct ucc_geth_private *ugeth)
 {
 	napi_enable(&ugeth->napi);
 	enable_irq(ugeth->ug_info->uf_info.irq);
-	netif_tx_wake_all_queues(ugeth->ndev);
+	netif_device_attach(ugeth->ndev);
 }
 
 /* Called every time the controller might need to be made
-- 
1.6.3.3

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

* [PATCH 3/3] ucc_geth: Don't needlessly change MAC settings in adjust_link()
  2009-12-24 15:30 [PATCH 0/3] ucc_geth: Some more fixes Anton Vorontsov
  2009-12-24 15:31 ` [PATCH 1/3] ucc_geth: Fix empty TX queue processing Anton Vorontsov
  2009-12-24 15:31 ` [PATCH 2/3] ucc_geth: Fix netdev watchdog triggering on link changes Anton Vorontsov
@ 2009-12-24 15:31 ` Anton Vorontsov
  2009-12-27  4:25 ` [PATCH 0/3] ucc_geth: Some more fixes David Miller
  3 siblings, 0 replies; 5+ messages in thread
From: Anton Vorontsov @ 2009-12-24 15:31 UTC (permalink / raw)
  To: David Miller; +Cc: linuxppc-dev, netdev, Lennart Sorensen

If PHY doesn't have an IRQ, phylib would poll for link changes, and
would call adjust_link() every second. In that case we disable and
enable the controller every second.

Let's better check if there is actually anything changed, and, if so,
change the MAC settings.

Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
---
 drivers/net/ucc_geth.c |   33 ++++++++++++++++++---------------
 1 files changed, 18 insertions(+), 15 deletions(-)

diff --git a/drivers/net/ucc_geth.c b/drivers/net/ucc_geth.c
index 7fff4c5..41ad2f3 100644
--- a/drivers/net/ucc_geth.c
+++ b/drivers/net/ucc_geth.c
@@ -1651,25 +1651,28 @@ static void adjust_link(struct net_device *dev)
 			ugeth->oldspeed = phydev->speed;
 		}
 
-		/*
-		 * To change the MAC configuration we need to disable the
-		 * controller. To do so, we have to either grab ugeth->lock,
-		 * which is a bad idea since 'graceful stop' commands might
-		 * take quite a while, or we can quiesce driver's activity.
-		 */
-		ugeth_quiesce(ugeth);
-		ugeth_disable(ugeth, COMM_DIR_RX_AND_TX);
-
-		out_be32(&ug_regs->maccfg2, tempval);
-		out_be32(&uf_regs->upsmr, upsmr);
-
-		ugeth_enable(ugeth, COMM_DIR_RX_AND_TX);
-		ugeth_activate(ugeth);
-
 		if (!ugeth->oldlink) {
 			new_state = 1;
 			ugeth->oldlink = 1;
 		}
+
+		if (new_state) {
+			/*
+			 * To change the MAC configuration we need to disable
+			 * the controller. To do so, we have to either grab
+			 * ugeth->lock, which is a bad idea since 'graceful
+			 * stop' commands might take quite a while, or we can
+			 * quiesce driver's activity.
+			 */
+			ugeth_quiesce(ugeth);
+			ugeth_disable(ugeth, COMM_DIR_RX_AND_TX);
+
+			out_be32(&ug_regs->maccfg2, tempval);
+			out_be32(&uf_regs->upsmr, upsmr);
+
+			ugeth_enable(ugeth, COMM_DIR_RX_AND_TX);
+			ugeth_activate(ugeth);
+		}
 	} else if (ugeth->oldlink) {
 			new_state = 1;
 			ugeth->oldlink = 0;
-- 
1.6.3.3

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

* Re: [PATCH 0/3] ucc_geth: Some more fixes
  2009-12-24 15:30 [PATCH 0/3] ucc_geth: Some more fixes Anton Vorontsov
                   ` (2 preceding siblings ...)
  2009-12-24 15:31 ` [PATCH 3/3] ucc_geth: Don't needlessly change MAC settings in adjust_link() Anton Vorontsov
@ 2009-12-27  4:25 ` David Miller
  3 siblings, 0 replies; 5+ messages in thread
From: David Miller @ 2009-12-27  4:25 UTC (permalink / raw)
  To: avorontsov; +Cc: linuxppc-dev, netdev, lsorense

From: Anton Vorontsov <avorontsov@ru.mvista.com>
Date: Thu, 24 Dec 2009 18:30:34 +0300

> Here are some more fixes and one small enhancement for the ucc_geth
> driver.

All 3 patches applied, thanks a lot!

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

end of thread, other threads:[~2009-12-27  4:25 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-12-24 15:30 [PATCH 0/3] ucc_geth: Some more fixes Anton Vorontsov
2009-12-24 15:31 ` [PATCH 1/3] ucc_geth: Fix empty TX queue processing Anton Vorontsov
2009-12-24 15:31 ` [PATCH 2/3] ucc_geth: Fix netdev watchdog triggering on link changes Anton Vorontsov
2009-12-24 15:31 ` [PATCH 3/3] ucc_geth: Don't needlessly change MAC settings in adjust_link() Anton Vorontsov
2009-12-27  4:25 ` [PATCH 0/3] ucc_geth: Some more fixes 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).