diff options
author | Simon Horman <horms@verge.net.au> | 2013-10-16 19:17:01 +0900 |
---|---|---|
committer | Ben Pfaff <blp@nicira.com> | 2013-10-16 09:08:30 -0700 |
commit | b5799021ba92444cdb8ba0a85168a0175a72ee84 (patch) | |
tree | f1129c564eb4900c3355cae4e743c11ed41c5886 /lib/netdev-dummy.c | |
parent | 48a5f330e33b1d115e15587472b32e476a0b9563 (diff) |
netdev-dummy: Count rx packets regardless of source
This alters the way rx packets are accounted for by
counting them when they are processed by netdev_dummy_rx_recv(),
which seems to be a common path used by all received packets.
Previously accounting was done earlier, in netdev_dummy_receive(),
however this does not appear to count packets that are received via
a socket.
This resolves packet counting errors reported by the following
OFtest tests:
port_stats.MultiFlowStats
port_stats.SingleFlowStats
pktact.WildcardPriorityWithDelete
pktact.WildcardPriority
Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Diffstat (limited to 'lib/netdev-dummy.c')
-rw-r--r-- | lib/netdev-dummy.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/netdev-dummy.c b/lib/netdev-dummy.c index e40c0995..fe54576f 100644 --- a/lib/netdev-dummy.c +++ b/lib/netdev-dummy.c @@ -470,6 +470,11 @@ netdev_dummy_rx_recv(struct netdev_rx *rx_, void *buffer, size_t size) if (packet->size <= size) { memcpy(buffer, packet->data, packet->size); retval = packet->size; + + ovs_mutex_lock(&netdev->mutex); + netdev->stats.rx_packets++; + netdev->stats.rx_bytes += packet->size; + ovs_mutex_unlock(&netdev->mutex); } else { retval = -EMSGSIZE; } @@ -870,8 +875,6 @@ netdev_dummy_receive(struct unixctl_conn *conn, } ovs_mutex_lock(&dummy_dev->mutex); - dummy_dev->stats.rx_packets++; - dummy_dev->stats.rx_bytes += packet->size; netdev_dummy_queue_packet(dummy_dev, packet); ovs_mutex_unlock(&dummy_dev->mutex); } |