On Thu, Jun 12, 2014 at 04:37:33PM -0700, Daniele Di Proietto wrote:
> Since dpif_netdev_enumerate() is used for "netdev" and "dummy" class, it
> incorrectly lists dpif-netdevs as "dummy" and vice versa.
> This patches address the issue by changing the dpif-provider interface: a
> dpif_class parameter is passed to the 'enumerate' call to match the right 
> class.
> 
> Signed-off-by: Daniele Di Proietto <ddiproie...@vmware.com>

Thanks!  I folded in the following coding style updates and will push
after running the unit tests.

diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c
index 8eb1f38..6c281fe 100644
--- a/lib/dpif-netdev.c
+++ b/lib/dpif-netdev.c
@@ -360,7 +360,8 @@ get_dp_netdev(const struct dpif *dpif)
 }
 
 static int
-dpif_netdev_enumerate(struct sset *all_dps, const struct dpif_class 
*dpif_class)
+dpif_netdev_enumerate(struct sset *all_dps,
+                      const struct dpif_class *dpif_class)
 {
     struct shash_node *node;
 
@@ -369,7 +370,7 @@ dpif_netdev_enumerate(struct sset *all_dps, const struct 
dpif_class *dpif_class)
         struct dp_netdev *dp = node->data;
         if (dpif_class != dp->class) {
             /* 'dp_netdevs' contains both "netdev" and "dummy" dpifs.
-             * if the class doesn't match, skip this dpif */
+             * If the class doesn't match, skip this dpif. */
              continue;
         }
         sset_add(all_dps, node->name);
diff --git a/lib/dpif.c b/lib/dpif.c
index c5d31f6..cace47b 100644
--- a/lib/dpif.c
+++ b/lib/dpif.c
@@ -272,9 +272,9 @@ dp_enumerate_names(const char *type, struct sset *names)
     }
 
     dpif_class = registered_class->dpif_class;
-    error = dpif_class->enumerate
-            ? dpif_class->enumerate(names, dpif_class)
-            : 0;
+    error = (dpif_class->enumerate
+             ? dpif_class->enumerate(names, dpif_class)
+             : 0);
     if (error) {
         VLOG_WARN("failed to enumerate %s datapaths: %s", dpif_class->type,
                    ovs_strerror(error));
_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to