@@ -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 ## */
@@ -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. */
@@ -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;
@@ -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) {
@@ -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;
}
@@ -403,6 +403,18 @@ 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 - with auxiliary_id - OF1.3])
AT_KEYWORDS([ofp-print])
AT_CHECK([ovs-ofctl ofp-print "\
@@ -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
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> --- v2: Add the capabilities bits to OpenFlow 1.4 instead of OpenFlow 1.5, as OpenFlow 1.4.1 added support for these. include/openflow/openflow-1.4.h | 6 ++++++ include/openvswitch/ofp-util.h | 11 ++++++++--- lib/ofp-print.c | 2 ++ lib/ofp-util.c | 8 ++++++-- ofproto/ofproto.c | 2 +- tests/ofp-print.at | 12 ++++++++++++ tests/ofproto.at | 2 +- 7 files changed, 36 insertions(+), 7 deletions(-)