From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR03-DB5-obe.outbound.protection.outlook.com (mail-eopbgr40074.outbound.protection.outlook.com [40.107.4.74]) by dpdk.org (Postfix) with ESMTP id 78065A499 for ; Sat, 20 Jan 2018 22:12:50 +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=tFuo3ZlMO3oYVuoOtfKr8qVy6fyxGstc8OOFLslB6Ph7TvJtqzpb42D+aQccB9u3R9ZKuywjLapyzW1hDOsCQtzTYJmcdgppXpbtqagITGotUhBXqTuC1W7VnSjqdfJmAVpX0Fluvslt/v/ljICmL9SAMJFrZDcf7Cdn7yxKqfs= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=matan@mellanox.com; Received: from mellanox.com (37.142.13.130) by HE1PR0502MB3804.eurprd05.prod.outlook.com (2603:10a6:7:86::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.428.17; Sat, 20 Jan 2018 21:12:48 +0000 From: Matan Azrad To: Ferruh Yigit , Adrien Mazarguil , Gaetan Rivet Cc: Thomas Monjalon , dev@dpdk.org Date: Sat, 20 Jan 2018 21:12:23 +0000 Message-Id: <1516482744-8415-6-git-send-email-matan@mellanox.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1516482744-8415-1-git-send-email-matan@mellanox.com> References: <1516274834-19755-1-git-send-email-matan@mellanox.com> <1516482744-8415-1-git-send-email-matan@mellanox.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [37.142.13.130] X-ClientProxiedBy: VI1PR0502CA0035.eurprd05.prod.outlook.com (2603:10a6:803:1::48) To HE1PR0502MB3804.eurprd05.prod.outlook.com (2603:10a6:7:86::30) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 42344e00-0b4a-41e4-17d8-08d5604a8faa X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(4604075)(48565401081)(2017052603307)(7153060)(7193020); SRVR:HE1PR0502MB3804; X-Microsoft-Exchange-Diagnostics: 1; HE1PR0502MB3804; 3:UlyS/unmbD1DGCFPvwxIM6Mek0RnYkKU0EvNO5ERxMpvx6D9hwRmfz40ZV5EbzD3bfJ/eYWQr6NG0W8/DcnRc8IvZD0lOiRsgTNMqSZQVYgH9kxL0r5nxbtL4hHz+wDIaq2+juLFp7kBtYjFHDC25Q7N9VSXFyibcvWt61Nc+AAU1cXgYnukDNVNfkTiIdnPq6UmOK+/g9GareGYgD4QMDNrn5krji9LTCVqBQIinm5RzFNTDIlAWJyWWVb2BwiG; 25:8XczIJuBuPsBWJ95Vi8d4bJ3+DhsmronLVQihYW1ZfSI8UWqQCLdn0FDgjc4cd5JZmcZZpTKCF9exyWDdAM5eLdxCmSc8wU4pNazD4doye3vZV4wu2K3L2wgA9Ils/UJk7Khq/U3nnxKq4Sdj54jAbT4bbnuZoVEE3IF8N8xWc5QiUIE0qo1ZJtNyUf2H8YhDszYJgzaGmJWojrknCi3oYL9+AesVCiDTMGB4XOtHnDLGrv8dQy+KelBYgm8r/OATepOkAQgrdReHfScY2SxCC5WmvYrbnQLoJtlqmOpZqkOwB8ogPAn1HkFLE2W6SaKw+NXRrHbM6YBVbiEkVfmYw==; 31:6gKDPjvukkb/VPTcC1GT/g6aEa4qJzb0DTkNRS9ZcYiPUJdwXVglpkqMuSOAvJyVlKrJReis40stipu7H5RHBEdmLKViK5gSPLSW/NEwamdgHnr1wYaWqZ1BNJE9XsA97E83QLyD+VyFfHOd95liUQ28qTBskkcZGZmhZOcrrrNaZXCOSFJGYDRxCSl4LqYCCWaACy91OUpIO0MbmPTx6MW/cauwLLrCUJKZLS8JOto= X-MS-TrafficTypeDiagnostic: HE1PR0502MB3804: X-LD-Processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtAddr X-Microsoft-Exchange-Diagnostics: 1; HE1PR0502MB3804; 20:R+QzVf+vUpYGNksoK4Ai9akFH66cn4JhxnmySxgLqDFTN4Q0VGzpjq7iyJ8kOBQZqVcKgTwcEwq8O3A3gzq6fOgjD40NeH5L5eGkbO/RkqM+T3WbHFnPSaLe7tvC/nlZuDbYS8V7fae/bQIEqMdqhclRqTIQ1gjsWWjDRGr06kqmpKsgnQdv7KPahqPRrpGCu5U6LarkG6ZtR+kw9AbnQ4GYVI3HchLFdi5/IVrptn/P5U/UJEeifnphBrjCqgJcWtJJlW5/BfbB8VkZhWJmQdNJ5vpdRE62Sm6E6Y1jG8o3c9qafjO9gdIY5u4bHJKRGNyOAZuS9d27IyPRgesB1rWjyuF2Do71nnmebwKXxXV0albjQXvKOSN+c1maAPhbA0BasB1B7eBEi3EHlfO1bDrKPB+HKHBjnwWFSKdCcxDwfoTnnG6rdssA7DC7yjYyMu8V+fW9VmYFd7eWlTmm6ONfr5FIfDjWL56h1DBGQb5byD2tVTM7Tx4rOBmqOc3/; 4:4kOnblqcA6rdBZu8s4Qc3YAm7RNYetjQ+vYdxwh8xT4m7yeRoQfnmqDgxDYfzQktU0ArqYnl+X9dKl+0d/EE1j5gQHOiXmmOWgfyzxKKR0eX+a6j5kUpgijuFYV8JAg107Ndr+vSHTi3pblvF0g1/SG/XbWRwiXUp9tn67zIQhA/4f5A852m03bt9EBTbqqwD78Dg8XjcpW62UBfkv9zmI8QgQCp24d94P+oqyYGNcNDEqLRK+txR4YVpTH1SzBZ4Qt8aPUtZ/j6Ywopam9m3FiRmKoQ6xKXWBmPa5PzsH0uqUdvTZJr0DaxeFmGoOY0 X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(20558992708506); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040501)(2401047)(8121501046)(5005006)(3231023)(2400081)(944501161)(3002001)(93006095)(93001095)(10201501046)(6055026)(6041288)(20161123562045)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123558120)(6072148)(201708071742011); SRVR:HE1PR0502MB3804; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:HE1PR0502MB3804; X-Forefront-PRVS: 0558D3C5AC X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(376002)(366004)(346002)(396003)(39380400002)(39860400002)(199004)(189003)(36756003)(47776003)(2906002)(4326008)(5660300001)(6116002)(478600001)(25786009)(50226002)(81156014)(59450400001)(16526018)(316002)(16586007)(51416003)(7696005)(76176011)(3846002)(52116002)(110136005)(33026002)(81166006)(386003)(7736002)(106356001)(105586002)(8936002)(8676002)(305945005)(66066001)(97736004)(53936002)(26005)(86362001)(55016002)(4720700003)(21086003)(48376002)(68736007)(50466002)(6666003)(69596002)(2950100002); DIR:OUT; SFP:1101; SCL:1; SRVR:HE1PR0502MB3804; 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; HE1PR0502MB3804; 23:AQM+x/A4Epio34y2qqN6Mz9otisHTyPvbWIbvBT?= =?us-ascii?Q?vVFWQkilp/0Fv+/U8ngm0FuttDr2wWZ1r7zyUsAnZtqQgdXqfXysbGkIBAAv?= =?us-ascii?Q?wyp7jIZUUK5FDQO9dq+qFlRTMSxYySeihC0M4EW/+nJMyVI7mLSTdbFz9qDI?= =?us-ascii?Q?ruT1DjGN+OlJECRRtBnIuZ1foY9om8+poezWEeSQoRLvxDHAxkR9nbRC0Ha2?= =?us-ascii?Q?6iBEkTWGLnPl0aFUYR5angzJ5CMUHAxWg7JKiamUwMpaGdgjIc2MiOiHEaqe?= =?us-ascii?Q?qoCMfvsuDTsprfq8E+ZvQDyQaLbJhewN2E210IaDV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DY=3D?= X-Microsoft-Exchange-Diagnostics: 1; HE1PR0502MB3804; 6:mCFJFrAN6u+HpR6WOp9fbqdEmqDCTEAMT/WvURKjS6t+r/duhOEH6qBlgYQsOkmx7TK5EVGF14Eyd54f7zO+9WWBUQqdebFSkpql/8H2JHXb4HX2E3TbQv/7I/6ki7YK9qWVxLBieePmh3xURKYwxYjS0FDQhcr4nbqN7n68trhX7r9Ik7tSpDPvNEWKn21CkkXTg5Da0zyaPlXAljqtGIIaZmjuLqZO+GSYNffCI28mj3WaEfsy+88kRDzcbkWp3lDeJF0/mtLr8q/2HP59oZdFKK7nmvDqUyyltXo6EKzvV9iKtu4Sc35yvcw46GmPWVoDXQJnCjIUC1I7Tx1P/QEaLXjv6GfSHKpBWDZVWKY=; 5:LkcdVuAqzkmsqLPXLQv9qZqugcWhzIclgluvYHVe8iEwYkusjhwaQhOwcun+/s4R29lwiZiWJvbhDcRgd3DXN414Ox2A6swHmTmpS5lvltznIZ005kTF8nAlO8mgzpzR6WXiDl7/JrKH+BmY3//qz1/tuQJDp6aAaU5s4SQ2RIM=; 24:v23CMiDLIBCTQZCnzJAgf+NH1CBpbIs3mydxKJOxfOl1CH0w8RAx1QyI8rxuUUGPwFrKLQb8cIYWJasfp/rpv45cU8JAgL24z6ETiYRjNu4=; 7:46lHruUJ5tBQmeunVdC2iAmkQx6MA3EQyXbuFYELkFBBykI+RslKU/Qcndz/tCwAfmFuE1KM9b+nlLkau55kRfA9pyC/QO+DQO8bxPZh04otaZTMb/cPX1DduEEyEEMGmjL+Y3IMZbTKzEhY0CFU/DccSN4ZV+nzq+q98gkZ5edDGQWUkGsOAXlFZ+Sa0TNnCC9WqwPMn6/DS8DJ8Y/4ThJSgax///KBr3/L0n80JgWt3/Xp4onWqZJi/r/c8Lla SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Jan 2018 21:12:48.6772 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 42344e00-0b4a-41e4-17d8-08d5604a8faa X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR0502MB3804 Subject: [dpdk-dev] [PATCH v7 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: Sat, 20 Jan 2018 21:12:50 -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