hmap: New functions, macros for iterating buckets without comparing hashes.
[openvswitch] / vswitchd / ovs-vswitchd.c
index 84c373f1238c66dfaf08bd96241f86ece791656d..fd2144abb0da2e20d4ecf7decb7e55f990ffb21a 100644 (file)
 #include "command-line.h"
 #include "compiler.h"
 #include "daemon.h"
+#include "dpif.h"
 #include "fault.h"
 #include "leak-checker.h"
 #include "mgmt.h"
+#include "netdev.h"
 #include "ovs-vswitchd.h"
 #include "poll-loop.h"
-#include "port.h"
 #include "proc-net-compat.h"
 #include "process.h"
 #include "signals.h"
@@ -49,7 +50,7 @@
 
 static void parse_options(int argc, char *argv[]);
 static void usage(void) NO_RETURN;
-static void reload(struct unixctl_conn *, const char *args);
+static unixctl_cb_func reload;
 
 static bool need_reconfigure;
 static struct unixctl_conn **conns;
@@ -78,12 +79,14 @@ main(int argc, char *argv[])
     if (retval) {
         ovs_fatal(retval, "could not listen for control connections");
     }
-    unixctl_command_register("vswitchd/reload", reload);
+    unixctl_command_register("vswitchd/reload", reload, NULL);
 
-    cfg_read();
+    retval = cfg_read();
+    if (retval) {
+        ovs_fatal(retval, "could not read config file");
+    }
     mgmt_init();
     bridge_init();
-    port_init();
     mgmt_reconfigure();
 
     need_reconfigure = false;
@@ -93,11 +96,15 @@ main(int argc, char *argv[])
             vlog_reopen_log_file();
             reconfigure();
         }
-        mgmt_run();
+        if (mgmt_run()) {
+            need_reconfigure = true;
+        }
         if (bridge_run()) {
             need_reconfigure = true;
         }
         unixctl_server_run(unixctl);
+        dp_run();
+        netdev_run();
 
         if (need_reconfigure) {
             poll_immediate_wake();
@@ -106,6 +113,8 @@ main(int argc, char *argv[])
         mgmt_wait();
         bridge_wait();
         unixctl_server_wait(unixctl);
+        dp_wait();
+        netdev_wait();
         poll_block();
     }
 
@@ -113,7 +122,7 @@ main(int argc, char *argv[])
 }
 
 static void
-reload(struct unixctl_conn *conn, const char *args UNUSED)
+reload(struct unixctl_conn *conn, const char *args UNUSED, void *aux UNUSED)
 {
     need_reconfigure = true;
     conns = xrealloc(conns, sizeof *conns * (n_conns + 1));
@@ -128,7 +137,6 @@ reconfigure(void)
     cfg_read();
     bridge_reconfigure();
     mgmt_reconfigure();
-    port_reconfigure();
 
     for (i = 0; i < n_conns; i++) {
         unixctl_command_reply(conns[i], 202, NULL);
@@ -217,6 +225,7 @@ parse_options(int argc, char *argv[])
                 "use --help for usage");
     }
 
+    cfg_init();
     config_file = argv[0];
     error = cfg_set_file(config_file);
     if (error) {