All of lore.kernel.org
 help / color / mirror / Atom feed
* ixgb boolean typo ?
@ 2004-08-03  0:55 Dave Jones
  2004-08-03  6:03 ` Andrew Morton
  0 siblings, 1 reply; 3+ messages in thread
From: Dave Jones @ 2004-08-03  0:55 UTC (permalink / raw)
  To: linux.nics; +Cc: Linux Kernel

Is this perhaps what was meant to be here ?

		Dave

--- 1/drivers/net/ixgb/ixgb_main.c~	2004-08-03 01:18:00.000000000 +0100
+++ 2/drivers/net/ixgb/ixgb_main.c	2004-08-03 01:53:46.653695768 +0100
@@ -1615,7 +1615,7 @@
 	}
 #else
 	for (i = 0; i < IXGB_MAX_INTR; i++)
-		if (!ixgb_clean_rx_irq(adapter) & !ixgb_clean_tx_irq(adapter))
+		if (!ixgb_clean_rx_irq(adapter) && !ixgb_clean_tx_irq(adapter))
 			break;
 	/* if RAIDC:EN == 1 and ICR:RXDMT0 == 1, we need to
 	 * set IMS:RXDMT0 to 1 to restart the RBD timer (POLL)

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

* Re: ixgb boolean typo ?
  2004-08-03  0:55 ixgb boolean typo ? Dave Jones
@ 2004-08-03  6:03 ` Andrew Morton
  2004-08-03 10:35   ` Herbert Xu
  0 siblings, 1 reply; 3+ messages in thread
From: Andrew Morton @ 2004-08-03  6:03 UTC (permalink / raw)
  To: Dave Jones; +Cc: linux.nics, linux-kernel

Dave Jones <davej@redhat.com> wrote:
>
> Is this perhaps what was meant to be here ?
> 
>  		Dave
> 
>  --- 1/drivers/net/ixgb/ixgb_main.c~	2004-08-03 01:18:00.000000000 +0100
>  +++ 2/drivers/net/ixgb/ixgb_main.c	2004-08-03 01:53:46.653695768 +0100
>  @@ -1615,7 +1615,7 @@
>   	}
>   #else
>   	for (i = 0; i < IXGB_MAX_INTR; i++)
>  -		if (!ixgb_clean_rx_irq(adapter) & !ixgb_clean_tx_irq(adapter))
>  +		if (!ixgb_clean_rx_irq(adapter) && !ixgb_clean_tx_irq(adapter))
>   			break;
>   	/* if RAIDC:EN == 1 and ICR:RXDMT0 == 1, we need to
>   	 * set IMS:RXDMT0 to 1 to restart the RBD timer (POLL)

Both versions will do the same thing, inefficiently: keep going until both
functions return false.  And keep pointlessly calling a functions which is
returning FALSE all the time.

I think this would be better:

--- 25/drivers/net/ixgb/ixgb_main.c~igxb-speedup	2004-08-02 23:01:04.810311392 -0700
+++ 25-akpm/drivers/net/ixgb/ixgb_main.c	2004-08-02 23:02:18.475112640 -0700
@@ -1615,8 +1615,12 @@ static irqreturn_t ixgb_intr(int irq, vo
 	}
 #else
 	for (i = 0; i < IXGB_MAX_INTR; i++)
-		if (!ixgb_clean_rx_irq(adapter) & !ixgb_clean_tx_irq(adapter))
+		if (ixgb_clean_rx_irq(adapter) == FALSE)
 			break;
+	for (i = 0; i < IXGB_MAX_INTR; i++)
+		if (ixgb_clean_tx_irq(adapter) == FALSE)
+			break;
+
 	/* if RAIDC:EN == 1 and ICR:RXDMT0 == 1, we need to
 	 * set IMS:RXDMT0 to 1 to restart the RBD timer (POLL)
 	 */
_


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

* Re: ixgb boolean typo ?
  2004-08-03  6:03 ` Andrew Morton
@ 2004-08-03 10:35   ` Herbert Xu
  0 siblings, 0 replies; 3+ messages in thread
From: Herbert Xu @ 2004-08-03 10:35 UTC (permalink / raw)
  To: Andrew Morton; +Cc: davej, linux.nics, linux-kernel

Andrew Morton <akpm@osdl.org> wrote:
> Dave Jones <davej@redhat.com> wrote:
>>
>> Is this perhaps what was meant to be here ?
>> 
>>               Dave
>> 
>>  --- 1/drivers/net/ixgb/ixgb_main.c~  2004-08-03 01:18:00.000000000 +0100
>>  +++ 2/drivers/net/ixgb/ixgb_main.c   2004-08-03 01:53:46.653695768 +0100
>>  @@ -1615,7 +1615,7 @@
>>       }
>>   #else
>>       for (i = 0; i < IXGB_MAX_INTR; i++)
>>  -            if (!ixgb_clean_rx_irq(adapter) & !ixgb_clean_tx_irq(adapter))
>>  +            if (!ixgb_clean_rx_irq(adapter) && !ixgb_clean_tx_irq(adapter))
>>                       break;
>>       /* if RAIDC:EN == 1 and ICR:RXDMT0 == 1, we need to
>>        * set IMS:RXDMT0 to 1 to restart the RBD timer (POLL)
> 
> Both versions will do the same thing, inefficiently: keep going until both
> functions return false.  And keep pointlessly calling a functions which is
> returning FALSE all the time.
> 
> I think this would be better:

Please note that ixgb_clean_rx_irq/ixgb_clean_tx_irq are not pure functions.
Their return values can change.

The original intention appears to be this: keep processing until both
RX and TX runs out of things to do.

Both of your patches do something different.

Perhaps we should add a comment instead.
-- 
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

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

end of thread, other threads:[~2004-08-03 10:36 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-08-03  0:55 ixgb boolean typo ? Dave Jones
2004-08-03  6:03 ` Andrew Morton
2004-08-03 10:35   ` Herbert Xu

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.