From patchwork Fri Jan 5 10:42:31 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: 856005 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="Wu7Vz38A"; 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 3zCh870KqNz9ryr for ; Fri, 5 Jan 2018 21:42:46 +1100 (AEDT) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 23E2FB9E; Fri, 5 Jan 2018 10:42:43 +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 156DD910 for ; Fri, 5 Jan 2018 10:42:42 +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 A4002CE for ; Fri, 5 Jan 2018 10:42:38 +0000 (UTC) X-AuditID: c1b4fb3a-716549c0000037f2-74-5a4f569c1c35 Received: from ESESSHC008.ericsson.se (Unknown_Domain [153.88.183.42]) by sessmg22.ericsson.net (Symantec Mail Security) with SMTP id 31.DD.14322.C965F4A5; Fri, 5 Jan 2018 11:42:36 +0100 (CET) Received: from EUR03-AM5-obe.outbound.protection.outlook.com (153.88.183.145) by oa.msg.ericsson.com (153.88.183.42) with Microsoft SMTP Server (TLS) id 14.3.352.0; Fri, 5 Jan 2018 11:42:32 +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=Toh6jFEMGHdfd5BKikZ75QLPMKLga+tfDlGUg5+imzg=; b=Wu7Vz38AdN9kT/iK7ATALHSHP/XpvFw2SX0687zsepm666yWw3WXOdLrhgnu+Up6EvCqFyzf2VnIiNIqs51U4DSKWzRiepqSzUb7TKs1FmQGivM94hbAWbn0NVQ54wr+bCU/J3A4Gtx51zB1X3NfF0WwshPG0naxTW01uQagC40= Received: from AM5PR0701MB2961.eurprd07.prod.outlook.com (10.168.156.135) by AM5SPR00MB2420.eurprd07.prod.outlook.com (10.168.160.150) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.386.5; Fri, 5 Jan 2018 10:42:31 +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.003; Fri, 5 Jan 2018 10:42:31 +0000 From: Vishal Deep Ajmera To: "dev@openvswitch.org" Thread-Topic: [PATCH V3] ofproto-dpif-xlate: Incorrect handling of errors in group action processing Thread-Index: AdOGENv5hAtWAdUuRwmMTA8rXNHgxQ== Date: Fri, 5 Jan 2018 10:42:31 +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; AM5SPR00MB2420; 7:bdCVAOExU/8FTnsAvnPTyqWcOlbXuanHD9OQ0uQB4Qj8TQPGYUotivcm1gqlCC90UMZPBNmsU95+NYygrrAvNf9H50E9TQQ4GiGhqnkR+9E9KcXHwBHi8449UnzeoKw0ch4s5HxsIuQQpbg45+BIDxWQT5LIQJLv46+nUytI3FhvYPiBYBVj1yT7iOCN2KJxjpfcdsS61TThiCFlZihQldsPN47vjRvYeCTl0uxBV3IfmJZWVFo4bcghdAI7Cd7+ x-ms-exchange-antispam-srfa-diagnostics: SSOS; x-ms-office365-filtering-correlation-id: 163edd99-e104-4a62-399e-08d55429060e x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(4534020)(4602075)(7168020)(4627115)(201703031133081)(201702281549075)(5600026)(4604075)(3008032)(2017052603307)(7153060); SRVR:AM5SPR00MB2420; x-ms-traffictypediagnostic: AM5SPR00MB2420: x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(37575265505322)(21748063052155); x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(6040470)(2401047)(8121501046)(5005006)(3231023)(944501075)(3002001)(10201501046)(93006095)(93001095)(6041268)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123564045)(20161123558120)(6072148)(201708071742011); SRVR:AM5SPR00MB2420; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:AM5SPR00MB2420; x-forefront-prvs: 05437568AA x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(979002)(346002)(396003)(366004)(39860400002)(39380400002)(376002)(199004)(189003)(6916009)(3846002)(2900100001)(8936002)(1730700003)(6506007)(3660700001)(3280700002)(2906002)(5630700001)(68736007)(19609705001)(102836004)(55236004)(6116002)(5640700003)(81156014)(8676002)(478600001)(53936002)(6306002)(55016002)(316002)(790700001)(59450400001)(81166006)(25786009)(105586002)(230783001)(2351001)(236005)(54896002)(5660300001)(9686003)(106356001)(7736002)(74316002)(5250100002)(33656002)(14454004)(7696005)(66066001)(99286004)(2501003)(6436002)(97736004)(86362001)(969003)(989001)(999001)(1009001)(1019001); DIR:OUT; SFP:1101; SCL:1; SRVR:AM5SPR00MB2420; H:AM5PR0701MB2961.eurprd07.prod.outlook.com; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; received-spf: None (protection.outlook.com: ericsson.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: uazKJHPg992wcAqWK6slYuO0VEBD5S61Q/f/esK7Yo66birwP4I8trIIccVd1X+uQ1nZUoOwvlG0TEuX0xS3Pg== spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: 163edd99-e104-4a62-399e-08d55429060e X-MS-Exchange-CrossTenant-originalarrivaltime: 05 Jan 2018 10:42:31.3843 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 92e84ceb-fbfd-47ab-be52-080c6b87953f X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM5SPR00MB2420 X-OriginatorOrg: ericsson.com X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprHKsWRmVeSWpSXmKPExsUyM2K7lu6cMP8ogxcHLS2Ont7D7MDo8ezm f8YAxigum5TUnMyy1CJ9uwSujOmnjjMWvEupWL2mm6WB8WB4FyMnh4SAicSUX0+Yuxi5OIQE DjNKXLvZzgaSEBI4zihx/k8JiM0i0MssceswG0TRLCaJA98nMkI4TxklJl94zwJSxSZgJfFr Sj+YLSKgL3Go5yyYLSyQKPGkZQFUPE3ixN4DbBC2nsSX6T0sEBtUJJ7f2gRm8wokSMy6/ZAV xGYUEJP4fmoNE4jNLCAucevJfCaIswUkluw5zwxhi0q8fPwPqj5J4s2WP4wQcSWJzTNfQNXL Slya3w12tITAViaJSY8OQDXrSWyd+BaqwVeiY9EfJoiiA4wSPxYchOrWlpjb94oFws6VuNX1 DiruJTH7xgOohrXMEpMuv2aHSMhI/OqdxwZhz2STaOiLhQRqqsTyta1Q26oljl3axzyBUXsW ku9mMXIA2fkSP5cLzwIHhqDEyZlPWCBKdCQW7P7EBmFrSyxb+JoZxj5z4DETsvgCRvZVjKLF qcXFuelGRnqpRZnJxcX5eXp5qSWbGIGp5uCW31Y7GA8+dzzEKMDBqMTDm+vlHyXEmlhWXJl7 iFGCg1lJhJfTyC9KiDclsbIqtSg/vqg0J7X4EKM0B4uSOK9TmkWUkEB6YklqdmpqQWoRTJaJ g1OqgXGpzYnj596WbZa4Vsokmm91ZMarg9Mr5qQGiP9aY1zTmLVtvUlXc8OvAOfLcUEMqx6s 8luq/ynvhZ+V4+VItt3Jm3eoawYuDSnqKpfqPP8yZJ1Zy95jfy4lbTXV3/NK7iCvm2hezPun 39sCphdU8ierx9YW72EwMEh81KAbsv+F2lPVH82VJkosxRmJhlrMRcWJABgJ7XYxAwAA 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 V3] 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 vishal.deep.ajmera@ericsson.com Signed-off-by: Keshav Gupta keshav.gupta@ericsson.com --- 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 d94e9dc..eb8021a 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