[ovs-dev] [PATCH 3/3] ofproto: Only dump queue statistics if the queue really exists.

Justin Pettit jpettit at nicira.com
Thu Sep 30 05:42:46 UTC 2010


The OpenFlow 1.0 spec seems to indicate that not sending information on queues that don't exist on a port is okay.

Looks good.

--Justin


On Sep 16, 2010, at 3:42 PM, Ben Pfaff wrote:

> Without this commit, "ovs-ofctl queue-stats br0 ALL 1" will print something
> like the following if port 3 has queue 1 but none of the other ports do:
> 
>    stats_reply (xid=0x7b378): flags=none type=5(queue)
>     4 queues
>      port 0 queue 1: bytes=?, pkts=?, errors=?
>      port 1 queue 1: bytes=?, pkts=?, errors=?
>      port 2 queue 1: bytes=?, pkts=?, errors=?
>      port 3 queue 1: bytes=0, pkts=0, errors=0
> 
> With this commit, it will print the following instead, which seems more
> useful:
> 
>   stats_reply (xid=0x3ada1): flags=none type=5(queue)
>    1 queues
>     port 3 queue 1: bytes=0, pkts=0, errors=0
> ---
> ofproto/ofproto.c |    5 +++--
> 1 files changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/ofproto/ofproto.c b/ofproto/ofproto.c
> index 844083d..aff9d05 100644
> --- a/ofproto/ofproto.c
> +++ b/ofproto/ofproto.c
> @@ -3432,8 +3432,9 @@ handle_queue_stats_for_port(struct ofport *port, uint16_t port_no,
>     } else {
>         struct netdev_queue_stats stats;
> 
> -        netdev_get_queue_stats(port->netdev, queue_id, &stats);
> -        put_queue_stats(cbdata, queue_id, &stats);
> +        if (!netdev_get_queue_stats(port->netdev, queue_id, &stats)) {
> +            put_queue_stats(cbdata, queue_id, &stats);
> +        }
>     }
> }
> 
> -- 
> 1.7.1
> 
> 
> _______________________________________________
> dev mailing list
> dev at openvswitch.org
> http://openvswitch.org/mailman/listinfo/dev_openvswitch.org





More information about the dev mailing list