From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id 740D3275D for ; Fri, 27 May 2016 12:40:03 +0200 (CEST) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga103.jf.intel.com with ESMTP; 27 May 2016 03:40:02 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.26,373,1459839600"; d="scan'208";a="709766534" Received: from irsmsx151.ger.corp.intel.com ([163.33.192.59]) by FMSMGA003.fm.intel.com with ESMTP; 27 May 2016 03:40:01 -0700 Received: from irsmsx108.ger.corp.intel.com ([169.254.11.183]) by IRSMSX151.ger.corp.intel.com ([169.254.4.151]) with mapi id 14.03.0248.002; Fri, 27 May 2016 11:40:00 +0100 From: "Iremonger, Bernard" To: David Marchand , "dev@dpdk.org" CC: "thomas.monjalon@6wind.com" , "viktorin@rehivetech.com" Thread-Topic: [dpdk-dev] [PATCH v2 15/17] eal: add hotplug operations for pci and vdev Thread-Index: AQHRmvpunFkpYnAQQkqEAjNOW0Uvyp/M0TFw Date: Fri, 27 May 2016 10:39:59 +0000 Message-ID: <8CEF83825BEC744B83065625E567D7C21A010584@IRSMSX108.ger.corp.intel.com> References: <1454076516-21591-1-git-send-email-david.marchand@6wind.com> <1461152657-19969-1-git-send-email-david.marchand@6wind.com> <1461152657-19969-16-git-send-email-david.marchand@6wind.com> In-Reply-To: <1461152657-19969-16-git-send-email-david.marchand@6wind.com> Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiMTNkOWVmYTctZGVlYS00NThmLWI1NTUtN2NhYjllNTJhNTJhIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE1LjkuNi42IiwiVHJ1c3RlZExhYmVsSGFzaCI6InpSdDhXa05ZRXVcLzFzYlBTd1poZmtrVHFjblY2WFNVWG9WWkdhRE1nZXRVPSJ9 x-ctpclassification: CTP_IC x-originating-ip: [163.33.239.180] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH v2 15/17] eal: add hotplug operations for pci and vdev X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 May 2016 10:40:04 -0000 Hi David, > -----Original Message----- > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of David Marchand > Sent: Wednesday, April 20, 2016 12:44 PM > To: dev@dpdk.org > Cc: thomas.monjalon@6wind.com; viktorin@rehivetech.com > Subject: [dpdk-dev] [PATCH v2 15/17] eal: add hotplug operations for pci = and > vdev >=20 > hotplug which deals with resources should come from the layer that alread= y > handles them, i.e. eal. >=20 > For both attach and detach operations, 'name' is used to select the bus t= hat > will handle the request. >=20 > Signed-off-by: David Marchand > --- > lib/librte_eal/bsdapp/eal/rte_eal_version.map | 8 +++++ > lib/librte_eal/common/eal_common_dev.c | 39 > +++++++++++++++++++++++++ > lib/librte_eal/common/include/rte_dev.h | 25 ++++++++++++++++ > lib/librte_eal/linuxapp/eal/rte_eal_version.map | 8 +++++ > 4 files changed, 80 insertions(+) >=20 > diff --git a/lib/librte_eal/bsdapp/eal/rte_eal_version.map > b/lib/librte_eal/bsdapp/eal/rte_eal_version.map > index 58c2951..4d075df 100644 > --- a/lib/librte_eal/bsdapp/eal/rte_eal_version.map > +++ b/lib/librte_eal/bsdapp/eal/rte_eal_version.map > @@ -151,3 +151,11 @@ DPDK_16.04 { > rte_eal_primary_proc_alive; >=20 > } DPDK_2.2; > + > +DPDK_16.07 { > + global: > + > + rte_eal_dev_attach; > + rte_eal_dev_detach; > + > +} DPDK_16.04; > diff --git a/lib/librte_eal/common/eal_common_dev.c > b/lib/librte_eal/common/eal_common_dev.c > index a8a4146..59ed3a0 100644 > --- a/lib/librte_eal/common/eal_common_dev.c > +++ b/lib/librte_eal/common/eal_common_dev.c > @@ -150,3 +150,42 @@ rte_eal_vdev_uninit(const char *name) > RTE_LOG(ERR, EAL, "no driver found for %s\n", name); > return -EINVAL; > } > + > +int rte_eal_dev_attach(const char *name, const char *devargs) { > + struct rte_pci_addr addr; > + int ret =3D -1; > + Should the input parameters name and devargs be checked? > + if (eal_parse_pci_DomBDF(name, &addr) =3D=3D 0) { > + if (rte_eal_pci_probe_one(&addr) < 0) > + goto err; > + > + } else { > + if (rte_eal_vdev_init(name, devargs)) > + goto err; > + } > + > + return 0; > + > +err: > + RTE_LOG(ERR, EAL, "Driver, cannot attach the device\n"); > + return ret; > +} > + > +int rte_eal_dev_detach(const char *name) { > + struct rte_pci_addr addr; > + Should the name parameter be checked? > + if (eal_parse_pci_DomBDF(name, &addr) =3D=3D 0) { > + if (rte_eal_pci_detach(&addr) < 0) > + goto err; > + } else { > + if (rte_eal_vdev_uninit(name)) > + goto err; > + } > + return 0; > + > +err: > + RTE_LOG(ERR, EAL, "Driver, cannot detach the device\n"); > + return -1; > +} > diff --git a/lib/librte_eal/common/include/rte_dev.h > b/lib/librte_eal/common/include/rte_dev.h > index 85e48f2..b1c0520 100644 > --- a/lib/librte_eal/common/include/rte_dev.h > +++ b/lib/librte_eal/common/include/rte_dev.h > @@ -178,6 +178,31 @@ int rte_eal_vdev_init(const char *name, const char > *args); > */ > int rte_eal_vdev_uninit(const char *name); >=20 > +/** > + * Attach a resource to a registered driver. > + * > + * @param name > + * The resource name, that refers to a pci resource or some private > + * way of designating a resource for vdev drivers. Based on this > + * resource name, eal will identify a driver capable of handling > + * this resource and pass this resource to the driver probing > + * function. > + * @param devargs > + * Device arguments to be passed to the driver. > + * @return > + * 0 on success, negative on error. > + */ > +int rte_eal_dev_attach(const char *name, const char *devargs); > + > +/** > + * Detach a resource from its driver. > + * > + * @param name > + * Same description as for rte_eal_dev_attach(). > + * Here, eal will call the driver detaching function. > + */ > +int rte_eal_dev_detach(const char *name); > + > #define PMD_REGISTER_DRIVER(d)\ > RTE_INIT(devinitfn_ ##d);\ > static void devinitfn_ ##d(void)\ > diff --git a/lib/librte_eal/linuxapp/eal/rte_eal_version.map > b/lib/librte_eal/linuxapp/eal/rte_eal_version.map > index 12503ef..0404a52 100644 > --- a/lib/librte_eal/linuxapp/eal/rte_eal_version.map > +++ b/lib/librte_eal/linuxapp/eal/rte_eal_version.map > @@ -154,3 +154,11 @@ DPDK_16.04 { > rte_eal_primary_proc_alive; >=20 > } DPDK_2.2; > + > +DPDK_16.07 { > + global: > + > + rte_eal_dev_attach; > + rte_eal_dev_detach; > + > +} DPDK_16.04; > -- > 1.9.1 Regards, Bernard.