[ovs-dev] [next 26/35] ofproto: Initialize ports immediately upon ofproto creation.

Ben Pfaff blp at nicira.com
Tue Apr 26 16:24:52 UTC 2011


I don't see why we should delay initializing the ports to the first call
of ofproto_run1().  We originally did initialize the ports in
ofproto_create(), but back in January 2010 Jesse moved the call into
ofproto_run1() in commit 149f577a "netdev: Fully handle netdev lifecycle
through refcounting."  The commit message doesn't explain why this
particular change was made, so I can only assume that it was important at
the time.  Now, however, everything seems to work fine with initialization
done in the most logical place.
---
 ofproto/ofproto.c |    6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/ofproto/ofproto.c b/ofproto/ofproto.c
index 6043dc4..301e811 100644
--- a/ofproto/ofproto.c
+++ b/ofproto/ofproto.c
@@ -438,6 +438,8 @@ ofproto_create(const char *datapath, const char *datapath_type,
     /* Initialize OpenFlow connections. */
     p->connmgr = connmgr_create(p, datapath, local_name);
 
+    init_ports(p);
+
     *ofprotop = p;
     return 0;
 }
@@ -769,10 +771,6 @@ ofproto_run1(struct ofproto *p)
     int error;
     int i;
 
-    if (shash_is_empty(&p->port_by_name)) {
-        init_ports(p);
-    }
-
     for (i = 0; i < 50; i++) {
         struct dpif_upcall packet;
 
-- 
1.7.4.4




More information about the dev mailing list