From: Ben Pfaff Date: Thu, 16 Sep 2010 22:41:14 +0000 (-0700) Subject: ofproto: Only dump queue statistics if the queue really exists. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1ac788f67ff614662ce7d9af36d5eb7597f53a3f;p=openvswitch ofproto: Only dump queue statistics if the queue really exists. 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 --- diff --git a/ofproto/ofproto.c b/ofproto/ofproto.c index c683e3b6..00cac6e2 100644 --- a/ofproto/ofproto.c +++ b/ofproto/ofproto.c @@ -3433,8 +3433,9 @@ handle_queue_stats_for_port(struct ofport *port, uint32_t queue_id, } 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); + } } }