[dpdk-dev] [PATCH v7 7/8] mempool: introduce block size align flag
olivier.matz at 6wind.com
Mon Oct 2 16:26:36 CEST 2017
On Sun, Oct 01, 2017 at 02:59:01PM +0530, Santosh Shukla wrote:
> Some mempool hw like octeontx/fpa block, demands block size
> (/total_elem_sz) aligned object start address.
> Introducing an MEMPOOL_F_CAPA_BLK_ALIGNED_OBJECTS flag.
> If this flag is set:
> - Align object start address(vaddr) to a multiple of total_elt_sz.
> - Allocate one additional object. Additional object is needed to make
> sure that requested 'n' object gets correctly populated.
> - Let's say that we get 'x' size of memory chunk from memzone.
> - And application has requested 'n' object from mempool.
> - Ideally, we start using objects at start address 0 to...(x-block_sz)
> for n obj.
> - Not necessarily first object address i.e. 0 is aligned to block_sz.
> - So we derive 'offset' value for block_sz alignment purpose i.e..'off'.
> - That 'off' makes sure that start address of object is blk_sz aligned.
> - Calculating 'off' may end up sacrificing first block_sz area of
> memzone area x. So total number of the object which can fit in the
> pool area is n-1, Which is incorrect behavior.
> Therefore we request one additional object (/block_sz area) from memzone
> when MEMPOOL_F_CAPA_BLK_ALIGNED_OBJECTS flag is set.
> Signed-off-by: Santosh Shukla <santosh.shukla at caviumnetworks.com>
> Signed-off-by: Jerin Jacob <jerin.jacob at caviumnetworks.com>
> Tested-by: Hemant Agrawal <hemant.agrawal at nxp.com>
Acked-by: Olivier Matz <olivier.matz at 6wind.com>
More information about the dev