From: Chuck Ebbert <76306.1226@compuserve.com> Date: Sun, 3 Jul 2005 01:28:22 +0000 (-0400) Subject: [PATCH] loopback: optimize stats X-Git-Tag: v2.6.14-rc1~1055^2~53 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=18c16c696e8b2323a306af455c686df15c717206;p=linux-2.6 [PATCH] loopback: optimize stats This patch slightly optimizes the loopback driver's stats update. Saves two loads, one add and one increment per packet sent. Signed-off-by: Chuck Ebbert <76306.1226@compuserve.com> Signed-off-by: Jeff Garzik --- diff --git a/drivers/net/loopback.c b/drivers/net/loopback.c index c1e3cee8ec..dba76169e7 100644 --- a/drivers/net/loopback.c +++ b/drivers/net/loopback.c @@ -151,9 +151,9 @@ static int loopback_xmit(struct sk_buff *skb, struct net_device *dev) lb_stats = &per_cpu(loopback_stats, get_cpu()); lb_stats->rx_bytes += skb->len; - lb_stats->tx_bytes += skb->len; + lb_stats->tx_bytes = lb_stats->rx_bytes; lb_stats->rx_packets++; - lb_stats->tx_packets++; + lb_stats->tx_packets = lb_stats->rx_packets; put_cpu(); netif_rx(skb);