Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/79095/?format=api
http://patches.dpdk.org/api/patches/79095/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/patch/20200928231437.414489-30-thomas@monjalon.net/", "project": { "id": 1, "url": "http://patches.dpdk.org/api/projects/1/?format=api", "name": "DPDK", "link_name": "dpdk", "list_id": "dev.dpdk.org", "list_email": "dev@dpdk.org", "web_url": "http://core.dpdk.org", "scm_url": "git://dpdk.org/dpdk", "webscm_url": "http://git.dpdk.org/dpdk", "list_archive_url": "https://inbox.dpdk.org/dev", "list_archive_url_format": "https://inbox.dpdk.org/dev/{}", "commit_url_format": "" }, "msgid": "<20200928231437.414489-30-thomas@monjalon.net>", "list_archive_url": "https://inbox.dpdk.org/dev/20200928231437.414489-30-thomas@monjalon.net", "date": "2020-09-28T23:14:37", "name": "[v3,29/29] ethdev: allow close function to return an error", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": true, "hash": "81af5ef5bd031c03213b04601bb9b077eded832d", "submitter": { "id": 685, "url": "http://patches.dpdk.org/api/people/685/?format=api", "name": "Thomas Monjalon", "email": "thomas@monjalon.net" }, "delegate": { "id": 319, "url": "http://patches.dpdk.org/api/users/319/?format=api", "username": "fyigit", "first_name": "Ferruh", "last_name": "Yigit", "email": "ferruh.yigit@amd.com" }, "mbox": "http://patches.dpdk.org/project/dpdk/patch/20200928231437.414489-30-thomas@monjalon.net/mbox/", "series": [ { "id": 12565, "url": "http://patches.dpdk.org/api/series/12565/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=12565", "date": "2020-09-28T23:14:08", "name": "cleanup ethdev close operation", "version": 3, "mbox": "http://patches.dpdk.org/series/12565/mbox/" } ], "comments": "http://patches.dpdk.org/api/patches/79095/comments/", "check": "success", "checks": "http://patches.dpdk.org/api/patches/79095/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<dev-bounces@dpdk.org>", "X-Original-To": "patchwork@inbox.dpdk.org", "Delivered-To": "patchwork@inbox.dpdk.org", "Received": [ "from dpdk.org (dpdk.org [92.243.14.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id 98C5AA04C0;\n\tTue, 29 Sep 2020 01:24:07 +0200 (CEST)", "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 060551DA4D;\n\tTue, 29 Sep 2020 01:16:50 +0200 (CEST)", "from new2-smtp.messagingengine.com (new2-smtp.messagingengine.com\n [66.111.4.224]) by dpdk.org (Postfix) with ESMTP id F3A661D932\n for <dev@dpdk.org>; Tue, 29 Sep 2020 01:16:08 +0200 (CEST)", "from compute7.internal (compute7.nyi.internal [10.202.2.47])\n by mailnew.nyi.internal (Postfix) with ESMTP id 9A90C580797;\n Mon, 28 Sep 2020 19:16:08 -0400 (EDT)", "from mailfrontend2 ([10.202.2.163])\n by compute7.internal (MEProxy); Mon, 28 Sep 2020 19:16:08 -0400", "from xps.monjalon.net (184.203.134.77.rev.sfr.net [77.134.203.184])\n by mail.messagingengine.com (Postfix) with ESMTPA id 3054E306467E;\n Mon, 28 Sep 2020 19:16:06 -0400 (EDT)" ], "DKIM-Signature": [ "v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h=\n from:to:cc:subject:date:message-id:in-reply-to:references\n :mime-version:content-transfer-encoding; s=fm2; bh=yDI1jbMUDEnkQ\n W8nXcGDHS//F93KCostnrSmd+80iv4=; b=PFnga1qHDv8mpHMu+kJ/xOO67Bk69\n KQRUr7NhfGjEqtmSQxZdtuBwb+Y6aVnaVw/ZCpXqJWp38/0/wJ11hYGMjN7OlsRd\n FDEUIo83tH3l7s2Kr7ToIQxCDE6Kfno4RpeIZbcB+VyHCoZ/dDzrrXddVLV+EHaW\n EU1vJeB+/2RFnfJfP4ukLmB6V82hg5BBwYNLDEoVKzdXHS22C1XCUjimu66EnBgh\n wkGpJI5+L0IpcoxdKb8dPJIpJNiKEvgVRoxiWBwwA+5TWcULX1EjymqP5FMlC/QY\n YV7xW3C73yf0k3umpdN9Cndi7//Z+eUv5mE7lNU//jwPqhQr5iDi2EJhA==", "v=1; a=rsa-sha256; c=relaxed/relaxed; d=\n messagingengine.com; h=cc:content-transfer-encoding:date:from\n :in-reply-to:message-id:mime-version:references:subject:to\n :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=\n fm3; bh=yDI1jbMUDEnkQW8nXcGDHS//F93KCostnrSmd+80iv4=; b=bd1PHTeo\n CFPoZxKDz8l3DeabBWNw5uyCMea6IvjxPlzZ1a2TGjwL2Va7BLIaZ2PO3jcLgsDq\n hSxiVVebQfTAn7bGaFkzVxVKtOBa4UXLA9dsGBF+MYT0W/IOjV9ffacBydFRGx/l\n OM6g1PXHYXwaamxesenJxZAlo0953Mp/vIRJqSFNX4230agce5PjtKUTcA30byhV\n /p8OBWVgi3yTP7b8r9AVO0QPsGr3dwSxNK2h3bAWwFnW/6hvLgnP5FdcYsubvowo\n +QLLsX4oZYZuZApPUVsWrMg6jhA+flKwDfTr7R0OKO9dSciJzfJIC2XbnrQgNMVN\n 4iO4piJtYBEa9g==" ], "X-ME-Sender": "<xms:uG5yX31ubUEq553Bp425nFvvln417_ehhYwO7fPdOL0X5FU0smuHSw>\n <xme:uG5yX2F1DrYSZ1rDawnEi6R6SgLSjIU40ypNAwvAIiMZCKrDvESzDeHsUxVIYY-TO\n Zv3cknonqhHGd-oRg>", "X-ME-Proxy-Cause": "\n gggruggvucftvghtrhhoucdtuddrgedujedrvdejgddulecutefuodetggdotefrodftvf\n curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu\n uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc\n fjughrpefhvffufffkofgjfhgggfestdekredtredttdenucfhrhhomhepvfhhohhmrghs\n ucfoohhnjhgrlhhonhcuoehthhhomhgrshesmhhonhhjrghlohhnrdhnvghtqeenucggtf\n frrghtthgvrhhnpedvhefgiedvjeegtdevheefhfetleefgfeivefgffevfeejgedtgfeu\n tdehtdegveenucfkphepjeejrddufeegrddvtdefrddukeegnecuvehluhhsthgvrhfuih\n iivgepvdelnecurfgrrhgrmhepmhgrihhlfhhrohhmpehthhhomhgrshesmhhonhhjrghl\n ohhnrdhnvght", "X-ME-Proxy": "<xmx:uG5yX354acx5Na0jB5PcXkw8K8XIfSwPtS8mXznl4ocqD2dyx_1yaA>\n <xmx:uG5yX83tNGiHcZcGqC2LLPmELgfu4RxnCqJoP54bpiM9I5Qm0bIeng>\n <xmx:uG5yX6Eybyfrd4RzhjNDbVjuwjxFTCZrTyYGB2oLvMz2TF-2CBFu4w>\n <xmx:uG5yX3IhUYOB-jWhB2AfRTowqApvyjH9t742l2LVp-3GayjtYrOSRw>", "From": "Thomas Monjalon <thomas@monjalon.net>", "To": "dev@dpdk.org", "Cc": "ferruh.yigit@intel.com, arybchenko@solarflare.com,\n Liron Himi <lironh@marvell.com>, Ray Kinsella <mdr@ashroe.eu>,\n Neil Horman <nhorman@tuxdriver.com>,\n Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>,\n Gaetan Rivet <grive@u256.net>, Jakub Grajciar <jgrajcia@cisco.com>,\n Matan Azrad <matan@nvidia.com>, Shahaf Shuler <shahafs@nvidia.com>,\n Viacheslav Ovsiienko <viacheslavo@nvidia.com>,\n Zyta Szpak <zr@semihalf.com>, Stephen Hemminger <sthemmin@microsoft.com>,\n \"K. Y. Srinivasan\" <kys@microsoft.com>,\n Haiyang Zhang <haiyangz@microsoft.com>, Long Li <longli@microsoft.com>,\n Maxime Coquelin <maxime.coquelin@redhat.com>,\n Chenbo Xia <chenbo.xia@intel.com>, Zhihong Wang <zhihong.wang@intel.com>", "Date": "Tue, 29 Sep 2020 01:14:37 +0200", "Message-Id": "<20200928231437.414489-30-thomas@monjalon.net>", "X-Mailer": "git-send-email 2.28.0", "In-Reply-To": "<20200928231437.414489-1-thomas@monjalon.net>", "References": "<20200913220711.3768597-1-thomas@monjalon.net>\n <20200928231437.414489-1-thomas@monjalon.net>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[dpdk-dev] [PATCH v3 29/29] ethdev: allow close function to return\n\tan error", "X-BeenThere": "dev@dpdk.org", "X-Mailman-Version": "2.1.15", "Precedence": "list", "List-Id": "DPDK patches and discussions <dev.dpdk.org>", "List-Unsubscribe": "<https://mails.dpdk.org/options/dev>,\n <mailto:dev-request@dpdk.org?subject=unsubscribe>", "List-Archive": "<http://mails.dpdk.org/archives/dev/>", "List-Post": "<mailto:dev@dpdk.org>", "List-Help": "<mailto:dev-request@dpdk.org?subject=help>", "List-Subscribe": "<https://mails.dpdk.org/listinfo/dev>,\n <mailto:dev-request@dpdk.org?subject=subscribe>", "Errors-To": "dev-bounces@dpdk.org", "Sender": "\"dev\" <dev-bounces@dpdk.org>" }, "content": "The API function rte_eth_dev_close() was returning void.\nThe return type is changed to int for notifying of errors.\n\nIf an error happens during a close operation,\nthe status of the port is undefined,\na maximum of resources having been freed.\n\nSigned-off-by: Thomas Monjalon <thomas@monjalon.net>\nReviewed-by: Liron Himi <lironh@marvell.com>\n---\n doc/guides/rel_notes/deprecation.rst | 1 -\n doc/guides/rel_notes/release_20_11.rst | 4 +++-\n drivers/net/cxgbe/cxgbe_ethdev.c | 5 +++--\n drivers/net/cxgbe/cxgbevf_ethdev.c | 5 +++--\n drivers/net/failsafe/failsafe_ether.c | 6 +++++-\n drivers/net/failsafe/failsafe_ops.c | 5 ++++-\n drivers/net/memif/rte_eth_memif.c | 4 +---\n drivers/net/mlx5/mlx5.c | 7 ++++---\n drivers/net/mvneta/mvneta_ethdev.c | 5 +++--\n drivers/net/mvpp2/mrvl_ethdev.c | 5 +++--\n drivers/net/netvsc/hn_ethdev.c | 6 ++++--\n drivers/net/netvsc/hn_var.h | 2 +-\n drivers/net/netvsc/hn_vf.c | 7 +++++--\n drivers/net/virtio/virtio_user_ethdev.c | 4 +---\n lib/librte_ethdev/rte_ethdev.c | 13 ++++++++-----\n lib/librte_ethdev/rte_ethdev.h | 5 ++++-\n 16 files changed, 52 insertions(+), 32 deletions(-)", "diff": "diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst\nindex d07b4eeb47..1a61bd671a 100644\n--- a/doc/guides/rel_notes/deprecation.rst\n+++ b/doc/guides/rel_notes/deprecation.rst\n@@ -135,7 +135,6 @@ Deprecation Notices\n invalid port ID, unsupported operation, failed operation):\n \n - ``rte_eth_dev_stop``\n- - ``rte_eth_dev_close``\n \n * ethdev: New offload flags ``DEV_RX_OFFLOAD_FLOW_MARK`` will be added in 19.11.\n This will allow application to enable or disable PMDs from updating\ndiff --git a/doc/guides/rel_notes/release_20_11.rst b/doc/guides/rel_notes/release_20_11.rst\nindex 4eb3224a76..f98dc80b6c 100644\n--- a/doc/guides/rel_notes/release_20_11.rst\n+++ b/doc/guides/rel_notes/release_20_11.rst\n@@ -156,7 +156,9 @@ API Changes\n \n * ethdev: ``rte_eth_rx_descriptor_done()`` API has been deprecated.\n \n-* Renamed internal ethdev APIs:\n+* ethdev: Added ``int`` return type to ``rte_eth_dev_close()``.\n+\n+* ethdev: Renamed internal functions:\n \n * ``_rte_eth_dev_callback_process()`` -> ``rte_eth_dev_callback_process()``\n * ``_rte_eth_dev_reset`` -> ``rte_eth_dev_internal_reset()``\ndiff --git a/drivers/net/cxgbe/cxgbe_ethdev.c b/drivers/net/cxgbe/cxgbe_ethdev.c\nindex 16beb2d435..fe488231a7 100644\n--- a/drivers/net/cxgbe/cxgbe_ethdev.c\n+++ b/drivers/net/cxgbe/cxgbe_ethdev.c\n@@ -1296,12 +1296,13 @@ static int eth_cxgbe_dev_uninit(struct rte_eth_dev *eth_dev)\n {\n \tstruct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);\n \tuint16_t port_id;\n+\tint err = 0;\n \n \t/* Free up other ports and all resources */\n \tRTE_ETH_FOREACH_DEV_OF(port_id, &pci_dev->device)\n-\t\trte_eth_dev_close(port_id);\n+\t\terr |= rte_eth_dev_close(port_id);\n \n-\treturn 0;\n+\treturn err == 0 ? 0 : -EIO;\n }\n \n static int eth_cxgbe_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,\ndiff --git a/drivers/net/cxgbe/cxgbevf_ethdev.c b/drivers/net/cxgbe/cxgbevf_ethdev.c\nindex 947fcdd406..c2918f5356 100644\n--- a/drivers/net/cxgbe/cxgbevf_ethdev.c\n+++ b/drivers/net/cxgbe/cxgbevf_ethdev.c\n@@ -183,12 +183,13 @@ static int eth_cxgbevf_dev_uninit(struct rte_eth_dev *eth_dev)\n {\n \tstruct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);\n \tuint16_t port_id;\n+\tint err = 0;\n \n \t/* Free up other ports and all resources */\n \tRTE_ETH_FOREACH_DEV_OF(port_id, &pci_dev->device)\n-\t\trte_eth_dev_close(port_id);\n+\t\terr |= rte_eth_dev_close(port_id);\n \n-\treturn 0;\n+\treturn err == 0 ? 0 : -EIO;\n }\n \n static int eth_cxgbevf_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,\ndiff --git a/drivers/net/failsafe/failsafe_ether.c b/drivers/net/failsafe/failsafe_ether.c\nindex 7c68bbdec0..950d35dac4 100644\n--- a/drivers/net/failsafe/failsafe_ether.c\n+++ b/drivers/net/failsafe/failsafe_ether.c\n@@ -287,7 +287,11 @@ fs_dev_remove(struct sub_device *sdev)\n \t\t/* fallthrough */\n \tcase DEV_ACTIVE:\n \t\tfailsafe_eth_dev_unregister_callbacks(sdev);\n-\t\trte_eth_dev_close(PORT_ID(sdev));\n+\t\tret = rte_eth_dev_close(PORT_ID(sdev));\n+\t\tif (ret < 0) {\n+\t\t\tERROR(\"Port close failed for sub-device %u\",\n+\t\t\t PORT_ID(sdev));\n+\t\t}\n \t\tsdev->state = DEV_PROBED;\n \t\t/* fallthrough */\n \tcase DEV_PROBED:\ndiff --git a/drivers/net/failsafe/failsafe_ops.c b/drivers/net/failsafe/failsafe_ops.c\nindex 0ce7dfc8a6..79b24ec996 100644\n--- a/drivers/net/failsafe/failsafe_ops.c\n+++ b/drivers/net/failsafe/failsafe_ops.c\n@@ -648,7 +648,10 @@ failsafe_eth_dev_close(struct rte_eth_dev *dev)\n \tFOREACH_SUBDEV_STATE(sdev, i, dev, DEV_ACTIVE) {\n \t\tDEBUG(\"Closing sub_device %d\", i);\n \t\tfailsafe_eth_dev_unregister_callbacks(sdev);\n-\t\trte_eth_dev_close(PORT_ID(sdev));\n+\t\tret = rte_eth_dev_close(PORT_ID(sdev));\n+\t\tif (ret)\n+\t\t\tERROR(\"Error while closing sub-device %u\",\n+\t\t\t\t\tPORT_ID(sdev));\n \t\tsdev->state = DEV_ACTIVE - 1;\n \t}\n \trte_eth_dev_callback_unregister(RTE_ETH_ALL, RTE_ETH_EVENT_NEW,\ndiff --git a/drivers/net/memif/rte_eth_memif.c b/drivers/net/memif/rte_eth_memif.c\nindex ff8a58081f..33bf5c68a3 100644\n--- a/drivers/net/memif/rte_eth_memif.c\n+++ b/drivers/net/memif/rte_eth_memif.c\n@@ -1798,9 +1798,7 @@ rte_pmd_memif_remove(struct rte_vdev_device *vdev)\n \tif (eth_dev == NULL)\n \t\treturn 0;\n \n-\trte_eth_dev_close(eth_dev->data->port_id);\n-\n-\treturn 0;\n+\treturn rte_eth_dev_close(eth_dev->data->port_id);\n }\n \n static struct rte_vdev_driver pmd_memif_drv = {\ndiff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c\nindex 01ead6e6af..2e2f0b274c 100644\n--- a/drivers/net/mlx5/mlx5.c\n+++ b/drivers/net/mlx5/mlx5.c\n@@ -2010,6 +2010,7 @@ static int\n mlx5_pci_remove(struct rte_pci_device *pci_dev)\n {\n \tuint16_t port_id;\n+\tint ret = 0;\n \n \tRTE_ETH_FOREACH_DEV_OF(port_id, &pci_dev->device) {\n \t\t/*\n@@ -2017,11 +2018,11 @@ mlx5_pci_remove(struct rte_pci_device *pci_dev)\n \t\t * call the close function explicitly for secondary process.\n \t\t */\n \t\tif (rte_eal_process_type() == RTE_PROC_SECONDARY)\n-\t\t\tmlx5_dev_close(&rte_eth_devices[port_id]);\n+\t\t\tret |= mlx5_dev_close(&rte_eth_devices[port_id]);\n \t\telse\n-\t\t\trte_eth_dev_close(port_id);\n+\t\t\tret |= rte_eth_dev_close(port_id);\n \t}\n-\treturn 0;\n+\treturn ret == 0 ? 0 : -EIO;\n }\n \n static const struct rte_pci_id mlx5_pci_id_map[] = {\ndiff --git a/drivers/net/mvneta/mvneta_ethdev.c b/drivers/net/mvneta/mvneta_ethdev.c\nindex 607771149a..13d4b6af6b 100644\n--- a/drivers/net/mvneta/mvneta_ethdev.c\n+++ b/drivers/net/mvneta/mvneta_ethdev.c\n@@ -964,14 +964,15 @@ static int\n rte_pmd_mvneta_remove(struct rte_vdev_device *vdev)\n {\n \tuint16_t port_id;\n+\tint ret = 0;\n \n \tRTE_ETH_FOREACH_DEV(port_id) {\n \t\tif (rte_eth_devices[port_id].device != &vdev->device)\n \t\t\tcontinue;\n-\t\trte_eth_dev_close(port_id);\n+\t\tret = rte_eth_dev_close(port_id);\n \t}\n \n-\treturn 0;\n+\treturn ret == 0 ? 0 : -EIO;\n }\n \n static struct rte_vdev_driver pmd_mvneta_drv = {\ndiff --git a/drivers/net/mvpp2/mrvl_ethdev.c b/drivers/net/mvpp2/mrvl_ethdev.c\nindex a230a96840..acc8c70a95 100644\n--- a/drivers/net/mvpp2/mrvl_ethdev.c\n+++ b/drivers/net/mvpp2/mrvl_ethdev.c\n@@ -3022,14 +3022,15 @@ static int\n rte_pmd_mrvl_remove(struct rte_vdev_device *vdev)\n {\n \tuint16_t port_id;\n+\tint ret = 0;\n \n \tRTE_ETH_FOREACH_DEV(port_id) {\n \t\tif (rte_eth_devices[port_id].device != &vdev->device)\n \t\t\tcontinue;\n-\t\trte_eth_dev_close(port_id);\n+\t\tret = rte_eth_dev_close(port_id);\n \t}\n \n-\treturn 0;\n+\treturn ret == 0 ? 0 : -EIO;\n }\n \n static struct rte_vdev_driver pmd_mrvl_drv = {\ndiff --git a/drivers/net/netvsc/hn_ethdev.c b/drivers/net/netvsc/hn_ethdev.c\nindex 9af64821a1..3fa39dbebc 100644\n--- a/drivers/net/netvsc/hn_ethdev.c\n+++ b/drivers/net/netvsc/hn_ethdev.c\n@@ -841,14 +841,16 @@ hn_dev_stop(struct rte_eth_dev *dev)\n static int\n hn_dev_close(struct rte_eth_dev *dev)\n {\n+\tint ret;\n+\n \tPMD_INIT_FUNC_TRACE();\n \tif (rte_eal_process_type() != RTE_PROC_PRIMARY)\n \t\treturn 0;\n \n-\thn_vf_close(dev);\n+\tret = hn_vf_close(dev);\n \thn_dev_free_queues(dev);\n \n-\treturn 0;\n+\treturn ret;\n }\n \n static const struct eth_dev_ops hn_eth_dev_ops = {\ndiff --git a/drivers/net/netvsc/hn_var.h b/drivers/net/netvsc/hn_var.h\nindex 4b63f87607..74f30669ac 100644\n--- a/drivers/net/netvsc/hn_var.h\n+++ b/drivers/net/netvsc/hn_var.h\n@@ -217,7 +217,7 @@ const uint32_t *hn_vf_supported_ptypes(struct rte_eth_dev *dev);\n int\thn_vf_start(struct rte_eth_dev *dev);\n void\thn_vf_reset(struct rte_eth_dev *dev);\n void\thn_vf_stop(struct rte_eth_dev *dev);\n-void\thn_vf_close(struct rte_eth_dev *dev);\n+int\thn_vf_close(struct rte_eth_dev *dev);\n \n int\thn_vf_allmulticast_enable(struct rte_eth_dev *dev);\n int\thn_vf_allmulticast_disable(struct rte_eth_dev *dev);\ndiff --git a/drivers/net/netvsc/hn_vf.c b/drivers/net/netvsc/hn_vf.c\nindex f5f15c0462..d29eee7627 100644\n--- a/drivers/net/netvsc/hn_vf.c\n+++ b/drivers/net/netvsc/hn_vf.c\n@@ -316,18 +316,21 @@ void hn_vf_reset(struct rte_eth_dev *dev)\n \tVF_ETHDEV_FUNC(dev, rte_eth_dev_reset);\n }\n \n-void hn_vf_close(struct rte_eth_dev *dev)\n+int hn_vf_close(struct rte_eth_dev *dev)\n {\n \tstruct hn_data *hv = dev->data->dev_private;\n \tuint16_t vf_port;\n+\tint ret = 0;\n \n \trte_rwlock_read_lock(&hv->vf_lock);\n \tvf_port = hv->vf_port;\n \tif (vf_port != HN_INVALID_PORT)\n-\t\trte_eth_dev_close(vf_port);\n+\t\tret = rte_eth_dev_close(vf_port);\n \n \thv->vf_port = HN_INVALID_PORT;\n \trte_rwlock_read_unlock(&hv->vf_lock);\n+\n+\treturn ret;\n }\n \n int hn_vf_stats_reset(struct rte_eth_dev *dev)\ndiff --git a/drivers/net/virtio/virtio_user_ethdev.c b/drivers/net/virtio/virtio_user_ethdev.c\nindex 87f6cb6950..865f73807f 100644\n--- a/drivers/net/virtio/virtio_user_ethdev.c\n+++ b/drivers/net/virtio/virtio_user_ethdev.c\n@@ -813,9 +813,7 @@ virtio_user_pmd_remove(struct rte_vdev_device *vdev)\n \t\treturn rte_eth_dev_release_port(eth_dev);\n \n \t/* make sure the device is stopped, queues freed */\n-\trte_eth_dev_close(eth_dev->data->port_id);\n-\n-\treturn 0;\n+\treturn rte_eth_dev_close(eth_dev->data->port_id);\n }\n \n static struct rte_vdev_driver virtio_user_driver = {\ndiff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.c\nindex e68943b461..1459ac1ad5 100644\n--- a/lib/librte_ethdev/rte_ethdev.c\n+++ b/lib/librte_ethdev/rte_ethdev.c\n@@ -1704,19 +1704,22 @@ rte_eth_dev_set_link_down(uint16_t port_id)\n \treturn eth_err(port_id, (*dev->dev_ops->dev_set_link_down)(dev));\n }\n \n-void\n+int\n rte_eth_dev_close(uint16_t port_id)\n {\n \tstruct rte_eth_dev *dev;\n+\tint ret;\n \n-\tRTE_ETH_VALID_PORTID_OR_RET(port_id);\n+\tRTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -EINVAL);\n \tdev = &rte_eth_devices[port_id];\n \n-\tRTE_FUNC_PTR_OR_RET(*dev->dev_ops->dev_close);\n-\t(*dev->dev_ops->dev_close)(dev);\n+\tRTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_close, -ENOTSUP);\n+\tret = (*dev->dev_ops->dev_close)(dev);\n \n \trte_ethdev_trace_close(port_id);\n-\trte_eth_dev_release_port(dev);\n+\tret = rte_eth_dev_release_port(dev);\n+\n+\treturn ret;\n }\n \n int\ndiff --git a/lib/librte_ethdev/rte_ethdev.h b/lib/librte_ethdev/rte_ethdev.h\nindex 24d898ae89..4380d8ecf6 100644\n--- a/lib/librte_ethdev/rte_ethdev.h\n+++ b/lib/librte_ethdev/rte_ethdev.h\n@@ -2281,8 +2281,11 @@ int rte_eth_dev_set_link_down(uint16_t port_id);\n *\n * @param port_id\n * The port identifier of the Ethernet device.\n+ * @return\n+ * - Zero if the port is closed successfully.\n+ * - Negative if something went wrong.\n */\n-void rte_eth_dev_close(uint16_t port_id);\n+int rte_eth_dev_close(uint16_t port_id);\n \n /**\n * Reset a Ethernet device and keep its port id.\n", "prefixes": [ "v3", "29/29" ] }{ "id": 79095, "url": "