Skip to content

Commit

Permalink
[PATCH] loopback: optimize stats
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Chuck Ebbert authored and Jeff Garzik committed Jul 31, 2005
1 parent d2ae1d2 commit 18c16c6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/net/loopback.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 18c16c6

Please sign in to comment.