[ovs-dev] [PATCH v2 1/2] netdev-dummy: Correctly maintain port statistics.
Ethan Jackson
ethan at nicira.com
Mon Feb 4 21:10:14 UTC 2013
Acked-by: Ethan Jackson <ethan at nicira.com>
On Thu, Jan 31, 2013 at 4:28 PM, Ben Pfaff <blp at nicira.com> wrote:
> Signed-off-by: Ben Pfaff <blp at nicira.com>
> ---
> lib/netdev-dummy.c | 18 +++++++++++++++++-
> 1 files changed, 17 insertions(+), 1 deletions(-)
>
> diff --git a/lib/netdev-dummy.c b/lib/netdev-dummy.c
> index f81b68e..234d7bc 100644
> --- a/lib/netdev-dummy.c
> +++ b/lib/netdev-dummy.c
> @@ -205,6 +205,19 @@ netdev_dummy_drain(struct netdev *netdev_)
> }
>
> static int
> +netdev_dummy_send(struct netdev *netdev, const void *buffer OVS_UNUSED,
> + size_t size)
> +{
> + struct netdev_dev_dummy *dev =
> + netdev_dev_dummy_cast(netdev_get_dev(netdev));
> +
> + dev->stats.tx_packets++;
> + dev->stats.tx_bytes += size;
> +
> + return 0;
> +}
> +
> +static int
> netdev_dummy_set_etheraddr(struct netdev *netdev,
> const uint8_t mac[ETH_ADDR_LEN])
> {
> @@ -336,7 +349,7 @@ static const struct netdev_class dummy_class = {
> netdev_dummy_recv_wait,
> netdev_dummy_drain,
>
> - NULL, /* send */
> + netdev_dummy_send, /* send */
> NULL, /* send_wait */
>
> netdev_dummy_set_etheraddr,
> @@ -443,6 +456,9 @@ netdev_dummy_receive(struct unixctl_conn *conn,
> return;
> }
>
> + dummy_dev->stats.rx_packets++;
> + dummy_dev->stats.rx_bytes += packet->size;
> +
> n_listeners = 0;
> LIST_FOR_EACH (dev, node, &dummy_dev->devs) {
> if (dev->listening) {
> --
> 1.7.2.5
>
> _______________________________________________
> dev mailing list
> dev at openvswitch.org
> http://openvswitch.org/mailman/listinfo/dev
More information about the dev
mailing list