From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id C6587A04DB; Mon, 28 Sep 2020 20:24:46 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 1D6F51D567; Mon, 28 Sep 2020 20:24:44 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by dpdk.org (Postfix) with ESMTP id 569F51D53A for ; Mon, 28 Sep 2020 20:24:41 +0200 (CEST) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 08SIKDAC009112; Mon, 28 Sep 2020 11:24:35 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : references : in-reply-to : content-type : content-transfer-encoding : mime-version; s=pfpt0220; bh=Z793F6RU7uOdwJc1GK3HxvnSORYjACMM7T0ijKKoUHU=; b=AWa1yrikO9Xi9J51Zw9Hu5n7Gg8QNccdAuDV5V0GWZQxB0lvNATTAZ32NlN981IJ13fG Otc01wDc/B5HoOdXavYoMwI//cbPQ2ca8XObBCV82nVWRTPJbDuyLNRhv8qftdshfzgL 08PZ1iuOWXgX7AnDf6vEpL6MmUj9iYpQP+a9x5oKbxi6lVb4pnkDCUvbymvuzcXOlKX8 Z5ILwC07UwusU5xQamSsxPruBK418K2ESvCNu77FfxLPd6QoOBXb3BNLjKydwysPHLVQ WTb7Pm1vog9rmEwhqICln/bYgfHHrH1E8Ka1N50HWnZpbLE3spx4MowJJ6UNEghJP5m8 gA== Received: from sc-exch03.marvell.com ([199.233.58.183]) by mx0b-0016f401.pphosted.com with ESMTP id 33t55p2j0y-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Mon, 28 Sep 2020 11:24:35 -0700 Received: from SC-EXCH03.marvell.com (10.93.176.83) by SC-EXCH03.marvell.com (10.93.176.83) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 28 Sep 2020 11:24:33 -0700 Received: from NAM02-BL2-obe.outbound.protection.outlook.com (104.47.38.57) by SC-EXCH03.marvell.com (10.93.176.83) with Microsoft SMTP Server (TLS) id 15.0.1497.2 via Frontend Transport; Mon, 28 Sep 2020 11:24:33 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WXY347R7kxskx4wGSMb+EQHgJ7Qhb8s3nR4ceOoj39K73IhEXNDlJGPdnfSdnYsBA64xJaqaXNIuVlkyLrmzvDTbS/b7ZOWsQbEU+CoylfQ91wOvYBLS2N+jWn5wKxwAx5ERMyw1vECgoosnDx0CgBhE2UlFdMV4JcPXoHwI0OqZBhFRIjKT9pDfNON1yX+BXprQDYl/0dnTPtU91zDjrt78LrmHDhJ/Yp9T9AZky2mWTpsLeYXOwbeNvvr1MsBiV9XsUQvPc81z7i+zmC6wjjX7qchkOAaTuBgym3fUYll8s+Rbzt29C0XtMhIYC3VvP6OO0Z4ta5e5wKrvNnLYkw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Z793F6RU7uOdwJc1GK3HxvnSORYjACMM7T0ijKKoUHU=; b=cjJica4hC65+Gt8xGV0QDDtNvUjQCLKsix1ow3B9XAS/jLE9WOKg/2YOKA+Gn44LwKqii2qJ0PuMJK8jaJfw/oHXpxIOgNkV8Jx6sxYPY0FVIxdmbADinFEW46gqKnNAVTk+rRzToqlzQOKkbuWSRX6hYKvlRTqT1xlXe7RwOmSkd5c7RF3+JDkC/vRR0FDATpUxvB+ZxqD0difSmqdVopRTnzwO38f9JBCzhv8eKINgjGnDNrLsWQT08qc40x6EWBX3BWdRl3VKUOAbynhfxq+vU1oIWihonlA8wHQ6KVBVkKKk2SZMytIMHjzQNbjvmprjGTMUEaZyyPnDSZ9IMg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=marvell.com; dmarc=pass action=none header.from=marvell.com; dkim=pass header.d=marvell.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.onmicrosoft.com; s=selector1-marvell-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Z793F6RU7uOdwJc1GK3HxvnSORYjACMM7T0ijKKoUHU=; b=ja/niNnEnvAKf0mlbawt6kIJF57ofSG2luKHUcq7Pc5Q0+WA2DHB0gwgOYPYqtT2Obp4B5M+BGtp6KksHCKMhd698l0kJ4tZB6H+QV2x4Et/th96PFduRxBpKCaPtgfW5HXixMF5/YeCCLBxeVtNuvQ6jfjzo0Y4BhTIbBmwDqo= Received: from DM5PR18MB2214.namprd18.prod.outlook.com (2603:10b6:4:b9::21) by DM5PR1801MB1833.namprd18.prod.outlook.com (2603:10b6:4:62::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3348.15; Mon, 28 Sep 2020 18:24:31 +0000 Received: from DM5PR18MB2214.namprd18.prod.outlook.com ([fe80::d0b8:c02e:9d8e:95b]) by DM5PR18MB2214.namprd18.prod.outlook.com ([fe80::d0b8:c02e:9d8e:95b%3]) with mapi id 15.20.3391.026; Mon, 28 Sep 2020 18:24:31 +0000 From: Liron Himi To: Thomas Monjalon , "dev@dpdk.org" CC: "ferruh.yigit@intel.com" , "arybchenko@solarflare.com" , Ray Kinsella , Neil Horman , Rahul Lakkireddy , Gaetan Rivet , Jakub Grajciar , Matan Azrad , Shahaf Shuler , Viacheslav Ovsiienko , "Zyta Szpak" , Stephen Hemminger , "K. Y. Srinivasan" , Haiyang Zhang , "Long Li" , Maxime Coquelin , Chenbo Xia , Zhihong Wang , Liron Himi Thread-Topic: [EXT] [PATCH v2 25/25] ethdev: allow close function to return an error Thread-Index: AQHWlSghIQHoSmHF6UebMnGD6ps9Pql+Xk2g Date: Mon, 28 Sep 2020 18:24:30 +0000 Message-ID: References: <20200913220711.3768597-1-thomas@monjalon.net> <20200927234249.3198780-1-thomas@monjalon.net> <20200927234249.3198780-26-thomas@monjalon.net> In-Reply-To: <20200927234249.3198780-26-thomas@monjalon.net> Accept-Language: he-IL, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: monjalon.net; dkim=none (message not signed) header.d=none;monjalon.net; dmarc=none action=none header.from=marvell.com; x-originating-ip: [46.117.144.7] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 75d088c5-7ce8-4c09-0c8a-08d863dbbe18 x-ms-traffictypediagnostic: DM5PR1801MB1833: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:2201; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: lzWWyGYtGrTMvxGrEerEBTQRHnmQ6eGX3u+UevBi6d0GI0coMM37Rxe4vzK3Q3MX6Ce/mUDsQ0oNuonkVR5lK3KaFsh18lMs5ecp8lyug4pqqBqgU7YxmP8UOVbHqretsrAit7MUQZCBMj5b9q3YHXfq62aGKCLL14BkAvJQiVXG4F/6/lI8q8xmKKLMhGCEIEHOYwmSg2F6u3fhDq+1AIhTBlOi2OXYTbNL0EsULvj3ZgJ2sCQZTcP/d3uK9XAIPgEZPGURpBY9N00rR7pgsaRbzhuhL0qN3mK6VB3tCBhkQDigoyyHBQ8LiBBAJzr8tU9Kjlvayu6DP/lOV+jta1/NhV1W1r50xZoEAadifMkTlX8QMquRgeYBlNd/l0cx x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM5PR18MB2214.namprd18.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(396003)(366004)(346002)(136003)(376002)(39860400002)(110136005)(71200400001)(55016002)(7416002)(5660300002)(7696005)(478600001)(186003)(316002)(30864003)(6506007)(53546011)(26005)(66946007)(52536014)(4326008)(66556008)(64756008)(66446008)(54906003)(8676002)(66476007)(33656002)(83380400001)(9686003)(86362001)(76116006)(8936002)(107886003)(2906002); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata: m/BjPO9ssOllGGdhxkixMEBCsomPxmCxVapCbHhWyA3YXRpKbyd+sLY+2ecKzdw61WDANOpvHn9ea5PHbr9rne6uwMamQHkrw9Nr+gwinDYTFmL2nrHMUVZrw9TXcX3sLmiFMAXthQAk13nQqOM1X3A0FeS3hqUOizLyJdaqGWQRCMv4WYRztJbtHiucj6m3N4qYgiZ7w0K0TSl9AaAgfQ8tdi9eC6TYcujErcfLvdRPxBOR5gPvFBMV3Ggc2yNUaOblGNvc54Sz2HOL45+VZrar+leVITk2H+ByPexcL8j9+eIG++fhLofO8f4je8N5fTrkDdnvgQgDWkWLc3jyAV+wcZj8dn0eBmzq8HzAfJz0jQKUJ0fZ4zMXoZwd0dLKaDXVkEGp1alnYA2/4eS5U0R532tnSOsLt6DooqJkoJ3Guy1ItazYcj/Vv9mR187mO/hUOBBOpiO0gYaR1fEIpiOHOeirohP8pJzojhqbLWhy1oJq9lT8IXXwF/Tfb4yrcwyOUv5PE38U1akBya0i0HaVJdpVht/eR299gR5G3hmh1ylQ1xGruV3RFoiDN1hb4FNsKLS/GMzQaroR6JjRNFUO6fyvKw3b9Vo9/T7lsDeNJuDOQKpQn4tjSZOSm2i2eEFRYmR/hK7wUZCu5vOt+w== Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: DM5PR18MB2214.namprd18.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 75d088c5-7ce8-4c09-0c8a-08d863dbbe18 X-MS-Exchange-CrossTenant-originalarrivaltime: 28 Sep 2020 18:24:30.9740 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 70e1fb47-1155-421d-87fc-2e58f638b6e0 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: 3coVgOaEkEjxWeMaKI6uZH6JRQ/M0wiFu5yYv8jjaelg3n+gHvoLSAkrabYdNpEepEyjCDNttgQRlriXS+YJLQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR1801MB1833 X-OriginatorOrg: marvell.com X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.235, 18.0.687 definitions=2020-09-28_20:2020-09-28, 2020-09-28 signatures=0 Subject: Re: [dpdk-dev] [EXT] [PATCH v2 25/25] ethdev: allow close function to return an error 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" For mvpp2, mvneta. Reviewed-by: Liron Himi -----Original Message----- From: Thomas Monjalon =20 Sent: Monday, 28 September 2020 02:43 To: dev@dpdk.org Cc: ferruh.yigit@intel.com; arybchenko@solarflare.com; Ray Kinsella ; Neil Horman ; Rahul Lakkireddy ; Gaetan Rivet ; Jakub Grajciar ; Matan Azrad ; Shahaf Shuler ; Viacheslav Ovsiienko ; Zyta Szpak ; Liron Himi ; Stephen Hemminger ; K. Y. Srinivasan ; Haiyang Zhang ; Long Li ; Maxime Coquelin ; Chenbo Xia ; Zhihong Wang Subject: [EXT] [PATCH v2 25/25] ethdev: allow close function to return an e= rror External Email ---------------------------------------------------------------------- The API function rte_eth_dev_close() was returning void. The return type is changed to int for notifying of errors. If an error happens during a close operation, the status of the port is und= efined, a maximum of resources having been freed. Signed-off-by: Thomas Monjalon --- doc/guides/rel_notes/deprecation.rst | 1 - doc/guides/rel_notes/release_20_11.rst | 4 +++- drivers/net/cxgbe/cxgbe_ethdev.c | 5 +++-- drivers/net/cxgbe/cxgbevf_ethdev.c | 5 +++-- drivers/net/failsafe/failsafe_ether.c | 6 +++++- drivers/net/failsafe/failsafe_ops.c | 5 ++++- drivers/net/memif/rte_eth_memif.c | 4 +--- drivers/net/mlx5/mlx5.c | 7 ++++--- drivers/net/mvneta/mvneta_ethdev.c | 5 +++-- drivers/net/mvpp2/mrvl_ethdev.c | 5 +++-- drivers/net/netvsc/hn_ethdev.c | 6 ++++-- drivers/net/netvsc/hn_var.h | 2 +- drivers/net/netvsc/hn_vf.c | 7 +++++-- drivers/net/virtio/virtio_user_ethdev.c | 4 +--- lib/librte_ethdev/rte_ethdev.c | 13 ++++++++----- lib/librte_ethdev/rte_ethdev.h | 5 ++++- 16 files changed, 52 insertions(+), 32 deletions(-) diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/de= precation.rst index a907358078..bfa43990f0 100644 --- a/doc/guides/rel_notes/deprecation.rst +++ b/doc/guides/rel_notes/deprecation.rst @@ -140,7 +140,6 @@ Deprecation Notices invalid port ID, unsupported operation, failed operation): =20 - ``rte_eth_dev_stop`` - - ``rte_eth_dev_close`` =20 * ethdev: New offload flags ``DEV_RX_OFFLOAD_FLOW_MARK`` will be added in = 19.11. This will allow application to enable or disable PMDs from updating diff= --git a/doc/guides/rel_notes/release_20_11.rst b/doc/guides/rel_notes/rele= ase_20_11.rst index f377ab8e87..ec5a3937e8 100644 --- a/doc/guides/rel_notes/release_20_11.rst +++ b/doc/guides/rel_notes/release_20_11.rst @@ -152,7 +152,9 @@ API Changes =20 * ethdev: ``rte_eth_rx_descriptor_done()`` API has been deprecated. =20 -* Renamed internal ethdev APIs: +* ethdev: Added ``int`` return type to ``rte_eth_dev_close()``. + +* ethdev: Renamed internal functions: =20 * ``_rte_eth_dev_callback_process()`` -> ``rte_eth_dev_callback_process(= )`` * ``_rte_eth_dev_reset`` -> ``rte_eth_dev_internal_reset()`` diff --git = a/drivers/net/cxgbe/cxgbe_ethdev.c b/drivers/net/cxgbe/cxgbe_ethdev.c index 16beb2d435..fe488231a7 100644 --- a/drivers/net/cxgbe/cxgbe_ethdev.c +++ b/drivers/net/cxgbe/cxgbe_ethdev.c @@ -1296,12 +1296,13 @@ static int eth_cxgbe_dev_uninit(struct rte_eth_dev = *eth_dev) { struct rte_pci_device *pci_dev =3D RTE_ETH_DEV_TO_PCI(eth_dev); uint16_t port_id; + int err =3D 0; =20 /* Free up other ports and all resources */ RTE_ETH_FOREACH_DEV_OF(port_id, &pci_dev->device) - rte_eth_dev_close(port_id); + err |=3D rte_eth_dev_close(port_id); =20 - return 0; + return err =3D=3D 0 ? 0 : -EIO; } =20 static int eth_cxgbe_pci_probe(struct rte_pci_driver *pci_drv __rte_unused= , diff --git a/drivers/net/cxgbe/cxgbevf_ethdev.c b/drivers/net/cxgbe/cxgbe= vf_ethdev.c index 947fcdd406..c2918f5356 100644 --- a/drivers/net/cxgbe/cxgbevf_ethdev.c +++ b/drivers/net/cxgbe/cxgbevf_ethdev.c @@ -183,12 +183,13 @@ static int eth_cxgbevf_dev_uninit(struct rte_eth_dev = *eth_dev) { struct rte_pci_device *pci_dev =3D RTE_ETH_DEV_TO_PCI(eth_dev); uint16_t port_id; + int err =3D 0; =20 /* Free up other ports and all resources */ RTE_ETH_FOREACH_DEV_OF(port_id, &pci_dev->device) - rte_eth_dev_close(port_id); + err |=3D rte_eth_dev_close(port_id); =20 - return 0; + return err =3D=3D 0 ? 0 : -EIO; } =20 static int eth_cxgbevf_pci_probe(struct rte_pci_driver *pci_drv __rte_unus= ed, diff --git a/drivers/net/failsafe/failsafe_ether.c b/drivers/net/failsa= fe/failsafe_ether.c index 7c68bbdec0..950d35dac4 100644 --- a/drivers/net/failsafe/failsafe_ether.c +++ b/drivers/net/failsafe/failsafe_ether.c @@ -287,7 +287,11 @@ fs_dev_remove(struct sub_device *sdev) /* fallthrough */ case DEV_ACTIVE: failsafe_eth_dev_unregister_callbacks(sdev); - rte_eth_dev_close(PORT_ID(sdev)); + ret =3D rte_eth_dev_close(PORT_ID(sdev)); + if (ret < 0) { + ERROR("Port close failed for sub-device %u", + PORT_ID(sdev)); + } sdev->state =3D DEV_PROBED; /* fallthrough */ case DEV_PROBED: diff --git a/drivers/net/failsafe/failsafe_ops.c b/drivers/net/failsafe/fai= lsafe_ops.c index 0ce7dfc8a6..79b24ec996 100644 --- a/drivers/net/failsafe/failsafe_ops.c +++ b/drivers/net/failsafe/failsafe_ops.c @@ -648,7 +648,10 @@ failsafe_eth_dev_close(struct rte_eth_dev *dev) FOREACH_SUBDEV_STATE(sdev, i, dev, DEV_ACTIVE) { DEBUG("Closing sub_device %d", i); failsafe_eth_dev_unregister_callbacks(sdev); - rte_eth_dev_close(PORT_ID(sdev)); + ret =3D rte_eth_dev_close(PORT_ID(sdev)); + if (ret) + ERROR("Error while closing sub-device %u", + PORT_ID(sdev)); sdev->state =3D DEV_ACTIVE - 1; } rte_eth_dev_callback_unregister(RTE_ETH_ALL, RTE_ETH_EVENT_NEW, diff --gi= t a/drivers/net/memif/rte_eth_memif.c b/drivers/net/memif/rte_eth_memif.c index ff8a58081f..33bf5c68a3 100644 --- a/drivers/net/memif/rte_eth_memif.c +++ b/drivers/net/memif/rte_eth_memif.c @@ -1798,9 +1798,7 @@ rte_pmd_memif_remove(struct rte_vdev_device *vdev) if (eth_dev =3D=3D NULL) return 0; =20 - rte_eth_dev_close(eth_dev->data->port_id); - - return 0; + return rte_eth_dev_close(eth_dev->data->port_id); } =20 static struct rte_vdev_driver pmd_memif_drv =3D { diff --git a/drivers/net= /mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c index 01ead6e6af..2e2f0b274c 100644 --- a/drivers/net/mlx5/mlx5.c +++ b/drivers/net/mlx5/mlx5.c @@ -2010,6 +2010,7 @@ static int mlx5_pci_remove(struct rte_pci_device *pci_dev) { uint16_t port_id; + int ret =3D 0; =20 RTE_ETH_FOREACH_DEV_OF(port_id, &pci_dev->device) { /* @@ -2017,11 +2018,11 @@ mlx5_pci_remove(struct rte_pci_device *pci_dev) * call the close function explicitly for secondary process. */ if (rte_eal_process_type() =3D=3D RTE_PROC_SECONDARY) - mlx5_dev_close(&rte_eth_devices[port_id]); + ret |=3D mlx5_dev_close(&rte_eth_devices[port_id]); else - rte_eth_dev_close(port_id); + ret |=3D rte_eth_dev_close(port_id); } - return 0; + return ret =3D=3D 0 ? 0 : -EIO; } =20 static const struct rte_pci_id mlx5_pci_id_map[] =3D { diff --git a/driver= s/net/mvneta/mvneta_ethdev.c b/drivers/net/mvneta/mvneta_ethdev.c index 607771149a..13d4b6af6b 100644 --- a/drivers/net/mvneta/mvneta_ethdev.c +++ b/drivers/net/mvneta/mvneta_ethdev.c @@ -964,14 +964,15 @@ static int rte_pmd_mvneta_remove(struct rte_vdev_device *vdev) { uint16_t port_id; + int ret =3D 0; =20 RTE_ETH_FOREACH_DEV(port_id) { if (rte_eth_devices[port_id].device !=3D &vdev->device) continue; - rte_eth_dev_close(port_id); + ret =3D rte_eth_dev_close(port_id); } =20 - return 0; + return ret =3D=3D 0 ? 0 : -EIO; } =20 static struct rte_vdev_driver pmd_mvneta_drv =3D { diff --git a/drivers/ne= t/mvpp2/mrvl_ethdev.c b/drivers/net/mvpp2/mrvl_ethdev.c index a230a96840..a= cc8c70a95 100644 --- a/drivers/net/mvpp2/mrvl_ethdev.c +++ b/drivers/net/mvpp2/mrvl_ethdev.c @@ -3022,14 +3022,15 @@ static int rte_pmd_mrvl_remove(struct rte_vdev_device *vdev) { uint16_t port_id; + int ret =3D 0; =20 RTE_ETH_FOREACH_DEV(port_id) { if (rte_eth_devices[port_id].device !=3D &vdev->device) continue; - rte_eth_dev_close(port_id); + ret =3D rte_eth_dev_close(port_id); } =20 - return 0; + return ret =3D=3D 0 ? 0 : -EIO; } =20 static struct rte_vdev_driver pmd_mrvl_drv =3D { diff --git a/drivers/net/= netvsc/hn_ethdev.c b/drivers/net/netvsc/hn_ethdev.c index 9af64821a1..3fa39= dbebc 100644 --- a/drivers/net/netvsc/hn_ethdev.c +++ b/drivers/net/netvsc/hn_ethdev.c @@ -841,14 +841,16 @@ hn_dev_stop(struct rte_eth_dev *dev) static int hn_= dev_close(struct rte_eth_dev *dev) { + int ret; + PMD_INIT_FUNC_TRACE(); if (rte_eal_process_type() !=3D RTE_PROC_PRIMARY) return 0; =20 - hn_vf_close(dev); + ret =3D hn_vf_close(dev); hn_dev_free_queues(dev); =20 - return 0; + return ret; } =20 static const struct eth_dev_ops hn_eth_dev_ops =3D { diff --git a/drivers/= net/netvsc/hn_var.h b/drivers/net/netvsc/hn_var.h index 4b63f87607..74f3066= 9ac 100644 --- a/drivers/net/netvsc/hn_var.h +++ b/drivers/net/netvsc/hn_var.h @@ -217,7 +217,7 @@ const uint32_t *hn_vf_supported_ptypes(struct rte_eth_d= ev *dev); int hn_vf_start(struct rte_eth_dev *dev); void hn_vf_reset(struct rte_eth_dev *dev); void hn_vf_stop(struct rte_eth_dev *dev); -void hn_vf_close(struct rte_eth_dev *dev); +int hn_vf_close(struct rte_eth_dev *dev); =20 int hn_vf_allmulticast_enable(struct rte_eth_dev *dev); int hn_vf_allmulticast_disable(struct rte_eth_dev *dev); diff --git a/drivers/net/netvsc/hn_vf.c b/drivers/net/netvsc/hn_vf.c index = f5f15c0462..d29eee7627 100644 --- a/drivers/net/netvsc/hn_vf.c +++ b/drivers/net/netvsc/hn_vf.c @@ -316,18 +316,21 @@ void hn_vf_reset(struct rte_eth_dev *dev) VF_ETHDEV_FUNC(dev, rte_eth_dev_reset); } =20 -void hn_vf_close(struct rte_eth_dev *dev) +int hn_vf_close(struct rte_eth_dev *dev) { struct hn_data *hv =3D dev->data->dev_private; uint16_t vf_port; + int ret =3D 0; =20 rte_rwlock_read_lock(&hv->vf_lock); vf_port =3D hv->vf_port; if (vf_port !=3D HN_INVALID_PORT) - rte_eth_dev_close(vf_port); + ret =3D rte_eth_dev_close(vf_port); =20 hv->vf_port =3D HN_INVALID_PORT; rte_rwlock_read_unlock(&hv->vf_lock); + + return ret; } =20 int hn_vf_stats_reset(struct rte_eth_dev *dev) diff --git a/drivers/net/vi= rtio/virtio_user_ethdev.c b/drivers/net/virtio/virtio_user_ethdev.c index 87f6cb6950..865f73807f 100644 --- a/drivers/net/virtio/virtio_user_ethdev.c +++ b/drivers/net/virtio/virtio_user_ethdev.c @@ -813,9 +813,7 @@ virtio_user_pmd_remove(struct rte_vdev_device *vdev) return rte_eth_dev_release_port(eth_dev); =20 /* make sure the device is stopped, queues freed */ - rte_eth_dev_close(eth_dev->data->port_id); - - return 0; + return rte_eth_dev_close(eth_dev->data->port_id); } =20 static struct rte_vdev_driver virtio_user_driver =3D { diff --git a/lib/li= brte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.c index 5c0e8f170e.= .6091630a2f 100644 --- a/lib/librte_ethdev/rte_ethdev.c +++ b/lib/librte_ethdev/rte_ethdev.c @@ -1705,19 +1705,22 @@ rte_eth_dev_set_link_down(uint16_t port_id) return eth_err(port_id, (*dev->dev_ops->dev_set_link_down)(dev)); } =20 -void +int rte_eth_dev_close(uint16_t port_id) { struct rte_eth_dev *dev; + int ret; =20 - RTE_ETH_VALID_PORTID_OR_RET(port_id); + RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -EINVAL); dev =3D &rte_eth_devices[port_id]; =20 - RTE_FUNC_PTR_OR_RET(*dev->dev_ops->dev_close); - (*dev->dev_ops->dev_close)(dev); + RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_close, -ENOTSUP); + ret =3D (*dev->dev_ops->dev_close)(dev); =20 rte_ethdev_trace_close(port_id); - rte_eth_dev_release_port(dev); + ret =3D rte_eth_dev_release_port(dev); + + return ret; } =20 int diff --git a/lib/librte_ethdev/rte_ethdev.h b/lib/librte_ethdev/rte_ethdev.= h index 24d898ae89..4380d8ecf6 100644 --- a/lib/librte_ethdev/rte_ethdev.h +++ b/lib/librte_ethdev/rte_ethdev.h @@ -2281,8 +2281,11 @@ int rte_eth_dev_set_link_down(uint16_t port_id); * * @param port_id * The port identifier of the Ethernet device. + * @return + * - Zero if the port is closed successfully. + * - Negative if something went wrong. */ -void rte_eth_dev_close(uint16_t port_id); +int rte_eth_dev_close(uint16_t port_id); =20 /** * Reset a Ethernet device and keep its port id. -- 2.28.0