[ovs-dev] [vport-stats 1/3] datapath: Fix vport_get_stats() in !VPORT_F_GEN_STATS case.

Ben Pfaff blp at nicira.com
Wed Jan 5 18:24:05 UTC 2011


When VPORT_F_GEN_STATS was not set, vport_get_stats() would always return
an error (either an error returned by ->get_stats(), otherwise
-EOPNOTSUPP).  This fixes the problem.

Found by inspection.

Signed-off-by: Ben Pfaff <blp at nicira.com>
---
 datapath/vport.c |    7 ++-----
 1 files changed, 2 insertions(+), 5 deletions(-)

diff --git a/datapath/vport.c b/datapath/vport.c
index a3244a3..0527d07 100644
--- a/datapath/vport.c
+++ b/datapath/vport.c
@@ -795,7 +795,7 @@ int vport_get_stats(struct vport *vport, struct rtnl_link_stats64 *stats)
 {
 	struct rtnl_link_stats64 dev_stats;
 	struct rtnl_link_stats64 *dev_statsp = NULL;
-	int err;
+	int err = 0;
 
 	if (vport->ops->get_stats) {
 		if (vport->ops->flags & VPORT_F_GEN_STATS)
@@ -875,10 +875,7 @@ int vport_get_stats(struct vport *vport, struct rtnl_link_stats64 *stats)
 			stats->tx_bytes		+= local_stats.tx_bytes;
 			stats->tx_packets	+= local_stats.tx_packets;
 		}
-
-		err = 0;
-	} else
-		err = -EOPNOTSUPP;
+	}
 
 out:
 	return err;
-- 
1.7.1





More information about the dev mailing list