aboutsummaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorAshish Sharma <ashishsharma@google.com>2011-10-07 17:54:16 -0700
committerArve Hjønnevåg <arve@android.com>2013-07-01 13:40:37 -0700
commit19d2b31c931e7fc8c33ee4d455005bb8e8790274 (patch)
tree0e62b0bcb23109dff9f6ab94b14306e0c66c9aba /net
parentef08cfe9ce821b31f929a8396069b20f7a9b05f8 (diff)
bridge: Have tx_bytes count headers like rx_bytes.
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. The clean way would be for Rx to include the eth header, but the skb len has already been adjusted by the time the br code sees the skb. This is only a temporary workaround until we can completely ignore or cleanly fix the skb->len handling. Change-Id: I910de95a4686b2119da7f1f326e2154ef31f9972 Signed-off-by: Ashish Sharma <ashishsharma@google.com>
Diffstat (limited to 'net')
-rw-r--r--net/bridge/br_device.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/net/bridge/br_device.c b/net/bridge/br_device.c
index 967312803e4..239e0e84f9e 100644
--- a/net/bridge/br_device.c
+++ b/net/bridge/br_device.c
@@ -41,11 +41,6 @@ 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);
-
if (!br_allowed_ingress(br, br_get_vlan_info(br), skb, &vid))
goto out;
@@ -54,6 +49,12 @@ netdev_tx_t br_dev_xmit(struct sk_buff *skb, struct net_device *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);
+
if (is_broadcast_ether_addr(dest))
br_flood_deliver(br, skb);
else if (is_multicast_ether_addr(dest)) {