[dpdk-dev] [EXT] Re: [PATCH] ethdev: fix DMA zone reserve not honoring size

Jerin Jacob Kollanukkaran jerinj at marvell.com
Tue Apr 2 02:47:49 CEST 2019


On Mon, 2019-04-01 at 10:30 +0300, Andrew Rybchenko wrote:
> External Email
> On 3/31/19 7:25 PM, Pavan Nikhilesh Bhagavatula wrote:
> > From: Pavan Nikhilesh <pbhagavatula at marvell.com>
> > 
> > The `rte_eth_dma_zone_reserve()` is generally used to create HW
> > rings.
> > In some scenarios when a driver needs to reconfigure the ring size
> > since the named memzone already exists it returns the previous
> > memzone
> > without checking if a different sized ring is requested.
> > 
> > Introduce a check to see if the ring size requested is different
> > from the
> > previously created memzone length.
> > 
> > Fixes: 719dbebceb81 ("xen: allow determining DOM0 at runtime")
> > Cc: stable at dpdk.org
> > 
> > Signed-off-by: Pavan Nikhilesh <pbhagavatula at marvell.com>
> > ---
> >  lib/librte_ethdev/rte_ethdev.c | 5 ++++-
> >  1 file changed, 4 insertions(+), 1 deletion(-)
> > 
> > diff --git a/lib/librte_ethdev/rte_ethdev.c
> > b/lib/librte_ethdev/rte_ethdev.c
> > index 12b66b68c..4ae12e43b 100644
> > --- a/lib/librte_ethdev/rte_ethdev.c
> > +++ b/lib/librte_ethdev/rte_ethdev.c
> > @@ -3604,9 +3604,12 @@ rte_eth_dma_zone_reserve(const struct
> > rte_eth_dev *dev, const char *ring_name,
> >  	}
> >  
> >  	mz = rte_memzone_lookup(z_name);
> > -	if (mz)
> > +	if (mz && (mz->len == size))
> >  		return mz;
> >  
> > +	if (mz)
> > +		rte_memzone_free(mz);
>  
> NACK
> I really don't like that API which should reserve does free if
> requested
> size does not match previously allocated.

Why? Is due to API name? If so,
Can we have rte_eth_dma_zone_reservere_with_resize() then ?
or any another name, You would like to have?

> I understand the motivation, but I don't think the solution is
> correct.

What you think it has correct solution then?
Obviously, We can not allocate max ring size in init time. 
If the NIC has support for 64K HW ring, We will be wasting too much as
it is per queue.


> 
> > +
> >  	return rte_memzone_reserve_aligned(z_name, size, socket_id,
> >  			RTE_MEMZONE_IOVA_CONTIG, align);
> >  }
>  


More information about the dev mailing list