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 B7FB1A052B; Thu, 30 Jul 2020 17:53:09 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 2D93BE07; Thu, 30 Jul 2020 17:53:09 +0200 (CEST) Received: from EUR03-DB5-obe.outbound.protection.outlook.com (mail-eopbgr40058.outbound.protection.outlook.com [40.107.4.58]) by dpdk.org (Postfix) with ESMTP id B183E3B5 for ; Thu, 30 Jul 2020 17:53:07 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Og9ukxTQyWYylbXDUuGEMFqs1baQcbLQFsxT/pGH7e31i1IXjlg41BuCi8MvgosusVYe4iUa3qKgPPwYZhus98ZkjtuYhB4HLjJlQOqKGKuWcn0yhgTWSKXs3X5ChJyb/N209tcbehqrrlHocSXl/G87EhpS971Low2YA7FBBof45MarrCHxSQ+x8tncpwEMslNwEMsr61Uo2e7Bn14G6ED9HH+Ur7SSzhGJAiup9Ji0CzRzyofZqr9coJ/Djizg5w2KQTQKdimlKVR7MYbC56tWqGSYaAwwBmdpyAkdRrZVHFYAah/ZgqgxKHl9ziR3uxFY13sx7uz+JQ84U+KaZg== 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=Ndsg0X9S15LumIThDAI48mJMlLNdW46XPSspuA9esOM=; b=YsWGICd9n+MHdR/8msDNwjL8ZcGxXn7IWjIq9+DQPvAzHkBJW0W303153tyCpZovrhqj5PBQU8WLVYcuTUnVh8r2retMbE7uV5WXo7hsbiLGMSpgj2kx8g2luyeLEo6OSVhAigvrUAb8Ra6gO7raeWKKu+aXjFP4aY7qdMjCUlNnGdEnefVDQeRq7pFhbYqM5wjWZR+HHw0sAIWGUG1ZQhOy1W0qY0UBs+5LaTrCB5IlI5VO3Jf05kuGmNs9yq4KkqpRBWw8XlPhDXQJuLWxoEG2jEW1xl369+z3UVAjngrHw32VH1RJDXi939RdY31EWJn5niq6YBVVmJTe2Uwfcw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Ndsg0X9S15LumIThDAI48mJMlLNdW46XPSspuA9esOM=; b=As2dREP+yyzntICAvA4aoAE8LUWf+ehT04z4zjZIpI1fPpbxzyWNa0kS3JW360b81vSUcmQU1BxvIPmSs5BMJMeKisCLrzv0Qn4S4MrbBqZI5jM22ZPEDMXJcwLxI2mRljyO/KJ4YRCZG0J91aS0Tze5y1y+5DL9kKiPErZRce0= Received: from VI1PR04MB7136.eurprd04.prod.outlook.com (2603:10a6:800:122::19) by VI1PR04MB7136.eurprd04.prod.outlook.com (2603:10a6:800:122::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3216.24; Thu, 30 Jul 2020 15:53:05 +0000 Received: from VI1PR04MB7136.eurprd04.prod.outlook.com ([fe80::15d:faec:f4e9:a8a]) by VI1PR04MB7136.eurprd04.prod.outlook.com ([fe80::15d:faec:f4e9:a8a%7]) with mapi id 15.20.3216.034; Thu, 30 Jul 2020 15:53:05 +0000 From: Rohit Raj To: Stephen Hemminger CC: Ray Kinsella , Neil Horman , "dev@dpdk.org" Thread-Topic: [EXT] Re: [dpdk-dev] [PATCH v1 1/3] eal: add API for bus close Thread-Index: AQHWZP4mEiSbp0TlEUaVUaEjjEyVyKkdPbgAgAMLEBA= Date: Thu, 30 Jul 2020 15:53:05 +0000 Message-ID: References: <20200728164252.2000-1-rohit.raj@nxp.com> <20200728102348.6f130454@hermes.lan> In-Reply-To: <20200728102348.6f130454@hermes.lan> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: networkplumber.org; dkim=none (message not signed) header.d=none; networkplumber.org; dmarc=none action=none header.from=nxp.com; x-originating-ip: [103.87.58.104] x-ms-publictraffictype: Email x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: 77d17a42-6386-4bd8-4e20-08d834a0a5e6 x-ms-traffictypediagnostic: VI1PR04MB7136: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:5236; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: oO5O88S7mBOHIhZ0BqsLKlWb0wkvYTvQm0sV3XfEIDo163fc6MPghomG3IvkN5pkYueZqTUYfW6dc7xA8VrUWsmyceLvFohp70biAHhBeHs7qkmCDMTAIlOC1xmELeSszWv6OEAQPXxVNyzHewoObhPNEt/3yE1aU1rZZ9YNkOk8D99DncwM5PZMRRkmw34J5WFZqUYoPoFDKCylgwD/zUg09SPHUTbq9V72ECRvDUSBMa/GG4FyIgKLiif8dNRucHHQYyPdsi+5Kqtoy+Vc6x+XgSCM9MsJclQvGgjJROnylrOlSYFng/pWl/4SWd1SgYeXLvKoQqoezRujFmWsZA== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VI1PR04MB7136.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(4636009)(366004)(6916009)(2906002)(55016002)(9686003)(8676002)(26005)(86362001)(71200400001)(186003)(64756008)(4326008)(66446008)(8936002)(53546011)(7696005)(44832011)(54906003)(498600001)(76116006)(6506007)(66476007)(66556008)(5660300002)(33656002)(66946007)(83380400001)(52536014); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata: wtiIiwexF30ldb4A31N0rNfibnAYm8n/RxDRWmWnsRUYZiPDnfUb3p5r/Fka+roL/EMqZrG9j6xWP/uDA0dc9n+3SpIepUvfpdSQNfEDXrTqbhvoO41fgOU3pYVH2otyv9RHLsQLkb6/Uu7pe2Z0k2m5wLzq98NJnU/Su3NtIdFUBsf81PNaX40omXl4J5KQnm7henXF/nbcqXhyF5lS8Is76zY4fuK7j8w9z23clwKd19sicrh772nX6BAM62adicnSuw8KojpwnEq8qKpdeTNQPcHf1/kAtSgxVByzvyrNbq0U/4nzhWmfUcNizUw/o3DWfiJBWDTrgFWxlTn0WjbxzDk58V0MCGh/qO5i7W1EBhKZEx6yvxlb1+Z6mZayZUekLpmENOToJ9BlAHgix7Whvi5RVRSQ+wAohSbTK9SaNb1aB2Kmgg6vRzCLK4AKMsNYEOeemZHozNjBYtAHTlVHEIOBCvpUUo7sXfJ4+60= x-ms-exchange-transport-forked: True Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB7136.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 77d17a42-6386-4bd8-4e20-08d834a0a5e6 X-MS-Exchange-CrossTenant-originalarrivaltime: 30 Jul 2020 15:53:05.4177 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: OrtMWavrAZfaMsz5QiXLEkBFaB31U9RnNhBoFsHqTfDH8w5QeUucf8XGAELVA2g9711pMUvHDNtcJhyr3R4x6Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB7136 Subject: Re: [dpdk-dev] [EXT] Re: [PATCH v1 1/3] eal: add API for bus close 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" Yes, I agree. I will rework and send this patch series again. Regards, Rohit Raj Software Engineer | NXP India Private Limited Email: rohit.raj@nxp.com -----Original Message----- From: Stephen Hemminger =20 Sent: Tuesday, July 28, 2020 10:54 PM To: Rohit Raj Cc: Ray Kinsella ; Neil Horman ; dev@= dpdk.org Subject: [EXT] Re: [dpdk-dev] [PATCH v1 1/3] eal: add API for bus close Caution: EXT Email On Tue, 28 Jul 2020 22:12:50 +0530 rohit.raj@nxp.com wrote: > From: Rohit Raj > > As per the current code we have API for bus probe, but the bus close=20 > API is missing. This breaks the multi process scenarios as objects are=20 > not cleaned while terminating the secondary processes. > > This patch adds a new API rte_bus_close() for cleanup of bus objects=20 > which were acquired during probe. > > Signed-off-by: Rohit Raj > --- > lib/librte_eal/common/eal_common_bus.c | 34 +++++++++++++++++++++++++- > lib/librte_eal/include/rte_bus.h | 25 ++++++++++++++++++- > lib/librte_eal/rte_eal_version.map | 3 +++ > 3 files changed, 60 insertions(+), 2 deletions(-) > > diff --git a/lib/librte_eal/common/eal_common_bus.c=20 > b/lib/librte_eal/common/eal_common_bus.c > index baa5b532a..4c8c7eecc 100644 > --- a/lib/librte_eal/common/eal_common_bus.c > +++ b/lib/librte_eal/common/eal_common_bus.c > @@ -1,5 +1,5 @@ > /* SPDX-License-Identifier: BSD-3-Clause > - * Copyright 2016 NXP > + * Copyright 2016,2020 NXP > */ > > #include > @@ -56,6 +56,38 @@ rte_bus_scan(void) > return 0; > } > > +int > +rte_bus_close(void) > +{ > + int ret; > + struct rte_bus *bus, *vbus =3D NULL; > + > + TAILQ_FOREACH(bus, &rte_bus_list, next) { > + if (!strcmp(bus->name, "vdev")) { > + vbus =3D bus; > + continue; > + } > + > + if (bus->close) { > + ret =3D bus->close(); > + if (ret) > + RTE_LOG(ERR, EAL, "Bus (%s) close failed.\n= ", > + bus->name); > + } > + } > + > + if (vbus) { > + if (vbus->close) { > + ret =3D vbus->close(); > + if (ret) > + RTE_LOG(ERR, EAL, "Bus (%s) close failed.\n= ", > + vbus->name); > + } > + } > + > + return 0; > +} > + > /* Probe all devices of all buses */ > int > rte_bus_probe(void) > diff --git a/lib/librte_eal/include/rte_bus.h=20 > b/lib/librte_eal/include/rte_bus.h > index d3034d0ed..af4787b18 100644 > --- a/lib/librte_eal/include/rte_bus.h > +++ b/lib/librte_eal/include/rte_bus.h > @@ -1,5 +1,5 @@ > /* SPDX-License-Identifier: BSD-3-Clause > - * Copyright 2016 NXP > + * Copyright 2016,2020 NXP > */ > > #ifndef _RTE_BUS_H_ > @@ -67,6 +67,18 @@ typedef int (*rte_bus_scan_t)(void); > */ > typedef int (*rte_bus_probe_t)(void); > > +/** > + * Implementation specific close function which is responsible for=20 > +closing > + * devices on that bus. > + * > + * This is called while iterating over each registered bus. > + * > + * @return > + * 0 for successful close > + * !0 for any error while closing > + */ > +typedef int (*rte_bus_close_t)(void); > + > /** > * Device iterator to find a device on a bus. > * > @@ -248,6 +260,7 @@ struct rte_bus { > const char *name; /**< Name of the bus */ > rte_bus_scan_t scan; /**< Scan for devices attached to bus = */ > rte_bus_probe_t probe; /**< Probe devices on bus */ > + rte_bus_close_t close; /**< Close devices on bus */ > rte_bus_find_device_t find_device; /**< Find a device on the bus */ > rte_bus_plug_t plug; /**< Probe single device for drivers *= / > rte_bus_unplug_t unplug; /**< Remove single device from driver = */ > @@ -301,6 +314,16 @@ int rte_bus_scan(void); > */ > int rte_bus_probe(void); > > +/** > + * For each device on the buses, call the device specific close. > + * > + * @return > + * 0 for successful close > + * !0 otherwise > + */ > +__rte_experimental > +int rte_bus_close(void); > + > /** > * Dump information of all the buses registered with EAL. > * > diff --git a/lib/librte_eal/rte_eal_version.map=20 > b/lib/librte_eal/rte_eal_version.map > index bf0c17c23..6a6d993a1 100644 > --- a/lib/librte_eal/rte_eal_version.map > +++ b/lib/librte_eal/rte_eal_version.map > @@ -403,6 +403,9 @@ EXPERIMENTAL { > rte_mp_disable; > rte_thread_register; > rte_thread_unregister; > + > + # added in 20.11 > + rte_bus_close; > }; > > INTERNAL { This be called in the rte_eal_cleanup path?