From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-ve1eur01on0054.outbound.protection.outlook.com [104.47.1.54]) by dpdk.org (Postfix) with ESMTP id 1897E1B012 for ; Tue, 19 Dec 2017 18:10:48 +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=aH0jjSdKGCTS0o8Tq3uEQhCLCZcLJIA89gsTZ2/b9tI=; b=DqRkqFlLFzOFUPSxUV72/C+BzzGgkNBY0cSehKLw5FJxxbgSzf0wnT6k/fTYaOL/s2beTS7tsZmWOxPrSCJrOiIsKhBb0OI+11l0oYo0maiVCw+hGW5ArvwQDW49v/iTmwAXvuuaxlUysdx8zAVP3H6XMu6L5DudoK1gQGLWVa4= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=matan@mellanox.com; Received: from mellanox.com (37.142.13.130) by AM6PR0502MB3655.eurprd05.prod.outlook.com (2603:10a6:209:9::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.323.15; Tue, 19 Dec 2017 17:10:46 +0000 From: Matan Azrad To: Adrien Mazarguil , Thomas Monjalon , Gaetan Rivet Cc: dev@dpdk.org Date: Tue, 19 Dec 2017 17:10:14 +0000 Message-Id: <1513703415-29145-6-git-send-email-matan@mellanox.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1513703415-29145-1-git-send-email-matan@mellanox.com> References: <1513175370-16583-1-git-send-email-matan@mellanox.com> <1513703415-29145-1-git-send-email-matan@mellanox.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [37.142.13.130] X-ClientProxiedBy: DB3PR0202CA0017.eurprd02.prod.outlook.com (2603:10a6:8:1::30) To AM6PR0502MB3655.eurprd05.prod.outlook.com (2603:10a6:209:9::16) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 64796ff2-51a5-47ce-344d-08d547037250 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(5600026)(4604075)(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(48565401081)(2017052603307); SRVR:AM6PR0502MB3655; X-Microsoft-Exchange-Diagnostics: 1; AM6PR0502MB3655; 3:T8B3FrzCgy+pOoBH9ra6GxLbL5loTKScLRv4hbLrhwx4+2z3kmyaevd5+qHP1w9kTDiWYo+JLltFOa6m2cmfn9QdyAZIhA/nJk/8WwG6/zb7tucuRGVwL1ZRBBV/wb8xG+n3Eip2mJFH3u3XeP+BwP4tJXWyQPyOHWp0OO1I/M5PVB7dfWD/Ofuz0XCH3JBxyAQn9lHKGl5XKZYkLSWl4GfD0XnHmMGZGvaoDPgQO3rJAKCvGfTRSrD5Q1igcrCa; 25:fkqPupXtU/5SSIZ5bB8gTkHrVhQUqsnx1HKR1U0btitRmMssE/9wnUfRGX9+SbtMTlk3PQ5Er1UyfsVb52PRJzTVxHzqbwOwpxeURT4DpAojzIO1nvSOnLHsl2viAt8WrbZBOaQwBriw/VkN3qx55jqw499SiYZ/sJivU4VtyMRhCKb3kNvdJMm7aYxVq9nRAv1IOFHRpf2M6oa8dJMQyRSmRBvkyPFOEoNT5KCFiHyVA0/QieM+xtJGA62yaP00g/rCLF8CIgcmVVQVvz9ztsA5rl0T5WtPQ8Y8xQAseBssh6Ydq7HD1km8DF/KCXrCQJjbqd5ZHDx63s9XT0dqUA==; 31:s6v6LCcaC8qQLn1JLYTzfDPlEFSUJnBi6CRhyr0QT5b64hShnICSrSZEtXxbE8YuOLfRELBX31RydkkDqI1bd3bABOJivs5cgwPDxgu8m79dF2YUhllTpquPrVbz9Mv8HeT1MY/ZlIiJf+uJimPFBOf59fEAM5IIdXoyMDO03Il/+akO6PGrF/DcGHZ9Dam/T1g/8EzSaFJodYhCyEyNhpLcB1QJW36LrbaAisXnWNk= X-MS-TrafficTypeDiagnostic: AM6PR0502MB3655: X-LD-Processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtAddr X-Microsoft-Exchange-Diagnostics: 1; AM6PR0502MB3655; 20:h2NaEu39d2lRfeslm4Vokv232j7u3r4CRde24iOsnXOxG5Ylugkop4tzjIvou0TcNH5EyvgeUTR3T2ugboNlS2Jg7nyC1qZaaMux8JwEIDLnHhSxqtqraYdMf0Jqx9m+Rf4FpFK32DjLhnMUk8GaN/dQvmuKiohPmdRn+5bocptf60sk6xnqBpkspELZQNg4HU32asb5ulo1d4hN5ynOOdTVyXoSixy01xYEU8Zr+DPgix6YbMiUnrHTfTKwbZETdIZ9brJIH4fxt57Yi2baLSvwoJVr5C/Jrzio3cLCZNwv7/wakBhIfrxcxE1Jzo6GBPupzJ+hJ/99VRAsegtauyA9Qk4MJnO3SNtcEqVm9W+t1kMkHDVFe35r7snd8wBpoeLv+52oOOiARAy1qSNl/SSaefaZCl5Zt9pn4UNYXz+w6TwAPxD0cozQksFw93HClaeizE1G5v6oFU/qPHU5WagVE8HAPtO3anX/MhRR5JoJvY4PmncpX3l+9DuSp6eq; 4:cn6cPb8warDiAgRx1QONZ+6ugp7mErLwps1SuA5allG+olnRe+5OgdZixAjzQNtX7lVuNf5JPemxAWrmGZun2s7A5HJFeL3mMY+jSk4L8zDc8QwrcEZgW0SqchpMnbBwt7COT4XKhFr76AZ13mV4TCfNiGDt8F9fIHNDym9kQvwdlAvFapidb5ykgDZLtStpqjbUB+e6LzNB1gBw8Jkl/yv+isqkZKibvGNmauism13dM6NKYGQFume2litYPz4eN0NVUW8woK4WHQOIaj3GfZUASHBWNCDe7I50xXsAd4VXfGOCT/G9agjwpJNcU5pb X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(20558992708506); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040450)(2401047)(5005006)(8121501046)(93006095)(93001095)(10201501046)(3002001)(3231023)(6055026)(6041248)(20161123558100)(20161123560025)(20161123562025)(20161123564025)(20161123555025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(6072148)(201708071742011); SRVR:AM6PR0502MB3655; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:AM6PR0502MB3655; X-Forefront-PRVS: 052670E5A4 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(396003)(346002)(39860400002)(376002)(366004)(189003)(199004)(52116002)(47776003)(81166006)(69596002)(66066001)(7696005)(305945005)(2906002)(5660300001)(7736002)(55016002)(478600001)(51416003)(59450400001)(4720700003)(33026002)(6666003)(386003)(2950100002)(16586007)(16526018)(110136005)(316002)(48376002)(8936002)(106356001)(105586002)(50226002)(50466002)(76176011)(36756003)(68736007)(21086003)(8676002)(81156014)(53936002)(3846002)(25786009)(97736004)(86362001)(4326008)(6116002); DIR:OUT; SFP:1101; SCL:1; SRVR:AM6PR0502MB3655; H:mellanox.com; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A: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; AM6PR0502MB3655; 23:WJmU79c+dMYrASuFCBPlYlDiQwWCPhX/2Kf5a4+?= =?us-ascii?Q?Jk3zBP36k+qfIbbI936nrNLIxyP7RZq9/UIxmi9y/X7C68lH29epl9K1YoQL?= =?us-ascii?Q?FaZykvQzjeymV4EjqwB4QIYQU2TkoC61V9lG1l78Ls1mvYcucwnZc44CZDlW?= =?us-ascii?Q?Nm0wFtz5lMdsITxZp4QKUbrhQ97kMNPQHXWgefF5Rr3Vo66LfTsDxEysmNxS?= =?us-ascii?Q?lNIJH8H3QPVECtSYAUvymghRvSqfNCoyUZQSc/MEszduEToEo7jPl2i5FikK?= =?us-ascii?Q?im/P131BX7FDwMwz/pz9ROqZaoFLs1for0k24P7GTsKCi0fHB7EfEmfBR0I0?= =?us-ascii?Q?A9WIEulReFPagWN5O3pPv3TZ+3CYj1m9fNMxoQxrLdLo9ldSGVRPqbM+uMQb?= =?us-ascii?Q?DMYXW0t6PWJev6mz7OpT5P2Xgg6tC4fcVLw4+F7IPx46UKtGM3kMYTMury0W?= =?us-ascii?Q?OcDOIH5nsLQOOt28+vh/esQUgVvyiy3QObMyqISNeLu8G35VFsE01iAv4lB7?= =?us-ascii?Q?y32q7Yj0W55V+MXc+Wc7xgkzXJEExRyvRFgm+TbssK9FvH0swNlBtLcCgx25?= =?us-ascii?Q?wxl5VPPKiog0PpW92VHrbWGYoZlibLezkWV00dhLiQ1MSPTnYKaXyzQE0JIp?= =?us-ascii?Q?kzyuifIf8nxOQwzq3Y16CfIpKFD+eN0r8XR6uWIBujuKTkfOo0rHW2tM/F2v?= =?us-ascii?Q?B9fV3py7KvLCDyykiGoJXLL6t66kYWi4grea4ScvLp1mxNQayUFeNlW43U2K?= =?us-ascii?Q?+TPUHQLj/JBetI/GnZZsoL8wowxXTIhHyYnaJizsmzg+1YCHS4UGc9A5fIQl?= =?us-ascii?Q?q0A2/6YCMnnVXL9Cz4h0RtZal/K/PvBfKUnycaIEBDuZPgTCZwZJ82ugebG6?= =?us-ascii?Q?XdAm6FSxetQPSdGLUPgegGEXBla/lnXiRJsI57NlvRqzkAxSmrs1v8Xj9e50?= =?us-ascii?Q?Zr94OapK4aC4DS6FFTnXvlBCWkcDgXoJHNVMaLfQdJjRUlW5ije1+SYRWvCx?= =?us-ascii?Q?ADJTPSiZAn2OgXirQqWGhUBS6h3djnceu6ypL/cbHfNva9e1PVRijOL/xuWZ?= =?us-ascii?Q?g/J997211tJTMDaZE3BTBkrU/uOcwgsqYEg3N8I7AMBIqtTt97eGnw+pjx7j?= =?us-ascii?Q?Y2oMGpkohVvsHqvLnXPkx2TxAej9uZDCP?= X-Microsoft-Exchange-Diagnostics: 1; AM6PR0502MB3655; 6:YWPIL2/oXuMcJMq7ausgpQg/aGeaINRGsPXl6Hgf06Y6JI4RTrIF9WDZfce+X9rhWQtBmF3sk2/SL6QWNnishRZVAI0w6Pnhbs3+j6gwARaGmkMv5Q6qgdpTTlU9IdR8avEmvYl5kyWE53Il+2dB+ibQtTH+jS43c4IosR2f4AiQ+q8ZViibknR5STMXis0xCRyituI1C3ADNqaYx/TBASLyfenWyzq5N413OG1W4ayIj0zVgvJoujA1M/2SJnE//TsQ6GlZ1srM3qvsPLToh5vQaCh4m1USJ8nSN7hb6dw35QSKunUjyXYmQyL3txHEye1jxO3YOEJUjf6Y7yGXbUpnQ1dyqOJqRv6kkx67G6c=; 5:Pk3Zm+NmFz3ALSa3+pN9lLfKq2FTWpAEn88VtnZ57zeaNrWWQsI4vKqis/L+Ufr0NE/HYrFwMl0N80T3yNSjp3auuTwYoFsA548zzNMDeDE8xEANemhOYzbuNHgw1whIc2gKG5+QOU9HQSr/tNL4NhCdCXLvLAcldhtqILnzWas=; 24:kzDoB6rjuoP9Cl/9Qmq+Nutt9PS50Lv9BqQM9lezamVXSb8u9plE9r841Zr9DvIlmBJe5LthINZbd+zGT3VvP49BBzuV3d+Qk9nCyJLM8c4=; 7:GR9t6yGX3i9WhtTr/uYCnXVg3Iy7SPNUzSbw+ASvaPMwyXaufSqlRjvijkBvA9LTZV4Vu8Eb+fT7cjkONK58McD3DU5J27K09l+8QnL7lD6v6ax3fn0WmrjNtMkFqtgiw5qHAl7Jk2se0RXtDaUYQ461PTPSXV4ynhdJUmEb/nzwjXIopc+MugoqsP+1ebJTrzwgj29sFrLNtIG68Ux3uAGkLLUWMY6QZ0SMule41LRLOcDddljw8DuivyiQHxk1 SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Dec 2017 17:10:46.2844 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 64796ff2-51a5-47ce-344d-08d547037250 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR0502MB3655 Subject: [dpdk-dev] [PATCH v3 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: Tue, 19 Dec 2017 17:10:48 -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 --- 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