[<prev] [next>] [day] [month] [year] [list]
Message-ID: <46FDE7D4.9050909@garzik.org>
Date: Sat, 29 Sep 2007 01:51:16 -0400
From: Jeff Garzik <jeff@...zik.org>
To: akpm@...ux-foundation.org, shemminger@...ux-foundation.org
CC: netdev <netdev@...r.kernel.org>
Subject: Re: [patch 08/17] sky2: avoid divide in receive path
akpm@...ux-foundation.org wrote:
> From: Stephen Hemminger <shemminger@...ux-foundation.org>
>
> Avoid divide (modulus) in receive buffer handling path.
>
> Signed-off-by: Stephen Hemminger <shemminger@...ux-foundation.org>
> Signed-off-by: Andrew Morton <akpm@...ux-foundation.org>
> ---
>
> drivers/net/sky2.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff -puN drivers/net/sky2.c~sky2-avoid-divide-in-receive-path drivers/net/sky2.c
> --- a/drivers/net/sky2.c~sky2-avoid-divide-in-receive-path
> +++ a/drivers/net/sky2.c
> @@ -2155,7 +2155,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;
it is silly to introduce a branch just for this.
require that the ring size is a power-of-2, and then replace the divide
with a mask.
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists