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 46BB4A0547; Fri, 5 Mar 2021 14:42:15 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 2B0D322A3A1; Fri, 5 Mar 2021 14:40:15 +0100 (CET) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id E8B6C22A39F for ; Fri, 5 Mar 2021 14:40:13 +0100 (CET) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 125DUnY7018424 for ; Fri, 5 Mar 2021 05:40:13 -0800 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-type; s=pfpt0220; bh=dNQwzv1+2rsN9VZrly/h2fKVz/6gNXddiFSuvM75WO8=; b=dDihHPNWTWW12Tx3tYzggtfcqfIp3IT6+J21D4Fr85DnTfuytgXQ0Jkrde4CLXAChPKl xfaXjjYgpgWZeqmBhTIvU9pV50B4VxXdwageNBJng/RIvB8GqgN0T1piKsaMNskfFgXY NjsdQ6wNKBWmqILlC9tPbtSrQPxgTN3eSqvOiyRF2GZ+LzaXtHp6o2BQHmd7sn9THDCz VIvPKjUL9P03QFXCzTQtAxho3qhgtf4smMuQkoAAZru+m16pYur9bNzOiUx0sJYlSf70 /xGaaX+QgrqWMIiQ2nnLLbI74QxC1Abt5Wvp99GuYf4OXZ1aAtEOxvo5nJbLWdTQFfeL YQ== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0a-0016f401.pphosted.com with ESMTP id 372s2umrms-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Fri, 05 Mar 2021 05:40:13 -0800 Received: from SC-EXCH01.marvell.com (10.93.176.81) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Fri, 5 Mar 2021 05:40:11 -0800 Received: from DC5-EXCH02.marvell.com (10.69.176.39) by SC-EXCH01.marvell.com (10.93.176.81) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Fri, 5 Mar 2021 05:40:11 -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.2 via Frontend Transport; Fri, 5 Mar 2021 05:40:11 -0800 Received: from hyd1588t430.marvell.com (unknown [10.29.52.204]) by maili.marvell.com (Postfix) with ESMTP id D5F2A3F7041; Fri, 5 Mar 2021 05:40:08 -0800 (PST) From: Nithin Dabilpuram To: CC: , , , , , , Date: Fri, 5 Mar 2021 19:08:40 +0530 Message-ID: <20210305133918.8005-15-ndabilpuram@marvell.com> X-Mailer: git-send-email 2.8.4 In-Reply-To: <20210305133918.8005-1-ndabilpuram@marvell.com> References: <20210305133918.8005-1-ndabilpuram@marvell.com> MIME-Version: 1.0 Content-Type: text/plain X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.369, 18.0.761 definitions=2021-03-05_08:2021-03-03, 2021-03-05 signatures=0 Subject: [dpdk-dev] [PATCH 14/52] common/cnxk: add npa performance counter support 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" From: Ashwin Sekhar T K Add APIs to read NPA performance counters. Signed-off-by: Ashwin Sekhar T K --- drivers/common/cnxk/roc_npa.c | 50 +++++++++++++++++++++++++++++++++++++++++ drivers/common/cnxk/roc_npa.h | 37 ++++++++++++++++++++++++++++++ drivers/common/cnxk/version.map | 1 + 3 files changed, 88 insertions(+) diff --git a/drivers/common/cnxk/roc_npa.c b/drivers/common/cnxk/roc_npa.c index f747a9b..c4bcad7 100644 --- a/drivers/common/cnxk/roc_npa.c +++ b/drivers/common/cnxk/roc_npa.c @@ -131,6 +131,56 @@ npa_aura_pool_fini(struct mbox *mbox, uint32_t aura_id, uint64_t aura_handle) return 0; } +int +roc_npa_pool_op_pc_reset(uint64_t aura_handle) +{ + struct npa_lf *lf = idev_npa_obj_get(); + struct npa_aq_enq_req *pool_req; + struct npa_aq_enq_rsp *pool_rsp; + struct ndc_sync_op *ndc_req; + struct mbox_dev *mdev; + int rc = -ENOSPC, off; + struct mbox *mbox; + + if (lf == NULL) + return NPA_ERR_PARAM; + + mbox = lf->mbox; + mdev = &mbox->dev[0]; + plt_npa_dbg("lf=%p aura_handle=0x%" PRIx64, lf, aura_handle); + + pool_req = mbox_alloc_msg_npa_aq_enq(mbox); + if (pool_req == NULL) + return rc; + pool_req->aura_id = roc_npa_aura_handle_to_aura(aura_handle); + pool_req->ctype = NPA_AQ_CTYPE_POOL; + pool_req->op = NPA_AQ_INSTOP_WRITE; + pool_req->pool.op_pc = 0; + pool_req->pool_mask.op_pc = ~pool_req->pool_mask.op_pc; + + rc = mbox_process(mbox); + if (rc < 0) + return rc; + + off = mbox->rx_start + + PLT_ALIGN(sizeof(struct mbox_hdr), MBOX_MSG_ALIGN); + pool_rsp = (struct npa_aq_enq_rsp *)((uintptr_t)mdev->mbase + off); + + if (pool_rsp->hdr.rc != 0) + return NPA_ERR_AURA_POOL_FINI; + + /* Sync NDC-NPA for LF */ + ndc_req = mbox_alloc_msg_ndc_sync_op(mbox); + if (ndc_req == NULL) + return -ENOSPC; + ndc_req->npa_lf_sync = 1; + rc = mbox_process(mbox); + if (rc) { + plt_err("Error on NDC-NPA LF sync, rc %d", rc); + return NPA_ERR_AURA_POOL_FINI; + } + return 0; +} static inline char * npa_stack_memzone_name(struct npa_lf *lf, int pool_id, char *name) { diff --git a/drivers/common/cnxk/roc_npa.h b/drivers/common/cnxk/roc_npa.h index ed63718..a7815e5 100644 --- a/drivers/common/cnxk/roc_npa.h +++ b/drivers/common/cnxk/roc_npa.h @@ -146,6 +146,40 @@ roc_npa_aura_op_available(uint64_t aura_handle) return reg & 0xFFFFFFFFF; } +static inline uint64_t +roc_npa_pool_op_performance_counter(uint64_t aura_handle, const int drop) +{ + union { + uint64_t u; + struct npa_aura_op_wdata_s s; + } op_wdata; + int64_t *addr; + uint64_t reg; + + op_wdata.u = 0; + op_wdata.s.aura = roc_npa_aura_handle_to_aura(aura_handle); + if (drop) + op_wdata.s.drop |= BIT_ULL(63); /* DROP */ + + addr = (int64_t *)(roc_npa_aura_handle_to_base(aura_handle) + + NPA_LF_POOL_OP_PC); + + reg = roc_atomic64_add_nosync(op_wdata.u, addr); + /* + * NPA_LF_POOL_OP_PC Read Data + * + * 63 49 48 48 47 0 + * ----------------------------- + * | Reserved | OP_ERR | OP_PC | + * ----------------------------- + */ + + if (reg & BIT_ULL(48) /* OP_ERR */) + return 0; + else + return reg & 0xFFFFFFFFFFFF; +} + static inline void roc_npa_aura_op_bulk_free(uint64_t aura_handle, uint64_t const *buf, unsigned int num, const int fabs) @@ -396,4 +430,7 @@ void __roc_api roc_npa_aura_op_range_set(uint64_t aura_handle, int __roc_api roc_npa_ctx_dump(void); int __roc_api roc_npa_dump(void); +/* Reset operation performance counter. */ +int __roc_api roc_npa_pool_op_pc_reset(uint64_t aura_handle); + #endif /* _ROC_NPA_H_ */ diff --git a/drivers/common/cnxk/version.map b/drivers/common/cnxk/version.map index 114034e..02dc3df 100644 --- a/drivers/common/cnxk/version.map +++ b/drivers/common/cnxk/version.map @@ -20,6 +20,7 @@ INTERNAL { roc_npa_dump; roc_npa_pool_create; roc_npa_pool_destroy; + roc_npa_pool_op_pc_reset; roc_npa_pool_range_update_check; local: *; -- 2.8.4