From patchwork Wed Nov 8 09:44:15 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: 835743 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="a1Gnn9gB"; 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 3yX1bY00D4z9s4s for ; Wed, 8 Nov 2017 20:44:24 +1100 (AEDT) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id E7C9C727; Wed, 8 Nov 2017 09:44:21 +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 66524504 for ; Wed, 8 Nov 2017 09:44:20 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from sesbmg22.ericsson.net (sesbmg22.ericsson.net [193.180.251.48]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id E23688A for ; Wed, 8 Nov 2017 09:44:18 +0000 (UTC) X-AuditID: c1b4fb30-759ff70000007d10-6e-5a02d1f1e810 Received: from ESESSHC018.ericsson.se (Unknown_Domain [153.88.183.72]) by sesbmg22.ericsson.net (Symantec Mail Security) with SMTP id DC.23.32016.1F1D20A5; Wed, 8 Nov 2017 10:44:17 +0100 (CET) Received: from EUR01-VE1-obe.outbound.protection.outlook.com (153.88.183.145) by oa.msg.ericsson.com (153.88.183.72) with Microsoft SMTP Server (TLS) id 14.3.352.0; Wed, 8 Nov 2017 10:44:16 +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=OeJ57z/YKstl7+tE6lTp7ZW2E80/LRmbpG6j5tflKFI=; b=a1Gnn9gB/klWrrnc555SZ8Xw13je6WEBU08NmZs4K1p+1Na6YYcVBwLC6So2+sUjFYSrLeE8aR67lpleP9T+vnOQ9IHaPfvckluJekMJUcSQ6OKqj60w9vkI1NUw/YLBT7DsXfVguDatPcHVDJSwFT6/y2GtQaGHm7q28y3zmrg= Received: from AM5PR0701MB2961.eurprd07.prod.outlook.com (10.168.156.135) by AM5PR0701MB2962.eurprd07.prod.outlook.com (10.168.156.136) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.218.6; Wed, 8 Nov 2017 09:44:15 +0000 Received: from AM5PR0701MB2961.eurprd07.prod.outlook.com ([fe80::c8c:e32c:e8d4:c7d1]) by AM5PR0701MB2961.eurprd07.prod.outlook.com ([fe80::c8c:e32c:e8d4:c7d1%17]) with mapi id 15.20.0239.004; Wed, 8 Nov 2017 09:44:15 +0000 From: Vishal Deep Ajmera To: "dev@openvswitch.org" Thread-Topic: [PATCH] Skip processing actions when batch is emptied. Thread-Index: AdNYdX8YDcQuTV/USnKOU0a7jvezqA== Date: Wed, 8 Nov 2017 09:44:15 +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; AM5PR0701MB2962; 6:8eRVK8bsMKRZuc/OSLEzPex3kJUckUh4L/wrMNp1C669PuHNm/4mHX5Vw11T5c0MnViGNtBvgd3WArVPk0wUrmEXtlu5UbNQ4Z7VGl9g5I+I1I5lTWnuF58eucATRgnKeByIE2ZQ3lqdgYch+azeitxAN024sELVDDcsYM12uUfCaJhSOGcg4jXxzvi8f2s+k019wyOYFmfQI8e7eX8rMUji7fK9+dO2B+ziD4yGFCnIVravw9QB58oJW4pU+VYzbBBauXVe3LGHAxLdIFWTK97VKfzH48366svexmTr3JE4Kq2RjmJquZHSAPAJG8zmn/w626+92vKvXyQMW8KVI78EJreHx5sogMYtO0s4yJ4=; 5:dJQyOsutWg5oLcIp6DAuc533joaeM42OxYmOv4DsSDfFDhB+JVUKS6vk0z9o7O8CwCsy2GWPU6EIu/TOLXALBjkaHb5zd9iFsGGMHM4XbrN8fSjUqmf+Zo+N8vCGD+9E7yx9qeKKFgy/kmjOluJuJVaNXJsCacEPOpfc1rauZEY=; 24:WoTtQiOI7FkGQ6Pu3yNo360+UZ6pkzwuOlkhQZLQtYw+hUcaspItFQ67rtgkLHuPnPLGdf7h2Qb42SGRCXFFyhaUq2ao0Zjj6al0jfdVWBk=; 7:xWY+xl98DOYYKysj11uolgwVISeWCYv2qss7gmqnSLhzrX6NHf+BYRBhIdssWiil62Xs6Z4O7eiVhPHkOHq3+m3SZ+NqWpLSZ9ZvDRarDhNARtlbnW6RCXdtF7H8KwBCkZKXb6h3yRV7y2tJU4i67CsJ0MfxJIjtgvDN9K8mIUIe0BfnzMorQJj4tzDEsmHzT69lej7kIbkT6MZLiskI92rizpJmA/YOezpU1BTbrl3ySOwvg0wb0yTXU8HGjgUG x-ms-exchange-antispam-srfa-diagnostics: SSOS; x-ms-office365-filtering-correlation-id: 71ed8a50-fefc-4d9a-510b-08d5268d4677 x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(2017052603199); SRVR:AM5PR0701MB2962; x-ms-traffictypediagnostic: AM5PR0701MB2962: x-exchange-antispam-report-test: UriScan:(37575265505322)(21748063052155); x-microsoft-antispam-prvs: x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(2401047)(5005006)(8121501046)(3231021)(100000703101)(100105400095)(3002001)(93006095)(93001095)(10201501046)(6041248)(20161123558100)(20161123555025)(20161123564025)(20161123562025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123560025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:AM5PR0701MB2962; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:AM5PR0701MB2962; x-forefront-prvs: 0485417665 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(6009001)(376002)(346002)(39860400002)(189002)(199003)(7696004)(105586002)(5640700003)(2906002)(3280700002)(81166006)(6916009)(316002)(81156014)(74316002)(99286004)(5250100002)(50986999)(6506006)(2501003)(3660700001)(53936002)(54356999)(68736007)(1730700003)(2900100001)(33656002)(14454004)(7736002)(101416001)(5660300001)(6436002)(8676002)(5630700001)(8936002)(106356001)(86362001)(25786009)(9686003)(790700001)(2351001)(97736004)(478600001)(102836003)(66066001)(55016002)(19609705001)(6116002)(54896002)(6306002)(189998001)(3846002); DIR:OUT; SFP:1101; SCL:1; SRVR:AM5PR0701MB2962; H:AM5PR0701MB2961.eurprd07.prod.outlook.com; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; 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: 71ed8a50-fefc-4d9a-510b-08d5268d4677 X-MS-Exchange-CrossTenant-originalarrivaltime: 08 Nov 2017 09:44:15.6324 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 92e84ceb-fbfd-47ab-be52-080c6b87953f X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM5PR0701MB2962 X-OriginatorOrg: ericsson.com X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprPKsWRmVeSWpSXmKPExsUyM2K7h+7Hi0xRBofm81scPb2H2YHR49nN /4wBjFFcNimpOZllqUX6dglcGYvnf2YtOGRXsePyHMYGxnumXYycHBICJhJHdzYwg9hCAocZ JSa2A9lcQPZxRom11/awgDgsAr3MEvMXNTFCZOYySXzrusoO4TxhlDg/bzYbSD+bgJXEryn9 LCC2iIC+xKGes2C2sIC9xMdvW5gg4i4SzSsfskLYehJTlveA9bIIqEicXrsJ7A5egQSJzXf3 gdUzCohJfD+1BsxmFhCXuPVkPhPE3QISS/acZ4awRSVePv7HClGfJPFmyx9GiLiSxOaZL6Dq ZSUuze8G+0BC4Ai7xKddK9kgEnoSWye+hWrwlfhytIkdomg2o0TPl41QCR2JlzsmQW3zkph9 4wHU1HyJ/2v2s0A03GCV2LloBtBUDiBHRqL/RRJE/AqrxIyubSyQIE6VWL62lRESLFISd690 Mk5g1JqF5LtZQO3MQHO3H4+dBQ4MQYmTM5+wQJToSCzY/YkNwtaWWLbwNTOMfebAYyZk8QWM 7KsYRYtTi5Ny042M9FKLMpOLi/Pz9PJSSzYxApPNwS2/DXYwvnzueIhRgINRiYf3xzamKCHW xLLiytxDjBIczEoivOfOAoV4UxIrq1KL8uOLSnNSiw8xSnOwKInzOu67ECEkkJ5YkpqdmlqQ WgSTZeLglGpgZO7ZdP1Il5PxbO77zRJHC1Y8Evq8P3u5kbDm64/L1mTYHnDeuy1qj9tUl78x jo3esrkrHxx82rzg+7b3UsLzg2S71r9cavbl19dZDZn8ZmlcK6rfn0q59Uf6UeVV2zClPSW1 tw86Ws1v+PxtW/f/M0kf+Lb/u7wwe+XWV0/kyzddSpVjtzr/+ZISS3FGoqEWc1FxIgADYjZ0 MgMAAA== X-Spam-Status: No, score=-2.3 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, HTML_MESSAGE,RCVD_IN_DNSWL_MED autolearn=disabled 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] Skip processing actions when batch is emptied. 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 Today in OVS, when errors are encountered during the execution of an action the entire batch of packets may be deleted (for e.g. in processing push_tnl_action, if the port is not found in the port_cache of PMD). The remaining actions continue to be executed even though there are no packets to be processed. It is assumed that the code dealing with each action checks that the batch is not empty before executing. Crashes may occur if the assumption is not met. The patch makes OVS skip processing of further actions from the action-set once a batch is emptied. Doing so centralizes the check in one place and avoids the possibility of crashes. Signed-off-by: Vishal Deep Ajmera Signed-off-by: Vishal Deep Ajmera Acked-by: William Tu Acked-by: William Tu --- lib/odp-execute.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) dev@openvswitch.org https://mail.openvswitch.org/mailman/listinfo/ovs-dev diff --git a/lib/odp-execute.c b/lib/odp-execute.c index 3109f39..8697727 100644 --- a/lib/odp-execute.c +++ b/lib/odp-execute.c @@ -685,9 +685,12 @@ odp_execute_actions(void *dp, struct dp_packet_batch *batch, bool steal, dp_execute_action(dp, batch, a, may_steal); - if (last_action) { - /* We do not need to free the packets. dp_execute_actions() - * has stolen them */ + if (last_action || (batch->count == 0)) { + /* We do not need to free the packets. + * Either dp_execute_actions() has stolen them + * or the batch is freed due to errors. In either + * case we do not need to execute further actions. + */ return; } } _______________________________________________ dev mailing list