From: Stephen Hemminger Date: Fri, 9 Dec 2005 19:34:59 +0000 (-0800) Subject: [PATCH] sky2: ring distance optimization X-Git-Tag: v2.6.16-rc1~474^2~22^2~7^2~35 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=129372d0524c9124d5693f63c1d3c1ce2e3714ce;p=linux-2.6 [PATCH] sky2: ring distance optimization Faster way to compute ring distance. Signed-off-by: Stephen Hemminger Signed-off-by: Jeff Garzik --- diff --git a/drivers/net/sky2.c b/drivers/net/sky2.c index eae270d818..2dd46a05fb 100644 --- a/drivers/net/sky2.c +++ b/drivers/net/sky2.c @@ -1039,7 +1039,7 @@ err_out: /* Modular subtraction in ring */ static inline int tx_dist(unsigned tail, unsigned head) { - return (head >= tail ? head : head + TX_RING_SIZE) - tail; + return (head - tail) % TX_RING_SIZE; } /* Number of list elements available for next tx */