From patchwork Wed Apr 29 16:53:28 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Numan Siddique X-Patchwork-Id: 1279533 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=140.211.166.137; helo=fraxinus.osuosl.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 fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49C4NH3lDvz9sRY for ; Thu, 30 Apr 2020 02:53:49 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id F294B86519; Wed, 29 Apr 2020 16:53:46 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id SLQMQJlaxvbp; Wed, 29 Apr 2020 16:53:44 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by fraxinus.osuosl.org (Postfix) with ESMTP id A7E12860E6; Wed, 29 Apr 2020 16:53:44 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 8E098C0865; Wed, 29 Apr 2020 16:53:44 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by lists.linuxfoundation.org (Postfix) with ESMTP id C1F59C0172 for ; Wed, 29 Apr 2020 16:53:43 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id BE53284D49 for ; Wed, 29 Apr 2020 16:53:43 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 1FlymHcZngFc for ; Wed, 29 Apr 2020 16:53:42 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from relay10.mail.gandi.net (relay10.mail.gandi.net [217.70.178.230]) by whitealder.osuosl.org (Postfix) with ESMTPS id DD450810BA for ; Wed, 29 Apr 2020 16:53:41 +0000 (UTC) Received: from nummac.local (unknown [27.7.189.251]) (Authenticated sender: numans@ovn.org) by relay10.mail.gandi.net (Postfix) with ESMTPSA id 6586B24000A; Wed, 29 Apr 2020 16:53:37 +0000 (UTC) From: numans@ovn.org To: dev@openvswitch.org Date: Wed, 29 Apr 2020 22:23:28 +0530 Message-Id: <20200429165328.1051436-1-numans@ovn.org> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Subject: [ovs-dev] [PATCH ovn v2] controller: Use OpenFlow version 1.5 X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" From: Numan Siddique When adding flows to the group table, we need to use OFP15_VERSION to set the selection_method. Right now ovn-controller is setting select_method=dp_hash for OVN load balancers, but when encoding the group mod, it is ignored. Signed-off-by: Numan Siddique --- v1 -> v2 ------ * Addressed review comments from Ilya, except for the ovn-controller-vtep. controller/ofctrl.c | 14 +++++++------- controller/ovn-controller.c | 2 +- controller/pinctrl.c | 2 +- lib/actions.c | 10 +++++----- lib/expr.c | 2 +- tests/ovn.at | 6 +++--- utilities/ovn-sbctl.c | 4 ++-- utilities/ovn-trace.c | 4 ++-- 8 files changed, 22 insertions(+), 22 deletions(-) diff --git a/controller/ofctrl.c b/controller/ofctrl.c index 485a857d1..4b51cd86e 100644 --- a/controller/ofctrl.c +++ b/controller/ofctrl.c @@ -178,7 +178,7 @@ ofctrl_init(struct ovn_extend_table *group_table, int inactivity_probe_interval) { swconn = rconn_create(inactivity_probe_interval, 0, - DSCP_DEFAULT, 1 << OFP13_VERSION); + DSCP_DEFAULT, 1 << OFP15_VERSION); tx_counter = rconn_packet_counter_create(); hmap_init(&installed_flows); ovs_list_init(&flow_updates); @@ -282,8 +282,8 @@ process_tlv_table_reply(const struct ofputil_tlv_table_reply *reply) ovs_list_init(&ttm.mappings); ovs_list_push_back(&ttm.mappings, &tm.list_node); - xid = queue_msg(ofputil_encode_tlv_table_mod(OFP13_VERSION, &ttm)); - xid2 = queue_msg(ofputil_encode_barrier_request(OFP13_VERSION)); + xid = queue_msg(ofputil_encode_tlv_table_mod(OFP15_VERSION, &ttm)); + xid2 = queue_msg(ofputil_encode_barrier_request(OFP15_VERSION)); state = S_TLV_TABLE_MOD_SENT; return true; @@ -911,7 +911,7 @@ encode_flow_mod(struct ofputil_flow_mod *fm) fm->buffer_id = UINT32_MAX; fm->out_port = OFPP_ANY; fm->out_group = OFPG_ANY; - return ofputil_encode_flow_mod(fm, OFPUTIL_P_OF13_OXM); + return ofputil_encode_flow_mod(fm, OFPUTIL_P_OF15_OXM); } static void @@ -926,7 +926,7 @@ add_flow_mod(struct ofputil_flow_mod *fm, struct ovs_list *msgs) static struct ofpbuf * encode_group_mod(const struct ofputil_group_mod *gm) { - return ofputil_encode_group_mod(OFP13_VERSION, gm, NULL, -1); + return ofputil_encode_group_mod(OFP15_VERSION, gm, NULL, -1); } static void @@ -940,7 +940,7 @@ add_group_mod(const struct ofputil_group_mod *gm, struct ovs_list *msgs) static struct ofpbuf * encode_meter_mod(const struct ofputil_meter_mod *mm) { - return ofputil_encode_meter_mod(OFP13_VERSION, mm); + return ofputil_encode_meter_mod(OFP15_VERSION, mm); } static void @@ -1281,7 +1281,7 @@ ofctrl_put(struct ovn_desired_flow_table *flow_table, if (!ovs_list_is_empty(&msgs)) { /* Add a barrier to the list of messages. */ - struct ofpbuf *barrier = ofputil_encode_barrier_request(OFP13_VERSION); + struct ofpbuf *barrier = ofputil_encode_barrier_request(OFP15_VERSION); const struct ofp_header *oh = barrier->data; ovs_be32 xid_ = oh->xid; ovs_list_push_back(&msgs, &barrier->list_node); diff --git a/controller/ovn-controller.c b/controller/ovn-controller.c index 6ff897325..a2d92429c 100644 --- a/controller/ovn-controller.c +++ b/controller/ovn-controller.c @@ -2297,7 +2297,7 @@ parse_options(int argc, char *argv[]) usage(); case 'V': - ovs_print_version(OFP13_VERSION, OFP13_VERSION); + ovs_print_version(OFP15_VERSION, OFP15_VERSION); exit(EXIT_SUCCESS); VLOG_OPTION_HANDLERS diff --git a/controller/pinctrl.c b/controller/pinctrl.c index 3230bb386..6bd425db2 100644 --- a/controller/pinctrl.c +++ b/controller/pinctrl.c @@ -2761,7 +2761,7 @@ pinctrl_handler(void *arg_) static long long int svc_monitors_next_run_time = LLONG_MAX; static long long int send_prefixd_time = LLONG_MAX; - swconn = rconn_create(5, 0, DSCP_DEFAULT, 1 << OFP13_VERSION); + swconn = rconn_create(5, 0, DSCP_DEFAULT, 1 << OFP15_VERSION); while (!latch_is_set(&pctrl->pinctrl_thread_exit)) { if (pctrl->br_int_name) { diff --git a/lib/actions.c b/lib/actions.c index 21c07969d..021a376b4 100644 --- a/lib/actions.c +++ b/lib/actions.c @@ -1508,7 +1508,7 @@ encode_nested_actions(const struct ovnact_nest *on, size_t oc_offset = encode_start_controller_op(opcode, false, NX_CTLR_NO_METER, ofpacts); ofpacts_put_openflow_actions(inner_ofpacts.data, inner_ofpacts.size, - ofpacts, OFP13_VERSION); + ofpacts, OFP15_VERSION); encode_finish_controller_op(oc_offset, ofpacts); /* Free memory. */ @@ -2311,7 +2311,7 @@ encode_PUT_DHCPV4_OPTS(const struct ovnact_put_opts *pdo, size_t oc_offset = encode_start_controller_op(ACTION_OPCODE_PUT_DHCP_OPTS, true, NX_CTLR_NO_METER, ofpacts); - nx_put_header(ofpacts, dst.field->id, OFP13_VERSION, false); + nx_put_header(ofpacts, dst.field->id, OFP15_VERSION, false); ovs_be32 ofs = htonl(dst.ofs); ofpbuf_put(ofpacts, &ofs, sizeof ofs); @@ -2342,7 +2342,7 @@ encode_PUT_DHCPV6_OPTS(const struct ovnact_put_opts *pdo, size_t oc_offset = encode_start_controller_op( ACTION_OPCODE_PUT_DHCPV6_OPTS, true, NX_CTLR_NO_METER, ofpacts); - nx_put_header(ofpacts, dst.field->id, OFP13_VERSION, false); + nx_put_header(ofpacts, dst.field->id, OFP15_VERSION, false); ovs_be32 ofs = htonl(dst.ofs); ofpbuf_put(ofpacts, &ofs, sizeof ofs); @@ -2452,7 +2452,7 @@ encode_DNS_LOOKUP(const struct ovnact_dns_lookup *dl, size_t oc_offset = encode_start_controller_op(ACTION_OPCODE_DNS_LOOKUP, true, NX_CTLR_NO_METER, ofpacts); - nx_put_header(ofpacts, dst.field->id, OFP13_VERSION, false); + nx_put_header(ofpacts, dst.field->id, OFP15_VERSION, false); ovs_be32 ofs = htonl(dst.ofs); ofpbuf_put(ofpacts, &ofs, sizeof ofs); encode_finish_controller_op(oc_offset, ofpacts); @@ -2616,7 +2616,7 @@ encode_PUT_ND_RA_OPTS(const struct ovnact_put_opts *po, size_t oc_offset = encode_start_controller_op( ACTION_OPCODE_PUT_ND_RA_OPTS, true, NX_CTLR_NO_METER, ofpacts); - nx_put_header(ofpacts, dst.field->id, OFP13_VERSION, false); + nx_put_header(ofpacts, dst.field->id, OFP15_VERSION, false); ovs_be32 ofs = htonl(dst.ofs); ofpbuf_put(ofpacts, &ofs, sizeof ofs); diff --git a/lib/expr.c b/lib/expr.c index 78646a1af..078d17840 100644 --- a/lib/expr.c +++ b/lib/expr.c @@ -1414,7 +1414,7 @@ expr_symbol_format(const struct expr_symbol *symbol, struct ds *s) } else if (symbol->ovn_field) { ds_put_cstr(s, symbol->name); } else { - nx_format_field_name(symbol->field->id, OFP13_VERSION, s); + nx_format_field_name(symbol->field->id, OFP15_VERSION, s); } } diff --git a/tests/ovn.at b/tests/ovn.at index c04cd06d2..7befc8224 100644 --- a/tests/ovn.at +++ b/tests/ovn.at @@ -1215,7 +1215,7 @@ reg1[0] = put_dhcp_opts(offerip=1.2.3.4, domain_name=1.2.3.4); # nd_ns nd_ns { nd.target = xxreg0; output; }; - encodes as controller(userdata=00.00.00.09.00.00.00.00.ff.ff.00.18.00.00.23.20.00.06.00.80.00.00.00.00.00.01.de.10.00.01.2e.10.ff.ff.00.10.00.00.23.20.00.0e.ff.f8.40.00.00.00) + encodes as controller(userdata=00.00.00.09.00.00.00.00.00.1c.00.18.00.80.00.00.00.00.00.00.00.01.de.10.80.00.3e.10.00.00.00.00.ff.ff.00.10.00.00.23.20.00.0e.ff.f8.40.00.00.00) has prereqs ip6 nd_ns { }; @@ -1226,12 +1226,12 @@ nd_ns { }; # nd_na nd_na { eth.src = 12:34:56:78:9a:bc; nd.tll = 12:34:56:78:9a:bc; outport = inport; inport = ""; /* Allow sending out inport. */ output; }; formats as nd_na { eth.src = 12:34:56:78:9a:bc; nd.tll = 12:34:56:78:9a:bc; outport = inport; inport = ""; output; }; - encodes as controller(userdata=00.00.00.03.00.00.00.00.00.19.00.10.80.00.08.06.12.34.56.78.9a.bc.00.00.00.19.00.10.80.00.42.06.12.34.56.78.9a.bc.00.00.ff.ff.00.18.00.00.23.20.00.06.00.20.00.00.00.00.00.01.1c.04.00.01.1e.04.00.19.00.10.00.01.1c.04.00.00.00.00.00.00.00.00.ff.ff.00.10.00.00.23.20.00.0e.ff.f8.40.00.00.00) + encodes as controller(userdata=00.00.00.03.00.00.00.00.00.19.00.10.80.00.08.06.12.34.56.78.9a.bc.00.00.00.19.00.10.80.00.42.06.12.34.56.78.9a.bc.00.00.00.1c.00.18.00.20.00.00.00.00.00.00.00.01.1c.04.00.01.1e.04.00.00.00.00.00.19.00.10.00.01.1c.04.00.00.00.00.00.00.00.00.ff.ff.00.10.00.00.23.20.00.0e.ff.f8.40.00.00.00) has prereqs nd_ns # nd_na_router nd_na_router { eth.src = 12:34:56:78:9a:bc; nd.tll = 12:34:56:78:9a:bc; outport = inport; inport = ""; /* Allow sending out inport. */ output; }; formats as nd_na_router { eth.src = 12:34:56:78:9a:bc; nd.tll = 12:34:56:78:9a:bc; outport = inport; inport = ""; output; }; - encodes as controller(userdata=00.00.00.0c.00.00.00.00.00.19.00.10.80.00.08.06.12.34.56.78.9a.bc.00.00.00.19.00.10.80.00.42.06.12.34.56.78.9a.bc.00.00.ff.ff.00.18.00.00.23.20.00.06.00.20.00.00.00.00.00.01.1c.04.00.01.1e.04.00.19.00.10.00.01.1c.04.00.00.00.00.00.00.00.00.ff.ff.00.10.00.00.23.20.00.0e.ff.f8.40.00.00.00) + encodes as controller(userdata=00.00.00.0c.00.00.00.00.00.19.00.10.80.00.08.06.12.34.56.78.9a.bc.00.00.00.19.00.10.80.00.42.06.12.34.56.78.9a.bc.00.00.00.1c.00.18.00.20.00.00.00.00.00.00.00.01.1c.04.00.01.1e.04.00.00.00.00.00.19.00.10.00.01.1c.04.00.00.00.00.00.00.00.00.ff.ff.00.10.00.00.23.20.00.0e.ff.f8.40.00.00.00) has prereqs nd_ns # get_nd diff --git a/utilities/ovn-sbctl.c b/utilities/ovn-sbctl.c index d8bb3dcbc..04e082c70 100644 --- a/utilities/ovn-sbctl.c +++ b/utilities/ovn-sbctl.c @@ -795,7 +795,7 @@ sbctl_open_vconn(struct shash *options) char *remote = ovs->data ? xstrdup(ovs->data) : default_ovs(); struct vconn *vconn; - int retval = vconn_open_block(remote, 1 << OFP13_VERSION, 0, -1, &vconn); + int retval = vconn_open_block(remote, 1 << OFP15_VERSION, 0, -1, &vconn); if (retval) { VLOG_WARN("%s: connection failed (%s)", remote, ovs_strerror(retval)); } @@ -816,7 +816,7 @@ sbctl_dump_openflow(struct vconn *vconn, const struct uuid *uuid, bool stats) struct ofputil_flow_stats *fses; size_t n_fses; - int error = vconn_dump_flows(vconn, &fsr, OFPUTIL_P_OF13_OXM, + int error = vconn_dump_flows(vconn, &fsr, OFPUTIL_P_OF15_OXM, &fses, &n_fses); if (error) { VLOG_WARN("%s: error obtaining flow stats (%s)", diff --git a/utilities/ovn-trace.c b/utilities/ovn-trace.c index c9d72285c..d7251e7ed 100644 --- a/utilities/ovn-trace.c +++ b/utilities/ovn-trace.c @@ -2326,7 +2326,7 @@ trace_openflow(const struct ovntrace_flow *f, struct ovs_list *super) struct ofputil_flow_stats *fses; size_t n_fses; - int error = vconn_dump_flows(vconn, &fsr, OFPUTIL_P_OF13_OXM, + int error = vconn_dump_flows(vconn, &fsr, OFPUTIL_P_OF15_OXM, &fses, &n_fses); if (error) { ovntrace_node_append(super, OVNTRACE_NODE_ERROR, @@ -2435,7 +2435,7 @@ trace(const char *dp_s, const char *flow_s) ds_put_char(&output, '\n'); if (ovs) { - int retval = vconn_open_block(ovs, 1 << OFP13_VERSION, 0, -1, &vconn); + int retval = vconn_open_block(ovs, 1 << OFP15_VERSION, 0, -1, &vconn); if (retval) { VLOG_WARN("%s: connection failed (%s)", ovs, ovs_strerror(retval)); }