From: Jerin Jacob <jerinjacobk@gmail.com>
To: Pavan Nikhilesh <pbhagavatula@marvell.com>
Cc: Jerin Jacob <jerinj@marvell.com>,
Nithin Dabilpuram <ndabilpuram@marvell.com>,
dpdk-dev <dev@dpdk.org>
Subject: Re: [dpdk-dev] [PATCH 1/2] mempool/octeontx2: fix shift calculation
Date: Thu, 1 Jul 2021 12:12:39 +0530 [thread overview]
Message-ID: <CALBAE1PeG57uBqHAuc0S_8_hrh4uNTUFUkrzioV_Q8MCXhv+Vw@mail.gmail.com> (raw)
In-Reply-To: <20210614192426.2978-1-pbhagavatula@marvell.com>
On Tue, Jun 15, 2021 at 12:54 AM <pbhagavatula@marvell.com> wrote:
>
> From: Pavan Nikhilesh <pbhagavatula@marvell.com>
>
> Shift is used to generate an 8-bit saturate value from the current
> aura used count. The shift value should be derived from the log2 of
> block count if it is greater than 256 else the shift should be 0.
>
> Fixes: 7bcc47cbe2fa ("mempool/octeontx2: add mempool alloc op")
Cc: stable@dpdk.og
>
> Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
Series applied to dpdk-next-net-eventdev/for-main. Thanks
> ---
> drivers/mempool/octeontx2/otx2_mempool_ops.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/mempool/octeontx2/otx2_mempool_ops.c b/drivers/mempool/octeontx2/otx2_mempool_ops.c
> index 9ff71bcf6b..d827fd8c7b 100644
> --- a/drivers/mempool/octeontx2/otx2_mempool_ops.c
> +++ b/drivers/mempool/octeontx2/otx2_mempool_ops.c
> @@ -611,7 +611,8 @@ npa_lf_aura_pool_pair_alloc(struct otx2_npa_lf *lf, const uint32_t block_size,
> /* Update aura fields */
> aura->pool_addr = pool_id;/* AF will translate to associated poolctx */
> aura->ena = 1;
> - aura->shift = __builtin_clz(block_count) - 8;
> + aura->shift = rte_log2_u32(block_count);
> + aura->shift = aura->shift < 8 ? 0 : aura->shift - 8;
> aura->limit = block_count;
> aura->pool_caching = 1;
> aura->err_int_ena = BIT(NPA_AURA_ERR_INT_AURA_ADD_OVER);
> @@ -626,7 +627,8 @@ npa_lf_aura_pool_pair_alloc(struct otx2_npa_lf *lf, const uint32_t block_size,
> pool->ena = 1;
> pool->buf_size = block_size / OTX2_ALIGN;
> pool->stack_max_pages = stack_size;
> - pool->shift = __builtin_clz(block_count) - 8;
> + pool->shift = rte_log2_u32(block_count);
> + pool->shift = pool->shift < 8 ? 0 : pool->shift - 8;
> pool->ptr_start = 0;
> pool->ptr_end = ~0;
> pool->stack_caching = 1;
> --
> 2.17.1
>
prev parent reply other threads:[~2021-07-01 6:43 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-14 19:24 pbhagavatula
2021-06-14 19:24 ` [dpdk-dev] [PATCH 2/2] event/octeontx2: configure aura backpressure pbhagavatula
2021-07-01 6:42 ` Jerin Jacob [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CALBAE1PeG57uBqHAuc0S_8_hrh4uNTUFUkrzioV_Q8MCXhv+Vw@mail.gmail.com \
--to=jerinjacobk@gmail.com \
--cc=dev@dpdk.org \
--cc=jerinj@marvell.com \
--cc=ndabilpuram@marvell.com \
--cc=pbhagavatula@marvell.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).