Currently physical ports stats are collected from kernel datapath. However, those counter do not reflect actual wire packet counters when LSO or TSO are enabled by the NIC. In the meantime, the stats collected form routing stack does. While both stats are valid, Reporting netlink stats for packet counts and byte counts make it easier to correlate those numbers with external measurements.
Signed-off-by: Andy Zhou <az...@nicira.com> --- lib/netdev-linux.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/lib/netdev-linux.c b/lib/netdev-linux.c index 5c7065f..c7b3fec 100644 --- a/lib/netdev-linux.c +++ b/lib/netdev-linux.c @@ -1566,6 +1566,13 @@ netdev_linux_get_stats(const struct netdev *netdev_, /* stats not available from OVS then use ioctl stats. */ *stats = dev_stats; } else { + /* Use Netlink's packet and byte counts since vport's counters + * do not reflect packet counts on the wire when LSO/TSO are enabled. */ + stats->rx_packets = dev_stats.rx_packets; + stats->rx_bytes = dev_stats.rx_bytes; + stats->tx_packets = dev_stats.tx_packets; + stats->tx_bytes = dev_stats.tx_bytes; + stats->rx_errors += dev_stats.rx_errors; stats->tx_errors += dev_stats.tx_errors; stats->rx_dropped += dev_stats.rx_dropped; @@ -1629,6 +1636,13 @@ netdev_tap_get_stats(const struct netdev *netdev_, struct netdev_stats *stats) stats->tx_heartbeat_errors = 0; stats->tx_window_errors = 0; } else { + /* Use Netlink's packet and byte counts since vport counters + * do not reflect packet counts on the wire when LSO/TSO are enabled. */ + stats->rx_packets = dev_stats.tx_packets; + stats->rx_bytes = dev_stats.tx_bytes; + stats->tx_packets = dev_stats.rx_packets; + stats->tx_bytes = dev_stats.rx_bytes; + stats->rx_dropped += dev_stats.tx_dropped; stats->tx_dropped += dev_stats.rx_dropped; -- 1.9.1 _______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev