From patchwork Sat Jun 1 01:49:02 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerin Jacob Kollanukkaran X-Patchwork-Id: 53995 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id DBF501BA42; Sat, 1 Jun 2019 03:50:29 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by dpdk.org (Postfix) with ESMTP id A60901B9A8 for ; Sat, 1 Jun 2019 03:50:28 +0200 (CEST) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x511lgs1003158; Fri, 31 May 2019 18:50:27 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=pfpt0818; bh=jiWT5QHScUCKPMSg/Psb/s+4xwac8obAKtGqZlCFPls=; b=VUGR2xQ6/HGLqCPpQaNu/MAlsOUCswbFUEhDiJ0BZ38/vhw5XIbWXfLvdhgyjW8ypsEB T+dHCog+e3LrXS6bpJdBsYAuPZoEy8UzTmo+pIb/wnAKnsr6o3ApLeYcofDiQDLFSEqr co99QMsLcnKYivGi9SJ27Lx88rGxCIFOnRaxKX6mOQYMyCsNLCNu1Sfp4RX3ij6fsWk4 Ijz3ZDWiZTLPKRy1VZ5OOXRTh85PP5MyqrxSdWsPxLp2Ss1iNhbrbAgg+HqggceMkl9S oLdZmVfGbl8UUig5Sy5uE0dfhEVKAtJgV2lzNk9gWnN76Ig0Onj+YVftrr80hLn/VPO3 wQ== Received: from sc-exch03.marvell.com ([199.233.58.183]) by mx0b-0016f401.pphosted.com with ESMTP id 2su5xh2bwd-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Fri, 31 May 2019 18:50:27 -0700 Received: from SC-EXCH01.marvell.com (10.93.176.81) by SC-EXCH03.marvell.com (10.93.176.83) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Fri, 31 May 2019 18:50:25 -0700 Received: from maili.marvell.com (10.93.176.43) by SC-EXCH01.marvell.com (10.93.176.81) with Microsoft SMTP Server id 15.0.1367.3 via Frontend Transport; Fri, 31 May 2019 18:50:25 -0700 Received: from jerin-lab.marvell.com (jerin-lab.marvell.com [10.28.34.14]) by maili.marvell.com (Postfix) with ESMTP id 667A03F7041; Fri, 31 May 2019 18:50:24 -0700 (PDT) From: To: , Jerin Jacob , Nithin Dabilpuram , Vamsi Attunuru CC: Olivier Matz , Pavan Nikhilesh Date: Sat, 1 Jun 2019 07:19:02 +0530 Message-ID: <20190601014905.45531-25-jerinj@marvell.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190601014905.45531-1-jerinj@marvell.com> References: <20190523081339.56348-1-jerinj@marvell.com> <20190601014905.45531-1-jerinj@marvell.com> MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-06-01_02:, , signatures=0 Subject: [dpdk-dev] [PATCH v2 24/27] mempool/octeontx2: add fast path mempool ops X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 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" From: Jerin Jacob Add enqueue and dequeue mempool fastpath operations. Cc: Olivier Matz Signed-off-by: Jerin Jacob Signed-off-by: Pavan Nikhilesh --- drivers/mempool/octeontx2/otx2_mempool_ops.c | 57 ++++++++++++++++++++ 1 file changed, 57 insertions(+) diff --git a/drivers/mempool/octeontx2/otx2_mempool_ops.c b/drivers/mempool/octeontx2/otx2_mempool_ops.c index 966b7d7f1..c59bd73c0 100644 --- a/drivers/mempool/octeontx2/otx2_mempool_ops.c +++ b/drivers/mempool/octeontx2/otx2_mempool_ops.c @@ -7,6 +7,61 @@ #include "otx2_mempool.h" +static int __hot +otx2_npa_enq(struct rte_mempool *mp, void * const *obj_table, unsigned int n) +{ + unsigned int index; const uint64_t aura_handle = mp->pool_id; + const uint64_t reg = npa_lf_aura_handle_to_aura(aura_handle); + const uint64_t addr = npa_lf_aura_handle_to_base(aura_handle) + + NPA_LF_AURA_OP_FREE0; + + for (index = 0; index < n; index++) + otx2_store_pair((uint64_t)obj_table[index], reg, addr); + + return 0; +} + +static __rte_noinline int +npa_lf_aura_op_alloc_one(const int64_t wdata, int64_t * const addr, + void **obj_table, uint8_t i) +{ + uint8_t retry = 4; + + do { + obj_table[i] = (void *)otx2_atomic64_add_nosync(wdata, addr); + if (obj_table[i] != NULL) + return 0; + + } while (retry--); + + return -ENOENT; +} + +static inline int __hot +otx2_npa_deq(struct rte_mempool *mp, void **obj_table, unsigned int n) +{ + const int64_t wdata = npa_lf_aura_handle_to_aura(mp->pool_id); + unsigned int index; + uint64_t obj; + + int64_t * const addr = (int64_t * const) + (npa_lf_aura_handle_to_base(mp->pool_id) + + NPA_LF_AURA_OP_ALLOCX(0)); + for (index = 0; index < n; index++, obj_table++) { + obj = npa_lf_aura_op_alloc_one(wdata, addr, obj_table, 0); + if (obj == 0) { + for (; index > 0; index--) { + obj_table--; + otx2_npa_enq(mp, obj_table, 1); + } + return -ENOENT; + } + *obj_table = (void *)obj; + } + + return 0; +} + static unsigned int otx2_npa_get_count(const struct rte_mempool *mp) { @@ -404,9 +459,11 @@ static struct rte_mempool_ops otx2_npa_ops = { .name = "octeontx2_npa", .alloc = otx2_npa_alloc, .free = otx2_npa_free, + .enqueue = otx2_npa_enq, .get_count = otx2_npa_get_count, .calc_mem_size = otx2_npa_calc_mem_size, .populate = otx2_npa_populate, + .dequeue = otx2_npa_deq, }; MEMPOOL_REGISTER_OPS(otx2_npa_ops);