X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=utilities%2Fovs-openflowd.c;h=4ca22e0d8459a12216a9ff98bb5a770858e941d0;hb=df2fa9b50e1c0e93c6be1d31a5d69eb4f077add3;hp=33ebc68151b6d99f7993959d8c376a69afa260a1;hpb=bf8f2167fd3107f5513d487a69a6568cf51afd68;p=openvswitch diff --git a/utilities/ovs-openflowd.c b/utilities/ovs-openflowd.c index 33ebc681..4ca22e0d 100644 --- a/utilities/ovs-openflowd.c +++ b/utilities/ovs-openflowd.c @@ -28,7 +28,6 @@ #include "compiler.h" #include "daemon.h" #include "dirs.h" -#include "dpif.h" #include "dummy.h" #include "leak-checker.h" #include "list.h" @@ -93,7 +92,6 @@ main(int argc, char *argv[]) struct ofproto *ofproto; struct ofsettings s; int error; - struct dpif *dpif; struct netflow_options nf_options; const char *port; bool exiting; @@ -116,9 +114,10 @@ main(int argc, char *argv[]) VLOG_INFO("Open vSwitch version %s", VERSION BUILDNR); VLOG_INFO("OpenFlow protocol version 0x%02x", OFP_VERSION); - error = dpif_create_and_open(s.dp_name, s.dp_type, &dpif); + error = ofproto_create(s.dp_name, s.dp_type, &ofproto); if (error) { - VLOG_FATAL("could not create datapath (%s)", strerror(error)); + VLOG_FATAL("could not initialize OpenFlow switch (%s)", + strerror(error)); } /* Add ports to the datapath if requested by the user. */ @@ -131,7 +130,7 @@ main(int argc, char *argv[]) port, strerror(error)); } - error = dpif_port_add(dpif, netdev, NULL); + error = ofproto_port_add(ofproto, netdev, NULL); if (error) { VLOG_FATAL("failed to add %s as a port (%s)", port, strerror(error)); @@ -140,12 +139,7 @@ main(int argc, char *argv[]) netdev_close(netdev); } - /* Start OpenFlow processing. */ - error = ofproto_create(s.dp_name, s.dp_type, NULL, NULL, &ofproto); - if (error) { - VLOG_FATAL("could not initialize openflow switch (%s)", - strerror(error)); - } + /* Configure OpenFlow switch. */ if (s.datapath_id) { ofproto_set_datapath_id(ofproto, s.datapath_id); } @@ -175,12 +169,10 @@ main(int argc, char *argv[]) VLOG_FATAL("unrecoverable datapath error (%s)", strerror(error)); } unixctl_server_run(unixctl); - dp_run(); netdev_run(); ofproto_wait(ofproto); unixctl_server_wait(unixctl); - dp_wait(); netdev_wait(); if (exiting) { poll_immediate_wake(); @@ -188,7 +180,7 @@ main(int argc, char *argv[]) poll_block(); } - dpif_close(dpif); + ofproto_destroy(ofproto); return 0; } @@ -249,37 +241,37 @@ parse_options(int argc, char *argv[], struct ofsettings *s) DAEMON_OPTION_ENUMS }; static struct option long_options[] = { - {"datapath-id", required_argument, 0, OPT_DATAPATH_ID}, - {"mfr-desc", required_argument, 0, OPT_MFR_DESC}, - {"hw-desc", required_argument, 0, OPT_HW_DESC}, - {"sw-desc", required_argument, 0, OPT_SW_DESC}, - {"serial-desc", required_argument, 0, OPT_SERIAL_DESC}, - {"dp-desc", required_argument, 0, OPT_DP_DESC}, - {"config", required_argument, 0, 'F'}, - {"br-name", required_argument, 0, OPT_BR_NAME}, - {"fail", required_argument, 0, OPT_FAIL_MODE}, - {"inactivity-probe", required_argument, 0, OPT_INACTIVITY_PROBE}, - {"max-idle", required_argument, 0, OPT_MAX_IDLE}, - {"max-backoff", required_argument, 0, OPT_MAX_BACKOFF}, - {"listen", required_argument, 0, 'l'}, - {"snoop", required_argument, 0, OPT_SNOOP}, - {"rate-limit", optional_argument, 0, OPT_RATE_LIMIT}, - {"burst-limit", required_argument, 0, OPT_BURST_LIMIT}, - {"out-of-band", no_argument, 0, OPT_OUT_OF_BAND}, - {"in-band", no_argument, 0, OPT_IN_BAND}, - {"netflow", required_argument, 0, OPT_NETFLOW}, - {"ports", required_argument, 0, OPT_PORTS}, - {"unixctl", required_argument, 0, OPT_UNIXCTL}, - {"enable-dummy", no_argument, 0, OPT_ENABLE_DUMMY}, - {"verbose", optional_argument, 0, 'v'}, - {"help", no_argument, 0, 'h'}, - {"version", no_argument, 0, 'V'}, + {"datapath-id", required_argument, NULL, OPT_DATAPATH_ID}, + {"mfr-desc", required_argument, NULL, OPT_MFR_DESC}, + {"hw-desc", required_argument, NULL, OPT_HW_DESC}, + {"sw-desc", required_argument, NULL, OPT_SW_DESC}, + {"serial-desc", required_argument, NULL, OPT_SERIAL_DESC}, + {"dp-desc", required_argument, NULL, OPT_DP_DESC}, + {"config", required_argument, NULL, 'F'}, + {"br-name", required_argument, NULL, OPT_BR_NAME}, + {"fail", required_argument, NULL, OPT_FAIL_MODE}, + {"inactivity-probe", required_argument, NULL, OPT_INACTIVITY_PROBE}, + {"max-idle", required_argument, NULL, OPT_MAX_IDLE}, + {"max-backoff", required_argument, NULL, OPT_MAX_BACKOFF}, + {"listen", required_argument, NULL, 'l'}, + {"snoop", required_argument, NULL, OPT_SNOOP}, + {"rate-limit", optional_argument, NULL, OPT_RATE_LIMIT}, + {"burst-limit", required_argument, NULL, OPT_BURST_LIMIT}, + {"out-of-band", no_argument, NULL, OPT_OUT_OF_BAND}, + {"in-band", no_argument, NULL, OPT_IN_BAND}, + {"netflow", required_argument, NULL, OPT_NETFLOW}, + {"ports", required_argument, NULL, OPT_PORTS}, + {"unixctl", required_argument, NULL, OPT_UNIXCTL}, + {"enable-dummy", no_argument, NULL, OPT_ENABLE_DUMMY}, + {"verbose", optional_argument, NULL, 'v'}, + {"help", no_argument, NULL, 'h'}, + {"version", no_argument, NULL, 'V'}, DAEMON_LONG_OPTIONS, VLOG_LONG_OPTIONS, LEAK_CHECKER_LONG_OPTIONS, STREAM_SSL_LONG_OPTIONS, - {"bootstrap-ca-cert", required_argument, 0, OPT_BOOTSTRAP_CA_CERT}, - {0, 0, 0, 0}, + {"bootstrap-ca-cert", required_argument, NULL, OPT_BOOTSTRAP_CA_CERT}, + {NULL, 0, NULL, 0}, }; char *short_options = long_options_to_short_options(long_options); struct ofproto_controller controller_opts; @@ -475,7 +467,7 @@ parse_options(int argc, char *argv[], struct ofsettings *s) } /* Local vconns. */ - dp_parse_name(argv[0], &s->dp_name, &s->dp_type); + ofproto_parse_name(argv[0], &s->dp_name, &s->dp_type); /* Figure out controller names. */ s->run_forever = false;