From patchwork Fri Jan 12 13:34:10 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zoltan Balogh X-Patchwork-Id: 859927 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=) 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 3zJ3f36bMGz9s9Y for ; Sat, 13 Jan 2018 00:35:23 +1100 (AEDT) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 5563FF21; Fri, 12 Jan 2018 13:34:22 +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 17F59F16 for ; Fri, 12 Jan 2018 13:34:18 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from sessmg23.ericsson.net (sessmg23.ericsson.net [193.180.251.45]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 63E18124 for ; Fri, 12 Jan 2018 13:34:17 +0000 (UTC) X-AuditID: c1b4fb2d-f179c9c000007932-dd-5a58b9572818 Received: from ESESSHC006.ericsson.se (Unknown_Domain [153.88.183.36]) by sessmg23.ericsson.net (Symantec Mail Security) with SMTP id 69.7F.31026.759B85A5; Fri, 12 Jan 2018 14:34:15 +0100 (CET) Received: from labserv2.eth.ericsson.se (153.88.183.153) by smtp.internal.ericsson.com (153.88.183.38) with Microsoft SMTP Server id 14.3.352.0; Fri, 12 Jan 2018 14:34:12 +0100 Received: from dell11.sdn.hu.eld.ericsson.se (unknown [10.58.48.15]) by labserv2.eth.ericsson.se (Postfix) with ESMTP id 9A62729C740; Fri, 12 Jan 2018 14:27:15 +0100 (CET) From: Zoltan Balogh To: Date: Fri, 12 Jan 2018 14:34:10 +0100 Message-ID: <20180112133411.27721-2-zoltan.balogh@ericsson.com> X-Mailer: git-send-email 2.15.1 In-Reply-To: <20180112133411.27721-1-zoltan.balogh@ericsson.com> References: <20180112133411.27721-1-zoltan.balogh@ericsson.com> MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrALMWRmVeSWpSXmKPExsUyM2K7im74zogogwMPpC2Ont7D7MDo8ezm f8YAxigum5TUnMyy1CJ9uwSujDeX/zAVTJaqWPH3OGsD4z6RLkZODgkBE4m9U5eydjFycQgJ HGaU2Hp/CxOEs4VRYtPzm8wQznpGiZVntrCDtLAJGEj8uPyFCcQWEZCU+Ld4CxuIzSygJ/Hk 6BGwuLCAtcTXDRcYQWwWAVWJmRsmsILYvAL2Ep+nbWWFWC0vMWFLEwuIzSngIPHx7ymw+UJA NQtfbWaEqBeUODnzCQvEfAmJgy9eMEPUqEscannNNoFRYBaSsllIyhYwMq1iFC1OLS7OTTcy 1kstykwuLs7P08tLLdnECAy3g1t+6+5gXP3a8RCjAAejEg/v6TURUUKsiWXFlbmHGCU4mJVE eI8uBQrxpiRWVqUW5ccXleakFh9ilOZgURLnPenJGyUkkJ5YkpqdmlqQWgSTZeLglGpg7LoV 6rGpbZ5QiPMOZnunCYvLhN0dRC+IOpbf/Oh3NlFJ67/Mhz8p7E5VmzI+r1hZs++s2PbFp3h1 HnuvlL5q+ryulSdkbZvAfF5D8TVr5/yImPbDMozj462XDEd+Oqw4I/pqH4vFlk79mFdHUzo/ OnyL7prQ0XwzNMzYztJ0rvn7VU2nJXY+UWIpzkg01GIuKk4EAEp3J/szAgAA X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Subject: [ovs-dev] [PATCH 1/2] ofproto-dpif-xlate: add uuid to xports 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 This should make possible to look up xport by UUID and will be used by a later commit. Signed-off-by: Zoltan Balogh --- ofproto/ofproto-dpif-xlate.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/ofproto/ofproto-dpif-xlate.c b/ofproto/ofproto-dpif-xlate.c index 896d5e290..47b4f7378 100644 --- a/ofproto/ofproto-dpif-xlate.c +++ b/ofproto/ofproto-dpif-xlate.c @@ -65,6 +65,7 @@ #include "tnl-ports.h" #include "tunnel.h" #include "util.h" +#include "uuid.h" COVERAGE_DEFINE(xlate_actions); COVERAGE_DEFINE(xlate_actions_oversize); @@ -148,6 +149,9 @@ struct xport { struct hmap_node ofp_node; /* Node in parent xbridge 'xports' map. */ ofp_port_t ofp_port; /* Key in parent xbridge 'xports' map. */ + struct hmap_node uuid_node; /* Node in global 'xports_uuid' map. */ + struct uuid uuid; /* Key in global 'xports_uuid' map. */ + odp_port_t odp_port; /* Datapath port number or ODPP_NONE. */ struct ovs_list bundle_node; /* In parent xbundle (if it exists). */ @@ -503,6 +507,7 @@ struct xlate_cfg { struct hmap xbridges; struct hmap xbundles; struct hmap xports; + struct hmap xports_uuid; }; static OVSRCU_TYPE(struct xlate_cfg *) xcfgp = OVSRCU_INITIALIZER(NULL); static struct xlate_cfg *new_xcfg = NULL; @@ -823,6 +828,8 @@ xlate_xport_init(struct xlate_cfg *xcfg, struct xport *xport) hash_pointer(xport->ofport, 0)); hmap_insert(&xport->xbridge->xports, &xport->ofp_node, hash_ofp_port(xport->ofp_port)); + hmap_insert(&xcfg->xports_uuid, &xport->uuid_node, + uuid_hash(&xport->uuid)); } static void @@ -1011,6 +1018,7 @@ xlate_xport_copy(struct xbridge *xbridge, struct xbundle *xbundle, new_xport->ofport = xport->ofport; new_xport->ofp_port = xport->ofp_port; new_xport->xbridge = xbridge; + new_xport->uuid = xport->uuid; xlate_xport_init(new_xcfg, new_xport); xlate_xport_set(new_xport, xport->odp_port, xport->netdev, xport->cfm, @@ -1081,6 +1089,7 @@ xlate_txn_start(void) hmap_init(&new_xcfg->xbridges); hmap_init(&new_xcfg->xbundles); hmap_init(&new_xcfg->xports); + hmap_init(&new_xcfg->xports_uuid); xcfg = ovsrcu_get(struct xlate_cfg *, &xcfgp); if (!xcfg) { @@ -1109,6 +1118,7 @@ xlate_xcfg_free(struct xlate_cfg *xcfg) hmap_destroy(&xcfg->xbridges); hmap_destroy(&xcfg->xbundles); hmap_destroy(&xcfg->xports); + hmap_destroy(&xcfg->xports_uuid); free(xcfg); } @@ -1270,6 +1280,7 @@ xlate_ofport_set(struct ofproto_dpif *ofproto, struct ofbundle *ofbundle, xport->ofport = ofport; xport->xbridge = xbridge_lookup(new_xcfg, ofproto); xport->ofp_port = ofp_port; + uuid_generate(&xport->uuid); xlate_xport_init(new_xcfg, xport); } @@ -1334,6 +1345,7 @@ xlate_xport_remove(struct xlate_cfg *xcfg, struct xport *xport) hmap_destroy(&xport->skb_priorities); hmap_remove(&xcfg->xports, &xport->hmap_node); + hmap_remove(&xcfg->xports_uuid, &xport->uuid_node); hmap_remove(&xport->xbridge->xports, &xport->ofp_node); netdev_close(xport->netdev); From patchwork Fri Jan 12 13:34:11 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zoltan Balogh X-Patchwork-Id: 859926 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=) 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 3zJ3dR2JQHz9s9Y for ; Sat, 13 Jan 2018 00:34:51 +1100 (AEDT) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 50C50F76; Fri, 12 Jan 2018 13:34:19 +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 08D1BF16 for ; Fri, 12 Jan 2018 13:34:17 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from sessmg23.ericsson.net (sessmg23.ericsson.net [193.180.251.45]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 64AE018A for ; Fri, 12 Jan 2018 13:34:15 +0000 (UTC) X-AuditID: c1b4fb2d-b4dff70000007932-d6-5a58b955faca Received: from ESESSHC009.ericsson.se (Unknown_Domain [153.88.183.45]) by sessmg23.ericsson.net (Symantec Mail Security) with SMTP id 88.7F.31026.559B85A5; Fri, 12 Jan 2018 14:34:13 +0100 (CET) Received: from labserv2.eth.ericsson.se (153.88.183.153) by smtp.internal.ericsson.com (153.88.183.47) with Microsoft SMTP Server id 14.3.352.0; Fri, 12 Jan 2018 14:34:12 +0100 Received: from dell11.sdn.hu.eld.ericsson.se (unknown [10.58.48.15]) by labserv2.eth.ericsson.se (Postfix) with ESMTP id BD67429C742; Fri, 12 Jan 2018 14:27:15 +0100 (CET) From: Zoltan Balogh To: Date: Fri, 12 Jan 2018 14:34:11 +0100 Message-ID: <20180112133411.27721-3-zoltan.balogh@ericsson.com> X-Mailer: git-send-email 2.15.1 In-Reply-To: <20180112133411.27721-1-zoltan.balogh@ericsson.com> References: <20180112133411.27721-1-zoltan.balogh@ericsson.com> MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprPLMWRmVeSWpSXmKPExsUyM2K7rm7ozogog83PtSyOnt7D7MDo8ezm f8YAxigum5TUnMyy1CJ9uwSujEtL3jMX/M+qOPOth7WBcXNIFyMnh4SAiUTPvRcsILaQwGFG iQ83kroYuYDsLYwSJ48vY4Jw1jNKfFnzmx2kik3AQOLH5S9MILaIgKTEv8Vb2EBsZoEYiQ3/ jjOD2MIC5hI3Hr0Dm8oioCrx5scRsBpeAXuJVf+WMkJslpeYsKUJrIZTwEHi499T7BBX2Ess fLWZEaJeUOLkzCcsEPMlJA6+eMEMUaMucajlNdsERoFZSMpmISlbwMi0ilG0OLW4ODfdyFgv tSgzubg4P08vL7VkEyMw2A5u+a27g3H1a8dDjAIcjEo8vKfXREQJsSaWFVfmHmKU4GBWEuE9 uhQoxJuSWFmVWpQfX1Sak1p8iFGag0VJnPekJ2+UkEB6YklqdmpqQWoRTJaJg1OqgdFbXPDe AaPWqqzZl1ds14vXcpqgNK1m6WY93k6tyYeY1wq+Uqu+mvFHn92un6dT5/GF39xbX82p/3jT 4PektWJP49j+dJ8rMMiROq139vHLWV52HQHFMqaNGy2NQnY1W3x5Kprn5Kc9R+BNRsssj91i KQk6wZOOLL+6N1KzMdKCd9Ht5Vb7+ZRYijMSDbWYi4oTAWBra8YyAgAA X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Subject: [ovs-dev] [PATCH 2/2] xlate: fix xport lookup for recirc 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 Xlate_lookup and xlate_lookup_ofproto_() provides in_port and ofproto based on xport determined using flow, which is extracted from packet. The lookup can happen due to recirculation as well. It can happen, that packet_type has been modified during xlate before recirculation is triggered, so the lookup fails or delivers wrong xport. This can be worked around by propagating xport to ctx->xin after the very first lookup and store it in frozen state of the recirculation. So, when lookup is performed due to recirculation, the xport can be retrieved from the frozen state. The packet-type-aware unit tests are updated with a new one to verify this behavior. Signed-off-by: Zoltan Balogh CC: Jan Scheurich Fixes: beb75a40fdc2 ("userspace: Switching of L3 packets in L2 pipeline") --- ofproto/ofproto-dpif-rid.c | 5 +- ofproto/ofproto-dpif-rid.h | 1 + ofproto/ofproto-dpif-xlate.c | 52 ++++++++++++++++++ ofproto/ofproto-dpif-xlate.h | 4 ++ tests/packet-type-aware.at | 122 +++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 183 insertions(+), 1 deletion(-) diff --git a/ofproto/ofproto-dpif-rid.c b/ofproto/ofproto-dpif-rid.c index 83278d82b..79412c28b 100644 --- a/ofproto/ofproto-dpif-rid.c +++ b/ofproto/ofproto-dpif-rid.c @@ -162,7 +162,8 @@ frozen_state_equal(const struct frozen_state *a, const struct frozen_state *b) b->ofpacts, b->ofpacts_len) && ofpacts_equal(a->action_set, a->action_set_len, b->action_set, b->action_set_len) - && !memcmp(a->userdata, b->userdata, a->userdata_len)); + && !memcmp(a->userdata, b->userdata, a->userdata_len) + && uuid_equals(&a->xport_uuid, &b->xport_uuid)); } /* Lockless RCU protected lookup. If node is needed accross RCU quiescent @@ -294,6 +295,8 @@ recirc_alloc_id(struct ofproto_dpif *ofproto) }, .in_port = OFPP_NONE }, }; + /* In order to make sparse happy, xport_uuid needs to be set separately. */ + state.xport_uuid = UUID_ZERO; return recirc_alloc_id__(&state, frozen_state_hash(&state))->id; } diff --git a/ofproto/ofproto-dpif-rid.h b/ofproto/ofproto-dpif-rid.h index 858b02e39..441584af8 100644 --- a/ofproto/ofproto-dpif-rid.h +++ b/ofproto/ofproto-dpif-rid.h @@ -143,6 +143,7 @@ struct frozen_state { size_t stack_size; mirror_mask_t mirrors; /* Mirrors already output. */ bool conntracked; /* Conntrack occurred prior to freeze. */ + struct uuid xport_uuid; /* UUID of 1st port packet received on. */ /* Actions to be translated when thawing. */ struct ofpact *ofpacts; diff --git a/ofproto/ofproto-dpif-xlate.c b/ofproto/ofproto-dpif-xlate.c index 47b4f7378..e2a175a4c 100644 --- a/ofproto/ofproto-dpif-xlate.c +++ b/ofproto/ofproto-dpif-xlate.c @@ -561,6 +561,8 @@ static struct xbundle *xbundle_lookup(struct xlate_cfg *, const struct ofbundle *); static struct xport *xport_lookup(struct xlate_cfg *, const struct ofport_dpif *); +static struct xport *xport_lookup_by_uuid(struct xlate_cfg *, + const struct uuid *); static struct xport *get_ofp_port(const struct xbridge *, ofp_port_t ofp_port); static struct skb_priority_to_dscp *get_skb_priority(const struct xport *, uint32_t skb_priority); @@ -1374,12 +1376,36 @@ xlate_lookup_ofproto_(const struct dpif_backer *backer, const struct flow *flow, struct xlate_cfg *xcfg = ovsrcu_get(struct xlate_cfg *, &xcfgp); const struct xport *xport; + /* If packet is recirculated, xport can be retrieved from frozen state. */ + if (flow->recirc_id) { + const struct recirc_id_node *recirc_id_node; + + recirc_id_node = recirc_id_node_find(flow->recirc_id); + + if (OVS_UNLIKELY(!recirc_id_node)) { + return NULL; + } + + /* If recirculation was initiated due to bond (in_port = OFPP_NONE) + * then frozen state is static and xport_uuid is not defined, so xport + * cannot be restored from frozen state. */ + if (recirc_id_node->state.metadata.in_port != OFPP_NONE) { + struct uuid xport_uuid = recirc_id_node->state.xport_uuid; + xport = xport_lookup_by_uuid(xcfg, &xport_uuid); + if (xport && xport->xbridge && xport->xbridge->ofproto) { + goto out; + } + } + } + xport = xport_lookup(xcfg, tnl_port_should_receive(flow) ? tnl_port_receive(flow) : odp_port_to_ofport(backer, flow->in_port.odp_port)); if (OVS_UNLIKELY(!xport)) { return NULL; } + +out: *xportp = xport; if (ofp_in_port) { *ofp_in_port = xport->ofp_port; @@ -1517,6 +1543,26 @@ xport_lookup(struct xlate_cfg *xcfg, const struct ofport_dpif *ofport) return NULL; } +static struct xport * +xport_lookup_by_uuid(struct xlate_cfg *xcfg, const struct uuid *uuid) +{ + struct hmap *xports; + struct xport *xport; + + if (uuid_is_zero(uuid) || !xcfg) { + return NULL; + } + + xports = &xcfg->xports_uuid; + + HMAP_FOR_EACH_IN_BUCKET (xport, uuid_node, uuid_hash(uuid), xports) { + if (uuid_equals(&xport->uuid, uuid)) { + return xport; + } + } + return NULL; +} + static struct stp_port * xport_get_stp_port(const struct xport *xport) { @@ -4480,6 +4526,7 @@ finish_freezing__(struct xlate_ctx *ctx, uint8_t table) .stack_size = ctx->stack.size, .mirrors = ctx->mirrors, .conntracked = ctx->conntracked, + .xport_uuid = ctx->xin->xport_uuid, .ofpacts = ctx->frozen_actions.data, .ofpacts_len = ctx->frozen_actions.size, .action_set = ctx->action_set.data, @@ -6509,6 +6556,7 @@ xlate_in_init(struct xlate_in *xin, struct ofproto_dpif *ofproto, xin->odp_actions = odp_actions; xin->in_packet_out = false; xin->recirc_queue = NULL; + xin->xport_uuid = UUID_ZERO; /* Do recirc lookup. */ xin->frozen_state = NULL; @@ -6934,6 +6982,9 @@ xlate_actions(struct xlate_in *xin, struct xlate_out *xout) * flow->in_port is the ultimate input port of the packet.) */ struct xport *in_port = get_ofp_port(xbridge, ctx.base_flow.in_port.ofp_port); + if (in_port && !in_port->peer) { + ctx.xin->xport_uuid = in_port->uuid; + } if (flow->packet_type != htonl(PT_ETH) && in_port && in_port->pt_mode == NETDEV_PT_LEGACY_L3 && ctx.table_id == 0) { @@ -7173,6 +7224,7 @@ xlate_resume(struct ofproto_dpif *ofproto, .stack_size = pin->stack_size, .mirrors = pin->mirrors, .conntracked = pin->conntracked, + .xport_uuid = UUID_ZERO, /* When there are no actions, xlate_actions() will search the flow * table. We don't want it to do that (we want it to resume), so diff --git a/ofproto/ofproto-dpif-xlate.h b/ofproto/ofproto-dpif-xlate.h index 39542de2b..2cbb3c909 100644 --- a/ofproto/ofproto-dpif-xlate.h +++ b/ofproto/ofproto-dpif-xlate.h @@ -26,6 +26,7 @@ #include "ofproto.h" #include "stp.h" #include "ovs-lldp.h" +#include "uuid.h" struct bfd; struct bond; @@ -162,6 +163,9 @@ struct xlate_in { /* ofproto/trace maintains this queue to trace flows that require * recirculation. */ struct ovs_list *recirc_queue; + + /* UUID of first non-patch port packet was received on.*/ + struct uuid xport_uuid; }; void xlate_ofproto_set(struct ofproto_dpif *, const char *name, struct dpif *, diff --git a/tests/packet-type-aware.at b/tests/packet-type-aware.at index 33332f16a..f43095c60 100644 --- a/tests/packet-type-aware.at +++ b/tests/packet-type-aware.at @@ -915,3 +915,125 @@ deafbeefbabeaa550000000208004500006c00004000402f26610a0000010a000002000008004500 OVS_VSWITCHD_STOP AT_CLEANUP + + +AT_SETUP([ptap - recirculate after packet_type change]) + +######################## +# --<--+ +# LOCAL | +# +--o------+ +# | int-br | +# +------o--+ +# L3 tunnel (remote : 20.0.0.2/24) +# +--o------+ +# | br0 | <- 20.0.0.1/24 +# +------o--+ +# p0 | +# +--<-- + +OVS_VSWITCHD_START([dnl + -- set bridge br0 other-config:hwaddr=aa:bb:cc:00:00:01 \ + -- add-port br0 p0 \ + -- set interface p0 type=dummy other_config:hwaddr=aa:bb:cc:00:00:01 ofport_request=1 \ + -- add-br int-br -- set bridge int-br datapath_type=dummy \ + -- add-port int-br tunnel \ + -- set interface tunnel type=gre options:packet_type=legacy_l3 options:remote_ip=20.0.0.2 ofport_request=2 +]) + +### Verify datapath configuration +AT_CHECK([ + ovs-appctl dpif/show | grep -v hit | sed 's/\t/ /g' | sed 's./[[0-9]]\{1,\}..' +], [0], [dnl + br0: + br0 65534: (dummy-internal) + p0 1: (dummy) + int-br: + int-br 65534: (dummy-internal) + tunnel 2: (gre: packet_type=legacy_l3, remote_ip=20.0.0.2) +]) + +AT_CHECK([ + ovs-appctl netdev-dummy/ip4addr br0 20.0.0.1/24 && + ovs-appctl ovs/route/add 20.0.0.2/24 br0 && + ovs-appctl tnl/neigh/set br0 20.0.0.1 aa:bb:cc:00:00:01 && + ovs-appctl tnl/neigh/set br0 20.0.0.2 aa:bb:cc:00:00:02 +], [0], [ignore]) + +ovs-appctl time/warp 1000 + +AT_CHECK([ + ovs-appctl ovs/route/show | grep User +],[0], [dnl +User: 20.0.0.0/24 dev br0 SRC 20.0.0.1 +]) + +AT_CHECK([ + ovs-appctl tnl/neigh/show | grep br | tr -s ' ' | sort +],[0], [dnl +20.0.0.1 aa:bb:cc:00:00:01 br0 +20.0.0.2 aa:bb:cc:00:00:02 br0 +]) + +# Goto_table after pop_mpls triggers recirculation. +AT_CHECK([ + ovs-ofctl del-flows br0 && + ovs-ofctl del-flows int-br && + ovs-ofctl add-flow br0 "actions=normal" + ovs-ofctl add-flow int-br "table=0,in_port=tunnel,actions=pop_mpls:0x800,goto_table:20" && + ovs-ofctl add-flow int-br "table=20,actions=dec_ttl,output:LOCAL" +], [0], [ignore]) + +ovs-appctl time/warp 1000 + +AT_CHECK([ + ovs-ofctl dump-flows br0 -OOpenFlow13 | ofctl_strip | grep actions | sed 's/reset_counts //' +], [0], [dnl + actions=NORMAL +]) + +AT_CHECK([ + ovs-ofctl dump-flows int-br -OOpenFlow13 | ofctl_strip | grep actions | sed 's/reset_counts //' +], [0], [dnl + in_port=2 actions=pop_mpls:0x0800,resubmit(,20) + table=20, actions=dec_ttl,LOCAL +]) + +# Receive MPLS over L3 GRE packet in underlay bridge. +AT_CHECK([ + ovs-appctl netdev-dummy/receive p0 aabbcc000001aabbcc00000208004500007000004000402f125d140000021400000100008847003e71404500005470f5400040013445c0a80a14c0a80a0a08004e1adbfc0001566b575a00000000604f010000000000101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f3031323334353637 + ovs-appctl netdev-dummy/receive p0 aabbcc000001aabbcc00000208004500007000004000402f125d140000021400000100008847003e71404500005470f5400040013445c0a80a14c0a80a0a08004e1adbfc0001566b575a00000000604f010000000000101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f3031323334353637 +], [0], [ignore]) + +ovs-appctl time/warp 1000 + +AT_CHECK([ + ovs-appctl netdev-dummy/receive p0 aabbcc000001aabbcc00000208004500007000004000402f125d140000021400000100008847003e71404500005470f5400040013445c0a80a14c0a80a0a08004e1adbfc0001566b575a00000000604f010000000000101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f3031323334353637 + ovs-appctl netdev-dummy/receive p0 aabbcc000001aabbcc00000208004500007000004000402f125d140000021400000100008847003e71404500005470f5400040013445c0a80a14c0a80a0a08004e1adbfc0001566b575a00000000604f010000000000101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f3031323334353637 +], [0], [ignore]) + +ovs-appctl time/warp 1000 + +# After packet has been received on L3 port in overlay bridge, its packet_type changes to Ethernet. +# Resubmit after pop_mpls recirculates the L2 packet. +AT_CHECK([ + ovs-appctl dpctl/dump-flows --names dummy@ovs-dummy | strip_used | grep -v ipv6 | sort +], [0], [flow-dump from non-dpdk interfaces: +recirc_id(0),in_port(p0),packet_type(ns=0,id=0),eth(src=aa:bb:cc:00:00:02,dst=aa:bb:cc:00:00:01),eth_type(0x0800),ipv4(dst=20.0.0.1,proto=47,frag=no), packets:3, bytes:378, used:0.0s, actions:tnl_pop(gre_sys) +tunnel(src=20.0.0.2,dst=20.0.0.1,flags(-df-csum)),recirc_id(0),in_port(gre_sys),packet_type(ns=1,id=0x8847),mpls(label=999/0x0,tc=0/0,ttl=64/0x0,bos=1/1), packets:3, bytes:264, used:0.0s, actions:push_eth(src=00:00:00:00:00:00,dst=00:00:00:00:00:00),pop_mpls(eth_type=0x800),recirc(0x1) +tunnel(src=20.0.0.2,dst=20.0.0.1,flags(-df-csum)),recirc_id(0x1),in_port(gre_sys),packet_type(ns=0,id=0),eth(dst=00:00:00:00:00:00),eth_type(0x0800),ipv4(ttl=64,frag=no), packets:3, bytes:294, used:0.0s, actions:set(ipv4(ttl=63)),int-br +]) + +ovs-appctl time/warp 1000 + +AT_CHECK([ + ovs-ofctl dump-ports int-br +], [0], [OFPST_PORT reply (xid=0x2): 2 ports + port LOCAL: rx pkts=0, bytes=0, drop=?, errs=?, frame=?, over=?, crc=? + tx pkts=4, bytes=392, drop=?, errs=?, coll=? + port 2: rx pkts=4, bytes=352, drop=?, errs=?, frame=?, over=?, crc=? + tx pkts=0, bytes=0, drop=?, errs=?, coll=? +]) + +OVS_VSWITCHD_STOP +AT_CLEANUP