[ovs-dev] [PATCH 1/2 v2] include/openflow: Add OpenFlow 1.4 header file
Alexandru Copot
alex.mihai.c at gmail.com
Tue Oct 22 08:40:02 UTC 2013
It contains only Set-Async-Config and Role status message definitions.
Signed-off-by: Alexandru Copot <alex.mihai.c at gmail.com>
Cc: Daniel Baluta <dbaluta at ixiacom.com>
---
The OFPACPT_ and OFPTFPT_ are still named like this. It's the
way they are defined in the header file in the specification.
build-aux/extract-ofp-msgs | 3 +
include/openflow/automake.mk | 4 +
include/openflow/openflow-1.4.h | 157 ++++++++++++++++++++++++++++++++++++++++
include/openflow/openflow.h | 1 +
lib/learning-switch.c | 1 +
lib/ofp-msgs.h | 6 ++
lib/ofp-print.c | 2 +
lib/rconn.c | 1 +
ofproto/ofproto.c | 1 +
9 files changed, 176 insertions(+)
create mode 100644 include/openflow/openflow-1.4.h
diff --git a/build-aux/extract-ofp-msgs b/build-aux/extract-ofp-msgs
index 5eaa141..448e7db 100755
--- a/build-aux/extract-ofp-msgs
+++ b/build-aux/extract-ofp-msgs
@@ -10,6 +10,7 @@ OFP10_VERSION = 0x01
OFP11_VERSION = 0x02
OFP12_VERSION = 0x03
OFP13_VERSION = 0x04
+OFP14_VERSION = 0x05
NX_VENDOR_ID = 0x00002320
@@ -24,10 +25,12 @@ version_map = {"1.0": (OFP10_VERSION, OFP10_VERSION),
"1.1": (OFP11_VERSION, OFP11_VERSION),
"1.2": (OFP12_VERSION, OFP12_VERSION),
"1.3": (OFP13_VERSION, OFP13_VERSION),
+ "1.4": (OFP14_VERSION, OFP14_VERSION),
"1.0+": (OFP10_VERSION, OFP13_VERSION),
"1.1+": (OFP11_VERSION, OFP13_VERSION),
"1.2+": (OFP12_VERSION, OFP13_VERSION),
"1.3+": (OFP13_VERSION, OFP13_VERSION),
+ "1.4+": (OFP14_VERSION, OFP14_VERSION),
"1.0-1.1": (OFP10_VERSION, OFP11_VERSION),
"1.0-1.2": (OFP10_VERSION, OFP12_VERSION),
"1.1-1.2": (OFP11_VERSION, OFP12_VERSION),
diff --git a/include/openflow/automake.mk b/include/openflow/automake.mk
index 76a8f06..2938642 100644
--- a/include/openflow/automake.mk
+++ b/include/openflow/automake.mk
@@ -4,6 +4,7 @@ noinst_HEADERS += \
include/openflow/openflow-1.1.h \
include/openflow/openflow-1.2.h \
include/openflow/openflow-1.3.h \
+ include/openflow/openflow-1.4.h \
include/openflow/openflow-common.h \
include/openflow/openflow.h
@@ -20,6 +21,7 @@ HSTAMP_FILES = \
include/openflow/openflow-1.1.hstamp \
include/openflow/openflow-1.2.hstamp \
include/openflow/openflow-1.3.hstamp \
+ include/openflow/openflow-1.4.hstamp \
include/openflow/openflow-common.hstamp \
include/openflow/openflow.hstamp
CLEANFILES += $(HSTAMP_FILES)
@@ -37,6 +39,8 @@ include/openflow/openflow-1.3.hstamp: \
include/openflow/openflow-common.h \
include/openflow/openflow-1.1.h \
include/openflow/openflow-1.2.h
+include/openflow/openflow-1.4.hstamp: \
+ include/openflow/openflow-1.4.h
include/openflow/nicira-ext.hstamp: \
include/openflow/openflow.h \
include/openflow/openflow-common.h \
diff --git a/include/openflow/openflow-1.4.h b/include/openflow/openflow-1.4.h
new file mode 100644
index 0000000..77fdb57
--- /dev/null
+++ b/include/openflow/openflow-1.4.h
@@ -0,0 +1,157 @@
+/* Copyright (c) 2008 The Board of Trustees of The Leland Stanford
+* Junior University
+* Copyright (c) 2011, 2012 Open Networking Foundation
+*
+* We are making the OpenFlow specification and associated documentation
+* (Software) available for public use and benefit with the expectation
+* that others will use, modify and enhance the Software and contribute
+* those enhancements back to the community. However, since we would
+* like to make the Software available for broadest use, with as few
+* restrictions as possible permission is hereby granted, free of
+* charge, to any person obtaining a copy of this Software to deal in
+* the Software under the copyrights without restriction, including
+* without limitation the rights to use, copy, modify, merge, publish,
+* distribute, sublicense, and/or sell copies of the Software, and to
+* permit persons to whom the Software is furnished to do so, subject to
+* the following conditions:
+*
+* The above copyright notice and this permission notice shall be
+* included in all copies or substantial portions of the Software.
+*
+* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+* SOFTWARE.
+*
+* The name and trademarks of copyright holder(s) may NOT be used in
+* advertising or publicity pertaining to the Software or any
+* derivatives without specific, written prior permission.
+*/
+
+/* OpenFlow: protocol between controller and datapath. */
+
+#ifndef OPENFLOW_14_H
+#define OPENFLOW_14_H 1
+
+#include "openflow/openflow-1.3.h"
+/*
+ * OpenFlow 1.4 is more extensible by using TLV structures
+ */
+
+/* Common header for all async config Properties */
+struct ofp14_async_config_prop_header {
+ ovs_be16 type; /* One of OFPACPT_*. */
+ ovs_be16 length; /* Length in bytes of this property. */
+};
+OFP_ASSERT(sizeof(struct ofp14_async_config_prop_header) == 4);
+
+/* Asynchronous message configuration.
+ * OFPT_GET_ASYNC_REPLY or OFPT_SET_ASYNC.
+ */
+struct ofp14_async_config {
+ struct ofp_header header;
+ /* Async config Property list - 0 or more */
+ struct ofp14_async_config_prop_header properties[0];
+};
+OFP_ASSERT(sizeof(struct ofp14_async_config) == 8);
+
+/* Async Config property types.
+* Low order bit cleared indicates a property for the slave role.
+* Low order bit set indicates a property for the master/equal role.
+*/
+enum ofp14_async_config_prop_type {
+ OFPACPT_PACKET_IN_SLAVE = 0, /* Packet-in mask for slave. */
+ OFPACPT_PACKET_IN_MASTER = 1, /* Packet-in mask for master. */
+ OFPACPT_PORT_STATUS_SLAVE = 2, /* Port-status mask for slave. */
+ OFPACPT_PORT_STATUS_MASTER = 3, /* Port-status mask for master. */
+ OFPACPT_FLOW_REMOVED_SLAVE = 4, /* Flow removed mask for slave. */
+ OFPACPT_FLOW_REMOVED_MASTER = 5, /* Flow removed mask for master. */
+ OFPACPT_ROLE_STATUS_SLAVE = 6, /* Role status mask for slave. */
+ OFPACPT_ROLE_STATUS_MASTER = 7, /* Role status mask for master. */
+ OFPACPT_TABLE_STATUS_SLAVE = 8, /* Table status mask for slave. */
+ OFPACPT_TABLE_STATUS_MASTER = 9, /* Table status mask for master. */
+ OFPACPT_REQUESTFORWARD_SLAVE = 10, /* RequestForward mask for slave. */
+ OFPACPT_REQUESTFORWARD_MASTER = 11, /* RequestForward mask for master. */
+ OFPTFPT_EXPERIMENTER_SLAVE = 0xFFFE, /* Experimenter for slave. */
+ OFPTFPT_EXPERIMENTER_MASTER = 0xFFFF, /* Experimenter for master. */
+};
+
+/* Various reason based properties */
+struct ofp14_async_config_prop_reasons {
+ /* 'type' is one of OFPACPT_PACKET_IN_*, OFPACPT_PORT_STATUS_*,
+ * OFPACPT_FLOW_REMOVED_*, OFPACPT_ROLE_STATUS_*,
+ * OFPACPT_TABLE_STATUS_*, OFPACPT_REQUESTFORWARD_*. */
+ ovs_be16 type;
+ ovs_be16 length; /* Length in bytes of this property. */
+ ovs_be32 mask; /* Bitmasks of reason values. */
+};
+OFP_ASSERT(sizeof(struct ofp14_async_config_prop_reasons) == 8);
+
+/* Experimenter async config property */
+struct ofp14_async_config_prop_experimenter {
+ ovs_be16 type; /* One of OFPTFPT_EXPERIMENTER_SLAVE,
+ OFPTFPT_EXPERIMENTER_MASTER. */
+ ovs_be16 length; /* Length in bytes of this property. */
+ ovs_be32 experimenter; /* Experimenter ID which takes the same
+ form as in struct
+ ofp_experimenter_header. */
+ ovs_be32 exp_type; /* Experimenter defined. */
+ /* Followed by:
+ * - Exactly (length - 12) bytes containing the experimenter data, then
+ * - Exactly (length + 7)/8*8 - (length) (between 0 and 7)
+ * bytes of all-zero bytes */
+};
+OFP_ASSERT(sizeof(struct ofp14_async_config_prop_experimenter) == 12);
+
+/* Common header for all Role Properties */
+struct ofp14_role_prop_header {
+ ovs_be16 type; /* One of OFPRPT_*. */
+ ovs_be16 length; /* Length in bytes of this property. */
+};
+OFP_ASSERT(sizeof(struct ofp14_role_prop_header) == 4);
+
+/* Role status event message. */
+struct ofp14_role_status {
+ struct ofp_header header; /* Type OFPT_ROLE_REQUEST/OFPT_ROLE_REPLY. */
+ ovs_be32 role; /* One of OFPCR_ROLE_*. */
+ uint8_t reason; /* One of OFPCRR_*. */
+ uint8_t pad[3]; /* Align to 64 bits. */
+ ovs_be64 generation_id; /* Master Election Generation Id */
+
+ /* Followed by a list of struct ofp14_role_prop_header */
+};
+OFP_ASSERT(sizeof(struct ofp14_role_status) == 24);
+
+/* What changed about the controller role */
+enum ofp14_controller_role_reason {
+ OFPCRR_MASTER_REQUEST = 0, /* Another controller asked to be master. */
+ OFPCRR_CONFIG = 1, /* Configuration changed on the switch. */
+ OFPCRR_EXPERIMENTER = 2, /* Experimenter data changed. */
+};
+
+/* Role property types.
+*/
+enum ofp14_role_prop_type {
+ OFPRPT_EXPERIMENTER = 0xFFFF, /* Experimenter property. */
+};
+
+/* Experimenter role property */
+struct ofp14_role_prop_experimenter {
+ ovs_be16 type; /* One of OFPRPT_EXPERIMENTER. */
+ ovs_be16 length; /* Length in bytes of this property. */
+ ovs_be32 experimenter; /* Experimenter ID which takes the same
+ form as in struct
+ ofp_experimenter_header. */
+ ovs_be32 exp_type; /* Experimenter defined. */
+ /* Followed by:
+ * - Exactly (length - 12) bytes containing the experimenter data, then
+ * - Exactly (length + 7)/8*8 - (length) (between 0 and 7)
+ * bytes of all-zero bytes */
+};
+OFP_ASSERT(sizeof(struct ofp14_role_prop_experimenter) == 12);
+
+#endif /* openflow/openflow-1.4.h */
diff --git a/include/openflow/openflow.h b/include/openflow/openflow.h
index d5a78fe..6ec6588 100644
--- a/include/openflow/openflow.h
+++ b/include/openflow/openflow.h
@@ -21,5 +21,6 @@
#include "openflow/openflow-1.1.h"
#include "openflow/openflow-1.2.h"
#include "openflow/openflow-1.3.h"
+#include "openflow/openflow-1.4.h"
#endif /* openflow/openflow.h */
diff --git a/lib/learning-switch.c b/lib/learning-switch.c
index b133637..8efbce1 100644
--- a/lib/learning-switch.c
+++ b/lib/learning-switch.c
@@ -369,6 +369,7 @@ lswitch_process_packet(struct lswitch *sw, const struct ofpbuf *msg)
case OFPTYPE_PORT_DESC_STATS_REPLY:
case OFPTYPE_ROLE_REQUEST:
case OFPTYPE_ROLE_REPLY:
+ case OFPTYPE_ROLE_STATUS:
case OFPTYPE_SET_FLOW_FORMAT:
case OFPTYPE_FLOW_MOD_TABLE_ID:
case OFPTYPE_SET_PACKET_IN_FORMAT:
diff --git a/lib/ofp-msgs.h b/lib/ofp-msgs.h
index bfc84f3..642e8eb 100644
--- a/lib/ofp-msgs.h
+++ b/lib/ofp-msgs.h
@@ -226,6 +226,9 @@ enum ofpraw {
/* OFPT 1.3+ (29): struct ofp13_meter_mod, uint8_t[8][]. */
OFPRAW_OFPT13_METER_MOD,
+ /* OFPT 1.4+ (30): struct ofp14_role_status, uint8_t[8][]. */
+ OFPRAW_OFPT14_ROLE_STATUS,
+
/* Standard statistics. */
/* OFPST 1.0+ (0): void. */
@@ -496,6 +499,9 @@ enum ofptype {
/* Meters and rate limiters configuration messages. */
OFPTYPE_METER_MOD, /* OFPRAW_OFPT13_METER_MOD. */
+ /* Controller role change event messages. */
+ OFPTYPE_ROLE_STATUS, /* OFPRAW_OFPT14_ROLE_STATUS. */
+
/* Statistics. */
OFPTYPE_DESC_STATS_REQUEST, /* OFPRAW_OFPST_DESC_REQUEST. */
OFPTYPE_DESC_STATS_REPLY, /* OFPRAW_OFPST_DESC_REPLY. */
diff --git a/lib/ofp-print.c b/lib/ofp-print.c
index a31de9d..8bd7eef 100644
--- a/lib/ofp-print.c
+++ b/lib/ofp-print.c
@@ -2494,6 +2494,8 @@ ofp_to_string__(const struct ofp_header *oh, enum ofpraw raw,
case OFPTYPE_ROLE_REPLY:
ofp_print_role_message(string, oh);
break;
+ case OFPTYPE_ROLE_STATUS:
+ break;
case OFPTYPE_METER_STATS_REQUEST:
case OFPTYPE_METER_CONFIG_STATS_REQUEST:
diff --git a/lib/rconn.c b/lib/rconn.c
index 96b3579..f7f90f7 100644
--- a/lib/rconn.c
+++ b/lib/rconn.c
@@ -1418,6 +1418,7 @@ is_admitted_msg(const struct ofpbuf *b)
case OFPTYPE_METER_FEATURES_STATS_REPLY:
case OFPTYPE_ROLE_REQUEST:
case OFPTYPE_ROLE_REPLY:
+ case OFPTYPE_ROLE_STATUS:
case OFPTYPE_SET_FLOW_FORMAT:
case OFPTYPE_FLOW_MOD_TABLE_ID:
case OFPTYPE_SET_PACKET_IN_FORMAT:
diff --git a/ofproto/ofproto.c b/ofproto/ofproto.c
index f44a7c4..36fd004 100644
--- a/ofproto/ofproto.c
+++ b/ofproto/ofproto.c
@@ -5815,6 +5815,7 @@ handle_openflow__(struct ofconn *ofconn, const struct ofpbuf *msg)
case OFPTYPE_METER_CONFIG_STATS_REPLY:
case OFPTYPE_METER_FEATURES_STATS_REPLY:
case OFPTYPE_TABLE_FEATURES_STATS_REPLY:
+ case OFPTYPE_ROLE_STATUS:
default:
return OFPERR_OFPBRC_BAD_TYPE;
}
--
1.8.4.1
More information about the dev
mailing list