netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] forcedeth: tx timeout fix
@ 2009-04-25 19:17 Ayaz Abdulla
  2009-04-26  1:16 ` David Miller
  2009-04-27 18:59 ` Andrew Morton
  0 siblings, 2 replies; 3+ messages in thread
From: Ayaz Abdulla @ 2009-04-25 19:17 UTC (permalink / raw)
  To: Jeff Garzik, Manfred Spraul, Andrew Morton, David S. Miller,
	nedev

[-- Attachment #1: Type: text/plain, Size: 222 bytes --]

This patch fixes the tx_timeout() to properly handle the clean up of the 
tx ring. It also sets the tx put pointer back to the correct position to 
be in sync with HW.

Signed-off-by: Ayaz Abdulla <aabdulla@nvidia.com>




[-- Attachment #2: patch-forcedeth-tx-timeout --]
[-- Type: text/plain, Size: 1827 bytes --]

--- old/drivers/net/forcedeth.c	2009-04-25 15:07:31.000000000 -0400
+++ new/drivers/net/forcedeth.c	2009-04-25 15:10:34.000000000 -0400
@@ -1880,6 +1880,7 @@
 	np->tx_pkts_in_progress = 0;
 	np->tx_change_owner = NULL;
 	np->tx_end_flip = NULL;
+	np->tx_stop = 0;
 
 	for (i = 0; i < np->tx_ring_size; i++) {
 		if (!nv_optimized(np)) {
@@ -2530,6 +2531,8 @@
 	struct fe_priv *np = netdev_priv(dev);
 	u8 __iomem *base = get_hwbase(dev);
 	u32 status;
+	union ring_type put_tx;
+	int saved_tx_limit;
 
 	if (np->msi_flags & NV_MSI_X_ENABLED)
 		status = readl(base + NvRegMSIXIrqStatus) & NVREG_IRQSTAT_MASK;
@@ -2589,24 +2592,32 @@
 	/* 1) stop tx engine */
 	nv_stop_tx(dev);
 
-	/* 2) check that the packets were not sent already: */
+	/* 2) complete any outstanding tx and do not give HW any limited tx pkts */
+	saved_tx_limit = np->tx_limit;
+	np->tx_limit = 0; /* prevent giving HW any limited pkts */
+	np->tx_stop = 0;  /* prevent waking tx queue */
 	if (!nv_optimized(np))
 		nv_tx_done(dev, np->tx_ring_size);
 	else
 		nv_tx_done_optimized(dev, np->tx_ring_size);
 
-	/* 3) if there are dead entries: clear everything */
-	if (np->get_tx_ctx != np->put_tx_ctx) {
-		printk(KERN_DEBUG "%s: tx_timeout: dead entries!\n", dev->name);
-		nv_drain_tx(dev);
-		nv_init_tx(dev);
-		setup_hw_rings(dev, NV_SETUP_TX_RING);
-	}
+	/* save current HW postion */
+	if (np->tx_change_owner)
+		put_tx.ex = np->tx_change_owner->first_tx_desc;
+	else
+		put_tx = np->put_tx;
 
-	netif_wake_queue(dev);
+	/* 3) clear all tx state */
+	nv_drain_tx(dev);
+	nv_init_tx(dev);
+
+	/* 4) restore state to current HW position */
+	np->get_tx = np->put_tx = put_tx;
+	np->tx_limit = saved_tx_limit;
 
-	/* 4) restart tx engine */
+	/* 5) restart tx engine */
 	nv_start_tx(dev);
+	netif_wake_queue(dev);
 	spin_unlock_irq(&np->lock);
 }
 

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

* Re: [PATCH] forcedeth: tx timeout fix
  2009-04-25 19:17 [PATCH] forcedeth: tx timeout fix Ayaz Abdulla
@ 2009-04-26  1:16 ` David Miller
  2009-04-27 18:59 ` Andrew Morton
  1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2009-04-26  1:16 UTC (permalink / raw)
  To: aabdulla; +Cc: jgarzik, manfred, akpm, netdev

From: Ayaz Abdulla <aabdulla@nvidia.com>
Date: Sat, 25 Apr 2009 15:17:56 -0400

> This patch fixes the tx_timeout() to properly handle the clean up of
> the tx ring. It also sets the tx put pointer back to the correct
> position to be in sync with HW.
> 
> Signed-off-by: Ayaz Abdulla <aabdulla@nvidia.com>

You don't need to CC: Jeff Garzik as he is no longer handling
network driver patches.

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

* Re: [PATCH] forcedeth: tx timeout fix
  2009-04-25 19:17 [PATCH] forcedeth: tx timeout fix Ayaz Abdulla
  2009-04-26  1:16 ` David Miller
@ 2009-04-27 18:59 ` Andrew Morton
  1 sibling, 0 replies; 3+ messages in thread
From: Andrew Morton @ 2009-04-27 18:59 UTC (permalink / raw)
  To: Ayaz Abdulla; +Cc: jgarzik, manfred, davem, netdev

On Sat, 25 Apr 2009 15:17:56 -0400
Ayaz Abdulla <aabdulla@nvidia.com> wrote:

> This patch fixes the tx_timeout() to properly handle the clean up of the 
> tx ring. It also sets the tx put pointer back to the correct position to 
> be in sync with HW.

It's unclear (to me) what the real-world impact of this bugfix is. 
There isn't enough information here to decide whether the fix should be
backported to 2.6.29 (and earlier?).  What is the user-visible
behaviour change?  What hardware does it affect?  What is the risk that
the change will inadvertently break other setups?  etc.

Please always provide such information in the changelogs.


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

end of thread, other threads:[~2009-04-27 19:02 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-04-25 19:17 [PATCH] forcedeth: tx timeout fix Ayaz Abdulla
2009-04-26  1:16 ` David Miller
2009-04-27 18:59 ` Andrew Morton

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