Skip to contentSkip to conversation

ixgb boolean typo ?

PATCH Dave Jones 3 participants 3 messages Aug 3, 2004 Network drivers

lore
Share & tools
lore

Dave Jones

author
#0 lore raw

Is this perhaps what was meant to be here ?

Dave

drivers/net/ixgb/ixgb_main.c renamed from drivers/net/ixgb/ixgb_main.c~ +1 -1
@@ -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)
#1 lore raw
Quoted 5 lines · Dave Jones

Is this perhaps what was meant to be here ?

Dave

Quoted 11 lines

--- 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:

drivers/net/ixgb/ixgb_main.c renamed from drivers/net/ixgb/ixgb_main.c~igxb-speedup +5 -1
@@ -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)
 	 */

_

#2 lore raw
Quoted 18 lines · Andrew Morton
Quoted 8 lines · Dave Jones

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 @@

Quoted 8 lines
      }
  #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)
Quoted 5 lines

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.

Signature · 4 lines
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt