Thread (8 messages) 8 messages, 3 authors, 2009-03-04

Re: [PATCH] net: more timeouts that reach -1

From: "Guo-Fu Tseng" <cooldavid@cooldavid.org>
Date: 2009-02-27 15:52:34

On Fri, 27 Feb 2009 16:37:30 +0100, roel kluin wrote
On Fri, Feb 27, 2009 at 12:43 PM, Guo-Fu Tseng [off-list ref] wrote:
quoted
There should be no difference after this modification.
The return value of this function is: "limit > 0 ? limit : 0;"
There is:
In the last iteration limit is 1 during the test before it is decremented to 0.

rxdesc = rxring->desc;
rxdesc += i;

If then we break out of the loop by the 'goto out;', we continue with:

out:
        atomic_set(&rxring->next_to_clean, i);

out_inc:
        atomic_inc(&jme->rx_cleaning);

but since limit is already decremented, 0 is returned.
quoted
Guo-Fu Tseng
Roel
I see.
But the correct patch should be following one, right?

===================================================================
--- jme.c	(revision 580)
+++ jme.c	(working copy)
@@ -958,13 +958,14 @@
 		goto out_inc;
 
 	i = atomic_read(&rxring->next_to_clean);
-	while (limit-- > 0) {
+	while (limit > 0) {
 		rxdesc = rxring->desc;
 		rxdesc += i;
 
 		if ((rxdesc->descwb.flags & RXWBFLAG_OWN) ||
 		!(rxdesc->descwb.desccnt & RXWBDCNT_WBCPL))
 			goto out;
+		--limit;
 
 		desccnt = rxdesc->descwb.desccnt & RXWBDCNT_DCNT;
 


Guo-Fu Tseng
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help