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 5DFE8A0524; Wed, 2 Jun 2021 17:57:22 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id CC2E5410F1; Wed, 2 Jun 2021 17:57:13 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by mails.dpdk.org (Postfix) with ESMTP id DF0DA410E5 for ; Wed, 2 Jun 2021 17:57:11 +0200 (CEST) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 152FpJOP019770; Wed, 2 Jun 2021 08:57:11 -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=pfpt0220; bh=5KZzawirqyIqAd3mkDq1ZV7bEpe3l2AoHi1ibbFHRyE=; b=egs/22+vTSPt8/F9uofwsGOFCNnqNFuiyknEjyK1Au888sxhcf5HoHJQHPCDFEkhRCQN cD7zuq74AGk+9Kaw935A/rB7b/gPW1N+k2rFQMSFkcHsHg/vXsjgAR6nmIZ93ifhSc90 P5R+YKG449D1SxEQFp6zJOABLSQpg0LUZD3n60Jw2spK8my4kf3VAIjrrC48ibisVxm0 SgdV2jCpEJ1tQYCNW7oM/dKki3+AkuZLY24Ut5SuqBrXdn7fLw/gb/6RTu1VLW6Sn5Dd /bexO9gE+gh90nDozZJ5CBcGg/WKP2wXmjF+qMIRRQQWs6aHqwvlVBVOl5F6vjwFNMT/ 6w== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0b-0016f401.pphosted.com with ESMTP id 38wufguhdb-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Wed, 02 Jun 2021 08:57:11 -0700 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 2 Jun 2021 08:57:09 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Wed, 2 Jun 2021 08:57:08 -0700 Received: from HY-LT1002.marvell.com (unknown [10.193.70.1]) by maili.marvell.com (Postfix) with ESMTP id F117C3F7040; Wed, 2 Jun 2021 08:57:05 -0700 (PDT) From: Anoob Joseph To: Akhil Goyal , Thomas Monjalon CC: Aakash Sasidharan , Jerin Jacob , Ankur Dwivedi , Tejasree Kondoj , , Srujana Challa Date: Wed, 2 Jun 2021 21:26:19 +0530 Message-ID: <1622649385-22652-6-git-send-email-anoobj@marvell.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1622649385-22652-1-git-send-email-anoobj@marvell.com> References: <1622649385-22652-1-git-send-email-anoobj@marvell.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-ORIG-GUID: 28-CszBA2hlHt_oW4B-bIqdk345EDUMp X-Proofpoint-GUID: 28-CszBA2hlHt_oW4B-bIqdk345EDUMp X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.391, 18.0.761 definitions=2021-06-02_08:2021-06-02, 2021-06-02 signatures=0 Subject: [dpdk-dev] [PATCH 05/11] common/cnxk: add CPT diagnostics 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: Aakash Sasidharan Add routines to fetch and dump CPT statistics and states. Signed-off-by: Aakash Sasidharan Signed-off-by: Srujana Challa --- drivers/common/cnxk/roc_cpt.c | 182 ++++++++++++++++++++++++++++++++++++++++ drivers/common/cnxk/roc_cpt.h | 2 + drivers/common/cnxk/version.map | 2 + 3 files changed, 186 insertions(+) diff --git a/drivers/common/cnxk/roc_cpt.c b/drivers/common/cnxk/roc_cpt.c index 0ee3c02..a23e4bb 100644 --- a/drivers/common/cnxk/roc_cpt.c +++ b/drivers/common/cnxk/roc_cpt.c @@ -118,6 +118,34 @@ cpt_lf_unregister_irqs(struct roc_cpt_lf *lf) cpt_lf_unregister_misc_irq(lf); } +static void +cpt_lf_dump(struct roc_cpt_lf *lf) +{ + plt_cpt_dbg("CPT LF"); + plt_cpt_dbg("RBASE: 0x%016lx", lf->rbase); + plt_cpt_dbg("LMT_BASE: 0x%016lx", lf->lmt_base); + plt_cpt_dbg("MSIXOFF: 0x%x", lf->msixoff); + plt_cpt_dbg("LF_ID: 0x%x", lf->lf_id); + plt_cpt_dbg("NB DESC: %d", lf->nb_desc); + plt_cpt_dbg("FC_ADDR: 0x%016lx", (uintptr_t)lf->fc_addr); + plt_cpt_dbg("CQ.VADDR: 0x%016lx", (uintptr_t)lf->iq_vaddr); + + plt_cpt_dbg("CPT LF REG:"); + plt_cpt_dbg("LF_CTL[0x%016llx]: 0x%016lx", CPT_LF_CTL, + plt_read64(lf->rbase + CPT_LF_CTL)); + plt_cpt_dbg("Q_SIZE[0x%016llx]: 0x%016lx", CPT_LF_INPROG, + plt_read64(lf->rbase + CPT_LF_INPROG)); + + plt_cpt_dbg("Q_BASE[0x%016llx]: 0x%016lx", CPT_LF_Q_BASE, + plt_read64(lf->rbase + CPT_LF_Q_BASE)); + plt_cpt_dbg("Q_SIZE[0x%016llx]: 0x%016lx", CPT_LF_Q_SIZE, + plt_read64(lf->rbase + CPT_LF_Q_SIZE)); + plt_cpt_dbg("Q_INST_PTR[0x%016llx]: 0x%016lx", CPT_LF_Q_INST_PTR, + plt_read64(lf->rbase + CPT_LF_Q_INST_PTR)); + plt_cpt_dbg("Q_GRP_PTR[0x%016llx]: 0x%016lx", CPT_LF_Q_GRP_PTR, + plt_read64(lf->rbase + CPT_LF_Q_GRP_PTR)); +} + int roc_cpt_rxc_time_cfg(struct roc_cpt *roc_cpt, struct roc_cpt_rxc_time_cfg *cfg) { @@ -387,6 +415,8 @@ roc_cpt_lf_init(struct roc_cpt *roc_cpt, struct roc_cpt_lf *lf) lf->pf_func = cpt->dev.pf_func; + cpt_lf_dump(lf); + return 0; lf_destroy: @@ -530,6 +560,158 @@ roc_cpt_eng_grp_add(struct roc_cpt *roc_cpt, enum cpt_eng_type eng_type) return rsp->eng_grp_num; } +static int +cpt_af_reg_read(struct roc_cpt *roc_cpt, uint64_t reg, uint64_t *val) +{ + struct cpt *cpt = roc_cpt_to_cpt_priv(roc_cpt); + struct cpt_rd_wr_reg_msg *msg; + struct dev *dev = &cpt->dev; + int ret; + + msg = mbox_alloc_msg_cpt_rd_wr_register(dev->mbox); + if (msg == NULL) + return -EIO; + + msg->hdr.pcifunc = dev->pf_func; + + msg->is_write = 0; + msg->reg_offset = reg; + msg->ret_val = val; + + ret = mbox_process_msg(dev->mbox, (void *)&msg); + if (ret) + return -EIO; + + *val = msg->val; + + return 0; +} + +static int +cpt_sts_print(struct roc_cpt *roc_cpt) +{ + struct cpt *cpt = roc_cpt_to_cpt_priv(roc_cpt); + struct dev *dev = &cpt->dev; + struct cpt_sts_req *req; + struct cpt_sts_rsp *rsp; + int ret; + + req = mbox_alloc_msg_cpt_sts_get(dev->mbox); + if (req == NULL) + return -EIO; + + req->blkaddr = 0; + ret = mbox_process_msg(dev->mbox, (void *)&rsp); + if (ret) + return -EIO; + + plt_print(" %s:\t0x%016lx", "inst_req_pc", rsp->inst_req_pc); + plt_print(" %s:\t0x%016lx", "inst_lat_pc", rsp->inst_lat_pc); + plt_print(" %s:\t\t0x%016lx", "rd_req_pc", rsp->rd_req_pc); + plt_print(" %s:\t\t0x%016lx", "rd_lat_pc", rsp->rd_lat_pc); + plt_print(" %s:\t\t0x%016lx", "rd_uc_pc", rsp->rd_uc_pc); + plt_print(" %s:\t0x%016lx", "active_cycles_pc", + rsp->active_cycles_pc); + plt_print(" %s:\t\t0x%016lx", "ctx_mis_pc", rsp->ctx_mis_pc); + plt_print(" %s:\t\t0x%016lx", "ctx_hit_pc", rsp->ctx_hit_pc); + plt_print(" %s:\t\t0x%016lx", "ctx_aop_pc", rsp->ctx_aop_pc); + plt_print(" %s:\t0x%016lx", "ctx_aop_lat_pc", rsp->ctx_aop_lat_pc); + plt_print(" %s:\t0x%016lx", "ctx_ifetch_pc", rsp->ctx_ifetch_pc); + plt_print(" %s:\t0x%016lx", "ctx_ifetch_lat_pc", + rsp->ctx_ifetch_lat_pc); + plt_print(" %s:\t0x%016lx", "ctx_ffetch_pc", rsp->ctx_ffetch_pc); + plt_print(" %s:\t0x%016lx", "ctx_ffetch_lat_pc", + rsp->ctx_ffetch_lat_pc); + plt_print(" %s:\t0x%016lx", "ctx_wback_pc", rsp->ctx_wback_pc); + plt_print(" %s:\t0x%016lx", "ctx_wback_lat_pc", + rsp->ctx_wback_lat_pc); + plt_print(" %s:\t\t0x%016lx", "ctx_psh_pc", rsp->ctx_psh_pc); + plt_print(" %s:\t0x%016lx", "ctx_psh_lat_pc", rsp->ctx_psh_lat_pc); + plt_print(" %s:\t\t0x%016lx", "ctx_err", rsp->ctx_err); + plt_print(" %s:\t\t0x%016lx", "ctx_enc_id", rsp->ctx_enc_id); + plt_print(" %s:\t0x%016lx", "ctx_flush_timer", rsp->ctx_flush_timer); + plt_print(" %s:\t\t0x%016lx", "rxc_time", rsp->rxc_time); + plt_print(" %s:\t0x%016lx", "rxc_time_cfg", rsp->rxc_time_cfg); + plt_print(" %s:\t0x%016lx", "rxc_active_sts", rsp->rxc_active_sts); + plt_print(" %s:\t0x%016lx", "rxc_zombie_sts", rsp->rxc_zombie_sts); + plt_print(" %s:\t0x%016lx", "rxc_dfrg", rsp->rxc_dfrg); + plt_print(" %s:\t0x%016lx", "x2p_link_cfg0", rsp->x2p_link_cfg0); + plt_print(" %s:\t0x%016lx", "x2p_link_cfg1", rsp->x2p_link_cfg1); + plt_print(" %s:\t0x%016lx", "busy_sts_ae", rsp->busy_sts_ae); + plt_print(" %s:\t0x%016lx", "free_sts_ae", rsp->free_sts_ae); + plt_print(" %s:\t0x%016lx", "busy_sts_se", rsp->busy_sts_se); + plt_print(" %s:\t0x%016lx", "free_sts_se", rsp->free_sts_se); + plt_print(" %s:\t0x%016lx", "busy_sts_ie", rsp->busy_sts_ie); + plt_print(" %s:\t0x%016lx", "free_sts_ie", rsp->free_sts_ie); + plt_print(" %s:\t0x%016lx", "exe_err_info", rsp->exe_err_info); + plt_print(" %s:\t\t0x%016lx", "cptclk_cnt", rsp->cptclk_cnt); + plt_print(" %s:\t\t0x%016lx", "diag", rsp->diag); + + return 0; +} + +int +roc_cpt_afs_print(struct roc_cpt *roc_cpt) +{ + uint64_t reg_val; + + plt_print("CPT AF registers:"); + + if (cpt_af_reg_read(roc_cpt, CPT_AF_LFX_CTL(0), ®_val)) + return -EIO; + + plt_print(" CPT_AF_LF0_CTL:\t0x%016lx", reg_val); + + if (cpt_af_reg_read(roc_cpt, CPT_AF_LFX_CTL2(0), ®_val)) + return -EIO; + + plt_print(" CPT_AF_LF0_CTL2:\t0x%016lx", reg_val); + + cpt_sts_print(roc_cpt); + + return 0; +} + +static void +cpt_lf_print(struct roc_cpt_lf *lf) +{ + uint64_t reg_val; + + reg_val = plt_read64(lf->rbase + CPT_LF_CTX_ENC_BYTE_CNT); + plt_print(" Encrypted byte count:\t%ld", reg_val); + + reg_val = plt_read64(lf->rbase + CPT_LF_CTX_ENC_PKT_CNT); + plt_print(" Encrypted packet count:\t%ld", reg_val); + + reg_val = plt_read64(lf->rbase + CPT_LF_CTX_DEC_BYTE_CNT); + plt_print(" Decrypted byte count:\t%ld", reg_val); + + reg_val = plt_read64(lf->rbase + CPT_LF_CTX_ENC_PKT_CNT); + plt_print(" Decrypted packet count:\t%ld", reg_val); +} + +int +roc_cpt_lfs_print(struct roc_cpt *roc_cpt) +{ + struct cpt *cpt = roc_cpt_to_cpt_priv(roc_cpt); + struct roc_cpt_lf *lf; + int lf_id; + + if (cpt == NULL) + return -EINVAL; + + for (lf_id = 0; lf_id < roc_cpt->nb_lf; lf_id++) { + lf = roc_cpt->lf[lf_id]; + if (lf == NULL) + continue; + + plt_print("Count registers for CPT LF%d:", lf_id); + cpt_lf_print(lf); + } + + return 0; +} + void roc_cpt_iq_disable(struct roc_cpt_lf *lf) { diff --git a/drivers/common/cnxk/roc_cpt.h b/drivers/common/cnxk/roc_cpt.h index abe492e..692fa79 100644 --- a/drivers/common/cnxk/roc_cpt.h +++ b/drivers/common/cnxk/roc_cpt.h @@ -58,5 +58,7 @@ int __roc_api roc_cpt_dev_configure(struct roc_cpt *roc_cpt, int nb_lf); void __roc_api roc_cpt_dev_clear(struct roc_cpt *roc_cpt); int __roc_api roc_cpt_lf_init(struct roc_cpt *roc_cpt, struct roc_cpt_lf *lf); void __roc_api roc_cpt_lf_fini(struct roc_cpt_lf *lf); +int __roc_api roc_cpt_afs_print(struct roc_cpt *roc_cpt); +int __roc_api roc_cpt_lfs_print(struct roc_cpt *roc_cpt); void __roc_api roc_cpt_iq_disable(struct roc_cpt_lf *lf); #endif /* _ROC_CPT_H_ */ diff --git a/drivers/common/cnxk/version.map b/drivers/common/cnxk/version.map index 63f5fda..4f28f64 100644 --- a/drivers/common/cnxk/version.map +++ b/drivers/common/cnxk/version.map @@ -11,6 +11,7 @@ INTERNAL { cnxk_logtype_tim; cnxk_logtype_tm; roc_clk_freq_get; + roc_cpt_afs_print; roc_cpt_dev_clear; roc_cpt_dev_configure; roc_cpt_dev_fini; @@ -19,6 +20,7 @@ INTERNAL { roc_cpt_iq_disable; roc_cpt_lf_init; roc_cpt_lf_fini; + roc_cpt_lfs_print; roc_cpt_rxc_time_cfg; roc_error_msg_get; roc_idev_lmt_base_addr_get; -- 2.7.4