summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJarno Rajahalme <jarno@ovn.org>2016-11-14 13:24:55 -0800
committerJarno Rajahalme <jarno@ovn.org>2016-11-14 13:24:55 -0800
commit50b73fe16586ab18e5822ba9e952dd2fec539cf7 (patch)
tree37570a9dea10ba3380c177e1a4e963832b516578
parent14bf7951a2da2253619390e81fa9c54f92751068 (diff)
downloadopenvswitch-50b73fe16586ab18e5822ba9e952dd2fec539cf7.tar.gz
ofproto: Return the OFPC_BUNDLES bit in switch features reply.
Add definitions for the OpenFlow 1.4.1/1.5 specific capabilities bits OFPC14_BUNDLES and OFPC14_FLOW_MONITORING. Return the bundles capability bit in switch features reply. Reported-by: Andrej Leitner <andrej.leitner@pantheon.tech> Signed-off-by: Jarno Rajahalme <jarno@ovn.org> Acked-by: Ben Pfaff <blp@ovn.org>
-rw-r--r--include/openflow/openflow-1.4.h6
-rw-r--r--include/openvswitch/ofp-util.h11
-rw-r--r--lib/ofp-print.c2
-rw-r--r--lib/ofp-util.c8
-rw-r--r--ofproto/ofproto.c2
-rw-r--r--tests/ofp-print.at24
-rw-r--r--tests/ofproto.at2
7 files changed, 48 insertions, 7 deletions
diff --git a/include/openflow/openflow-1.4.h b/include/openflow/openflow-1.4.h
index 4599f9566..fcebe4eb3 100644
--- a/include/openflow/openflow-1.4.h
+++ b/include/openflow/openflow-1.4.h
@@ -39,6 +39,12 @@
#include <openflow/openflow-1.3.h>
+/* OpenFlow 1.4.1+ specific capabilities
+ * (struct ofp_switch_features, member capabilities). */
+enum ofp14_capabilities {
+ OFPC14_BUNDLES = 1 << 9, /* Switch supports bundles. */
+ OFPC14_FLOW_MONITORING = 1 << 10, /* Switch supports flow monitoring. */
+};
/* ## ---------- ## */
/* ## ofp14_port ## */
diff --git a/include/openvswitch/ofp-util.h b/include/openvswitch/ofp-util.h
index e4dacbf86..8703d2a3a 100644
--- a/include/openvswitch/ofp-util.h
+++ b/include/openvswitch/ofp-util.h
@@ -613,7 +613,7 @@ struct ofputil_phy_port {
};
enum ofputil_capabilities {
- /* OpenFlow 1.0, 1.1, 1.2, and 1.3 share these capability values. */
+ /* All OpenFlow versions share these capability values. */
OFPUTIL_C_FLOW_STATS = 1 << 0, /* Flow statistics. */
OFPUTIL_C_TABLE_STATS = 1 << 1, /* Table statistics. */
OFPUTIL_C_PORT_STATS = 1 << 2, /* Port statistics. */
@@ -626,11 +626,16 @@ enum ofputil_capabilities {
/* OpenFlow 1.0 only. */
OFPUTIL_C_STP = 1 << 3, /* 802.1d spanning tree. */
- /* OpenFlow 1.1, 1.2, and 1.3 share this capability. */
+ /* OpenFlow 1.1+ only. Note that this bit value does not match the one
+ * in the OpenFlow message. */
OFPUTIL_C_GROUP_STATS = 1 << 4, /* Group statistics. */
- /* OpenFlow 1.2 and 1.3 share this capability */
+ /* OpenFlow 1.2+ only. */
OFPUTIL_C_PORT_BLOCKED = 1 << 8, /* Switch will block looping ports */
+
+ /* OpenFlow 1.4+ only. */
+ OFPUTIL_C_BUNDLES = 1 << 9, /* Switch supports bundles. */
+ OFPUTIL_C_FLOW_MONITORING = 1 << 10, /* Switch supports flow monitoring. */
};
/* Abstract ofp_switch_features. */
diff --git a/lib/ofp-print.c b/lib/ofp-print.c
index 0a685517b..b7b5290ec 100644
--- a/lib/ofp-print.c
+++ b/lib/ofp-print.c
@@ -506,6 +506,8 @@ ofputil_capabilities_to_name(uint32_t bit)
case OFPUTIL_C_STP: return "STP";
case OFPUTIL_C_GROUP_STATS: return "GROUP_STATS";
case OFPUTIL_C_PORT_BLOCKED: return "PORT_BLOCKED";
+ case OFPUTIL_C_BUNDLES: return "BUNDLES";
+ case OFPUTIL_C_FLOW_MONITORING: return "FLOW_MONITORING";
}
return NULL;
diff --git a/lib/ofp-util.c b/lib/ofp-util.c
index c0a402f4c..899cfe388 100644
--- a/lib/ofp-util.c
+++ b/lib/ofp-util.c
@@ -4644,6 +4644,9 @@ BUILD_ASSERT_DECL((int) OFPUTIL_C_PORT_STATS == OFPC_PORT_STATS);
BUILD_ASSERT_DECL((int) OFPUTIL_C_IP_REASM == OFPC_IP_REASM);
BUILD_ASSERT_DECL((int) OFPUTIL_C_QUEUE_STATS == OFPC_QUEUE_STATS);
BUILD_ASSERT_DECL((int) OFPUTIL_C_ARP_MATCH_IP == OFPC_ARP_MATCH_IP);
+BUILD_ASSERT_DECL((int) OFPUTIL_C_PORT_BLOCKED == OFPC12_PORT_BLOCKED);
+BUILD_ASSERT_DECL((int) OFPUTIL_C_BUNDLES == OFPC14_BUNDLES);
+BUILD_ASSERT_DECL((int) OFPUTIL_C_FLOW_MONITORING == OFPC14_FLOW_MONITORING);
static uint32_t
ofputil_capabilities_mask(enum ofp_version ofp_version)
@@ -4655,10 +4658,12 @@ ofputil_capabilities_mask(enum ofp_version ofp_version)
return OFPC_COMMON | OFPC_ARP_MATCH_IP;
case OFP12_VERSION:
case OFP13_VERSION:
+ return OFPC_COMMON | OFPC12_PORT_BLOCKED;
case OFP14_VERSION:
case OFP15_VERSION:
case OFP16_VERSION:
- return OFPC_COMMON | OFPC12_PORT_BLOCKED;
+ return OFPC_COMMON | OFPC12_PORT_BLOCKED | OFPC14_BUNDLES
+ | OFPC14_FLOW_MONITORING;
default:
/* Caller needs to check osf->header.version itself */
return 0;
@@ -4784,7 +4789,6 @@ ofputil_encode_switch_features(const struct ofputil_switch_features *features,
osf->n_buffers = htonl(features->n_buffers);
osf->n_tables = features->n_tables;
- osf->capabilities = htonl(features->capabilities & OFPC_COMMON);
osf->capabilities = htonl(features->capabilities &
ofputil_capabilities_mask(version));
switch (version) {
diff --git a/ofproto/ofproto.c b/ofproto/ofproto.c
index de1c469ba..53b722665 100644
--- a/ofproto/ofproto.c
+++ b/ofproto/ofproto.c
@@ -3295,7 +3295,7 @@ handle_features_request(struct ofconn *ofconn, const struct ofp_header *oh)
features.n_tables = ofproto_get_n_visible_tables(ofproto);
features.capabilities = (OFPUTIL_C_FLOW_STATS | OFPUTIL_C_TABLE_STATS |
OFPUTIL_C_PORT_STATS | OFPUTIL_C_QUEUE_STATS |
- OFPUTIL_C_GROUP_STATS);
+ OFPUTIL_C_GROUP_STATS | OFPUTIL_C_BUNDLES);
if (arp_match_ip) {
features.capabilities |= OFPUTIL_C_ARP_MATCH_IP;
}
diff --git a/tests/ofp-print.at b/tests/ofp-print.at
index 694643839..61a71044d 100644
--- a/tests/ofp-print.at
+++ b/tests/ofp-print.at
@@ -403,6 +403,30 @@ capabilities: FLOW_STATS TABLE_STATS PORT_STATS IP_REASM QUEUE_STATS PORT_BLOCKE
])
AT_CLEANUP
+AT_SETUP([OFPT_FEATURES_REPLY - OF1.4])
+AT_KEYWORDS([ofp-print])
+AT_CHECK([ovs-ofctl ofp-print "\
+05 06 00 20 00 00 00 01 00 00 50 54 00 00 00 01 \
+00 00 01 00 ff 00 00 00 00 00 07 6f 00 00 00 00 \
+"], [0], [dnl
+OFPT_FEATURES_REPLY (OF1.4) (xid=0x1): dpid:0000505400000001
+n_tables:255, n_buffers:256
+capabilities: FLOW_STATS TABLE_STATS PORT_STATS GROUP_STATS IP_REASM QUEUE_STATS PORT_BLOCKED BUNDLES FLOW_MONITORING
+])
+AT_CLEANUP
+
+AT_SETUP([OFPT_FEATURES_REPLY - OF1.5])
+AT_KEYWORDS([ofp-print])
+AT_CHECK([ovs-ofctl ofp-print "\
+06 06 00 20 00 00 00 01 00 00 50 54 00 00 00 01 \
+00 00 01 00 ff 00 00 00 00 00 07 6f 00 00 00 00 \
+"], [0], [dnl
+OFPT_FEATURES_REPLY (OF1.5) (xid=0x1): dpid:0000505400000001
+n_tables:255, n_buffers:256
+capabilities: FLOW_STATS TABLE_STATS PORT_STATS GROUP_STATS IP_REASM QUEUE_STATS PORT_BLOCKED BUNDLES FLOW_MONITORING
+])
+AT_CLEANUP
+
AT_SETUP([OFPT_FEATURES_REPLY - with auxiliary_id - OF1.3])
AT_KEYWORDS([ofp-print])
AT_CHECK([ovs-ofctl ofp-print "\
diff --git a/tests/ofproto.at b/tests/ofproto.at
index 3964f1cd4..d360b7a94 100644
--- a/tests/ofproto.at
+++ b/tests/ofproto.at
@@ -1242,7 +1242,7 @@ do
AT_CHECK_UNQUOTED([strip_xids < stdout], [0], [dnl
OFPT_FEATURES_REPLY (OF1.4): dpid:fedcba9876543210
n_tables:254, n_buffers:0
-capabilities: FLOW_STATS TABLE_STATS PORT_STATS GROUP_STATS QUEUE_STATS
+capabilities: FLOW_STATS TABLE_STATS PORT_STATS GROUP_STATS QUEUE_STATS BUNDLES
OFPST_PORT_DESC reply (OF1.4):
LOCAL(br0): addr:aa:55:aa:55:00:00
config: $config