From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Pattan, Reshma" Subject: Re: [PATCH v10 11/25] eal/pci: helpers for device name parsing/update Date: Wed, 26 Oct 2016 09:12:06 +0000 Message-ID: <3AEA2BF9852C6F48A459DA490692831F010BE6C7@IRSMSX109.ger.corp.intel.com> References: <1466510566-9240-1-git-send-email-shreyansh.jain@nxp.com> <1474000200-16705-1-git-send-email-shreyansh.jain@nxp.com> <1474000200-16705-12-git-send-email-shreyansh.jain@nxp.com> <3AEA2BF9852C6F48A459DA490692831F010BD36E@IRSMSX109.ger.corp.intel.com> <39622c65-4cbd-4841-541f-8673e1935036@nxp.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Cc: "dev@dpdk.org" , Thomas Monjalon , "viktorin@rehivetech.com" To: Shreyansh Jain Return-path: Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id 3B9916CB3 for ; Wed, 26 Oct 2016 11:12:11 +0200 (CEST) In-Reply-To: <39622c65-4cbd-4841-541f-8673e1935036@nxp.com> Content-Language: en-US List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Hi, > -----Original Message----- > From: Shreyansh Jain [mailto:shreyansh.jain@nxp.com] > Sent: Wednesday, October 26, 2016 7:23 AM > To: Pattan, Reshma > Cc: dev@dpdk.org; viktorin@rehivetech.com; David Marchand > ; hemant.agrawal@nxp.com; Thomas Monjalon > > Subject: Re: [PATCH v10 11/25] eal/pci: helpers for device name parsing/u= pdate >=20 > Hello Reshma, >=20 > On Tuesday 25 October 2016 09:19 PM, Pattan, Reshma wrote: > > Hi Shreyansh, > > > >> -----Original Message----- > >> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Shreyansh Jain > >> Sent: Friday, September 16, 2016 5:30 AM > >> To: dev@dpdk.org > >> Cc: viktorin@rehivetech.com; David Marchand > >> ; hemant.agrawal@nxp.com; Thomas > Monjalon > >> ; Shreyansh Jain > >> Subject: [dpdk-dev] [PATCH v10 11/25] eal/pci: helpers for device > >> name parsing/update > >> > >> From: David Marchand > >> > >> - Move rte_eth_dev_create_unique_device_name() from ether/rte_ethdev.c > to > >> common/include/rte_pci.h as rte_eal_pci_device_name(). Being a commo= n > >> method, can be used across crypto/net PCI PMDs. > >> - Remove crypto specific routine and fallback to common name function. > >> - Introduce a eal private Update function for PCI device naming. > >> > >> Signed-off-by: David Marchand > >> [Shreyansh: Merge crypto/pci helper patches] > >> Signed-off-by: Shreyansh Jain > >> --- > >> lib/librte_cryptodev/rte_cryptodev.c | 27 +++--------------- > >> lib/librte_eal/bsdapp/eal/eal_pci.c | 49 > >> +++++++++++++++++++++++++++++++++ > >> lib/librte_eal/common/eal_private.h | 13 +++++++++ > >> lib/librte_eal/common/include/rte_pci.h | 24 ++++++++++++++++ > >> lib/librte_eal/linuxapp/eal/eal_pci.c | 13 +++++++++ > >> lib/librte_ether/rte_ethdev.c | 24 +++------------- > >> 6 files changed, 107 insertions(+), 43 deletions(-) > >> > >> diff --git a/lib/librte_cryptodev/rte_cryptodev.c > >> b/lib/librte_cryptodev/rte_cryptodev.c > >> index 2a3b649..c81e366 100644 > >> --- a/lib/librte_cryptodev/rte_cryptodev.c > >> +++ b/lib/librte_cryptodev/rte_cryptodev.c > >> @@ -365,23 +365,6 @@ rte_cryptodev_pmd_allocate(const char *name, int > >> socket_id) > >> return cryptodev; > >> } > >> > >> * > >> * This function is private to EAL. > >> diff --git a/lib/librte_eal/common/include/rte_pci.h > >> b/lib/librte_eal/common/include/rte_pci.h > >> index cf81898..e1f695f 100644 > >> --- a/lib/librte_eal/common/include/rte_pci.h > >> +++ b/lib/librte_eal/common/include/rte_pci.h > >> @@ -82,6 +82,7 @@ extern "C" { > >> /** Formatting string for PCI device identifier: Ex: 0000:00:01.0 */ > >> #define PCI_PRI_FMT "%.4" PRIx16 ":%.2" PRIx8 ":%.2" PRIx8 ".%" PRIx8 > >> +#define PCI_PRI_STR_SIZE sizeof("XXXX:XX:XX.X") > >> > >> /** Short formatting string, without domain, for PCI device: Ex: > >> 00:01.0 */ #define PCI_SHORT_PRI_FMT "%.2" PRIx8 ":%.2" PRIx8 ".%" > >> PRIx8 @@ -308,6 > >> > >> +static inline void > >> +rte_eal_pci_device_name(const struct rte_pci_addr *addr, > >> + char *output, size_t size) > >> +{ > >> + RTE_VERIFY(size >=3D PCI_PRI_STR_SIZE); > >> + RTE_VERIFY(snprintf(output, size, PCI_PRI_FMT, > >> + addr->domain, addr->bus, > >> + addr->devid, addr->function) >=3D 0); } > >> + > >> > >> +int > >> +pci_update_device(const struct rte_pci_addr *addr) { > >> + char filename[PATH_MAX]; > >> + > >> + snprintf(filename, sizeof(filename), "%s/" PCI_PRI_FMT, > >> + pci_get_sysfs_path(), addr->domain, addr->bus, addr->devid, > >> + addr->function); > >> + > >> + return pci_scan_one(filename, addr->domain, addr->bus, addr->devid, > >> + addr->function); > >> +} > >> + > > > > > > Earlier device names were created in the format "bus:deviceid.function"= as per > the below ethdev API. > > Now after above new eal API the name format is "domain:bus:deviceid.fun= c" > was that intentional and why is that so. >=20 > Yes, this is intentional. > It is to bring the naming in sync with the device name being used for sca= nning on > the bus (/sys/bus/pci/devices/AAAA:BB:CC.D/). Fair enough and thanks for clarification. Thanks, Reshma