From patchwork Sun Jun 9 23:23:41 2019
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
X-Patchwork-Submitter: Ben Pfaff
X-Patchwork-Id: 1112768
Return-Path:
X-Original-To: incoming@patchwork.ozlabs.org
Delivered-To: patchwork-incoming@bilbo.ozlabs.org
Authentication-Results: ozlabs.org;
spf=pass (mailfrom) smtp.mailfrom=openvswitch.org
(client-ip=140.211.169.12; helo=mail.linuxfoundation.org;
envelope-from=ovs-dev-bounces@openvswitch.org;
receiver=)
Authentication-Results: ozlabs.org;
dmarc=none (p=none dis=none) header.from=ovn.org
Received: from mail.linuxfoundation.org (mail.linuxfoundation.org
[140.211.169.12])
(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256
bits)) (No client certificate requested)
by ozlabs.org (Postfix) with ESMTPS id 45MXRB3BMlz9s4V
for ;
Mon, 10 Jun 2019 09:24:38 +1000 (AEST)
Received: from mail.linux-foundation.org (localhost [127.0.0.1])
by mail.linuxfoundation.org (Postfix) with ESMTP id C9F97C9A;
Sun, 9 Jun 2019 23:24:01 +0000 (UTC)
X-Original-To: dev@openvswitch.org
Delivered-To: ovs-dev@mail.linuxfoundation.org
Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org
[172.17.192.35])
by mail.linuxfoundation.org (Postfix) with ESMTPS id 7A39AC7A
for ; Sun, 9 Jun 2019 23:24:00 +0000 (UTC)
X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6
Received: from relay2-d.mail.gandi.net (relay2-d.mail.gandi.net
[217.70.183.194])
by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 0A89576F
for ; Sun, 9 Jun 2019 23:23:58 +0000 (UTC)
X-Originating-IP: 75.54.222.30
Received: from sigill.attlocal.net
(75-54-222-30.lightspeed.rdcyca.sbcglobal.net [75.54.222.30])
(Authenticated sender: blp@ovn.org)
by relay2-d.mail.gandi.net (Postfix) with ESMTPSA id F35D04000D;
Sun, 9 Jun 2019 23:23:53 +0000 (UTC)
From: Ben Pfaff
To: dev@openvswitch.org
Date: Sun, 9 Jun 2019 16:23:41 -0700
Message-Id: <20190609232342.14405-2-blp@ovn.org>
X-Mailer: git-send-email 2.20.1
In-Reply-To: <20190609232342.14405-1-blp@ovn.org>
References: <20190609232342.14405-1-blp@ovn.org>
MIME-Version: 1.0
X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW
autolearn=ham version=3.3.1
X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on
smtp1.linux-foundation.org
Cc: Ben Pfaff
Subject: [ovs-dev] [PATCH v2 1/2] ofp-actions: Support OF1.5 meter action.
X-BeenThere: ovs-dev@openvswitch.org
X-Mailman-Version: 2.1.12
Precedence: list
List-Id:
List-Unsubscribe: ,
List-Archive:
List-Post:
List-Help:
List-Subscribe: ,
Sender: ovs-dev-bounces@openvswitch.org
Errors-To: ovs-dev-bounces@openvswitch.org
OpenFlow 1.5 changed "meter" from an instruction to an action. This commit
supports it properly.
Signed-off-by: Ben Pfaff
Acked-by: Numan Siddique
---
Documentation/topics/openflow.rst | 6 --
NEWS | 1 +
include/openvswitch/ofp-actions.h | 4 +-
lib/ofp-actions.c | 117 +++++++++++++++++++++---------
lib/ovs-actions.xml | 11 ++-
tests/ofp-actions.at | 3 +
6 files changed, 100 insertions(+), 42 deletions(-)
diff --git a/Documentation/topics/openflow.rst b/Documentation/topics/openflow.rst
index b6a5c6b54920..b4e49be916be 100644
--- a/Documentation/topics/openflow.rst
+++ b/Documentation/topics/openflow.rst
@@ -242,12 +242,6 @@ features are listed in the previous section.
(optional for OF1.5+)
-* Meter action
-
- (EXT-379)
-
- (required for OF1.5+ if metering is supported)
-
* Port properties for pipeline fields
Prototype for OVS was done during specification.
diff --git a/NEWS b/NEWS
index 19cebf89a785..6f91a4d6950e 100644
--- a/NEWS
+++ b/NEWS
@@ -8,6 +8,7 @@ Post-v2.11.0
- OpenFlow:
* Removed support for OpenFlow 1.6 (draft), which ONF abandoned.
* New action "check_pkt_larger".
+ * Support for OpenFlow 1.5 "meter" action.
- Userspace datapath:
* ICMPv6 ND enhancements: support for match and set ND options type
and reserved fields.
diff --git a/include/openvswitch/ofp-actions.h b/include/openvswitch/ofp-actions.h
index 436c4aadf548..792b2679d3a8 100644
--- a/include/openvswitch/ofp-actions.h
+++ b/include/openvswitch/ofp-actions.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2013, 2014, 2015, 2016, 2017 Nicira, Inc.
+ * Copyright (c) 2012, 2013, 2014, 2015, 2016, 2017, 2019 Nicira, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -1360,7 +1360,7 @@ enum {
const char *ovs_instruction_name_from_type(enum ovs_instruction_type type);
int ovs_instruction_type_from_name(const char *name);
enum ovs_instruction_type ovs_instruction_type_from_ofpact_type(
- enum ofpact_type);
+ enum ofpact_type, enum ofp_version);
enum ofperr ovs_instruction_type_from_inst_type(
enum ovs_instruction_type *instruction_type, const uint16_t inst_type);
diff --git a/lib/ofp-actions.c b/lib/ofp-actions.c
index cabd5a05e1f4..ddef3b0c8780 100644
--- a/lib/ofp-actions.c
+++ b/lib/ofp-actions.c
@@ -259,6 +259,9 @@ enum ofp_raw_action_type {
/* NX1.0-1.4(6): struct nx_action_reg_move, ... VLMFF */
NXAST_RAW_REG_MOVE,
+ /* OF1.5+(29): uint32_t. */
+ OFPAT_RAW15_METER,
+
/* ## ------------------------- ## */
/* ## Nicira extension actions. ## */
/* ## ------------------------- ## */
@@ -407,7 +410,7 @@ static void ofpacts_update_instruction_actions(struct ofpbuf *openflow,
static void pad_ofpat(struct ofpbuf *openflow, size_t start_ofs);
static enum ofperr ofpacts_verify(const struct ofpact[], size_t ofpacts_len,
- uint32_t allowed_ovsinsts,
+ enum ofp_version, uint32_t allowed_ovsinsts,
enum ofpact_type outer_action,
char **errorp);
@@ -5957,7 +5960,7 @@ parse_CLONE(char *arg, const struct ofpact_parse_params *pp)
char *error;
ofpbuf_pull(pp->ofpacts, sizeof *clone);
- error = ofpacts_parse_copy(arg, pp, false, 0);
+ error = ofpacts_parse_copy(arg, pp, false, OFPACT_CLONE);
/* header points to the action list */
pp->ofpacts->header = ofpbuf_push_uninit(pp->ofpacts, sizeof *clone);
clone = pp->ofpacts->header;
@@ -7216,14 +7219,32 @@ check_OUTPUT_TRUNC(const struct ofpact_output_trunc *a,
return ofpact_check_output_port(a->port, cp->max_ports);
}
-/* Meter instruction. */
+/* Meter.
+ *
+ * In OpenFlow 1.3 and 1.4, "meter" is an instruction.
+ * In OpenFlow 1.5 and later, "meter" is an action.
+ *
+ * OpenFlow 1.5 */
+
+static enum ofperr
+decode_OFPAT_RAW15_METER(uint32_t meter_id,
+ enum ofp_version ofp_version OVS_UNUSED,
+ struct ofpbuf *out)
+{
+ struct ofpact_meter *om = ofpact_put_METER(out);
+ om->meter_id = meter_id;
+ om->provider_meter_id = UINT32_MAX; /* No provider meter ID. */
+ return 0;
+}
static void
encode_METER(const struct ofpact_meter *meter,
enum ofp_version ofp_version, struct ofpbuf *out)
{
- if (ofp_version >= OFP13_VERSION) {
+ if (ofp_version == OFP13_VERSION || ofp_version == OFP14_VERSION) {
instruction_put_OFPIT13_METER(out)->meter_id = htonl(meter->meter_id);
+ } else if (ofp_version >= OFP15_VERSION) {
+ put_OFPAT15_METER(out, meter->meter_id);
}
}
@@ -7683,8 +7704,8 @@ ofpacts_pull_openflow_actions__(struct ofpbuf *openflow,
error = ofpacts_decode(actions, actions_len, version, vl_mff_map,
ofpacts_tlv_bitmap, ofpacts);
if (!error) {
- error = ofpacts_verify(ofpacts->data, ofpacts->size, allowed_ovsinsts,
- outer_action, NULL);
+ error = ofpacts_verify(ofpacts->data, ofpacts->size, version,
+ allowed_ovsinsts, outer_action, NULL);
}
if (error) {
ofpbuf_clear(ofpacts);
@@ -7724,10 +7745,10 @@ ofpacts_pull_openflow_actions(struct ofpbuf *openflow,
uint64_t *ofpacts_tlv_bitmap,
struct ofpbuf *ofpacts)
{
- return ofpacts_pull_openflow_actions__(openflow, actions_len, version,
- 1u << OVSINST_OFPIT11_APPLY_ACTIONS,
- ofpacts, 0, vl_mff_map,
- ofpacts_tlv_bitmap);
+ return ofpacts_pull_openflow_actions__(
+ openflow, actions_len, version,
+ (1u << OVSINST_OFPIT11_APPLY_ACTIONS) | (1u << OVSINST_OFPIT13_METER),
+ ofpacts, 0, vl_mff_map, ofpacts_tlv_bitmap);
}
/* OpenFlow 1.1 action sets. */
@@ -7981,11 +8002,14 @@ ovs_instruction_type_from_name(const char *name)
}
enum ovs_instruction_type
-ovs_instruction_type_from_ofpact_type(enum ofpact_type type)
+ovs_instruction_type_from_ofpact_type(enum ofpact_type type,
+ enum ofp_version version)
{
switch (type) {
case OFPACT_METER:
- return OVSINST_OFPIT13_METER;
+ return (version >= OFP15_VERSION
+ ? OVSINST_OFPIT11_APPLY_ACTIONS
+ : OVSINST_OFPIT13_METER);
case OFPACT_CLEAR_ACTIONS:
return OVSINST_OFPIT11_CLEAR_ACTIONS;
case OFPACT_WRITE_ACTIONS:
@@ -8080,7 +8104,7 @@ struct ovsinst_map {
static const struct ovsinst_map *
get_ovsinst_map(enum ofp_version version)
{
- /* OpenFlow 1.1 and 1.2 instructions. */
+ /* OpenFlow 1.1, 1.2, and 1.5 instructions. */
static const struct ovsinst_map of11[] = {
{ OVSINST_OFPIT11_GOTO_TABLE, 1 },
{ OVSINST_OFPIT11_WRITE_METADATA, 2 },
@@ -8090,7 +8114,7 @@ get_ovsinst_map(enum ofp_version version)
{ 0, -1 },
};
- /* OpenFlow 1.3+ instructions. */
+ /* OpenFlow 1.3 and 1.4 instructions. */
static const struct ovsinst_map of13[] = {
{ OVSINST_OFPIT11_GOTO_TABLE, 1 },
{ OVSINST_OFPIT11_WRITE_METADATA, 2 },
@@ -8101,7 +8125,7 @@ get_ovsinst_map(enum ofp_version version)
{ 0, -1 },
};
- return version < OFP13_VERSION ? of11 : of13;
+ return version == OFP13_VERSION || version == OFP14_VERSION ? of13 : of11;
}
/* Converts 'ovsinst_bitmap', a bitmap whose bits correspond to OVSINST_*
@@ -8193,7 +8217,7 @@ OVS_INSTRUCTIONS
static enum ofperr
decode_openflow11_instructions(const struct ofp11_instruction insts[],
- size_t n_insts,
+ size_t n_insts, enum ofp_version version,
const struct ofp11_instruction *out[])
{
const struct ofp11_instruction *inst;
@@ -8209,6 +8233,11 @@ decode_openflow11_instructions(const struct ofp11_instruction insts[],
return error;
}
+ if (type == OVSINST_OFPIT13_METER && version >= OFP15_VERSION) {
+ /* "meter" is an action, not an instruction, in OpenFlow 1.5. */
+ return OFPERR_OFPBIC_UNKNOWN_INST;
+ }
+
if (out[type]) {
return OFPERR_OFPBIC_DUP_INST;
}
@@ -8271,7 +8300,7 @@ ofpacts_pull_openflow_instructions(struct ofpbuf *openflow,
}
error = decode_openflow11_instructions(
- instructions, instructions_len / OFP11_INSTRUCTION_ALIGN,
+ instructions, instructions_len / OFP11_INSTRUCTION_ALIGN, version,
insts);
if (error) {
goto exit;
@@ -8344,7 +8373,7 @@ ofpacts_pull_openflow_instructions(struct ofpbuf *openflow,
ogt->table_id = oigt->table_id;
}
- error = ofpacts_verify(ofpacts->data, ofpacts->size,
+ error = ofpacts_verify(ofpacts->data, ofpacts->size, version,
(1u << N_OVS_INSTRUCTIONS) - 1, 0, NULL);
exit:
if (error) {
@@ -8559,7 +8588,8 @@ ofpacts_verify_nested(const struct ofpact *a, enum ofpact_type outer_action,
if (outer_action) {
ovs_assert(outer_action == OFPACT_WRITE_ACTIONS
- || outer_action == OFPACT_CT);
+ || outer_action == OFPACT_CT
+ || outer_action == OFPACT_CLONE);
if (outer_action == OFPACT_CT) {
if (!field) {
@@ -8571,6 +8601,10 @@ ofpacts_verify_nested(const struct ofpact *a, enum ofpact_type outer_action,
return OFPERR_OFPBAC_BAD_ARGUMENT;
}
}
+
+ if (a->type == OFPACT_METER) {
+ return unsupported_nesting(a->type, outer_action, errorp);
+ }
}
return 0;
@@ -8580,6 +8614,10 @@ ofpacts_verify_nested(const struct ofpact *a, enum ofpact_type outer_action,
* appropriate order as defined by the OpenFlow spec and as required by Open
* vSwitch.
*
+ * The 'version' is relevant only for error reporting: Open vSwitch enforces
+ * the same rules for every version of OpenFlow, but different versions require
+ * different error codes.
+ *
* 'allowed_ovsinsts' is a bitmap of OVSINST_* values, in which 1-bits indicate
* instructions that are allowed within 'ofpacts[]'.
*
@@ -8587,8 +8625,8 @@ ofpacts_verify_nested(const struct ofpact *a, enum ofpact_type outer_action,
* within another action of type 'outer_action'. */
static enum ofperr
ofpacts_verify(const struct ofpact ofpacts[], size_t ofpacts_len,
- uint32_t allowed_ovsinsts, enum ofpact_type outer_action,
- char **errorp)
+ enum ofp_version version, uint32_t allowed_ovsinsts,
+ enum ofpact_type outer_action, char **errorp)
{
const struct ofpact *a;
enum ovs_instruction_type inst;
@@ -8616,7 +8654,7 @@ ofpacts_verify(const struct ofpact ofpacts[], size_t ofpacts_len,
return error;
}
- next = ovs_instruction_type_from_ofpact_type(a->type);
+ next = ovs_instruction_type_from_ofpact_type(a->type, version);
if (a > ofpacts
&& (inst == OVSINST_OFPIT11_APPLY_ACTIONS
? next < inst
@@ -8638,8 +8676,13 @@ ofpacts_verify(const struct ofpact ofpacts[], size_t ofpacts_len,
if (!((1u << next) & allowed_ovsinsts)) {
const char *name = ovs_instruction_name_from_type(next);
- verify_error(errorp, "%s instruction not allowed here", name);
- return OFPERR_OFPBIC_UNSUP_INST;
+ if (next == OVSINST_OFPIT13_METER && version >= OFP15_VERSION) {
+ verify_error(errorp, "%s action not allowed here", name);
+ return OFPERR_OFPBAC_BAD_TYPE;
+ } else {
+ verify_error(errorp, "%s instruction not allowed here", name);
+ return OFPERR_OFPBIC_UNSUP_INST;
+ }
}
inst = next;
@@ -8684,9 +8727,9 @@ ofpacts_put_openflow_actions(const struct ofpact ofpacts[], size_t ofpacts_len,
}
static enum ovs_instruction_type
-ofpact_is_apply_actions(const struct ofpact *a)
+ofpact_is_apply_actions(const struct ofpact *a, enum ofp_version version)
{
- return (ovs_instruction_type_from_ofpact_type(a->type)
+ return (ovs_instruction_type_from_ofpact_type(a->type, version)
== OVSINST_OFPIT11_APPLY_ACTIONS);
}
@@ -8707,14 +8750,14 @@ ofpacts_put_openflow_instructions(const struct ofpact ofpacts[],
a = ofpacts;
while (a < end) {
- if (ofpact_is_apply_actions(a)) {
+ if (ofpact_is_apply_actions(a, ofp_version)) {
size_t ofs = openflow->size;
instruction_put_OFPIT11_APPLY_ACTIONS(openflow);
do {
encode_ofpact(a, ofp_version, openflow);
a = ofpact_next(a);
- } while (a < end && ofpact_is_apply_actions(a));
+ } while (a < end && ofpact_is_apply_actions(a, ofp_version));
ofpacts_update_instruction_actions(openflow, ofs);
} else {
encode_ofpact(a, ofp_version, openflow);
@@ -9023,12 +9066,13 @@ ofpacts_get_meter(const struct ofpact ofpacts[], size_t ofpacts_len)
const struct ofpact *a;
OFPACT_FOR_EACH (a, ofpacts, ofpacts_len) {
- enum ovs_instruction_type inst;
-
- inst = ovs_instruction_type_from_ofpact_type(a->type);
if (a->type == OFPACT_METER) {
return ofpact_get_METER(a)->meter_id;
- } else if (inst > OVSINST_OFPIT13_METER) {
+ }
+
+ enum ovs_instruction_type inst
+ = ovs_instruction_type_from_ofpact_type(a->type, 0);
+ if (inst > OVSINST_OFPIT13_METER) {
break;
}
}
@@ -9174,6 +9218,13 @@ ofpacts_parse__(char *str, const struct ofpact_parse_params *pp,
ofp_port_t port;
if (ofpact_type_from_name(key, &type)) {
error = ofpact_parse(type, value, pp);
+
+ if (type == OFPACT_METER && !allow_instructions) {
+ /* Meter is an action in OF1.5 and it's being used in a
+ * context where instructions aren't allowed. Therefore,
+ * this must be OF1.5+. */
+ *pp->usable_protocols &= OFPUTIL_P_OF15_UP;
+ }
} else if (!strcasecmp(key, "mod_vlan_vid")) {
error = parse_set_vlan_vid(value, true, pp);
} else if (!strcasecmp(key, "mod_vlan_pcp")) {
@@ -9208,7 +9259,7 @@ ofpacts_parse__(char *str, const struct ofpact_parse_params *pp,
}
char *error = NULL;
- ofpacts_verify(pp->ofpacts->data, pp->ofpacts->size,
+ ofpacts_verify(pp->ofpacts->data, pp->ofpacts->size, OFP11_VERSION,
(allow_instructions
? (1u << N_OVS_INSTRUCTIONS) - 1
: ((1u << OVSINST_OFPIT11_APPLY_ACTIONS)
diff --git a/lib/ovs-actions.xml b/lib/ovs-actions.xml
index ab6c0030aa50..e52cd849e37b 100644
--- a/lib/ovs-actions.xml
+++ b/lib/ovs-actions.xml
@@ -2832,11 +2832,20 @@ while link > max_link
1.5 changes meter
from an instruction to an action.
+
+ OpenFlow 1.5 allows implementations to restrict meter
to
+ be the first action in an action list and to exclude
+ meter
from action sets, for better compatibility with
+ OpenFlow 1.3 and 1.4. Open vSwitch restricts the meter
+ action both ways.
+
+
Open vSwitch 2.0 introduced OpenFlow protocol support for meters, but
it did not include a datapath implementation. Open vSwitch 2.7 added
meter support to the userspace datapath. Open vSwitch 2.10 added
- meter support to the kernel datapath.
+ meter support to the kernel datapath. Open vSwitch 2.12 added
+ support for meter as an action in OpenFlow 1.5.
diff --git a/tests/ofp-actions.at b/tests/ofp-actions.at
index f944369f4086..4893280a998f 100644
--- a/tests/ofp-actions.at
+++ b/tests/ofp-actions.at
@@ -792,6 +792,9 @@ AT_DATA([test-data], [dnl
# actions=set_field:00:00:00:00:12:34/00:00:00:00:ff:ff->eth_src
0019 0018 8000090c 000000001234 00000000ffff 00000000
+# actions=meter:5
+001d 0008 00000005
+
])
sed '/^[[#&]]/d' < test-data > input.txt
sed -n 's/^# //p; /^$/p' < test-data > expout
From patchwork Sun Jun 9 23:23:42 2019
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
X-Patchwork-Submitter: Ben Pfaff
X-Patchwork-Id: 1112769
Return-Path:
X-Original-To: incoming@patchwork.ozlabs.org
Delivered-To: patchwork-incoming@bilbo.ozlabs.org
Authentication-Results: ozlabs.org;
spf=pass (mailfrom) smtp.mailfrom=openvswitch.org
(client-ip=140.211.169.12; helo=mail.linuxfoundation.org;
envelope-from=ovs-dev-bounces@openvswitch.org;
receiver=)
Authentication-Results: ozlabs.org;
dmarc=none (p=none dis=none) header.from=ovn.org
Received: from mail.linuxfoundation.org (mail.linuxfoundation.org
[140.211.169.12])
(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256
bits)) (No client certificate requested)
by ozlabs.org (Postfix) with ESMTPS id 45MXRn499xz9s4V
for ;
Mon, 10 Jun 2019 09:25:09 +1000 (AEST)
Received: from mail.linux-foundation.org (localhost [127.0.0.1])
by mail.linuxfoundation.org (Postfix) with ESMTP id 842DBCAA;
Sun, 9 Jun 2019 23:24:08 +0000 (UTC)
X-Original-To: dev@openvswitch.org
Delivered-To: ovs-dev@mail.linuxfoundation.org
Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org
[172.17.192.35])
by mail.linuxfoundation.org (Postfix) with ESMTPS id 35758C79
for ; Sun, 9 Jun 2019 23:24:07 +0000 (UTC)
X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6
Received: from relay2-d.mail.gandi.net (relay2-d.mail.gandi.net
[217.70.183.194])
by smtp1.linuxfoundation.org (Postfix) with ESMTPS id D795C775
for ; Sun, 9 Jun 2019 23:24:05 +0000 (UTC)
X-Originating-IP: 75.54.222.30
Received: from sigill.attlocal.net
(75-54-222-30.lightspeed.rdcyca.sbcglobal.net [75.54.222.30])
(Authenticated sender: blp@ovn.org)
by relay2-d.mail.gandi.net (Postfix) with ESMTPSA id DAB684000F;
Sun, 9 Jun 2019 23:23:58 +0000 (UTC)
From: Ben Pfaff
To: dev@openvswitch.org
Date: Sun, 9 Jun 2019 16:23:42 -0700
Message-Id: <20190609232342.14405-3-blp@ovn.org>
X-Mailer: git-send-email 2.20.1
In-Reply-To: <20190609232342.14405-1-blp@ovn.org>
References: <20190609232342.14405-1-blp@ovn.org>
MIME-Version: 1.0
X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW
autolearn=ham version=3.3.1
X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on
smtp1.linux-foundation.org
Cc: Ben Pfaff
Subject: [ovs-dev] [PATCH v2 2/2] OpenFlow: Enable OpenFlow 1.5 by default.
X-BeenThere: ovs-dev@openvswitch.org
X-Mailman-Version: 2.1.12
Precedence: list
List-Id:
List-Unsubscribe: ,
List-Archive:
List-Post:
List-Help:
List-Subscribe: ,
Sender: ovs-dev-bounces@openvswitch.org
Errors-To: ovs-dev-bounces@openvswitch.org
Open vSwitch now supports all OpenFlow 1.5 required features, so enable
it by default.
Signed-off-by: Ben Pfaff
Acked-by: Numan Siddique
---
Documentation/faq/openflow.rst | 27 +++++++++----------
.../group-selection-method-property.txt | 16 +++++------
NEWS | 3 +++
include/openvswitch/ofp-protocol.h | 5 ++--
lib/ofp-version-opt.h | 2 +-
lib/ofp-version.man | 7 +----
tests/test-vconn.c | 14 +++++-----
vswitchd/vswitch.xml | 13 +++------
8 files changed, 39 insertions(+), 48 deletions(-)
diff --git a/Documentation/faq/openflow.rst b/Documentation/faq/openflow.rst
index 561d793a6692..8c94891703a8 100644
--- a/Documentation/faq/openflow.rst
+++ b/Documentation/faq/openflow.rst
@@ -30,17 +30,18 @@ Q: What versions of OpenFlow does Open vSwitch support?
A: The following table lists the versions of OpenFlow supported by each
version of Open vSwitch:
- =============== ===== ===== ===== ===== ===== =====
- Open vSwitch OF1.0 OF1.1 OF1.2 OF1.3 OF1.4 OF1.5
- =============== ===== ===== ===== ===== ===== =====
- 1.9 and earlier yes --- --- --- --- ---
- 1.10, 1.11 yes --- (*) (*) --- ---
- 2.0, 2.1 yes (*) (*) (*) --- ---
- 2.2 yes (*) (*) (*) (%) (*)
- 2.3, 2.4 yes yes yes yes (*) (*)
- 2.5, 2.6, 2.7 yes yes yes yes (*) (*)
- 2.8 yes yes yes yes yes (*)
- =============== ===== ===== ===== ===== ===== =====
+ ===================== ===== ===== ===== ===== ===== =====
+ Open vSwitch OF1.0 OF1.1 OF1.2 OF1.3 OF1.4 OF1.5
+ ===================== ===== ===== ===== ===== ===== =====
+ 1.9 and earlier yes --- --- --- --- ---
+ 1.10, 1.11 yes --- (*) (*) --- ---
+ 2.0, 2.1 yes (*) (*) (*) --- ---
+ 2.2 yes (*) (*) (*) (%) (*)
+ 2.3, 2.4 yes yes yes yes (*) (*)
+ 2.5, 2.6, 2.7 yes yes yes yes (*) (*)
+ 2.8, 2.9, 2.10, 2.11 yes yes yes yes yes (*)
+ 2.12 yes yes yes yes yes yes
+ ===================== ===== ===== ===== ===== ===== =====
--- Not supported.
yes Supported and enabled by default
@@ -73,8 +74,6 @@ Q: What versions of OpenFlow does Open vSwitch support?
could cause crashes. We don't recommend enabling it.)
:doc:`/topics/openflow` tracks support for OpenFlow 1.1 and later features.
- When support for OpenFlow 1.5 is solidly implemented, Open vSwitch will
- enable it by default.
Q: Does Open vSwitch support MPLS?
@@ -476,7 +475,7 @@ Q: How does OVS divide flows among buckets in an OpenFlow "select" group?
different hash function, using a Netronome extension to the OpenFlow 1.5+
group_mod message. For more information, see
Documentation/group-selection-method-property.txt in the Open vSwitch
- source tree. (OpenFlow 1.5 support in Open vSwitch is still experimental.)
+ source tree.
Q: An OpenFlow "select" group isn't dividing packets evenly among the buckets.
diff --git a/Documentation/group-selection-method-property.txt b/Documentation/group-selection-method-property.txt
index 29e8249af6ac..0b13da908a4e 100644
--- a/Documentation/group-selection-method-property.txt
+++ b/Documentation/group-selection-method-property.txt
@@ -18,7 +18,7 @@ Contents
1. Introduction
===============
-This text describes a Netronome Extension to (draft) OpenFlow 1.5 that allows a
+This text describes a Netronome Extension to OpenFlow 1.5 that allows a
controller to provide more information on the selection method for select
groups. This proposal is in the form of an enhanced select group type.
@@ -30,7 +30,7 @@ the OpenFlow specification.
===============
A new Netronome group experimenter property is defined which provides
-compatibility with the group mod message defined in draft Open Flow 1.5
+compatibility with the group mod message defined in Open Flow 1.5
(also known as ONF EXT-350) and allows parameters for the selection
method of select groups to be passed by the controller. In particular it
allows controllers to:
@@ -60,14 +60,14 @@ enum ntr_group_mod_subtype {
};
-Modifications to the group table from the controller may be done with a
-OFPT_GROUP_MOD message described (draft) Open Flow 1.5. Group Entry
-Message. Of relevance here is that (draft) Open Flow 1.5 group messages
-have properties.
+Modifications to the group table from the controller may be done with
+a OFPT_GROUP_MOD message described Open Flow 1.5. Group Entry
+Message. Of relevance here is that Open Flow 1.5 group messages have
+properties.
This proposal is defined in terms of an implementation of struct
-ofp_group_prop_experimenter which is described in (draft) Open Flow 1.5.
-The implementation is:
+ofp_group_prop_experimenter which is described in Open Flow 1.5. The
+implementation is:
struct ntr_group_prop_selection_method {
ovs_be16 type; /* OFPGPT_EXPERIMENTER. */
diff --git a/NEWS b/NEWS
index 6f91a4d6950e..fd3eb05c80f9 100644
--- a/NEWS
+++ b/NEWS
@@ -6,6 +6,9 @@ Post-v2.11.0
* Add support for vHost Post-copy Live Migration (experimental).
* OVS validated with DPDK 18.11.1 which is recommended to be used.
- OpenFlow:
+ * All features required by OpenFlow 1.5 are now implemented, so
+ ovs-vswitchd now enables OpenFlow 1.5 by default (in addition to
+ OpenFlow 1.0 to 1.4).
* Removed support for OpenFlow 1.6 (draft), which ONF abandoned.
* New action "check_pkt_larger".
* Support for OpenFlow 1.5 "meter" action.
diff --git a/include/openvswitch/ofp-protocol.h b/include/openvswitch/ofp-protocol.h
index 7873fdd12853..741ddc458bd2 100644
--- a/include/openvswitch/ofp-protocol.h
+++ b/include/openvswitch/ofp-protocol.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008-2017 Nicira, Inc.
+ * Copyright (c) 2008-2017, 2019 Nicira, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -151,7 +151,8 @@ enum ofputil_protocol ofputil_protocols_from_version_bitmap(uint32_t bitmap);
(1u << OFP11_VERSION) | \
(1u << OFP12_VERSION) | \
(1u << OFP13_VERSION) | \
- (1u << OFP14_VERSION))
+ (1u << OFP14_VERSION) | \
+ (1u << OFP15_VERSION))
#define OFPUTIL_DEFAULT_VERSIONS OFPUTIL_SUPPORTED_VERSIONS
enum ofputil_protocol ofputil_protocols_from_string(const char *s);
diff --git a/lib/ofp-version-opt.h b/lib/ofp-version-opt.h
index 525fd8ac41b9..f50f400d3293 100644
--- a/lib/ofp-version-opt.h
+++ b/lib/ofp-version-opt.h
@@ -10,7 +10,7 @@
#define OFP_VERSION_OPTION_HANDLERS \
case 'V': \
- ovs_print_version(OFP10_VERSION, OFP14_VERSION); \
+ ovs_print_version(OFP10_VERSION, OFP15_VERSION); \
exit(EXIT_SUCCESS); \
\
case 'O': \
diff --git a/lib/ofp-version.man b/lib/ofp-version.man
index 0e5391db72ba..301eb91152b6 100644
--- a/lib/ofp-version.man
+++ b/lib/ofp-version.man
@@ -27,12 +27,7 @@ by default:
.
.IP \(bu
\fBOpenFlow14\fR, for OpenFlow 1.4.
-.RE
-.
-.IP
-Support for the following protocol versions is provided for testing
-and development purposes. They are not enabled by default:
.
-.RS
.IP \(bu
\fBOpenFlow15\fR, for OpenFlow 1.5.
+.RE
diff --git a/tests/test-vconn.c b/tests/test-vconn.c
index 73ef9a9587ab..fc8ce4a2c0e1 100644
--- a/tests/test-vconn.c
+++ b/tests/test-vconn.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2009, 2010, 2011, 2012, 2013, 2014, 2017 Nicira, Inc.
+ * Copyright (c) 2009, 2010, 2011, 2012, 2013, 2014, 2017, 2019 Nicira, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -239,7 +239,7 @@ test_read_hello(struct ovs_cmdl_context *ctx)
if (retval == sizeof hello) {
enum ofpraw raw;
- CHECK(hello.version, OFP14_VERSION);
+ CHECK(hello.version, OFP15_VERSION);
CHECK(ofpraw_decode_partial(&raw, &hello, sizeof hello), 0);
CHECK(raw, OFPRAW_OFPT_HELLO);
CHECK(ntohs(hello.length), sizeof hello);
@@ -312,7 +312,7 @@ test_send_hello(const char *type, const void *out, size_t out_size,
if (retval == sizeof hello) {
enum ofpraw raw;
- CHECK(hello.version, OFP14_VERSION);
+ CHECK(hello.version, OFP15_VERSION);
CHECK(ofpraw_decode_partial(&raw, &hello, sizeof hello), 0);
CHECK(raw, OFPRAW_OFPT_HELLO);
CHECK(ntohs(hello.length), sizeof hello);
@@ -363,7 +363,7 @@ test_send_plain_hello(struct ovs_cmdl_context *ctx)
const char *type = ctx->argv[1];
struct ofpbuf *hello;
- hello = ofpraw_alloc_xid(OFPRAW_OFPT_HELLO, OFP14_VERSION,
+ hello = ofpraw_alloc_xid(OFPRAW_OFPT_HELLO, OFP15_VERSION,
htonl(0x12345678), 0);
test_send_hello(type, hello->data, hello->size, 0);
ofpbuf_delete(hello);
@@ -379,7 +379,7 @@ test_send_long_hello(struct ovs_cmdl_context *ctx)
struct ofpbuf *hello;
enum { EXTRA_BYTES = 8 };
- hello = ofpraw_alloc_xid(OFPRAW_OFPT_HELLO, OFP14_VERSION,
+ hello = ofpraw_alloc_xid(OFPRAW_OFPT_HELLO, OFP15_VERSION,
htonl(0x12345678), EXTRA_BYTES);
ofpbuf_put_zeros(hello, EXTRA_BYTES);
ofpmsg_update_length(hello);
@@ -395,7 +395,7 @@ test_send_echo_hello(struct ovs_cmdl_context *ctx)
const char *type = ctx->argv[1];
struct ofpbuf *echo;
- echo = ofpraw_alloc_xid(OFPRAW_OFPT_ECHO_REQUEST, OFP14_VERSION,
+ echo = ofpraw_alloc_xid(OFPRAW_OFPT_ECHO_REQUEST, OFP15_VERSION,
htonl(0x12345678), 0);
test_send_hello(type, echo->data, echo->size, EPROTO);
ofpbuf_delete(echo);
@@ -421,7 +421,7 @@ test_send_invalid_version_hello(struct ovs_cmdl_context *ctx)
const char *type = ctx->argv[1];
struct ofpbuf *hello;
- hello = ofpraw_alloc_xid(OFPRAW_OFPT_HELLO, OFP14_VERSION,
+ hello = ofpraw_alloc_xid(OFPRAW_OFPT_HELLO, OFP15_VERSION,
htonl(0x12345678), 0);
((struct ofp_header *) hello->data)->version = 0;
test_send_hello(type, hello->data, hello->size, EPROTO);
diff --git a/vswitchd/vswitch.xml b/vswitchd/vswitch.xml
index 89c06a1b7877..33d654f27bb2 100644
--- a/vswitchd/vswitch.xml
+++ b/vswitchd/vswitch.xml
@@ -1264,16 +1264,9 @@
-
- List of OpenFlow protocols that may be used when negotiating
- a connection with a controller. OpenFlow 1.0, 1.1, 1.2, 1.3, and
- 1.4 are enabled by default if this column is empty.
-
-
-
- OpenFlow 1.5 is not enabled by default because its
- implementations is missing features.
-
+ List of OpenFlow protocols that may be used when negotiating a
+ connection with a controller. OpenFlow 1.0, 1.1, 1.2, 1.3, 1.4, and
+ 1.5 are enabled by default if this column is empty.