From b5827b24c7c136b088e719bfe2020de31032ae37 Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Wed, 4 May 2011 10:15:31 -0700 Subject: bridge: Eliminate direct dependencies on dpif. The 'ofp_portp' argument of the new function ofproto_port_add() is always set to NULL in this commit, but a future commit will use nonnull values. --- utilities/ovs-openflowd.c | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) (limited to 'utilities/ovs-openflowd.c') diff --git a/utilities/ovs-openflowd.c b/utilities/ovs-openflowd.c index 86f5ca592..f54eb355d 100644 --- a/utilities/ovs-openflowd.c +++ b/utilities/ovs-openflowd.c @@ -93,7 +93,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 +115,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, NULL, NULL, &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 +131,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 +140,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); } @@ -188,7 +183,7 @@ main(int argc, char *argv[]) poll_block(); } - dpif_close(dpif); + ofproto_destroy(ofproto); return 0; } -- cgit v1.2.1 From fa066f015f716c74315fed1a08912d003dfe3f8c Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Wed, 11 May 2011 12:26:06 -0700 Subject: bridge: Move packet processing functionality into ofproto. Until now, packet processing in ovs-vswitchd has been split between two components: ofproto, for basic OpenFlow functionality, and bridge, for OFPP_NORMAL processing. This architecture will not work as Open vSwitch starts to support a wider variety of underlying hardware, because it imposes a model in which the bridge needs to be able to look at every exact-match flow within a OpenFlow flow, which most hardware doesn't support. Therefore, this commit moves all of the packet processing code in bridge into ofproto, as preparation for generalizing further. --- utilities/ovs-openflowd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'utilities/ovs-openflowd.c') diff --git a/utilities/ovs-openflowd.c b/utilities/ovs-openflowd.c index f54eb355d..c4d41d1ea 100644 --- a/utilities/ovs-openflowd.c +++ b/utilities/ovs-openflowd.c @@ -115,7 +115,7 @@ main(int argc, char *argv[]) VLOG_INFO("Open vSwitch version %s", VERSION BUILDNR); VLOG_INFO("OpenFlow protocol version 0x%02x", OFP_VERSION); - error = ofproto_create(s.dp_name, s.dp_type, NULL, NULL, &ofproto); + error = ofproto_create(s.dp_name, s.dp_type, &ofproto); if (error) { VLOG_FATAL("could not initialize OpenFlow switch (%s)", strerror(error)); -- cgit v1.2.1 From 640e1b20776f40633d33a5c2c2bba3e79eda0b64 Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Fri, 6 May 2011 15:04:29 -0700 Subject: dpif: Improve abstraction by making 'run' and 'wait' functions per-dpif. Until now, the dp_run() and dp_wait() functions had to be called at the top level of the program because they applied to every open dpif. By replacing them by functions that take a specific dpif as an argument, we can call them only from ofproto, which is currently the correct layer to deal with dpifs. --- utilities/ovs-openflowd.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'utilities/ovs-openflowd.c') diff --git a/utilities/ovs-openflowd.c b/utilities/ovs-openflowd.c index c4d41d1ea..4e8303672 100644 --- a/utilities/ovs-openflowd.c +++ b/utilities/ovs-openflowd.c @@ -170,12 +170,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(); -- cgit v1.2.1 From 63d347ce1bb0019713fcae184ac574335d717df0 Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Mon, 11 Apr 2011 15:08:19 -0700 Subject: ofproto: Improve abstraction by adding function ofproto_parse_name(). This means that ovs-ofctl and ovs-openflowd don't have to use the dpif layer at all, making it easier to change the ofproto implementation. --- utilities/ovs-openflowd.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'utilities/ovs-openflowd.c') diff --git a/utilities/ovs-openflowd.c b/utilities/ovs-openflowd.c index 4e8303672..2d2446e13 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" @@ -472,7 +471,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; -- cgit v1.2.1