Message ID | 1318020461-14494-1-git-send-email-ashishsharma@google.com |
---|---|
State | Changes Requested, archived |
Delegated to: | David Miller |
Headers | show |
On Fri, 2011-10-07 at 13:47 -0700, Ashish Sharma wrote: > Since rx_bytes accounting does not include Ethernet Headers in > br_input.c, excluding ETH_HLEN on the transmit path for consistent > measurement of packet length on both the Tx and Rx chains. [...] I think the TX path is correct in this regard, and the RX path should be changed to include header length. Ben.
diff --git a/net/bridge/br_device.c b/net/bridge/br_device.c index 32b8f9f..a9dd166 100644 --- a/net/bridge/br_device.c +++ b/net/bridge/br_device.c @@ -38,16 +38,17 @@ netdev_tx_t br_dev_xmit(struct sk_buff *skb, struct net_device *dev) } #endif - u64_stats_update_begin(&brstats->syncp); - brstats->tx_packets++; - brstats->tx_bytes += skb->len; - u64_stats_update_end(&brstats->syncp); - BR_INPUT_SKB_CB(skb)->brdev = dev; skb_reset_mac_header(skb); skb_pull(skb, ETH_HLEN); + u64_stats_update_begin(&brstats->syncp); + brstats->tx_packets++; + /* Exclude ETH_HLEN from byte stats for consistency with Rx chain */ + brstats->tx_bytes += skb->len; + u64_stats_update_end(&brstats->syncp); + rcu_read_lock(); if (is_broadcast_ether_addr(dest)) br_flood_deliver(br, skb);