* [PATCH] bridge: Have tx_bytes count headers like rx_bytes.
@ 2011-10-07 20:47 Ashish Sharma
2011-10-08 0:14 ` Ben Hutchings
0 siblings, 1 reply; 2+ messages in thread
From: Ashish Sharma @ 2011-10-07 20:47 UTC (permalink / raw)
To: netdev; +Cc: ashishsharma, jpa
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.
Signed-off-by: Ashish Sharma <ashishsharma@google.com>
Signed-off-by: JP Abgrall <jpa@google.com>
---
:100644 100644 32b8f9f... a9dd166... M net/bridge/br_device.c
net/bridge/br_device.c | 11 ++++++-----
1 files changed, 6 insertions(+), 5 deletions(-)
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);
--
1.7.3.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] bridge: Have tx_bytes count headers like rx_bytes.
2011-10-07 20:47 [PATCH] bridge: Have tx_bytes count headers like rx_bytes Ashish Sharma
@ 2011-10-08 0:14 ` Ben Hutchings
0 siblings, 0 replies; 2+ messages in thread
From: Ben Hutchings @ 2011-10-08 0:14 UTC (permalink / raw)
To: Ashish Sharma; +Cc: netdev, jpa
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.
--
Ben Hutchings, Staff Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-10-08 0:14 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-10-07 20:47 [PATCH] bridge: Have tx_bytes count headers like rx_bytes Ashish Sharma
2011-10-08 0:14 ` Ben Hutchings
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).