]> err.no Git - linux-2.6/commitdiff
[PATCH] loopback: optimize stats
authorChuck Ebbert <76306.1226@compuserve.com>
Sun, 3 Jul 2005 01:28:22 +0000 (21:28 -0400)
committerJeff Garzik <jgarzik@pobox.com>
Sun, 31 Jul 2005 05:06:10 +0000 (01:06 -0400)
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 <jgarzik@pobox.com>
drivers/net/loopback.c

index c1e3cee8ec33dfc575743d62424bdfbe8fca80ba..dba76169e77494d80a68c1b50245fd1dd196730c 100644 (file)
@@ -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);