On Fri, Mar 5, 2021 at 11:43 PM Ashwin Sekhar T K <[email protected]> wrote:
>
> Add generic cnxk mempool ops.
>
> Signed-off-by: Ashwin Sekhar T K <[email protected]>
> ---
> +int
> +cnxk_mempool_alloc(struct rte_mempool *mp)
> +{
> + uint64_t aura_handle = 0;
> + struct npa_aura_s aura;
> + struct npa_pool_s pool;
> + uint32_t block_count;
> + size_t block_size;
> + int rc = -ERANGE;
> +
> + block_size = mp->elt_size + mp->header_size + mp->trailer_size;
> + block_count = mp->size;
> + if (mp->header_size % ROC_ALIGN != 0) {
> + plt_err("Header size should be multiple of %dB", ROC_ALIGN);
> + goto error;
> + }
> +
> + if (block_size % ROC_ALIGN != 0) {
> + plt_err("Block size should be multiple of %dB", ROC_ALIGN);
> + goto error;
> + }
> +
> + memset(&aura, 0, sizeof(struct npa_aura_s));
> + memset(&pool, 0, sizeof(struct npa_pool_s));
> + pool.nat_align = 1;
> + /* TODO: Check whether to allow buf_offset > 1 ?? */
Please fix up this TODO.
> + pool.buf_offset = mp->header_size / ROC_ALIGN;
> +