From: Ben Pfaff Date: Wed, 30 Apr 2014 13:54:09 +0000 (-0700) Subject: Enable OpenFlow 1.0, 1.1, 1.2, and 1.3 by default. X-Git-Tag: sliver-openvswitch-2.2.90-1~3^2~29 X-Git-Url: http://git.onelab.eu/?p=sliver-openvswitch.git;a=commitdiff_plain;h=6dc5374435cc25bc4051b27bd52635e609a8872a Enable OpenFlow 1.0, 1.1, 1.2, and 1.3 by default. The Open vSwitch software switch now supports all the required features of OpenFlow 1.0 through 1.3, with one known trivial exception[*]. Enable them by default in ovs-vswitchd. For now, ovs-ofctl only enables OpenFlow 1.0 by default. This is because ovs-ofctl implements command such as "add-flow" as raw OpenFlow requests, but those requests have subtly different semantics in different OpenFlow versions. For example: - In OpenFlow 1.0, a "mod-flow" operation that does not find any existing flow to modify adds a new flow. - In OpenFlow 1.1, a "mod-flow" operation that does not find any existing flow to modify adds a new flow, but only if the mod-flow did not match on the flow cookie. - In OpenFlow 1.2 and a later, a "mod-flow" operation never adds a new flow. [*] OpenFlow 1.1, but not any earlier or later version of OpenFlow, requires support for VLANs introduced by Ethertype 0x88a8, but Open vSwitch does not support this Ethertype. Signed-off-by: Ben Pfaff Reviewed-by: YAMAMOTO Takashi --- diff --git a/FAQ b/FAQ index c43b0c8f3..128abe8ef 100644 --- a/FAQ +++ b/FAQ @@ -1119,19 +1119,28 @@ A: The following table lists the versions of OpenFlow supported by 2.0 yes [*] [*] [*] --- 2.1 yes [*] [*] [*] --- 2.2 yes [*] [*] [*] [%] + 2.3 yes yes yes yes [%] [*] Supported, with one or more missing features. [%] Support is unsafe: ovs-vswitchd will abort when certain unimplemented features are tested. - Because of missing features, OpenFlow 1.1, 1.2, and 1.3 must be - enabled manually. The following command enables OpenFlow 1.0, 1.1, - 1.2, and 1.3 on bridge br0: + Open vSwitch 2.3 enables OpenFlow 1.0, 1.1, 1.2, and 1.3 by default + in ovs-vswitchd. In Open vSwitch 1.10 through 2.2, OpenFlow 1.1, + 1.2, and 1.3 must be enabled manually in ovs-vswitchd. Either way, + the user may override the default: - ovs-vsctl set bridge br0 protocols=OpenFlow10,OpenFlow11,OpenFlow12,OpenFlow13 + - To enable OpenFlow 1.0, 1.1, 1.2, and 1.3 on bridge br0: - Use the -O option to enable support for later versions of OpenFlow - in ovs-ofctl. For example: + ovs-vsctl set bridge br0 protocols=OpenFlow10,OpenFlow11,OpenFlow12,OpenFlow13 + + - To enable only OpenFlow 1.0 on bridge br0: + + ovs-vsctl set bridge br0 protocols=OpenFlow10 + + All current versions of ovs-ofctl enable only OpenFlow 1.0 by + default. Use the -O option to enable support for later versions of + OpenFlow in ovs-ofctl. For example: ovs-ofctl -O OpenFlow13 dump-flows br0 @@ -1143,9 +1152,9 @@ A: The following table lists the versions of OpenFlow supported by invoked with a special --enable-of14 command line option. OPENFLOW-1.1+ in the Open vSwitch source tree tracks support for - OpenFlow 1.1 and later features. When support for a given OpenFlow - version is solidly implemented, Open vSwitch will enable that - version by default. + OpenFlow 1.1 and later features. When support for OpenFlow 1.4 is + solidly implemented, Open vSwitch will enable that version by + default. Q: Does Open vSwitch support MPLS? diff --git a/NEWS b/NEWS index 74b57ffff..ac7d6cc50 100644 --- a/NEWS +++ b/NEWS @@ -1,5 +1,7 @@ Post-v2.2.0 --------------------- + - OpenFlow 1.1, 1.2, and 1.3 are now enabled by default in + ovs-vswitchd. v2.2.0 - xx xxx xxx diff --git a/lib/ofp-util.h b/lib/ofp-util.h index fe2c7c23b..7c2803461 100644 --- a/lib/ofp-util.h +++ b/lib/ofp-util.h @@ -170,13 +170,15 @@ void ofputil_format_version_bitmap_names(struct ds *msg, uint32_t bitmap); uint32_t ofputil_protocols_to_version_bitmap(enum ofputil_protocol); enum ofputil_protocol ofputil_protocols_from_version_bitmap(uint32_t bitmap); -/* Bitmap of OpenFlow versions that Open vSwitch supports. */ -#define OFPUTIL_SUPPORTED_VERSIONS \ - ((1u << OFP10_VERSION) | (1u << OFP12_VERSION) | (1u << OFP13_VERSION)) - -/* Bitmap of OpenFlow versions to enable by default (a subset of - * OFPUTIL_SUPPORTED_VERSIONS). */ -#define OFPUTIL_DEFAULT_VERSIONS (1u << OFP10_VERSION) +/* Bitmaps of OpenFlow versions that Open vSwitch supports, and that it enables + * by default. When Open vSwitch has experimental or incomplete support for + * newer versions of OpenFlow, those versions should not be supported by + * default and thus should be omitted from the latter bitmap. */ +#define OFPUTIL_SUPPORTED_VERSIONS ((1u << OFP10_VERSION) | \ + (1u << OFP11_VERSION) | \ + (1u << OFP12_VERSION) | \ + (1u << OFP13_VERSION)) +#define OFPUTIL_DEFAULT_VERSIONS OFPUTIL_SUPPORTED_VERSIONS enum ofputil_protocol ofputil_protocols_from_string(const char *s); diff --git a/tests/ofproto-macros.at b/tests/ofproto-macros.at index 52f5af21d..fe765eeff 100644 --- a/tests/ofproto-macros.at +++ b/tests/ofproto-macros.at @@ -83,7 +83,7 @@ m4_define([OVS_VSWITCHD_START], /ofproto|INFO|datapath ID changed to fedcba9876543210/d']]) dnl Add bridges, ports, etc. - AT_CHECK([ovs-vsctl -- add-br br0 -- set bridge br0 datapath-type=dummy other-config:datapath-id=fedcba9876543210 other-config:hwaddr=aa:55:aa:55:00:00 protocols=[[OpenFlow10,OpenFlow11,OpenFlow12,OpenFlow13]] fail-mode=secure -- $1 m4_if([$2], [], [], [| ${PERL} $srcdir/uuidfilt.pl])], [0], [$2]) + AT_CHECK([ovs-vsctl -- add-br br0 -- set bridge br0 datapath-type=dummy other-config:datapath-id=fedcba9876543210 other-config:hwaddr=aa:55:aa:55:00:00 fail-mode=secure -- $1 m4_if([$2], [], [], [| ${PERL} $srcdir/uuidfilt.pl])], [0], [$2]) ]) m4_divert_push([PREPARE_TESTS]) diff --git a/tests/test-vconn.c b/tests/test-vconn.c index 8b24bd8f4..ec66f8628 100644 --- a/tests/test-vconn.c +++ b/tests/test-vconn.c @@ -231,7 +231,7 @@ test_read_hello(int argc OVS_UNUSED, char *argv[]) if (retval == sizeof hello) { enum ofpraw raw; - CHECK(hello.version, OFP10_VERSION); + CHECK(hello.version, OFP13_VERSION); CHECK(ofpraw_decode_partial(&raw, &hello, sizeof hello), 0); CHECK(raw, OFPRAW_OFPT_HELLO); CHECK(ntohs(hello.length), sizeof hello); @@ -304,7 +304,7 @@ test_send_hello(const char *type, const void *out, size_t out_size, if (retval == sizeof hello) { enum ofpraw raw; - CHECK(hello.version, OFP10_VERSION); + CHECK(hello.version, OFP13_VERSION); CHECK(ofpraw_decode_partial(&raw, &hello, sizeof hello), 0); CHECK(raw, OFPRAW_OFPT_HELLO); CHECK(ntohs(hello.length), sizeof hello); @@ -355,7 +355,7 @@ test_send_plain_hello(int argc OVS_UNUSED, char *argv[]) const char *type = argv[1]; struct ofpbuf *hello; - hello = ofpraw_alloc_xid(OFPRAW_OFPT_HELLO, OFP10_VERSION, + hello = ofpraw_alloc_xid(OFPRAW_OFPT_HELLO, OFP13_VERSION, htonl(0x12345678), 0); test_send_hello(type, ofpbuf_data(hello), ofpbuf_size(hello), 0); ofpbuf_delete(hello); @@ -371,7 +371,7 @@ test_send_long_hello(int argc OVS_UNUSED, char *argv[]) struct ofpbuf *hello; enum { EXTRA_BYTES = 8 }; - hello = ofpraw_alloc_xid(OFPRAW_OFPT_HELLO, OFP10_VERSION, + hello = ofpraw_alloc_xid(OFPRAW_OFPT_HELLO, OFP13_VERSION, htonl(0x12345678), EXTRA_BYTES); ofpbuf_put_zeros(hello, EXTRA_BYTES); ofpmsg_update_length(hello); @@ -387,7 +387,7 @@ test_send_echo_hello(int argc OVS_UNUSED, char *argv[]) const char *type = argv[1]; struct ofpbuf *echo; - echo = ofpraw_alloc_xid(OFPRAW_OFPT_ECHO_REQUEST, OFP10_VERSION, + echo = ofpraw_alloc_xid(OFPRAW_OFPT_ECHO_REQUEST, OFP13_VERSION, htonl(0x12345678), 0); test_send_hello(type, ofpbuf_data(echo), ofpbuf_size(echo), EPROTO); ofpbuf_delete(echo); @@ -413,7 +413,7 @@ test_send_invalid_version_hello(int argc OVS_UNUSED, char *argv[]) const char *type = argv[1]; struct ofpbuf *hello; - hello = ofpraw_alloc_xid(OFPRAW_OFPT_HELLO, OFP10_VERSION, + hello = ofpraw_alloc_xid(OFPRAW_OFPT_HELLO, OFP13_VERSION, htonl(0x12345678), 0); ((struct ofp_header *) ofpbuf_data(hello))->version = 0; test_send_hello(type, ofpbuf_data(hello), ofpbuf_size(hello), EPROTO); diff --git a/utilities/ovs-ofctl.c b/utilities/ovs-ofctl.c index 91c7f28fe..deba9dd78 100644 --- a/utilities/ovs-ofctl.c +++ b/utilities/ovs-ofctl.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013 Nicira, Inc. + * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013, 2014 Nicira, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -174,6 +174,23 @@ parse_options(int argc, char *argv[]) uint32_t versions; enum ofputil_protocol version_protocols; + /* For now, ovs-ofctl only enables OpenFlow 1.0 by default. This is + * because ovs-ofctl implements command such as "add-flow" as raw OpenFlow + * requests, but those requests have subtly different semantics in + * different OpenFlow versions. For example: + * + * - In OpenFlow 1.0, a "mod-flow" operation that does not find any + * existing flow to modify adds a new flow. + * + * - In OpenFlow 1.1, a "mod-flow" operation that does not find any + * existing flow to modify adds a new flow, but only if the mod-flow + * did not match on the flow cookie. + * + * - In OpenFlow 1.2 and a later, a "mod-flow" operation never adds a + * new flow. + */ + set_allowed_ofp_versions("OpenFlow10"); + for (;;) { unsigned long int timeout; int c; diff --git a/vswitchd/vswitch.xml b/vswitchd/vswitch.xml index 78594e75e..5aec270ad 100644 --- a/vswitchd/vswitch.xml +++ b/vswitchd/vswitch.xml @@ -566,9 +566,9 @@

- List of OpenFlow protocols that may be used when negotiating a - connection with a controller. A default value of - OpenFlow10 will be used if this column is empty. + List of OpenFlow protocols that may be used when negotiating + a connection with a controller. OpenFlow 1.0, 1.1, 1.2, and + 1.3 are enabled by default if this column is empty.