From 129372d0524c9124d5693f63c1d3c1ce2e3714ce Mon Sep 17 00:00:00 2001
From: Stephen Hemminger <shemminger@osdl.org>
Date: Fri, 9 Dec 2005 11:34:59 -0800
Subject: [PATCH] [PATCH] sky2: ring distance optimization

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 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/sky2.c b/drivers/net/sky2.c
index eae270d81808..2dd46a05fb30 100644
--- a/drivers/net/sky2.c
+++ b/drivers/net/sky2.c
@@ -1039,7 +1039,7 @@ static int sky2_up(struct net_device *dev)
 /* 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 */
-- 
GitLab