From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <xiao.w.wang@intel.com>
Received: from mga09.intel.com (mga09.intel.com [134.134.136.24])
 by dpdk.org (Postfix) with ESMTP id E193D1B79E
 for <dev@dpdk.org>; Tue,  3 Apr 2018 17:23:41 +0200 (CEST)
X-Amp-Result: SKIPPED(no attachment in message)
X-Amp-File-Uploaded: False
Received: from orsmga005.jf.intel.com ([10.7.209.41])
 by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;
 03 Apr 2018 08:23:40 -0700
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="5.48,401,1517904000"; d="scan'208";a="213582406"
Received: from fmsmsx106.amr.corp.intel.com ([10.18.124.204])
 by orsmga005.jf.intel.com with ESMTP; 03 Apr 2018 08:23:40 -0700
Received: from fmsmsx155.amr.corp.intel.com (10.18.116.71) by
 FMSMSX106.amr.corp.intel.com (10.18.124.204) with Microsoft SMTP Server (TLS)
 id 14.3.319.2; Tue, 3 Apr 2018 08:23:39 -0700
Received: from shsmsx152.ccr.corp.intel.com (10.239.6.52) by
 FMSMSX155.amr.corp.intel.com (10.18.116.71) with Microsoft SMTP Server (TLS)
 id 14.3.319.2; Tue, 3 Apr 2018 08:23:39 -0700
Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.166]) by
 SHSMSX152.ccr.corp.intel.com ([169.254.6.129]) with mapi id 14.03.0319.002;
 Tue, 3 Apr 2018 23:23:39 +0800
From: "Wang, Xiao W" <xiao.w.wang@intel.com>
To: Hemant Agrawal <hemant.agrawal@nxp.com>, "dev@dpdk.org" <dev@dpdk.org>
CC: "Burakov, Anatoly" <anatoly.burakov@intel.com>, "thomas@monjalon.net"
 <thomas@monjalon.net>
Thread-Topic: [dpdk-dev] [PATCH v4 2/2] eal/vfio: export internal vfio
 functions
Thread-Index: AQHTyzytI8YeElYuBEKBDmaizE00/qPvJv7Q
Date: Tue, 3 Apr 2018 15:23:38 +0000
Message-ID: <B7F2E978279D1D49A3034B7786DACF406F85CF1E@SHSMSX101.ccr.corp.intel.com>
References: <1522744086-31507-1-git-send-email-hemant.agrawal@nxp.com>
 <1522753815-28718-1-git-send-email-hemant.agrawal@nxp.com>
 <1522753815-28718-2-git-send-email-hemant.agrawal@nxp.com>
In-Reply-To: <1522753815-28718-2-git-send-email-hemant.agrawal@nxp.com>
Accept-Language: en-US
Content-Language: en-US
X-MS-Has-Attach: 
X-MS-TNEF-Correlator: 
x-ctpclassification: CTP_NT
x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiYTQwNTZlNTktODg1OC00MGY3LWJiZDQtOTRmYWQ0ZDgyNWI0IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjIuNS4xOCIsIlRydXN0ZWRMYWJlbEhhc2giOiJrR3J1ZzRlMkRCSjhyejlJUmVkdW5hQWwxNFJ5K2poS1hNaG01YXp0NWowUGVsNEpMUFRJT0puT0lZUUd0alwvRCJ9
dlp-product: dlpe-windows
dlp-version: 11.0.0.116
dlp-reaction: no-action
x-originating-ip: [10.239.127.40]
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
Subject: Re: [dpdk-dev] [PATCH v4 2/2] eal/vfio: export internal vfio
 functions
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://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: <https://dpdk.org/ml/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Tue, 03 Apr 2018 15:23:42 -0000

Hi Hemant,

> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Hemant Agrawal
> Sent: Tuesday, April 3, 2018 7:10 PM
> To: dev@dpdk.org
> Cc: Burakov, Anatoly <anatoly.burakov@intel.com>; thomas@monjalon.net
> Subject: [dpdk-dev] [PATCH v4 2/2] eal/vfio: export internal vfio functio=
ns
>=20
> This patch moves some of the internal vfio functions from
> eal_vfio.h to rte_vfio.h for common uses with "rte_" prefix.
>=20
> This patch also change the FSLMC bus usages from the internal
> VFIO functions to external ones with "rte_" prefix
>=20
> Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
> Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
> ---
>  drivers/bus/fslmc/Makefile                     |  1 -
>  drivers/bus/fslmc/fslmc_vfio.c                 |  7 +--
>  drivers/bus/fslmc/fslmc_vfio.h                 |  2 -
>  drivers/bus/fslmc/meson.build                  |  1 -
>  lib/librte_eal/bsdapp/eal/eal.c                | 20 +++++++
>  lib/librte_eal/common/include/rte_vfio.h       | 75
> +++++++++++++++++++++++++-
>  lib/librte_eal/linuxapp/eal/eal_vfio.c         | 38 ++++++-------
>  lib/librte_eal/linuxapp/eal/eal_vfio.h         | 21 --------
>  lib/librte_eal/linuxapp/eal/eal_vfio_mp_sync.c |  4 +-
>  lib/librte_eal/rte_eal_version.map             |  3 ++
>  10 files changed, 122 insertions(+), 50 deletions(-)
>=20
> diff --git a/drivers/bus/fslmc/Makefile b/drivers/bus/fslmc/Makefile
> index 93870ba..3aa34e2 100644
> --- a/drivers/bus/fslmc/Makefile
> +++ b/drivers/bus/fslmc/Makefile
> @@ -16,7 +16,6 @@ CFLAGS +=3D $(WERROR_FLAGS)
>  CFLAGS +=3D -I$(RTE_SDK)/drivers/bus/fslmc
>  CFLAGS +=3D -I$(RTE_SDK)/drivers/bus/fslmc/mc
>  CFLAGS +=3D -I$(RTE_SDK)/drivers/bus/fslmc/qbman/include
> -CFLAGS +=3D -I$(RTE_SDK)/lib/librte_eal/linuxapp/eal
>  CFLAGS +=3D -I$(RTE_SDK)/lib/librte_eal/common
>  LDLIBS +=3D -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring
>  LDLIBS +=3D -lrte_ethdev
> diff --git a/drivers/bus/fslmc/fslmc_vfio.c b/drivers/bus/fslmc/fslmc_vfi=
o.c
> index 62499de..f3b2960 100644
> --- a/drivers/bus/fslmc/fslmc_vfio.c
> +++ b/drivers/bus/fslmc/fslmc_vfio.c
> @@ -91,7 +91,8 @@ fslmc_get_container_group(int *groupid)
>  	}
>=20
>  	/* get group number */
> -	ret =3D vfio_get_group_no(SYSFS_FSL_MC_DEVICES, g_container,
> groupid);
> +	ret =3D rte_vfio_get_group_num(SYSFS_FSL_MC_DEVICES,
> +				     g_container, groupid);
>  	if (ret <=3D 0) {
>  		DPAA2_BUS_ERR("Unable to find %s IOMMU group",
> g_container);
>  		return -1;
> @@ -124,7 +125,7 @@ vfio_connect_container(void)
>  	}
>=20
>  	/* Opens main vfio file descriptor which represents the "container" */
> -	fd =3D vfio_get_container_fd();
> +	fd =3D rte_vfio_get_container_fd();
>  	if (fd < 0) {
>  		DPAA2_BUS_ERR("Failed to open VFIO container");
>  		return -errno;
> @@ -620,7 +621,7 @@ fslmc_vfio_setup_group(void)
>  	}
>=20
>  	/* Get the actual group fd */
> -	ret =3D vfio_get_group_fd(groupid);
> +	ret =3D rte_vfio_get_group_fd(groupid);
>  	if (ret < 0)
>  		return ret;
>  	vfio_group.fd =3D ret;
> diff --git a/drivers/bus/fslmc/fslmc_vfio.h b/drivers/bus/fslmc/fslmc_vfi=
o.h
> index e8fb344..9e2c4fe 100644
> --- a/drivers/bus/fslmc/fslmc_vfio.h
> +++ b/drivers/bus/fslmc/fslmc_vfio.h
> @@ -10,8 +10,6 @@
>=20
>  #include <rte_vfio.h>
>=20
> -#include "eal_vfio.h"
> -
>  #define DPAA2_MC_DPNI_DEVID	7
>  #define DPAA2_MC_DPSECI_DEVID	3
>  #define DPAA2_MC_DPCON_DEVID	5
> diff --git a/drivers/bus/fslmc/meson.build b/drivers/bus/fslmc/meson.buil=
d
> index e94340e..78f9d92 100644
> --- a/drivers/bus/fslmc/meson.build
> +++ b/drivers/bus/fslmc/meson.build
> @@ -22,6 +22,5 @@ sources =3D files('fslmc_bus.c',
>=20
>  allow_experimental_apis =3D true
>=20
> -includes +=3D include_directories('../../../lib/librte_eal/linuxapp/eal'=
)
>  includes +=3D include_directories('mc', 'qbman/include', 'portal')
>  cflags +=3D ['-D_GNU_SOURCE']
> diff --git a/lib/librte_eal/bsdapp/eal/eal.c b/lib/librte_eal/bsdapp/eal/=
eal.c
> index 4eafcb5..ac23db5 100644
> --- a/lib/librte_eal/bsdapp/eal/eal.c
> +++ b/lib/librte_eal/bsdapp/eal/eal.c
> @@ -781,3 +781,23 @@ int rte_vfio_clear_group(__rte_unused int
> vfio_group_fd)
>  {
>  	return 0;
>  }
> +
> +int __rte_experimental
> +rte_vfio_get_group_num(__rte_unused const char *sysfs_base,
> +		       __rte_unused const char *dev_addr,
> +		       __rte_unused int *iommu_group_num)
> +{
> +	return -1;
> +}
> +
> +int  __rte_experimental
> +rte_vfio_get_container_fd(void)
> +{
> +	return -1;
> +}
> +
> +int  __rte_experimental
> +rte_vfio_get_group_fd(__rte_unused int iommu_group_num)
> +{
> +	return -1;
> +}

No function declarations for the above 3 global API. I guess compile will f=
ail in BSD.
You may include the rte_vfio.h in this file, and remove the dummy prototype=
.
My previous patch "eal/vfio: add support for multiple container" does this =
too.

BRs,
Xiao