In 'ovs-dpctl dump-flows' output, we should only report the pmd
related info for 'dpif-netdev' datapath.  However, current
implementation also reports uninitialized pmd info for
'dpif-netlink' datapath, which is very confusing to users.

This commit fixes it.

Signed-off-by: Alex Wang <al...@nicira.com>
---
 lib/dpctl.c       |    8 ++++----
 lib/dpif-netdev.c |    6 ++++++
 lib/dpif-netdev.h |    2 ++
 3 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/lib/dpctl.c b/lib/dpctl.c
index 4c2614b..64b4af0 100644
--- a/lib/dpctl.c
+++ b/lib/dpctl.c
@@ -794,10 +794,10 @@ dpctl_dump_flows(int argc, const char *argv[], struct 
dpctl_params *dpctl_p)
             minimatch_destroy(&minimatch);
         }
         ds_clear(&ds);
-        /* If 'pmd_id' is specified, overlapping flows could be dumped from
-         * different pmd threads.  So, separates dumps from different pmds
-         * by printing a title line. */
-        if (pmd_id != f.pmd_id) {
+        /* For 'dpif-netdev' datapath, if 'pmd_id' is specified, overlapping
+         * flows could be dumped from different pmd threads.  So, separates
+         * dumps from different pmds by printing a title line. */
+        if (dpif_is_dpif_netdev(dpif) && pmd_id != f.pmd_id) {
             if (f.pmd_id == NON_PMD_CORE_ID) {
                 ds_put_format(&ds, "flow-dump from non-dpdk interfaces:\n");
             } else {
diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c
index 54bad02..b2adcda 100644
--- a/lib/dpif-netdev.c
+++ b/lib/dpif-netdev.c
@@ -498,6 +498,12 @@ get_dp_netdev(const struct dpif *dpif)
     return dpif_netdev_cast(dpif)->dp;
 }
 
+bool
+dpif_is_dpif_netdev(const struct dpif *dpif)
+{
+    return dpif->dpif_class->open == dpif_netdev_open;
+}
+
 static int
 dpif_netdev_enumerate(struct sset *all_dps,
                       const struct dpif_class *dpif_class)
diff --git a/lib/dpif-netdev.h b/lib/dpif-netdev.h
index d811507..94c7616 100644
--- a/lib/dpif-netdev.h
+++ b/lib/dpif-netdev.h
@@ -48,4 +48,6 @@ static inline void dp_packet_pad(struct ofpbuf *b)
 }
 #endif
 
+bool dpif_is_dpif_netdev(const struct dpif *);
+
 #endif /* netdev.h */
-- 
1.7.9.5

_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to