From patchwork Wed Jan 10 08:56:32 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Deep Ajmera X-Patchwork-Id: 858102 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; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=ericsson.onmicrosoft.com header.i=@ericsson.onmicrosoft.com header.b="baXABtG+"; dkim-atps=neutral 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 3zGjYS1Jgnz9s7M for ; Wed, 10 Jan 2018 19:56:43 +1100 (AEDT) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id C07F7F1A; Wed, 10 Jan 2018 08:56:40 +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 76D58EF3 for ; Wed, 10 Jan 2018 08:56:38 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from sessmg22.ericsson.net (sessmg22.ericsson.net [193.180.251.58]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 80D2114D for ; Wed, 10 Jan 2018 08:56:36 +0000 (UTC) X-AuditID: c1b4fb3a-335ff700000037f2-f7-5a55d54255a4 Received: from ESESSHC020.ericsson.se (Unknown_Domain [153.88.183.78]) by sessmg22.ericsson.net (Symantec Mail Security) with SMTP id DD.FD.14322.245D55A5; Wed, 10 Jan 2018 09:56:34 +0100 (CET) Received: from EUR01-DB5-obe.outbound.protection.outlook.com (153.88.183.145) by oa.msg.ericsson.com (153.88.183.78) with Microsoft SMTP Server (TLS) id 14.3.352.0; Wed, 10 Jan 2018 09:56:34 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ericsson.onmicrosoft.com; s=selector1-ericsson-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=ftweerPB6US3dHdIf/BFRBe1Sa8UnrUJdd7yN1PcuJ0=; b=baXABtG+8CWpAe4KcnhNjCCwy1s4vz6bBV/lv9DvMPD+j9jitndeEqrTM8AZlktdUnwcRs7KUNSW3H7QZudbhydCOlmMOrLceai6N9AWyAyXoEckJhcS2KJfu2LCnLCGbZ7Mb+Rqxe1/fg8ITno9RBMOP5mfhOxTXD17D09nPZI= Received: from AM5PR0701MB2961.eurprd07.prod.outlook.com (10.168.156.135) by AM5PR0701MB2835.eurprd07.prod.outlook.com (10.168.155.138) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.407.1; Wed, 10 Jan 2018 08:56:33 +0000 Received: from AM5PR0701MB2961.eurprd07.prod.outlook.com ([fe80::85a3:379e:4676:2922]) by AM5PR0701MB2961.eurprd07.prod.outlook.com ([fe80::85a3:379e:4676:2922%2]) with mapi id 15.20.0407.005; Wed, 10 Jan 2018 08:56:32 +0000 From: Vishal Deep Ajmera To: "dev@openvswitch.org" Thread-Topic: [PATCH V4] ofproto-dpif-xlate: Incorrect handling of errors in group action processing Thread-Index: AdOJ7w3+KcRftLbaRXKee5TETZfyxQ== Date: Wed, 10 Jan 2018 08:56:32 +0000 Message-ID: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [125.16.128.122] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; AM5PR0701MB2835; 7:wUym27r58WVsXhH2WtwNA0xiRPV20ownLeTc8Cm5xojgTNseHluoRTTUX+9UB6w8vbpZZX/LpHmIIoi7EpX1LB1YdwGiyAsKAIWyAeTMeNKQo5Z44wdABIo1pHx8dfpRuUlSVoKwuktGk29/VBQ8sIq++2hZ8FVIaeec6K0egncnIMJgxDi1s9T7VZCvAPoI3SUPcvQqtner3T81q1ZxrQkDs9tLiAXO08fdBXoG2GR7VK9aMM/GL40MvzpKbG4j x-ms-exchange-antispam-srfa-diagnostics: SSOS;SSOR; x-forefront-antispam-report: SFV:SKI; SCL:-1; SFV:NSPM; SFS:(10009020)(396003)(39380400002)(346002)(39860400002)(376002)(366004)(199004)(189003)(6436002)(2351001)(5660300001)(478600001)(105586002)(6916009)(53936002)(99286004)(9686003)(7696005)(33656002)(102836004)(97736004)(106356001)(86362001)(74316002)(66066001)(230783001)(6346003)(55016002)(305945005)(5640700003)(1730700003)(8936002)(2501003)(6506007)(81166006)(54906003)(7736002)(3660700001)(8676002)(3280700002)(81156014)(4326008)(2906002)(14454004)(3846002)(25786009)(59450400001)(5250100002)(2900100001)(316002)(6116002)(68736007)(55236004); DIR:OUT; SFP:1101; SCL:1; SRVR:AM5PR0701MB2835; H:AM5PR0701MB2961.eurprd07.prod.outlook.com; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; x-ms-office365-filtering-correlation-id: e98b6b94-076a-4594-63fd-08d558080c2b x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020048)(4652020)(4534078)(4602075)(7168020)(4627174)(201703031133081)(201702281549075)(5600026)(4604075)(3008032)(2017052603307)(7153060)(7193020); SRVR:AM5PR0701MB2835; x-ms-traffictypediagnostic: AM5PR0701MB2835: x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(37575265505322); x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(6040470)(2401047)(5005006)(8121501046)(3002001)(93006095)(93001095)(10201501046)(3231023)(944501119)(6041268)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123562045)(20161123564045)(6072148)(201708071742011); SRVR:AM5PR0701MB2835; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:AM5PR0701MB2835; x-forefront-prvs: 0548586081 received-spf: None (protection.outlook.com: ericsson.com does not designate permitted sender hosts) authentication-results: spf=none (sender IP is ) smtp.mailfrom=vishal.deep.ajmera@ericsson.com; x-microsoft-antispam-message-info: fb59RPXuXYpfg9ytnNAw9HCjlZJ1BIygWKQYLNJtOQNF3wbd2WyFtWnf6n6HDp/izTcE9Em+hzxy6onq4pr/lg== spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: e98b6b94-076a-4594-63fd-08d558080c2b X-MS-Exchange-CrossTenant-originalarrivaltime: 10 Jan 2018 08:56:32.8696 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 92e84ceb-fbfd-47ab-be52-080c6b87953f X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM5PR0701MB2835 X-OriginatorOrg: ericsson.com X-Brightmail-Tracker: H4sIAAAAAAAAA02Sa0hTYRjHfc85m8fV4LS8PN6+jEIob6nBsBVmhBIohooxEJ3teEnd5ByT 7JNQluhEQTO25rWbilqY3XBGm2hTU4d5qRDCFFfOiKSSmWVu74K+/R7+/+d5n//DS5OSSkEA XaAuZTm1skgqFFG6c0+Tw+Ln0hWR1yfksrWGCiQbmTCScUTi6rsdlGib11IphEIkV7FFBWUs F3EiW5R/Y3uNKnkbeMky2osqUItvNfKigYkBR/s6qkYiWsIMIxj5eIXChQWBqX9O6CwoppaE ia6vns4WCdNCwGjnMexaRTCzYyGdgpCJha3GOsrJ3kwEmLWTLiaZ0/CztnO3mab3M0pY2I7B llzo7HAQmMOh92Gjy04xB8Fo2HKNFDPZMLIxKnQyYnxhc7yHwCP94P1KK4EjMHDHOE1i9oHP y38EmKXwSPfJ7QmGmdYaV0xgnhDw7eqmEAvRUF1vFGDhgwBe9sx7YiEJ6vrsbmERwcDslFsI hd/ji+4nNOAYNpDOZLCbvuV1JvY/IKFhsNK9UhB0r+kpfDoW7vdWIhwnB9YHtlE9CtP/lwhz KLQNbggxH4Z77XZS77rGPhjTrVBtiOpGPjzL88V5UVHhLFdwnuc16nA1W9qPdj+HaeBX7DNk sp00I4ZG0r3iU2PpColAWcaXF5sR0KTUW5zUmqqQiFXK8sssp8niLhaxvBkF0pTUTxyfK1NI mDxlKVvIsiUs908laK+ACnT27ouu5qHvNYYmFKyXV4VUvfKlL1jFaUPc8/LpHd0Cklu2fpzR yg5kXissis6d7/CwWm8l7EmVz1om045a9ZFZCctVQ8drJXZVRmqyhyqk6U2zIS5kKnMpaUXe Z/YPCrIv5TgstqbZDv+MFG3wY9PNCN6mMUq/CJCi7/aClOLzlUcOkRyv/AsjaQAKGAMAAA== X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,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 V4] ofproto-dpif-xlate: Incorrect handling of errors in group action processing 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 As per OpenFlow v1.3 specification, when an action list contains a group action a copy of the packet is passed to the group for processing by the group. This means that if there is an error encountered during group processing, only the copy of packet should be dropped, but subsequent actions in the action list should be executed on the original packet. Additionally, if the group type is "ALL", each action bucket of the group should process a copy of the packet. If there is an error while processing one bucket other buckets should still be processed. Example 1: table=0,in_port=tap0 actions=output:tap1,group:10,output:tap2 Even if any error is encountered while processing the group action, the packet should still be forwarded to ports tap1 and tap2. Example 2: group_id=1,type=all,bucket=actions=output:tap1,bucket=actions=encap(eth) Even if processing the action in the second bucket fails because the packet already has an Ethernet header, the other copy of the packet should still be processed by the first bucket and output to port tap1. Currently the error handling in OVS does not comply with those rules. When any group bucket execution fails the error is recorded in the so-called "translation context" which is global for the processing of the original packet. Once an error is recorded, OVS skips processing subsequent buckets and installs a drop action in the datapath even if parts of the action list were previously processed successfully. This patch clears the error flag after any bucket of a group is executed. This way the error encountered in processing any bucket of the group will not impact other actions of action-list or other buckets of the group. Errors which are system limits to protect translation from taking too long time or too much space are not cleared. Instead drop action is installed for them. Signed-off-by: Vishal Deep Ajmera Signed-off-by: Keshav Gupta --- ofproto/ofproto-dpif-xlate.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) -- 1.9.1 diff --git a/ofproto/ofproto-dpif-xlate.c b/ofproto/ofproto-dpif-xlate.c index e8b94f5..9e05529 100644 --- a/ofproto/ofproto-dpif-xlate.c +++ b/ofproto/ofproto-dpif-xlate.c @@ -4066,6 +4066,22 @@ xlate_group_bucket(struct xlate_ctx *ctx, struct ofputil_bucket *bucket, * the group bucket freezes translation, the actions after the group action * must continue processing with the original, not the frozen packet! */ ctx->exit = false; + + /* Context error in a bucket should not impact processing of other buckets + * or actions. This is similar to cloning a packet for group buckets. + * There is no need to restore the error back to old value due to the fact + * that we actually processed group action which can happen only when there + * is no previous context error. + * + * Exception to above is errors which are system limits to protect + * translation from running too long or occupy too much space. These errors + * should not be masked. XLATE_RECURSION_TOO_DEEP, XLATE_TOO_MANY_RESUBMITS + * and XLATE_STACK_TOO_DEEP fall in this category. */ + if (ctx->error == XLATE_TOO_MANY_MPLS_LABELS || + ctx->error == XLATE_UNSUPPORTED_PACKET_TYPE) { + /* reset the error and continue processing other buckets */ + ctx->error = XLATE_OK; + } } static void