[ovs-dev] [tests 12/22] netdev-dummy: Correctly maintain port statistics.

Ben Pfaff blp at nicira.com
Fri Oct 26 00:02:08 UTC 2012


Signed-off-by: Ben Pfaff <blp at nicira.com>
---
 lib/netdev-dummy.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/lib/netdev-dummy.c b/lib/netdev-dummy.c
index 9776edc..cd19789 100644
--- a/lib/netdev-dummy.c
+++ b/lib/netdev-dummy.c
@@ -327,6 +327,9 @@ netdev_dummy_send(struct netdev *netdev, const void *buffer, size_t size)
         }
     }
 
+    dev->stats.tx_packets++;
+    dev->stats.tx_bytes += size;
+
     if (dev->peer) {
         struct netdev_dev_dummy *peer;
 
@@ -570,6 +573,9 @@ netdev_dummy_queue_packet(struct netdev_dev_dummy *dummy_dev,
 {
     struct netdev_dummy *dev, *prev;
 
+    dummy_dev->stats.rx_packets++;
+    dummy_dev->stats.rx_bytes += packet->size;
+
     prev = NULL;
     LIST_FOR_EACH (dev, node, &dummy_dev->devs) {
         if (dev->listening && dev->recv_queue_len < NETDEV_DUMMY_MAX_QUEUE) {
-- 
1.7.2.5




More information about the dev mailing list