From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR02-HE1-obe.outbound.protection.outlook.com (mail-eopbgr10086.outbound.protection.outlook.com [40.107.1.86]) by dpdk.org (Postfix) with ESMTP id 4AE991B2BF for ; Thu, 18 Jan 2018 12:27:46 +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=kUSL21iuCGyjb2wogCEEB0wHU8MMCIQxJRMsfpaUTyY=; b=HQK4ukrqy3YoU+ZmhCWUumRljnAZEX0CVN2FYFHIY5k7onjuPgpSsIe5Hl7SL95GSCwyupN0Ssv0Iviul4ygeF9G1n6YMktzhRGWWroISUKVxm9mpJpUorO18Fyhk02l9MU0FpesbrdbLwclURabtut+C/oBmshHxx5UHo+N54Q= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=matan@mellanox.com; Received: from mellanox.com (37.142.13.130) by AM6PR0502MB3797.eurprd05.prod.outlook.com (2603:10a6:209:a::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.428.17; Thu, 18 Jan 2018 11:27:44 +0000 From: Matan Azrad To: Ferruh Yigit , Adrien Mazarguil , Gaetan Rivet Cc: Thomas Monjalon , dev@dpdk.org Date: Thu, 18 Jan 2018 11:27:13 +0000 Message-Id: <1516274834-19755-6-git-send-email-matan@mellanox.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1516274834-19755-1-git-send-email-matan@mellanox.com> References: <1516220357-13013-1-git-send-email-matan@mellanox.com> <1516274834-19755-1-git-send-email-matan@mellanox.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [37.142.13.130] X-ClientProxiedBy: HE1PR0102CA0042.eurprd01.prod.exchangelabs.com (2603:10a6:7:7d::19) To AM6PR0502MB3797.eurprd05.prod.outlook.com (2603:10a6:209:a::26) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 427af63a-1515-4d3c-f3de-08d55e667eca X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(4604075)(48565401081)(2017052603307)(7153060)(7193020); SRVR:AM6PR0502MB3797; X-Microsoft-Exchange-Diagnostics: 1; AM6PR0502MB3797; 3:n6ApfP61ex9Dgt/KGLOwfggkFL5HR3b9YI0zLpr7LmMD0bCqzbJsTGr/PoQ1kyuy/3kv9yChEag1lai13znAPwBbJZlxKqqQi1V+jhM+CSjv1nH3Dn6RK4yhi0p+uVYfquCDnt3BahodrtRa2p++Fc3rj17T5WblEKiLSus0w8oKIrAR1tDpNZNY8R5ZGVC/qwTyB8fvTQCtecuATdf1Ouxi0Uezl1AwWdctu8A8ZfwoxGrpdrF7FydCa/vpUqfg; 25:k2Ol71H71snVTviyxYLv4OAnhGPRL3HFpiBGR4EC/EFaZMA3BvA3awNI3omzCBnGLqFXo9t+DcakWAZs9pZZXIypsARk9aG8B7mpUJ7lNeX3fD5CgukbH9NLjDOFYK3IRp0Z032eInwAF2JIT9rUw7ia377Qf3bmAbwmezB9eJgAVAh1BZGSWsBTcb2iNOD10ghGVLPTSoStrgaa7oot5p/po/JU4RNzkFhz89RRYa0n47sC2elF5vC2W4Z7zeqak/5lPVskavx/PAOhnUSQaqa11ZWw2D3Eel8teEZJQ4U218FDd7F89jOstikG2ipJWIjVkF+7AguNTwUXXbzGOA==; 31:ztaN49qiy5ye1lascXy+8SNFEOn4dkszt5acba3vlsn9JPq+rVxtrh3q+vbKzua3tP4+rnXUCRVUNsV2G1d5OP2bAGzNsBmbUxkUab8hmcR+90ZzqqE7FoO74+yIe72hNRXDS2A+uslZ9RvK2yDF0cJzJwBdS6hzMYtVcB4ScPrMOaah24jAiJ9k/CKVtRkAvYyyBWMXDORtuwQsfkMqQgpc/5o2GV/C9GXlXkY81hk= X-MS-TrafficTypeDiagnostic: AM6PR0502MB3797: X-LD-Processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtAddr X-Microsoft-Exchange-Diagnostics: 1; AM6PR0502MB3797; 20:krSJgxQpwNCmt34Ub/l7Mfkpk1F3U/Tdr6q+uW/mc2Qjt9+2ky7eYr6EFQmsvR9NvIBSER4xY1raWO9tWhZWNNFqocAFoCkm+eGbGZ/Ib0sRohMdsIhi14l4O6kbYiBavtbcdsCvzUomE78TGTAOSlI+fWuJ4akiJXbvtDAHNhY+uQv1t9Cq/OLeT5NlMYKA7AuCaAF+C2WIqZQj3248hbRoGHNAxaxfb4ZvBYq85sCumXzPrVfN6tLrh9Se9jLf93/Tb3vCxrjsa3W+56QNvymPESHlAc0yyJxC4NdebBW4v/l0vtBeJ//k+jX/5lBK5VfH5tu8jMwsk3/RgpYdIaF6CW/KszrIZOgX5JmAYOjsaNha4T5yLYdQFBAYkhuYZSIAhpMcWFMGXCN2aT2T2J+I+HICXK6HjuUb8CmILdVqbn6d2qiHyXipJAPXrpKp4ATENWiY6Zd8TxJn1odmFafIsPkQs/a/AANgB1/8IvgnrKksSinkqv+531bxR+jh; 4:zRzcIa7iQZnwtrjwYLCxa97x8AX5lAUGN08m73VmHzSWqYz22pDhs9I8LJYYebkG4jE/4/V/A/b3JxfMZoEOJ6jgpwjxb2en7CibVz+cUPH1lCIgbhudy0FeucKIeD6crtn5DEcEgX65+EFP/nyhIdEwsdhEHPX6G6lTlSfpF7xdFRNCjyCsZTa2F1tWpt89dQnwrSL83fvHHLSMSeb4+GWKRNMykKjE+5s35HW1PNZGRv3wmSdCwGtGDHtD5vVAK4GvFAXYXrTY1le6g3e3MdQCNZj0I4gYC0+NcXLhVWdaSMA2Gj54/6Nv9ru3rfMx 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)(3002001)(3231023)(2400060)(944501161)(10201501046)(6055026)(6041268)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123560045)(20161123564045)(6072148)(201708071742011); SRVR:AM6PR0502MB3797; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:AM6PR0502MB3797; X-Forefront-PRVS: 05568D1FF7 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(376002)(366004)(39860400002)(346002)(39380400002)(396003)(199004)(189003)(53936002)(6116002)(76176011)(386003)(4720700003)(59450400001)(26005)(7736002)(305945005)(50466002)(66066001)(2906002)(47776003)(16586007)(8676002)(110136005)(478600001)(316002)(25786009)(21086003)(2950100002)(48376002)(6666003)(51416003)(52116002)(7696005)(81156014)(8936002)(81166006)(4326008)(86362001)(16526018)(97736004)(68736007)(36756003)(50226002)(5660300001)(105586002)(69596002)(3846002)(106356001)(33026002)(55016002); DIR:OUT; SFP:1101; SCL:1; SRVR:AM6PR0502MB3797; 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; AM6PR0502MB3797; 23:GjxxqvCxvPC1t4qJc5L8vxEvp62QyTxG8Z3qugW?= =?us-ascii?Q?kNYBPTgkj/vX2Hf3HZuUQN/uy0CxlOJI0aCdeP6uA+uPdHkx2dRhDq6YXDtK?= =?us-ascii?Q?7DyqnVuk6bFgV/Ogu/F7cl+yWF284qEm+IF9UlSTsZR1DgBBMtlygA1gDaUP?= =?us-ascii?Q?X3grL0X+8kZw+yVsv/d14DGKDjJosNliOIzn5KHxJc871UI9EzGD//sbQ02N?= =?us-ascii?Q?v7alGlm1qzyzedE4uimIlSE72p2uss0BoS7n4gWF1wkfj7POkIbmLu28L2L9?= =?us-ascii?Q?ITlF50CEjZQ2TvKeSXdUMT3wo62v9eWa/MiP5EKXmV/YkfICkzkR18TwmIG2?= =?us-ascii?Q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ostics: 1; AM6PR0502MB3797; 6:aUxYv4TF79+/0sgyeW59kRXfSMmr8GCKZFOTXAwvnGhS/doZArMZjWJ3wbKHlPXc4QsIJvNZF9ZmfGm2GfFMkO+qai8bmvSd/GQTHnkboY1WIxCqmV7p6mNzMcnveW1Ez1mIGn5gbuGILhwsxUybjwRWOLe0NIU9pQbYtbLZZj9lkwlsCH1/XnETiBIAKT+sbEWFWzUYh29w+r5CVixotmZ5ADc/DU3Qoj84BTcpqVMXjT/GIIswmhqhSDZWRUyiYK4bZ4uhFKyWoy6AXdXq9wfnUK+P/k8q6MkvW2lPQGWVlN0f9VxEnnd6PcD7N/JFnRTcOJvAomvVGJLaFRU1ytTbBna9x/Z+PWE9jythDOo=; 5:vdj7PL+4svzPTUofDF6l5uqk2+SujJL6tE0xma9XGoiTVRmbXgKIWZn2hCdQKijb/I5c9zIgLgZKrd0ZIqte4QON1BBYrdVlw/q5+x6Xi5I33j1QhBkS4/SHoxEttdbbDCTtHk4qQECUNTU/SqEb4PW6Y5ARCWwboLQimtT5BEo=; 24:FYhbMfSm1iqHM+ZUYtsrLfCjzYrbRajijP21iNIvzBCHYm1Ja8CE/Dxs1BBeGtoa3G1gT6PALRrCK0wVEswKHdAXxS+0lPRS3iYVyQnqzLo=; 7:2zI8IPGc/kbfs5y1xTFC4hoEkweP+FLMg9ziZUCekSkzJ/p1O8Qf5UIRZeopWCt8e4xQk4ODscc/T0rpT8mhemskoO+3wIMDYkpyW6hBCjdY7V66Le1lQsWglNtQIpbTW00L4fYuIxiH9cQQziDAdQsVmsGZNbkEKwn8BjglIRnXGITz1cMLOCZ/Pp+EMcfehMRhA0YALIJe3kLFp0q+8kfnQ7GHjmuavXr2C9/TzGxt/mlAQs6EW34oamC7r2GU SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Jan 2018 11:27:44.0166 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 427af63a-1515-4d3c-f3de-08d55e667eca X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR0502MB3797 Subject: [dpdk-dev] [PATCH v6 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: Thu, 18 Jan 2018 11:27:46 -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 913d1a5..a86bfbd 100644 --- a/lib/librte_ether/rte_flow.c +++ b/lib/librte_ether/rte_flow.c @@ -107,6 +107,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) @@ -145,7 +157,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)); @@ -160,12 +173,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; @@ -183,7 +201,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)); @@ -200,7 +219,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)); @@ -220,7 +239,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)); @@ -238,7 +258,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 e0402cf..07ec217 100644 --- a/lib/librte_ether/rte_flow.h +++ b/lib/librte_ether/rte_flow.h @@ -1267,6 +1267,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