From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 2051AA0A0C; Thu, 1 Jul 2021 08:43:08 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id BC90D40141; Thu, 1 Jul 2021 08:43:07 +0200 (CEST) Received: from mail-io1-f47.google.com (mail-io1-f47.google.com [209.85.166.47]) by mails.dpdk.org (Postfix) with ESMTP id 9809F40040 for ; Thu, 1 Jul 2021 08:43:06 +0200 (CEST) Received: by mail-io1-f47.google.com with SMTP id i189so6231673ioa.8 for ; Wed, 30 Jun 2021 23:43:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=LnNaUKHhvyLXrRy3njAEF8RDlbBAvj8MphyeOGF0W1E=; b=JUzVlxliBsZuVtptEUfuA9LKS8E32udjpXn42fOK0a+h8c18VkG7QKkiEFc/ul+YV1 0DR1XiOpK4q0wkvcTJmYedLai9iX1F8ecTMDpS1+3tTfYmSyuB3b+EteFTE0wM2xCl73 oVXcdZRcwMGuGGMcq/r4T1M1SxWkRpgtaNeoBRcbjo1Lkk9cjzPrlJOhXM7huJeA9UDm JgUViSM/05u7fpe8Q0eJuPqQia38Rrg+YOJuVI67Qxji7qlHPYyslDR05FrMDRgaS4os UPDey9IGxR7cDtygDQwa5ctEnuzv77TW+dKOuHVTOzJOo3IWF6oCZDlk3Pj8MJwa9/3V cWgw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=LnNaUKHhvyLXrRy3njAEF8RDlbBAvj8MphyeOGF0W1E=; b=YeLGGc1B8p33NRCXmyR4VDT7czUYzLbczWPb4Qjf+9j/bcFZ6quvNjxQMYR9kG3EFL jlSROs3iuggv+fP5PfpR5PUmyJWqW63PUR7dLbxjmSVnUlMPJyMiwPTYQlDrLbI3grcP i8DRcTfghOJCmDYyTMeDPrKjxJzd1NythLB5Watn4g+XlkU+k/k5Y25/MdqBfxp2nAzn nbmdnB4tO9qvcJjtMndbNdC3W99u+h1PkIoJVI7SHaxf6AVpXJ7fB8JtIUGDRajFGXoj eAL/X32bkilfDGITptAXaf9UCogJFgp7nDME8+yDpl8IEsKiR4mr52xul/UbV59tZ9gQ kCfg== X-Gm-Message-State: AOAM531tl51Qewd8X2pXFOPgfZDDbmUQVoZVGms5P/qLQXJT0j4P8BZc d1p3wD/xrdx7jNgA9WkSy9qmzIFS2/oMeggZBls= X-Google-Smtp-Source: ABdhPJzU2AAf+10ttJ9uwGRH6vxwy/6dz3/JY3mv2LNPNJCZkPw1xoB8P86nwKUqeu/FgQfKJO3WY1jN7j8X0Xpr98w= X-Received: by 2002:a6b:7702:: with SMTP id n2mr11012400iom.1.1625121785921; Wed, 30 Jun 2021 23:43:05 -0700 (PDT) MIME-Version: 1.0 References: <20210614192426.2978-1-pbhagavatula@marvell.com> In-Reply-To: <20210614192426.2978-1-pbhagavatula@marvell.com> From: Jerin Jacob Date: Thu, 1 Jul 2021 12:12:39 +0530 Message-ID: To: Pavan Nikhilesh Cc: Jerin Jacob , Nithin Dabilpuram , dpdk-dev Content-Type: text/plain; charset="UTF-8" Subject: Re: [dpdk-dev] [PATCH 1/2] mempool/octeontx2: fix shift calculation X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On Tue, Jun 15, 2021 at 12:54 AM wrote: > > From: Pavan Nikhilesh > > 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 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 >