[dpdk-dev] [PATCH 1/6] vfio: allow DMA map of memory for the default vfio fd

Shahaf Shuler shahafs at mellanox.com
Wed Feb 13 16:23:49 CET 2019


Wednesday, February 13, 2019 11:45 AM, Gaëtan Rivet:
> Subject: Re: [PATCH 1/6] vfio: allow DMA map of memory for the default vfio
> fd
> 
> Hello Shahaf,

Hi Gaetan.

> 
> On Wed, Feb 13, 2019 at 11:10:21AM +0200, Shahaf Shuler wrote:
> > Enable users the option to call rte_vfio_dma_map with request to map
> > to the default vfio fd.
> >
> > Signed-off-by: Shahaf Shuler <shahafs at mellanox.com>
> > ---
> >  lib/librte_eal/common/include/rte_vfio.h |  6 ++++--
> >  lib/librte_eal/linuxapp/eal/eal_vfio.c   | 14 ++++++++++++--
> >  2 files changed, 16 insertions(+), 4 deletions(-)
> >
> 

[...]

> Can you use:
> 
> vfio_cfg = default_vfio_cfg;
> 
> instead? Then the comment is redundant.
> Actually, to keep with my comment above, it might be better to simply have
> 
>     if (container_fd == RTE_VFIO_DEFAULT_CONTAINER_FD)
>             vfio_cfg = default_vfio_cfg;
>     else
>             vfio_cfg = get_vfio_cfg_by_group_num(container_fd);
> 

Good suggestion. Will adjust in v2. 

> >  	if (vfio_cfg == NULL) {
> >  		RTE_LOG(ERR, EAL, "Invalid container fd\n");
> >  		return -1;
> > @@ -1917,7 +1922,12 @@ rte_vfio_container_dma_unmap(int
> container_fd, uint64_t vaddr, uint64_t iova,
> >  		return -1;
> >  	}
> >
> > -	vfio_cfg = get_vfio_cfg_by_container_fd(container_fd);
> > +	if (container_fd > 0) {
> > +		vfio_cfg = get_vfio_cfg_by_container_fd(container_fd);
> > +	} else {
> > +		/* when no fd provided use the default. */
> > +		vfio_cfg = &vfio_cfgs[0];
> > +	}
> >  	if (vfio_cfg == NULL) {
> >  		RTE_LOG(ERR, EAL, "Invalid container fd\n");
> >  		return -1;
> > --
> > 2.12.0
> >
> 
> --
> Gaëtan Rivet
> 6WIND


More information about the dev mailing list