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 BBBB3A04A6; Wed, 19 Jan 2022 13:06:32 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A2A7541148; Wed, 19 Jan 2022 13:06:32 +0100 (CET) Received: from mail-il1-f176.google.com (mail-il1-f176.google.com [209.85.166.176]) by mails.dpdk.org (Postfix) with ESMTP id DD79E4013F for ; Wed, 19 Jan 2022 13:06:30 +0100 (CET) Received: by mail-il1-f176.google.com with SMTP id x15so1973141ilc.5 for ; Wed, 19 Jan 2022 04:06:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=p96OH0+jJU0cStyrs2ljONuO5d/czMAoA8aulDjyXwY=; b=LELodp17B3Ux7/o/M+QWfHivjXhcOUL4r0mvUQD7qjuwmH36X7XAt06sNzot4g+O25 u/P0CPM9nFFkG5qEJ6WdLUaka8dY5Uz+RiHswv69UOMg2N8WxT+zP5XJfJqFqHUDD1iW H2iISafmbkCsAsTXgmLX4QdGwplfnmmV2WveZn4l1rYtzQAFNchET+2qekfk1BWBLksY saGJkRHJR7S4/9DkTpk0G/Z2g1VP5P5V/U7JG/NoLTaMHxicQlLU+pKLZ7RgFeqVlD2a 0fSWjMH9gM6b548viIVn3JAPMmp/DVut5VDotCb/ryJqgMUcwMp5hSoJRX3sHeqcWDiv ot1A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=p96OH0+jJU0cStyrs2ljONuO5d/czMAoA8aulDjyXwY=; b=GyLey6eGQwEng2dO8tYcN1QTk6d4jC90W+6h1vaJArPDlYmwaedzAcDp2FOR92XLxs MN+siS9gfSk3HEGPFDLPQRiwBjktvJrHA+hqbwn1Scj3a97RkAYh8B6YpYngXHadewZ4 4f5CNm+t/ApO80xRabEzrepwNxMUB7neSyv1nJmCKQ7Idmu0tL0ffi7seg1o9ooINWFg rPiWuGn0enL7Q6m+IKKWCtMMMsYJyHCwnyAYmN5xD18bi/pQcxh2c2+wejEX2WDXJR4c KXKeurhQAcGN8ODrqImpCz+T/GzquriyGUd9YLA2DicZx2cmrInIWbZLADDt033B+61y dndg== X-Gm-Message-State: AOAM531JXjj3PPxzQwNiSyufX/6B9MYwNYz9rFsrpX6igKnIP44Rs5Qn Wbkcevwugrvo9GRYbKGRge3H4Ex3RSvlgXLPeGyJwuykwkms6Q== X-Google-Smtp-Source: ABdhPJxJGXrgcC7wjz1fSZZmhEN95njX8PIHgxdN4alJ4uv9WoKKJzwMNz9Xs2gkMrBhDiP5affzYT1MLW2WVBTXl7M= X-Received: by 2002:a05:6e02:1a2c:: with SMTP id g12mr16968740ile.192.1642593990199; Wed, 19 Jan 2022 04:06:30 -0800 (PST) MIME-Version: 1.0 References: <20211204103046.3353646-1-asekhar@marvell.com> In-Reply-To: <20211204103046.3353646-1-asekhar@marvell.com> From: Jerin Jacob Date: Wed, 19 Jan 2022 17:36:04 +0530 Message-ID: Subject: Re: [PATCH] common/cnxk: enable lmtst burst for batch free To: Ashwin Sekhar T K , Ferruh Yigit Cc: dpdk-dev , Nithin Dabilpuram , Jerin Jacob , Sunil Kumar Kori , Satha Koteswara Rao Kottidi , Pavan Nikhilesh , Kiran Kumar K , Satheesh Paul , Anoob Joseph , Akhil Goyal Content-Type: text/plain; charset="UTF-8" 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 On Sat, Dec 4, 2021 at 4:02 PM Ashwin Sekhar T K wrote: > > Use lmtst burst when more than 15 pointers is requested > to be freed. > > Signed-off-by: Ashwin Sekhar T K Acked-by: Jerin Jacob Applied to dpdk-next-net-mrvl/for-next-net. Thanks Changed the commit as: common/cnxk: enable LMTST burst for batch free Use LMTST burst as a performance optimization when more than 15 pointers are requested to be freed. Signed-off-by: Ashwin Sekhar T K Acked-by: Jerin Jacob > --- > drivers/common/cnxk/roc_npa.h | 86 +++++++++++++++++++++++++++-------- > 1 file changed, 68 insertions(+), 18 deletions(-) > > diff --git a/drivers/common/cnxk/roc_npa.h b/drivers/common/cnxk/roc_npa.h > index 46350fdb48..dfe6e5318f 100644 > --- a/drivers/common/cnxk/roc_npa.h > +++ b/drivers/common/cnxk/roc_npa.h > @@ -10,7 +10,8 @@ > > #define ROC_NPA_MAX_BLOCK_SZ (128 * 1024) > #define ROC_CN10K_NPA_BATCH_ALLOC_MAX_PTRS 512 > -#define ROC_CN10K_NPA_BATCH_FREE_MAX_PTRS 15 > +#define ROC_CN10K_NPA_BATCH_FREE_MAX_PTRS 15U > +#define ROC_CN10K_NPA_BATCH_FREE_BURST_MAX 16U > > /* This value controls how much of the present average resource level is used to > * calculate the new resource level. > @@ -362,9 +363,6 @@ roc_npa_aura_batch_free(uint64_t aura_handle, uint64_t const *buf, > volatile uint64_t *lmt_data; > unsigned int i; > > - if (num > ROC_CN10K_NPA_BATCH_FREE_MAX_PTRS) > - return; > - > lmt_data = (uint64_t *)lmt_addr; > > addr = roc_npa_aura_handle_to_base(aura_handle) + > @@ -379,10 +377,8 @@ roc_npa_aura_batch_free(uint64_t aura_handle, uint64_t const *buf, > * ----------------------------------------- > */ > free0 = roc_npa_aura_handle_to_aura(aura_handle); > - if (fabs) > - free0 |= (0x1UL << 63); > - if (num & 0x1) > - free0 |= (0x1UL << 32); > + free0 |= ((uint64_t)!!fabs << 63); > + free0 |= ((uint64_t)(num & 0x1) << 32); > > /* tar_addr[4:6] is LMTST size-1 in units of 128b */ > tar_addr = addr | ((num >> 1) << 4); > @@ -396,23 +392,77 @@ roc_npa_aura_batch_free(uint64_t aura_handle, uint64_t const *buf, > } > > static inline void > -roc_npa_aura_op_batch_free(uint64_t aura_handle, uint64_t const *buf, > - unsigned int num, const int fabs, uint64_t lmt_addr, > - uint64_t lmt_id) > +roc_npa_aura_batch_free_burst(uint64_t aura_handle, uint64_t const *buf, > + unsigned int num, const int fabs, > + uint64_t lmt_addr, uint64_t lmt_id) > { > - unsigned int chunk; > + uint64_t addr, tar_addr, free0, send_data, lmtline; > + uint64_t *lmt_data; > + > + /* 63 52 51 20 19 7 6 4 3 0 > + * ---------------------------------------- > + * | RSVD | ADDR | RSVD | LMTST SZ(0) | 0 | > + * ---------------------------------------- > + */ > + addr = roc_npa_aura_handle_to_base(aura_handle) + > + NPA_LF_AURA_BATCH_FREE0; > + tar_addr = addr | (0x7 << 4); > + > + /* 63 63 62 33 32 32 31 20 19 0 > + * ----------------------------------------- > + * | FABS | Rsvd | COUNT_EOT | Rsvd | AURA | > + * ----------------------------------------- > + */ > + free0 = roc_npa_aura_handle_to_aura(aura_handle); > + free0 |= ((uint64_t)!!fabs << 63); > + free0 |= (0x1UL << 32); > > + /* Fill the lmt lines */ > + lmt_data = (uint64_t *)lmt_addr; > + lmtline = 0; > while (num) { > - chunk = (num >= ROC_CN10K_NPA_BATCH_FREE_MAX_PTRS) ? > - ROC_CN10K_NPA_BATCH_FREE_MAX_PTRS : > - num; > + lmt_data[lmtline * 16] = free0; > + memcpy(&lmt_data[(lmtline * 16) + 1], buf, > + ROC_CN10K_NPA_BATCH_FREE_MAX_PTRS * sizeof(uint64_t)); > + lmtline++; > + num -= ROC_CN10K_NPA_BATCH_FREE_MAX_PTRS; > + buf += ROC_CN10K_NPA_BATCH_FREE_MAX_PTRS; > + } > > - roc_npa_aura_batch_free(aura_handle, buf, chunk, fabs, lmt_addr, > - lmt_id); > + /* 63 19 18 16 15 12 11 11 10 0 > + * --------------------------------------------------------------- > + * | LMTST SZ(15) ... LMTST SZ(1) | Rsvd | CNTM1 | Rsvd | LMT_ID | > + * --------------------------------------------------------------- > + */ > + send_data = lmt_id | ((lmtline - 1) << 12) | (0x1FFFFFFFFFFFUL << 19); > + roc_lmt_submit_steorl(send_data, tar_addr); > + plt_io_wmb(); > +} > > +static inline void > +roc_npa_aura_op_batch_free(uint64_t aura_handle, uint64_t const *buf, > + unsigned int num, const int fabs, uint64_t lmt_addr, > + uint64_t lmt_id) > +{ > + unsigned int max_burst, chunk, bnum; > + > + max_burst = ROC_CN10K_NPA_BATCH_FREE_MAX_PTRS * > + ROC_CN10K_NPA_BATCH_FREE_BURST_MAX; > + bnum = num / ROC_CN10K_NPA_BATCH_FREE_MAX_PTRS; > + bnum *= ROC_CN10K_NPA_BATCH_FREE_MAX_PTRS; > + num -= bnum; > + > + while (bnum) { > + chunk = (bnum >= max_burst) ? max_burst : bnum; > + roc_npa_aura_batch_free_burst(aura_handle, buf, chunk, fabs, > + lmt_addr, lmt_id); > buf += chunk; > - num -= chunk; > + bnum -= chunk; > } > + > + if (num) > + roc_npa_aura_batch_free(aura_handle, buf, num, fabs, lmt_addr, > + lmt_id); > } > > static inline unsigned int > -- > 2.32.0 >