From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-ve1eur01on0074.outbound.protection.outlook.com [104.47.1.74]) by dpdk.org (Postfix) with ESMTP id B66371B1D6 for ; Wed, 10 Jan 2018 13:31:30 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Mellanox.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=+WJGP+D5SjLHPZ+iX5sAy2qXzsuelIDNqw9Y3AIJxjU=; b=MSHxc+C/7a7QnVA3LplUaDw9HyYCjAM+MrB1MJXBKphBbdiv2GNX9oNIyN+uflWeH+y1SC7xNyqq0XBqQLYmbcsiTZMMwlHCcqae2BuP+nm4dxLJ6BK4lZs6v1Ysre/Z/bF+mheT9yZ24JboK9muNJ0VnctQaztYyVBYKcNZ+Yg= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=matan@mellanox.com; Received: from mellanox.com (37.142.13.130) by AM0PR0502MB3796.eurprd05.prod.outlook.com (2603:10a6:208:1e::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.386.5; Wed, 10 Jan 2018 12:31:28 +0000 From: Matan Azrad To: Thomas Monjalon , Gaetan Rivet Cc: dev@dpdk.org Date: Wed, 10 Jan 2018 12:31:04 +0000 Message-Id: <1515587465-9304-6-git-send-email-matan@mellanox.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1515587465-9304-1-git-send-email-matan@mellanox.com> References: <1513703415-29145-1-git-send-email-matan@mellanox.com> <1515587465-9304-1-git-send-email-matan@mellanox.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [37.142.13.130] X-ClientProxiedBy: AM0PR0102CA0064.eurprd01.prod.exchangelabs.com (2603:10a6:208::41) To AM0PR0502MB3796.eurprd05.prod.outlook.com (2603:10a6:208:1e::30) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 915f4d2c-7cc3-4607-a71b-08d5582612fa X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(48565401081)(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(5600026)(4604075)(2017052603307)(7153060)(7193020); SRVR:AM0PR0502MB3796; X-Microsoft-Exchange-Diagnostics: 1; AM0PR0502MB3796; 3:OSyghKVowLdsX5ib+8Yi/4MeT9O/zDB215SH/2O7IkY/QVFyjUELhu06EbGNz977ea+3GdJuya7wefHKlw0ofxyd1yOTScy6bdMLSgvzas7l012CNLSGueRci28rz90/jsjDToW8gvcvw4Q4FMCj3S7ta25r3X4jduupDZ7vptTq8AA3AfCvEDKpa7EqyRj5Hjen/c5VOcEzgIaiK2oECsF0Vj7X2f0Ts66w9KizNMkz1PGpwGRgoFjfCfgSG3KC; 25:tuJdMRVe2f5wqM7csechwMPSzTLvbAQOcuC2Uh1dHHkjFPBZKxN/I7JBESA5dSFdY3yfADRIai0xJV6zQAlmzGZoBJT2tH7jjtqnZrhLORs1793n1yMEIUEnPRfg0d+wdNUBQUxWC7sGQtLZ55CdEn7dNkifCyL7pCL0dE+fOqvi1EP0nszFWCqa3ZklQJ3koj5ZqCwXPwQ4gb4StKVcSALIkwB6eV1E6HeouFqJg6TGamgbzsoijSIP5rGFKyb2OKpAiVEvSrp/RH+Y3IzTEc6NPGbgZ7mzhd+wB3ALCk3/rGnyYAz+QTNch9jpvygbY4u3S8qqJrxjomJnQLmW5A==; 31:iK5RJWMzLxWLdW+DHIactJBL8PMmiaOrSnkQK3rtOhrRyeOHb9HbWkVdy26KtnoVmUYJLLBAMtmGqxkyYKVUCSwQaq5l5i2AK2WXfy5hlSniK42FlfNUwoGk2xnvYll7a2BSeHXbL19I4hCkF2PgrtzPoZhda9Ywps7wjr4//uxpSunZoJTb5mb1+m6z7pVdWnBQE+ghjLIR70KQfcbpiMmjUJOL2NbU6OkZ9p03M+g= X-MS-TrafficTypeDiagnostic: AM0PR0502MB3796: X-LD-Processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtAddr X-Microsoft-Exchange-Diagnostics: 1; AM0PR0502MB3796; 20:hC9/LQZ2RzkQuSa5tpzfg5fGy6FHzEYH426pNt0CrHS9OBZvHKivuhdsqwK4F4fJkXWBAmGtdmC+uNjXHh4uI5pqglsQiVJ+rsRcuPOIbLfVDAmFpCo8gnZFs/NzruDh0X/Zzizk9GiC2kbj1jVD0mVv50obt+99CPzcoOL5VATL9YyjqvNxVQ00eFLNgL2tjW+SBMi9vQ1HuraU6iLx5xFonZE9DesUZaleEKW2uiFCzDEkzOegOkjk/ePiy5ml+S0eVDBg8VcThXt7ZZ+Cwste4JIKMP65hkiJa7ejQOev+UB90K907uQeQ8DOXWzGSxHOcpmoIOpAK3T0SnB87nfrPN3spPjzqqGA+MCUxqsgT2Qq+BhNnUOVh/636ggycHC5BGUooJltIXF8nUeW+ARKDQc/Y0ibErh3zyz6YefGBRi1PKI9xakpSoTjNgG8bRhdXInu/qhGRd2YKZx0GgD6Uh8cWD7O4H16pMyEZ9wTN/SxIYrdg4iR6EoGu2EA; 4:r74nBgdG55pyYlV3oymRZYgkInoMZFkaH9MVAmRWGcNoQySSHWCS+3Wbi8Taql93fIuZB2gnpa/Ne+EoEUlHZwyqac/6tx+ERiSKyDWa5d4yLIMJ+2fV0iqM3Ty2wImQqBSTFVWOkQVRyi5BwebzY1eMu//WU1cgxXpywUJ7Evq+mQBfDilAqSmoHDqTao6oRzvpK74BKLt99jQR+m8JES38/hGS2GshZCKvQ5YucOeNtwaIImhHH0C58qjKQ6+NgC3baG7kftGEGYG9xuvDEVYxryAuX1nNeiJ1EqEw2RuLvVDRN73ExUGyYrT35nzh X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(20558992708506); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040470)(2401047)(8121501046)(5005006)(93006095)(93001095)(3231023)(944501075)(10201501046)(3002001)(6055026)(6041268)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123564045)(20161123558120)(20161123562045)(6072148)(201708071742011); SRVR:AM0PR0502MB3796; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:AM0PR0502MB3796; X-Forefront-PRVS: 0548586081 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(346002)(396003)(376002)(39860400002)(366004)(39380400002)(199004)(189003)(55016002)(68736007)(21086003)(25786009)(6666003)(2950100002)(4720700003)(6116002)(3846002)(4326008)(81166006)(8936002)(86362001)(50226002)(97736004)(69596002)(53936002)(16586007)(105586002)(16526018)(305945005)(7736002)(48376002)(316002)(8676002)(81156014)(36756003)(110136005)(5660300001)(50466002)(106356001)(66066001)(51416003)(33026002)(52116002)(478600001)(7696005)(386003)(76176011)(59450400001)(47776003)(2906002); DIR:OUT; SFP:1101; SCL:1; SRVR:AM0PR0502MB3796; H:mellanox.com; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; Received-SPF: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; AM0PR0502MB3796; 23:16j1KIqdxFdZXu+Vhz8RUBC1WPjh4VmmmrCo2PL?= =?us-ascii?Q?UfGHNy1AZAvrxiYsdo6/zWDhyVDKa+T/I3su2BUgZPoM48diOomsYnUoAruN?= =?us-ascii?Q?TYMTByXdo+zDcVDg8DnNKnYbPHCPq7TOD2XVfpwbI4E4SochghP0i5/Qpweo?= =?us-ascii?Q?kCBB0j6T/wF0eNhif0cvsIs3Qpe7b+oribtxTUI08YBeu34DHr1MMo+ZGGLg?= =?us-ascii?Q?FFExr1XuuZmyZrzQonwduZb2Ip5wuII/6C3BxAngu97LjMbFOhAineLJKaax?= =?us-ascii?Q?GGCsC8yxrqHjIRYZ42hct//4WvTZubU6ONeocyHtqtson+6wEymg4uiAAhEh?= =?us-ascii?Q?D3c0nAO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R0502MB3796; 6:2S/kZ6X7F6Nv8CAhyoBMdkFhmU6rlEoNeE0SEIVB4t/DzTMCec4mDoGqQlT7PrRrPSuFz0xJesASC3LkVSKW45MAaDi+TA/R7G9ZGid7drvrEB+JZRPcQBW3Kr3P6Y9IrWUV4UmnPQk2V3GhW3Uv2mYyWmcaHD6Xf0qkoykaKZX05HU7MzB2bU3g/ZkQntAcS0Ue15eu9ZK1XKP3Vmfku7mfMCDTJwMkJzL+t4jCmq8+HVq2CYMN+zMCKv065opMlmrXdlGyQKHev0NpDB/jHnnwF5z5NA6HwTCVZhmZoj2u/mS5ZD/GsZnmWBW/YGpDSfBZ4zCyUYdyfnCrV6drQNiu5uBWojkltfbjhE4Oux4=; 5:f+N/sz9vxW5/k2QNU6laD9htLOaOLSMacGnDUulF8o0xRD+/c1ZQ1v6JnV66VhZUSVVQ3Sg4q+327G0GyCuXCFe22gBj59HYFbz6iXbJarYpIpa6fPoX4Hgtq2eeRsuSwAQUFGPLPf3ge49xpH4h4jJk8y1lOUINJaQHefM1RZs=; 24:Op0hGAS/yiAgZGx67jNhjpTZS/2IKZ1sYX8o3u51sHuXZ5x1emGNok1wXEXabTXU0JCMQJuDtC1pPx+6VLs0X42k8fFawQrbWcm194VxOTg=; 7:Vl8QxnL1nLpIjMxFRakVwh2Zj3Ol6ItjTRL7lDylVFIq8MUbXXIDusdtdviHyfbGVz57Q+lrmozzBQc3yQ1HZpgMTxahD8p/gMdvfvePcS8I/xuE+xhXMD03c2HQ6o31+H+B8c1hiIiH5kyw80rtVacP2pqNtkGdzLZB4JGcUPveNs0xoY+rbxakVNTrDiivGWsekpz8SWyHo6nzZ+1gRO4eW5XpD1KFCtHAWs8WGKeD/yYnI9HxJ7CJ/usJ3y29 SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Jan 2018 12:31:28.9305 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 915f4d2c-7cc3-4607-a71b-08d5582612fa X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR0502MB3796 Subject: [dpdk-dev] [PATCH v4 5/6] ethdev: adjust flow APIs removal error report X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Jan 2018 12:31:31 -0000 rte_eth_dev_is_removed API was added to detect a device removal synchronously. When a device removal occurs during flow command execution, many different errors can be reported to the user. Adjust all flow APIs error reports to return -EIO in case of device removal using rte_eth_dev_is_removed API. Signed-off-by: Matan Azrad Acked-by: Thomas Monjalon --- lib/librte_ether/rte_flow.c | 34 +++++++++++++++++++++++++++------- lib/librte_ether/rte_flow.h | 2 ++ 2 files changed, 29 insertions(+), 7 deletions(-) diff --git a/lib/librte_ether/rte_flow.c b/lib/librte_ether/rte_flow.c index 6659063..be481ce 100644 --- a/lib/librte_ether/rte_flow.c +++ b/lib/librte_ether/rte_flow.c @@ -106,6 +106,18 @@ struct rte_flow_desc_data { MK_FLOW_ACTION(VF, sizeof(struct rte_flow_action_vf)), }; +static int +flow_err(uint16_t port_id, int ret, struct rte_flow_error *error) +{ + if (ret == 0) + return 0; + if (rte_eth_dev_is_removed(port_id)) + return rte_flow_error_set(error, EIO, + RTE_FLOW_ERROR_TYPE_UNSPECIFIED, + NULL, rte_strerror(EIO)); + return ret; +} + /* Get generic flow operations structure from a port. */ const struct rte_flow_ops * rte_flow_ops_get(uint16_t port_id, struct rte_flow_error *error) @@ -144,7 +156,8 @@ struct rte_flow_desc_data { if (unlikely(!ops)) return -rte_errno; if (likely(!!ops->validate)) - return ops->validate(dev, attr, pattern, actions, error); + return flow_err(port_id, ops->validate(dev, attr, pattern, + actions, error), error); return rte_flow_error_set(error, ENOSYS, RTE_FLOW_ERROR_TYPE_UNSPECIFIED, NULL, rte_strerror(ENOSYS)); @@ -159,12 +172,17 @@ struct rte_flow * struct rte_flow_error *error) { struct rte_eth_dev *dev = &rte_eth_devices[port_id]; + struct rte_flow *flow; const struct rte_flow_ops *ops = rte_flow_ops_get(port_id, error); if (unlikely(!ops)) return NULL; - if (likely(!!ops->create)) - return ops->create(dev, attr, pattern, actions, error); + if (likely(!!ops->create)) { + flow = ops->create(dev, attr, pattern, actions, error); + if (flow == NULL) + flow_err(port_id, -rte_errno, error); + return flow; + } rte_flow_error_set(error, ENOSYS, RTE_FLOW_ERROR_TYPE_UNSPECIFIED, NULL, rte_strerror(ENOSYS)); return NULL; @@ -182,7 +200,8 @@ struct rte_flow * if (unlikely(!ops)) return -rte_errno; if (likely(!!ops->destroy)) - return ops->destroy(dev, flow, error); + return flow_err(port_id, ops->destroy(dev, flow, error), + error); return rte_flow_error_set(error, ENOSYS, RTE_FLOW_ERROR_TYPE_UNSPECIFIED, NULL, rte_strerror(ENOSYS)); @@ -199,7 +218,7 @@ struct rte_flow * if (unlikely(!ops)) return -rte_errno; if (likely(!!ops->flush)) - return ops->flush(dev, error); + return flow_err(port_id, ops->flush(dev, error), error); return rte_flow_error_set(error, ENOSYS, RTE_FLOW_ERROR_TYPE_UNSPECIFIED, NULL, rte_strerror(ENOSYS)); @@ -219,7 +238,8 @@ struct rte_flow * if (!ops) return -rte_errno; if (likely(!!ops->query)) - return ops->query(dev, flow, action, data, error); + return flow_err(port_id, ops->query(dev, flow, action, data, + error), error); return rte_flow_error_set(error, ENOSYS, RTE_FLOW_ERROR_TYPE_UNSPECIFIED, NULL, rte_strerror(ENOSYS)); @@ -237,7 +257,7 @@ struct rte_flow * if (!ops) return -rte_errno; if (likely(!!ops->isolate)) - return ops->isolate(dev, set, error); + return flow_err(port_id, ops->isolate(dev, set, error), error); return rte_flow_error_set(error, ENOSYS, RTE_FLOW_ERROR_TYPE_UNSPECIFIED, NULL, rte_strerror(ENOSYS)); diff --git a/lib/librte_ether/rte_flow.h b/lib/librte_ether/rte_flow.h index 47c88ea..180438f 100644 --- a/lib/librte_ether/rte_flow.h +++ b/lib/librte_ether/rte_flow.h @@ -1237,6 +1237,8 @@ struct rte_flow_error { * * -ENOSYS: underlying device does not support this functionality. * + * -EIO: underlying device is removed. + * * -EINVAL: unknown or invalid rule specification. * * -ENOTSUP: valid but unsupported rule specification (e.g. partial -- 1.8.3.1