From patchwork Mon Dec 11 11:54:33 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Deep Ajmera X-Patchwork-Id: 846926 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="Vwuac9RN"; 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 3ywLxL576dz9s5L for ; Mon, 11 Dec 2017 22:55:18 +1100 (AEDT) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 8B816AA6; Mon, 11 Dec 2017 11:55:15 +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 BC1AAA59 for ; Mon, 11 Dec 2017 11:55:13 +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 4BB69E7 for ; Mon, 11 Dec 2017 11:55:11 +0000 (UTC) X-AuditID: c1b4fb2d-139999c0000036aa-da-5a2e721da38e Received: from ESESSHC002.ericsson.se (Unknown_Domain [153.88.183.24]) by sessmg23.ericsson.net (Symantec Mail Security) with SMTP id 05.D6.13994.D127E2A5; Mon, 11 Dec 2017 12:55:09 +0100 (CET) Received: from EUR01-VE1-obe.outbound.protection.outlook.com (153.88.183.145) by oa.msg.ericsson.com (153.88.183.24) with Microsoft SMTP Server (TLS) id 14.3.352.0; Mon, 11 Dec 2017 12:54:35 +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=dML8w5CIlcB6aOuWNI7Au9NQ5c8ogsztZWkLQ42iJ/8=; b=Vwuac9RNneg5Dg8XqmGpiIl/33q3hIBqPqDYhvTNlmPJ3cf94Jv8AzVfxyfxu9ebzEqNquxuIkJ1cZlE9NI2ObTMs9DEM0TM3uBif2NcC+fR8z5DWSpa4NLz0S2EVaLD1+TBeYS8WxsDisahtVk86LsoIvnCOca1qeMEjbAHPD4= Received: from AM5PR0701MB2961.eurprd07.prod.outlook.com (10.168.156.135) by HE1PR07MB3339.eurprd07.prod.outlook.com (10.170.247.14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.323.4; Mon, 11 Dec 2017 11:54:34 +0000 Received: from AM5PR0701MB2961.eurprd07.prod.outlook.com ([fe80::4973:a9b1:5e22:2e0e]) by AM5PR0701MB2961.eurprd07.prod.outlook.com ([fe80::4973:a9b1:5e22:2e0e%17]) with mapi id 15.20.0323.011; Mon, 11 Dec 2017 11:54:34 +0000 From: Vishal Deep Ajmera To: "dev@openvswitch.org" Thread-Topic: [PATCH V2] ofproto-dpif-xlate: Incorrect handling of errors in group action processing Thread-Index: AdNydTHGf7pzuGqqQGaLRGzlMRHfqg== Date: Mon, 11 Dec 2017 11:54:33 +0000 Message-ID: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=vishal.deep.ajmera@ericsson.com; x-originating-ip: [125.16.128.122] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; HE1PR07MB3339; 6:CsB1ydyfGt9MKRihaqtjGDHEW/C8UJVEYHLAOEKucxQ9SGY+tI76uXuoSuhu2G8RXVQHoYRvLhgNUTp8a3mCs//66KWT8XLBVtv+84vQ0agW6+VB7xqpMUk+dBJH1RmClh9w9RFsU3qogpSUGUfv+1r8PrnCrFuve7+/C2rNE6g1RAesdrkpZMvUyu1O319PP+FPsrSbHqKk+46oDXeI6u/Y45y83lmvdgyQQebv5tRBjyH4ByWCFLXLbF9hvxiFl/v2tIb0GWZWe7sy7cQARRoGPoizOtqzCov/jYBYd0bGcQlg2Uhq98CZDAsEInFsd9L+/eJpcrjapLn2opeQmUxZo0B9p6A43czPuFjnqoU=; 5:Oz7ETWYdBwElOPvjuUqxaPo/OlD/DFA7Mcv7fYoZ22AkWK7MM0+yiWi7ijcAz3g0PmVI869TjcTL/XgnA18dLJ3O+BmVmjNEh53Tpgo7JbhvKUcSGrwZ/88zEMhOEAzV6dOW6z1w/pRKXp+aWFNfr1vIstdP2FbU8nbKfIQut7Y=; 24:4TywKUTQtbIjujo7VpXuAs3tDLgZjLeH/CU6SznkWjjtkKllMKzz8AasmHqOi1cAFgqdcQhu8lJlCvmZZnJ+TFryyKSJNg4acciPmUxsQhk=; 7:4Hsoh4vt1O0ZvAPMO8AeOujhqj6hJEnDef6rxgZmxkE0NpzVSroab3zMGmzO1Om/4CW8ilqSnuOYCWmHiRG37Nm9gpGyhxvhesQbJY14lG8gSl0k3WAOlKcE8/8NWDUnsbCw+Lgg+ZQHMf2sVpyeYkAHJeJq4xK4nnzc+1RG+mk5nplbdr7OyzDUsTzB0iLKxaLEWyZQzqRjJam8gLJODbDd/vwFHgvI/v7v2e3Uy54Ak583eaf4dQWGUHlG4iSR x-ms-exchange-antispam-srfa-diagnostics: SSOS;SSOR; x-forefront-antispam-report: SFV:SKI; SCL:-1; SFV:NSPM; SFS:(10009020)(39860400002)(376002)(366004)(346002)(199004)(189003)(7696005)(99286004)(6916009)(25786009)(97736004)(66066001)(2906002)(55236003)(8936002)(68736007)(575784001)(59450400001)(81166006)(5630700001)(86362001)(81156014)(6116002)(1730700003)(3846002)(102836003)(790700001)(8676002)(74316002)(2351001)(478600001)(5660300001)(105586002)(54906003)(230783001)(2501003)(106356001)(316002)(14454004)(5250100002)(19609705001)(4326008)(5640700003)(55016002)(6506006)(2900100001)(33656002)(3660700001)(6436002)(3280700002)(53936002)(7736002)(54896002)(6306002)(9686003); DIR:OUT; SFP:1101; SCL:1; SRVR:HE1PR07MB3339; H:AM5PR0701MB2961.eurprd07.prod.outlook.com; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; x-ms-office365-filtering-correlation-id: 707079f2-ebb1-48dc-b28a-08d5408df236 x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(5600026)(4604075)(4534020)(4602075)(7168020)(4627115)(201703031133081)(201702281549075)(2017052603307); SRVR:HE1PR07MB3339; x-ms-traffictypediagnostic: HE1PR07MB3339: x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(37575265505322)(21748063052155); x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(6040450)(2401047)(5005006)(8121501046)(3231022)(93006095)(93001095)(3002001)(10201501046)(6041248)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123562025)(20161123564025)(20161123560025)(20161123555025)(20161123558100)(6072148)(201708071742011); SRVR:HE1PR07MB3339; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:HE1PR07MB3339; x-forefront-prvs: 0518EEFB48 received-spf: None (protection.outlook.com: ericsson.com does not designate permitted sender hosts) spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: 707079f2-ebb1-48dc-b28a-08d5408df236 X-MS-Exchange-CrossTenant-originalarrivaltime: 11 Dec 2017 11:54:33.9780 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 92e84ceb-fbfd-47ab-be52-080c6b87953f X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR07MB3339 X-OriginatorOrg: ericsson.com X-Brightmail-Tracker: H4sIAAAAAAAAA02Sa0hTYRjHe885247i4ri8PFgmDEW8TdNCkwqDBAuKiojal5x51OGVc3Rk EWilyVITE2tKTMkyb122qUkjayZe0kolUVHINKcpSfugpKl5fCf47ff8n995eP9waFJWJ/Kg 1WmZLJemSpGLHSndpVYI8uQUypCHlT4Rvx7koIjOT2YyioiZGd1AMdbhQuosoXQ8Es+mqDUs F3ws1jGpa7EEZTyKv1b6p1uUgxYuapEDDcxBGGmtFGuRIy1jOhCUWw0ID90I7nYWU8JAMUUk jBVM2jUdAYPGAgkerJvftJeQwjExEwkrZfcpgV2YYLAU9m8xyUTDUtFzicB7GBWsGZZJ7CSA 7nG93VfArOUvITDF+MD4jG0rlzKxsLRWhwRGjBss9zYS+KY7jE3rCVyCgRrzFxKzK8xNrYuw HwcLpn8I53Iw6mbtvicM6u/Zc4sEWvJjMYeBtsQsEooBsySCmoElCV6chtdlLQgvmhAM9jRv XqI3B3/QLaRgJxms71btjzgFlSPfCexXkWAq7hRjfx+Y9CcER8awUNuUh0pQQMWOPpjT4cXH CbJiq78z9OimKZwHQtVbmxhzADyrnie3ue/9FLEzr0KSeuTKszyfmhgapmA59VWeT09TpLGZ BrT5A30wrQa9QQ3zxy2IoZHcSZrvq1DKRCoNn51qQUCTchfpoTNBSpk0XpV9neXSr3BZKSxv QXtpSu4u7TkpVcqYRFUmm8yyGSy3vSVoB48cJEqPqteEtC/229wabw51Nc/xgR1trQ4JWeeb NH25t13Hfzrfmhu6fGdXWLlxJdRdF+nXFhde4e00urtUu/5bpJPkvvqq9zJWfzPU1HoVf/Yr O2p8OdnnNuE33OvjnWzeb7b5sgtazrRx48L8uUrbU/2T6LwfoYfVGQ11yoFw52E5xSepDviT HK/6D/iJuwY8AwAA X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HTML_MESSAGE, 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 X-Content-Filtered-By: Mailman/MimeDel 2.1.12 Subject: [ovs-dev] [PATCH V2] 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 Signed-off-by: Vishal Deep Ajmera Signed-off-by: Keshav Gupta --- ofproto/ofproto-dpif-xlate.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) -- 1.9.1 diff --git a/ofproto/ofproto-dpif-xlate.c b/ofproto/ofproto-dpif-xlate.c index 9b3a2f2..7893c0e 100644 --- a/ofproto/ofproto-dpif-xlate.c +++ b/ofproto/ofproto-dpif-xlate.c @@ -4065,6 +4065,23 @@ 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