Avoid divide (modulus) in receive buffer handling path.

Signed-off-by: Stephen Hemminger <[EMAIL PROTECTED]>


--- a/drivers/net/sky2.c        2007-08-29 11:41:23.000000000 -0700
+++ b/drivers/net/sky2.c        2007-08-29 11:45:00.000000000 -0700
@@ -2140,7 +2140,8 @@ static struct sk_buff *sky2_receive(stru
                printk(KERN_DEBUG PFX "%s: rx slot %u status 0x%x len %d\n",
                       dev->name, sky2->rx_next, status, length);
 
-       sky2->rx_next = (sky2->rx_next + 1) % sky2->rx_pending;
+       if (++sky2->rx_next >= sky2->rx_pending)
+               sky2->rx_next = 0;
        prefetch(sky2->rx_ring + sky2->rx_next);
 
        if (status & GMR_FS_ANY_ERR)

-- 
Stephen Hemminger <[EMAIL PROTECTED]>

-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to