From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <thomas@monjalon.net>
Received: from out5-smtp.messagingengine.com (out5-smtp.messagingengine.com
 [66.111.4.29]) by dpdk.org (Postfix) with ESMTP id AA6A42C5E
 for <dev@dpdk.org>; Tue, 27 Mar 2018 17:54:00 +0200 (CEST)
Received: from compute1.internal (compute1.nyi.internal [10.202.2.41])
 by mailout.nyi.internal (Postfix) with ESMTP id 2491D20B3B;
 Tue, 27 Mar 2018 11:54:00 -0400 (EDT)
Received: from mailfrontend1 ([10.202.2.162])
 by compute1.internal (MEProxy); Tue, 27 Mar 2018 11:54:00 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h=
 cc:content-transfer-encoding:content-type:date:from:in-reply-to
 :message-id:mime-version:references:subject:to:x-me-sender
 :x-me-sender:x-sasl-enc; s=mesmtp; bh=mMeNmyB6lAuaVVH5JUwHtcR2lN
 BhEh+atHOSlOAouQU=; b=Hx1B8U9JT8p4jSy7OP8hMWvzTkzCN+qG5APeyhtDWn
 Yu5u7dvlE1lZU0JN5strXh6mQMt1ZbClnXLtzyDMVFZ7KXiyqUFzRUiDY60dt4Uh
 svuZLqPo1xU7HeyDC4UkzNJ9Q/Zj56pQbr7LZAUB+cr3u1AFe44rPjBrr7rRPpyT
 w=
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=
 messagingengine.com; h=cc:content-transfer-encoding:content-type
 :date:from:in-reply-to:message-id:mime-version:references
 :subject:to:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; bh=mMeNmy
 B6lAuaVVH5JUwHtcR2lNBhEh+atHOSlOAouQU=; b=WiG35EUs/ny7sGlx1/oq1h
 pO29Jxeu7caYaaVrMaFO5rIPnJjaBK9WBxg1VSd7zEv+edHpXkEZi3+GupHDT9OD
 2Qs+wo9FeHyqS+JR57sh/eaqZIgDSJxCt4cl6XD7rMnuriCEqxsAUclWnwiKemTo
 BksbgacYjpy5OQLjWr6m2vaU/5OZe0G+z8cA7rvYEX3p2ykc0dsIO3aCfivF4H8N
 /Ec3ooMY4gZPJvQQHCC7AQi9aA9NNuSE35xQ4DejT8KqD2JLrGdHl6/UJs9iWpcw
 ygc/Rp0O49Jby0o80T8AdIrjXu9LWBbU6oX2rGU2XrYagVgW3yDmvtpxqnjmERTw
 ==
X-ME-Sender: <xms:GGm6Wp1F41vV8dmaksjYOc14Yw2hjjlikZsJYCPr3FRoX3Fsi6adQA>
Received: from xps.localnet (184.203.134.77.rev.sfr.net [77.134.203.184])
 by mail.messagingengine.com (Postfix) with ESMTPA id 4F5FCE4488;
 Tue, 27 Mar 2018 11:53:59 -0400 (EDT)
From: Thomas Monjalon <thomas@monjalon.net>
To: Hemant Agrawal <hemant.agrawal@nxp.com>
Cc: dev@dpdk.org, bruce.richardson@intel.com, anatoly.burakov@intel.comm,
 xiao.w.wang@intel.com, junjie.j.chen@intel.com
Date: Tue, 27 Mar 2018 17:53:44 +0200
Message-ID: <1882630.IHjtNmfOsM@xps>
In-Reply-To: <1521014434-3399-1-git-send-email-hemant.agrawal@nxp.com>
References: <1521014434-3399-1-git-send-email-hemant.agrawal@nxp.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 7Bit
Content-Type: text/plain; charset="us-ascii"
Subject: Re: [dpdk-dev] [PATCH] 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, 27 Mar 2018 15:54:00 -0000

14/03/2018 09:00, Hemant Agrawal:
> This patch moves some of the internal vfio functions from
> eal_vfio.h to rte_vfio.h for common uses with "rte_" prefix.
> 
> This patch also change the FSLMC bus usages from the internal
> VFIO functions to external ones with "rte_" prefix
> 
> Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
> ---
> --- a/lib/librte_eal/common/include/rte_vfio.h
> +++ b/lib/librte_eal/common/include/rte_vfio.h
> @@ -28,6 +28,12 @@
> +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 5, 0)
> +#define RTE_VFIO_NOIOMMU 8
> +#else
> +#define RTE_VFIO_NOIOMMU VFIO_NOIOMMU_IOMMU
> +#endif

I know this is just a move of an existing code,
but do you know why this check is against a version number (4.5.0),
instead of #ifdef VFIO_NOIOMMU_IOMMU which would be backport-safe?

> +/**
> + * Parse IOMMU group number for a device
> + *
> + * This function is only relevant to linux and will return
> + * an error on BSD.
> + *
> + * @return
> + *   1 on success
> + *   0 for non-existent group
> + *  <0 for errors
> + */
> +int __rte_experimental
> +rte_vfio_get_group_no(const char *sysfs_base,
> +		const char *dev_addr, int *iommu_group_no);
> +
> +/**
> + * Open VFIO container fd or get an existing one
> + *
> + * This function is only relevant to linux and will return
> + * an error on BSD.
> + *
> + * @return
> + *  > 0 container fd
> + *  < 0 for errors
> + */
> +int __rte_experimental
> +rte_vfio_get_container_fd(void);
> +
> +/**
> + * Open VFIO group fd or get an existing one
> + *
> + * This function is only relevant to linux and will return
> + * an error on BSD.
> + *
> + * @return
> + *  > 0 group fd
> + *  < 0 for errors
> + */
> +int __rte_experimental
> +rte_vfio_get_group_fd(int iommu_group_no);

All these new functions should have some @param documentation.

This file is not included in doxygen, probably because @file is missing.

About the naming, are you sure about "group_no" instead of "group_num"?

> --- a/lib/librte_eal/rte_eal_version.map
> +++ b/lib/librte_eal/rte_eal_version.map
> @@ -254,5 +254,8 @@ EXPERIMENTAL {
>  	rte_service_set_runstate_mapped_check;
>  	rte_service_set_stats_enable;
>  	rte_service_start_with_defaults;
> +        rte_vfio_get_group_no;
> +        rte_vfio_get_container_fd;
> +        rte_vfio_get_group_fd;

Please indent with tabs.