[dpdk-dev] [PATCH v10 11/25] eal/pci: helpers for device name parsing/update

Pattan, Reshma reshma.pattan at intel.com
Wed Oct 26 11:12:06 CEST 2016


Hi,


> -----Original Message-----
> From: Shreyansh Jain [mailto:shreyansh.jain at nxp.com]
> Sent: Wednesday, October 26, 2016 7:23 AM
> To: Pattan, Reshma <reshma.pattan at intel.com>
> Cc: dev at dpdk.org; viktorin at rehivetech.com; David Marchand
> <david.marchand at 6wind.com>; hemant.agrawal at nxp.com; Thomas Monjalon
> <thomas.monjalon at 6wind.com>
> Subject: Re: [PATCH v10 11/25] eal/pci: helpers for device name parsing/update
> 
> Hello Reshma,
> 
> On Tuesday 25 October 2016 09:19 PM, Pattan, Reshma wrote:
> > Hi Shreyansh,
> >
> >> -----Original Message-----
> >> From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Shreyansh Jain
> >> Sent: Friday, September 16, 2016 5:30 AM
> >> To: dev at dpdk.org
> >> Cc: viktorin at rehivetech.com; David Marchand
> >> <david.marchand at 6wind.com>; hemant.agrawal at nxp.com; Thomas
> Monjalon
> >> <thomas.monjalon at 6wind.com>; Shreyansh Jain <shreyansh.jain at nxp.com>
> >> Subject: [dpdk-dev] [PATCH v10 11/25] eal/pci: helpers for device
> >> name parsing/update
> >>
> >> From: David Marchand <david.marchand at 6wind.com>
> >>
> >> - 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 common
> >>   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 <david.marchand at 6wind.com>
> >> [Shreyansh: Merge crypto/pci helper patches]
> >> Signed-off-by: Shreyansh Jain <shreyansh.jain at nxp.com>
> >> ---
> >>  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 >= PCI_PRI_STR_SIZE);
> >> +	RTE_VERIFY(snprintf(output, size, PCI_PRI_FMT,
> >> +			    addr->domain, addr->bus,
> >> +			    addr->devid, addr->function) >= 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.func"
> was that intentional  and why is that so.
> 
> Yes, this is intentional.
> It is to bring the naming in sync with the device name being used for scanning on
> the bus (/sys/bus/pci/devices/AAAA:BB:CC.D/).

Fair enough and thanks for clarification.

Thanks,
Reshma


More information about the dev mailing list