From patchwork Fri Jan 6 02:19:41 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jarno Rajahalme X-Patchwork-Id: 711638 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.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 3tvpD10xXSz9snk for ; Fri, 6 Jan 2017 13:20:01 +1100 (AEDT) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id D3B1BBFB; Fri, 6 Jan 2017 02:19:57 +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 60286BF1 for ; Fri, 6 Jan 2017 02:19:56 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from relay3-d.mail.gandi.net (relay3-d.mail.gandi.net [217.70.183.195]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 8BD7B178 for ; Fri, 6 Jan 2017 02:19:55 +0000 (UTC) Received: from mfilter18-d.gandi.net (mfilter18-d.gandi.net [217.70.178.146]) by relay3-d.mail.gandi.net (Postfix) with ESMTP id 56C03A80CE; Fri, 6 Jan 2017 03:19:54 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at mfilter18-d.gandi.net Received: from relay3-d.mail.gandi.net ([IPv6:::ffff:217.70.183.195]) by mfilter18-d.gandi.net (mfilter18-d.gandi.net [::ffff:10.0.15.180]) (amavisd-new, port 10024) with ESMTP id UW6gm2jHtTp7; Fri, 6 Jan 2017 03:19:52 +0100 (CET) X-Originating-IP: 208.91.1.34 Received: from sc9-mailhost3.vmware.com (unknown [208.91.1.34]) (Authenticated sender: jarno@ovn.org) by relay3-d.mail.gandi.net (Postfix) with ESMTPSA id BFC05A80C2; Fri, 6 Jan 2017 03:19:50 +0100 (CET) From: Jarno Rajahalme To: dev@openvswitch.org Date: Thu, 5 Jan 2017 18:19:41 -0800 Message-Id: <1483669181-15311-1-git-send-email-jarno@ovn.org> X-Mailer: git-send-email 2.1.4 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: yamamoto@ovn.org, simon.horman@netronome.com Subject: [ovs-dev] [PATCH] xlate: Recirculate also when MPLS POP is implicit. 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: , MIME-Version: 1.0 Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org 'ctx->was_mpls' is used to flag when an MPLS packet has been popped to a non-MPLS packet, but it was not set when the MPLS POP is implicit due to the 'ctx->xin->flow' being restored after a patch port traversal to group bucket execution. If MPLS push on a non-MPLS packet is followed by an MPLS POP in the same actions list, a recirculation after the MPLS POP would not be necessary, as the parsed L3/4 fields are still available. Even so, the current action validation and execution code in the Linux kernel datapath implementation would need to be enhanced to support this case. For now we trigger recirculation instead. Reported-by: Thomas Morin Suggested-by: Takashi YAMAMOTO Fixes: 742c0ac3c0ab ("mpls: Fix MPLS restoration after patch port and group bucket.") Signed-off-by: Jarno Rajahalme Acked-by: Ben Pfaff --- ofproto/ofproto-dpif-xlate.c | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/ofproto/ofproto-dpif-xlate.c b/ofproto/ofproto-dpif-xlate.c index 371ced4..27b64d9 100644 --- a/ofproto/ofproto-dpif-xlate.c +++ b/ofproto/ofproto-dpif-xlate.c @@ -3053,9 +3053,15 @@ compose_output_action__(struct xlate_ctx *ctx, ofp_port_t ofp_port, * metadata table. */ ctx->wc->masks.tunnel = old_flow_tnl_wc; - /* The peer bridge popping MPLS should have no effect on the original - * bridge. */ - ctx->was_mpls = old_was_mpls; + /* An MPLS packet can be implicitly popped back to a non-MPLS packet + * when the flow key is restored, if the patch port peer pushed MPLS to + * a non-MPLS packet. In this case the now restored flow key is of + * non-MPLS type, while the base flow is of an MPLS type. Set the + * 'was_mpls' flag also in that case. */ + ctx->was_mpls = old_was_mpls || + (eth_type_mpls(ctx->base_flow.dl_type) + && !eth_type_mpls(ctx->xin->flow.dl_type) + && ctx->xbridge->support.odp.recirc); /* The peer bridge's conntrack execution should have no effect on the * original bridge. */ @@ -3379,9 +3385,15 @@ xlate_group_bucket(struct xlate_ctx *ctx, struct ofputil_bucket *bucket) * group buckets. */ ctx->xin->flow = old_flow; - /* The group bucket popping MPLS should have no effect after bucket - * execution. */ - ctx->was_mpls = old_was_mpls; + /* An MPLS packet can be implicitly popped back to a non-MPLS packet + * when the flow key is restored, if the group bucket pushed MPLS to + * a non-MPLS packet. In this case the now restored flow key is of + * non-MPLS type, while the base flow is of an MPLS type. Set the + * 'was_mpls' flag also in that case. */ + ctx->was_mpls = old_was_mpls || + (eth_type_mpls(ctx->base_flow.dl_type) + && !eth_type_mpls(ctx->xin->flow.dl_type) + && ctx->xbridge->support.odp.recirc); /* The fact that the group bucket exits (for any reason) does not mean that * the translation after the group action should exit. Specifically, if