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 B0FE8A0C4C; Sat, 4 Dec 2021 11:32:47 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 26E0F4013F; Sat, 4 Dec 2021 11:32:47 +0100 (CET) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id A339440041 for ; Sat, 4 Dec 2021 11:32:45 +0100 (CET) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.16.1.2/8.16.1.2) with ESMTP id 1B4APvbB011977 for ; Sat, 4 Dec 2021 02:32:43 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : mime-version : content-transfer-encoding : content-type; s=pfpt0220; bh=pOpSR9yG1//DH/YOUVt0XJH/VMxevoscwdoZi2cm0Bk=; b=b6TpaaIQYU6vFZpjHVmYDztqoyjZPQgegu0bmKOd04EQBsfTbC+du6VLjBPL8V/coZsT aY9xfQF/bl+d+JSGanO9K3B7LQYvFmZcGIzDP1ya4aTHF4erH+56c7eUBiE5vB4iFTSD MFZt6qXtBH7fLbk+2LFY/f5TWwywO5/modt6/RdojzVQW4kSM2y4htbqK7F75o2WQMqy JJQicYz0N2nUBJ4bnaxgV/i4podAP6mjsvBbJ1fpb4JokRHHJfPBGiAKUtcSXdXpzgMu iPA/cbspLE3N+ElAzw1W3KskmaMzHFnADhtaCDbQ71F6G+1rQg1mmMv3j/Msteo3FXgC vQ== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3cr6jrg0fa-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Sat, 04 Dec 2021 02:32:43 -0800 Received: from DC5-EXCH02.marvell.com (10.69.176.39) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Sat, 4 Dec 2021 02:32:41 -0800 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server id 15.0.1497.18 via Frontend Transport; Sat, 4 Dec 2021 02:32:41 -0800 Received: from lab-ci-142.marvell.com (unknown [10.28.36.142]) by maili.marvell.com (Postfix) with ESMTP id AA4123F7088; Sat, 4 Dec 2021 02:32:38 -0800 (PST) From: Ashwin Sekhar T K To: CC: , , , , , , , , , Subject: [PATCH] common/cnxk: enable lmtst burst for batch free Date: Sat, 4 Dec 2021 16:00:46 +0530 Message-ID: <20211204103046.3353646-1-asekhar@marvell.com> X-Mailer: git-send-email 2.32.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-GUID: T-pQ6kL1qWLwf7e72JWihJKx90-Cvail X-Proofpoint-ORIG-GUID: T-pQ6kL1qWLwf7e72JWihJKx90-Cvail X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.790,Hydra:6.0.425,FMLib:17.11.62.513 definitions=2021-12-04_02,2021-12-02_01,2021-12-02_01 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 Use lmtst burst when more than 15 pointers is requested to be freed. Signed-off-by: Ashwin Sekhar T K --- 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