提交 18c16c69 编写于 作者: C Chuck Ebbert 提交者: Jeff Garzik

[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: NChuck Ebbert <76306.1226@compuserve.com>
Signed-off-by: NJeff Garzik <jgarzik@pobox.com>
上级 d2ae1d2f
...@@ -151,9 +151,9 @@ static int loopback_xmit(struct sk_buff *skb, struct net_device *dev) ...@@ -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 = &per_cpu(loopback_stats, get_cpu());
lb_stats->rx_bytes += skb->len; 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->rx_packets++;
lb_stats->tx_packets++; lb_stats->tx_packets = lb_stats->rx_packets;
put_cpu(); put_cpu();
netif_rx(skb); netif_rx(skb);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册