[PATCH] sky2: ring distance optimization
authorStephen Hemminger <shemminger@osdl.org>
Fri, 9 Dec 2005 19:34:59 +0000 (11:34 -0800)
committerJeff Garzik <jgarzik@pobox.com>
Mon, 12 Dec 2005 20:27:20 +0000 (15:27 -0500)
Faster way to compute ring distance.

Signed-off-by: Stephen Hemminger <shemminger@osdl.org>
Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
drivers/net/sky2.c

index eae270d..2dd46a0 100644 (file)
@@ -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 */