From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <reshma.pattan@intel.com>
Received: from mga05.intel.com (mga05.intel.com [192.55.52.43])
 by dpdk.org (Postfix) with ESMTP id 1AE21590B
 for <dev@dpdk.org>; Tue, 25 Oct 2016 17:49:52 +0200 (CEST)
Received: from orsmga005.jf.intel.com ([10.7.209.41])
 by fmsmga105.fm.intel.com with ESMTP; 25 Oct 2016 08:49:51 -0700
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="5.31,546,1473145200"; d="scan'208";a="23546642"
Received: from irsmsx102.ger.corp.intel.com ([163.33.3.155])
 by orsmga005.jf.intel.com with ESMTP; 25 Oct 2016 08:49:50 -0700
Received: from irsmsx109.ger.corp.intel.com ([169.254.13.122]) by
 IRSMSX102.ger.corp.intel.com ([169.254.2.226]) with mapi id 14.03.0248.002;
 Tue, 25 Oct 2016 16:49:49 +0100
From: "Pattan, Reshma" <reshma.pattan@intel.com>
To: Shreyansh Jain <shreyansh.jain@nxp.com>, "dev@dpdk.org" <dev@dpdk.org>
CC: "viktorin@rehivetech.com" <viktorin@rehivetech.com>, David Marchand
 <david.marchand@6wind.com>, "hemant.agrawal@nxp.com"
 <hemant.agrawal@nxp.com>, Thomas Monjalon <thomas.monjalon@6wind.com>
Thread-Topic: [dpdk-dev] [PATCH v10 11/25] eal/pci: helpers for device name
 parsing/update
Thread-Index: AQHSD9OXs6Oi2CVP9UmoCYxndcLWSaC5iwKg
Date: Tue, 25 Oct 2016 15:49:49 +0000
Message-ID: <3AEA2BF9852C6F48A459DA490692831F010BD36E@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>
In-Reply-To: <1474000200-16705-12-git-send-email-shreyansh.jain@nxp.com>
Accept-Language: en-US
Content-Language: en-US
X-MS-Has-Attach: 
X-MS-TNEF-Correlator: 
x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiNGE4ZDM4OTAtNmYzNy00OTIwLTg3YWItOWQyNmQ2NWU0MGM5IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE1LjkuNi42IiwiVHJ1c3RlZExhYmVsSGFzaCI6IklqbUtIVUpIZWxzU053emRzQlhndVZzZGFlcUhhV0FlZlBvVTlRTHljVDA9In0=
x-ctpclassification: CTP_IC
x-originating-ip: [163.33.239.182]
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
Subject: Re: [dpdk-dev] [PATCH v10 11/25] eal/pci: helpers for device
	name	parsing/update
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: patches and discussions about DPDK <dev.dpdk.org>
List-Unsubscribe: <http://dpdk.org/ml/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://dpdk.org/ml/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <http://dpdk.org/ml/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Tue, 25 Oct 2016 15:49:53 -0000

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 <david.marchand@6wind.com>;
> hemant.agrawal@nxp.com; Thomas Monjalon
> <thomas.monjalon@6wind.com>; Shreyansh Jain <shreyansh.jain@nxp.com>
> Subject: [dpdk-dev] [PATCH v10 11/25] eal/pci: helpers for device name
> parsing/update
>=20
> From: David Marchand <david.marchand@6wind.com>
>=20
> - 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.
>=20
> Signed-off-by: David Marchand <david.marchand@6wind.com>
> [Shreyansh: Merge crypto/pci helper patches]
> Signed-off-by: Shreyansh Jain <shreyansh.jain@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(-)
>=20
> 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;
>  }
>=20
>   *
>   * 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 */  #d=
efine
> PCI_PRI_FMT "%.4" PRIx16 ":%.2" PRIx8 ":%.2" PRIx8 ".%" PRIx8
> +#define PCI_PRI_STR_SIZE sizeof("XXXX:XX:XX.X")
>=20
>  /** Short formatting string, without domain, for PCI device: Ex: 00:01.0=
 */
> #define PCI_SHORT_PRI_FMT "%.2" PRIx8 ":%.2" PRIx8 ".%" PRIx8 @@ -308,6
>=20
> +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); }
> +
>=20
> +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" w=
as that intentional  and why is that so.

> -static int
> -rte_eth_dev_create_unique_device_name(char *name, size_t size,
> -		struct rte_pci_device *pci_dev)
> -{
> -	int ret;
> -
> -	ret =3D snprintf(name, size, "%d:%d.%d",
> -			pci_dev->addr.bus, pci_dev->addr.devid,
> -			pci_dev->addr.function);
> -	if (ret < 0)
> -		return ret;
> -	return 0;
> -}
> -