Before this patch, if dpif-linux failed to register a notifier it
would give up opening the datapath entirely.  This seems draconian
as a dpif can still perform the majority of its intended
functionality without vport notifications.
---
 lib/dpif-linux.c |   23 +++++++----------------
 1 files changed, 7 insertions(+), 16 deletions(-)

diff --git a/lib/dpif-linux.c b/lib/dpif-linux.c
index 9533e14..53ec071 100644
--- a/lib/dpif-linux.c
+++ b/lib/dpif-linux.c
@@ -160,7 +160,7 @@ static struct nl_sock *genl_sock;
 static struct nln *nln = NULL;
 
 static int dpif_linux_init(void);
-static int open_dpif(const struct dpif_linux_dp *, struct dpif **);
+static void open_dpif(const struct dpif_linux_dp *, struct dpif **);
 static bool dpif_linux_nln_parse(struct ofpbuf *, void *);
 static void dpif_linux_port_changed(const void *vport, void *dpif);
 
@@ -243,25 +243,21 @@ dpif_linux_open(const struct dpif_class *class 
OVS_UNUSED, const char *name,
     if (error) {
         return error;
     }
-    error = open_dpif(&dp, dpifp);
-    ofpbuf_delete(buf);
 
-    return error;
+    open_dpif(&dp, dpifp);
+    ofpbuf_delete(buf);
+    return 0;
 }
 
-static int
+static void
 open_dpif(const struct dpif_linux_dp *dp, struct dpif **dpifp)
 {
     struct dpif_linux *dpif;
-    int error;
     int i;
 
     dpif = xmalloc(sizeof *dpif);
-    error = nln_notifier_register(nln, &dpif->port_notifier,
-                                  dpif_linux_port_changed, dpif);
-    if (error) {
-        goto error_free;
-    }
+    nln_notifier_register(nln, &dpif->port_notifier,
+                          dpif_linux_port_changed, dpif);
 
     dpif_init(&dpif->dpif, &dpif_linux_class, dp->name,
               dp->dp_ifindex, dp->dp_ifindex);
@@ -282,11 +278,6 @@ open_dpif(const struct dpif_linux_dp *dp, struct dpif 
**dpifp)
     for (i = 1; i < LRU_MAX_PORTS; i++) {
         dpif_linux_push_port(dpif, i);
     }
-    return 0;
-
-error_free:
-    free(dpif);
-    return error;
 }
 
 static void
-- 
1.7.6.1

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

Reply via email to