From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR02-HE1-obe.outbound.protection.outlook.com (mail-eopbgr10076.outbound.protection.outlook.com [40.107.1.76]) by dpdk.org (Postfix) with ESMTP id 184FE1B2E5 for ; Wed, 17 Jan 2018 21:19:59 +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=YpaS00cTbnZ8FouPPop+PkBfcm/zKE9amPLh5qOKCZxUEfHb1yfbGK7Vm1tHODqOJYmOR24h0o6d4qdoOyz4sIQi00/XNDFBier6h/3CgwCjB9f+9hf1LM3r6cSkrzDB+szLITYcVgM/taoXR0zGXG8nVItoCNsq8M7mx2Xyyyw= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=matan@mellanox.com; Received: from mellanox.com (37.142.13.130) by AM6PR0502MB3799.eurprd05.prod.outlook.com (2603:10a6:209:a::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.407.7; Wed, 17 Jan 2018 20:19:57 +0000 From: Matan Azrad To: Ferruh Yigit , Adrien Mazarguil , Gaetan Rivet Cc: Thomas Monjalon , dev@dpdk.org Date: Wed, 17 Jan 2018 20:19:16 +0000 Message-Id: <1516220357-13013-6-git-send-email-matan@mellanox.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1516220357-13013-1-git-send-email-matan@mellanox.com> References: <1515587465-9304-1-git-send-email-matan@mellanox.com> <1516220357-13013-1-git-send-email-matan@mellanox.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [37.142.13.130] X-ClientProxiedBy: HE1PR06CA0129.eurprd06.prod.outlook.com (2603:10a6:7:16::16) To AM6PR0502MB3799.eurprd05.prod.outlook.com (2603:10a6:209:a::28) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: dc250ee8-2f19-4cb8-c989-08d55de7ae19 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(2017052603307)(7153060)(7193020); SRVR:AM6PR0502MB3799; X-Microsoft-Exchange-Diagnostics: 1; AM6PR0502MB3799; 3:ox4TpCf28JXaUSU1M6p23DwkyBk0CT/Kq92fxMmu8xClJcr4APFHmSKMy9f2A8hwfgGWinB8efae3flnZ4UmNF5WWJm4VHJv0V9+yvGj5pEXCedxPTvAMH1Hnbaba63mNNVh+f/95qTjuR48NqKFr3QQN8+tF6yJYOqy8Wx2YMqiDbgAwYHQicv1Eqa6Gpmceb6omGRLBzbXMLpt+oaVYESbuEz8i0b7+3kYEeuLO8a/najI/T7AOZe6RSjElonl; 25:GHenjy2QyUt2RDv5HpJXoYXPHQT7JFt3ecUdeZhEKFpZhRXC+DzE9tZUSppLfpDtanXMCrsX3q4mhcAuiOLJzwNE1CWKWJHM11r1b1C04+HyIkulJPwvgPum5qXzL6aVmfwZVMoZ38JCwFAAQsMPDoxJMi+Tj8IB5zqngpPJI6P1Ljb8kLleTnctKJZceLg10AleAK0HCyo6bvui9yIQ505NM66uRJyw6iKhgSHnaRfSLbqlE3CzxxeBsVkTG13+kNQDYF1rWn0TMmeC0nTuPfysi2PrBnIpiKm5P0oVmzMNRvwJ9c2v0IEo7fhxtF/FoUvVkBi0RT9KsZiJYXu4bQ==; 31:zUyC551YO8hc5ZswDXnt2JZY/pYzgIWSGcKbYgtWu407LSJLespmw5Z46aCS+yoo03BJOsNg7zw/ZzjhWaCgyZz9PmBRM9nuBwQD3gWprV7lCyqOGd7yQ8qlVAS9BKlMGNfz/rk/6WAx/oDM9zVvf9zGEU5eGOfYfi0EeYiXyEXkmJ5YawP9mzNnpOdP4qdjbEfG3k6aMQs50fdT43zOD+bemeb8bsxh7N7vazwbHtc= X-MS-TrafficTypeDiagnostic: AM6PR0502MB3799: X-LD-Processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtAddr X-Microsoft-Exchange-Diagnostics: 1; AM6PR0502MB3799; 20:a443ZqY4xsU0aLawPBWFVS08wQJS50c0nMAEeMqcJPpxCnyif2ftqzmjI7ozOsJv6Dq+K35OjU1A7ZN/TryHMw0pou3b58GVanjCc+YoGHH/4jV7vlNVYlYQdXapNtRMvhXEiXpg+56/0xwul9pfTCGr9ffWV5j4BABzlLvED8C8/KQXfVBntOhl3qu/vHjo24yf6Nuyr16OOvOg0pxn7TH+4elfsBjhiXpIKPMeAiaAhzCQ2iCAK6p77sqzJfH7umXE5GNG5JnDBfz0d3vnpiXnlUwr061/Z9i99rgIfpJ0nkwH+TMPN3pvxZOM2yODKe/xhp7yqmja0gVdCv9xngYr9JQIAl+vbIaoL5SaQwWj9GET+fPXFkaMr+B3xvsBYsGFk6uPUn2D8hNATGJqN9jT0vSB5DTiwvSxyCCFfG6XGVfm7q1AYQDgTVUTTDxsF9rrr1CFJPuuAnoG2jkHoe6R5dRxVbSNAG41FYmZZf7q3FFYxNc3jCv0EzCiTMec; 4:WQMfwEo/NiCOLe02DuW1XSxOHfz2TULH0DjfX/BncZtHr/HpJX3UVpnT3ZZJKonjkubJnLllt+1MZOsQI2LrERbI13HtbgRu32ENG1TxeI9+zOz6C0QGU3XTUXYIje6JkKv/jQ2I5LlH3AMjmyTlc+hosCtF7xBVeF9EMgIj80GdlS0FvyXZzbojfBRDwZ8wFJn0Vbr/aYZafiygoVY5mfzf52Q4IUPI781HO6doh/3LLMm230G9f/HR6ab2dbPxL7oBm+mVf5wb8YUVZe2S65KtB2it7pZ1cvrNTdC52ljEqYhuQcWMOPWYMPXCbN3f 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)(3002001)(10201501046)(93006095)(93001095)(3231023)(944501161)(6055026)(6041268)(20161123560045)(20161123562045)(20161123564045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011); SRVR:AM6PR0502MB3799; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:AM6PR0502MB3799; X-Forefront-PRVS: 0555EC8317 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(366004)(346002)(376002)(39380400002)(39860400002)(396003)(199004)(189003)(51416003)(6666003)(50226002)(53936002)(68736007)(106356001)(55016002)(21086003)(47776003)(16526018)(2906002)(66066001)(105586002)(97736004)(4720700003)(2950100002)(59450400001)(478600001)(52116002)(305945005)(48376002)(50466002)(33026002)(5660300001)(76176011)(69596002)(86362001)(3846002)(7696005)(7736002)(8936002)(81156014)(8676002)(110136005)(16586007)(25786009)(386003)(36756003)(6116002)(81166006)(316002)(26005)(4326008); DIR:OUT; SFP:1101; SCL:1; SRVR:AM6PR0502MB3799; 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; AM6PR0502MB3799; 23:z0BJ2uywBXx2sqZe4TikZx9fzVSMSyiej7vfNEv?= =?us-ascii?Q?7fhDZf8g3o3fEP9zb58rJrF534vjhLE1l6RzZDpgV4upqeu7POHHpffMAFvX?= =?us-ascii?Q?dAY34SBfrIk1hJk8V+gyIJ6HE4dgCCN0z6p05m5+9KK5ZyrlVTimEA5fGWkR?= =?us-ascii?Q?3T+wie0S1ba2hxXL7Aaic23fB6E/Mw4mF7Ye9yP2l5+c2sUhZDg4QSQUC2R2?= =?us-ascii?Q?mfqGpK7eJXisHq+/aUNj3NY780bfHenabqW6rohhJK3h+HfbTLHlnpNV7GvH?= =?us-ascii?Q?XkwWGjLuFlTbE0KZMZLRwSDwtEqtXuqsCuqt/Nn7brtrRVukRZQWyENC1EKj?= =?us-ascii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AM6PR0502MB3799; 6:Qbo9gpFuqRs8PNhYc/uFxTD0R1QbKYPRN8cP32nEBWVisFsXS3AutzkSriaTbuZNl1B9EqSptyW40lLDHDIQyrn7yUUp4rvE0m7MahLtmo4JAbSy4t9P8p013nKS60QOcMpC+izvI95FeOowFYXh11TFgmBMnEXPTaKi3e/PGgzvXivTTfO88yDEjNljtbotlKQRuFI8c+kNWm+ERua477UCYVqFVWxb3/5PCgyl4bKNv9DlfGCV2dLnTnCk5lIf3Q+BdTmfuYju1cpnqFtLlMxZzHl3pW7K9DyQq+C3VOnfd6LDvvuzm52CzcOf95mcRnn9IVVeb+asGeXStMC5FBczITpzXUjiODvaypZf5qQ=; 5:VnTVhIRFTi/prXvq3PD4LamjB60J+Z+8yoIZml4fdVQP4iDOs1aYS5Tyj3QXjTxYd0Md4xdp7HyPGxD5AteBTT1KBjXHVT/zxbqsvKwvNnq+pcn5TF92LtopPbgRBF5cuAdTLOKsBappQzf1jjqaq3ySbNJ83Ne5ZT6PLhcArJE=; 24:gRoHnICvQx9pAHec82RhzaSP0wADrpvJCT8SPqUZ5oDCiqjvPdfoCvDQjG0o2aNyOr4Sz/nw2Oh0atQWlNCvbbgWr8zIcc167wZ4fZMAWoc=; 7:WZedNSipJ0Pq93yD7DLV3lINOYE/NosY44EQasnig2q+rklpLKEUS9zEdDyifcO1dcmZH2lqOor22HxBi9SdGXdGNzGK57Ji1AMeLmKmB2hk3TalOzwQGngIKAwhFSGmvQ14oJL64ZrWLw4H6f3RC/hvtDGqxRH713x/CNwJ0nYvfQwbP6RdyDZaDu0mqSc6IxqIp7SjogShIcOoZ+EcE+VwMP4oEGZAOP76xDL6/xLRQ1SjhDi0DwtIkhVAlAjY SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jan 2018 20:19:57.3328 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: dc250ee8-2f19-4cb8-c989-08d55de7ae19 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR0502MB3799 Subject: [dpdk-dev] [PATCH v5 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, 17 Jan 2018 20:19:59 -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