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 99C5745909; Thu, 5 Sep 2024 09:47:42 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3BA8742E53; Thu, 5 Sep 2024 09:47:12 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by mails.dpdk.org (Postfix) with ESMTP id D98CF42E5D for ; Thu, 5 Sep 2024 09:47:00 +0200 (CEST) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 48547chl013664 for ; Thu, 5 Sep 2024 00:47:00 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=pfpt0220; bh=x ab/T2F9MpkrHJRl5ZRhZ2rimds01HHy81bjDifsnvk=; b=WWv/N1rv0x4v1S1ev BbVRkuiQTBtUmUNhktTaenFK9uNtwNJ76wIHEf33SiOYYoqJ2GJNQd50TkOZXHiA Py92jUQ7vH0+PRfanqD44nQFdPl8PSUmzI3Aoj83c+9vqopVYq3jkPiUyXUTgVqM 1OxgLgVGrg+wL5AEkPHCJLJkTjmt7pb1cG1Ti9yIMICf5AR3kW+ZKdTOSOC7wiB2 Dr7Dswk3ZoyCWFWXrMUH+wSSpzOFjXpXJm9F8ykHSjXcrBj6N6R//m3855yDNw4D llbXA+GOK8r4Vp6qdrcC6zfZinxG65FQW8MoXrKvLjDrEG7uv8C+en8mjcHnA6t0 YccTg== Received: from dc5-exch05.marvell.com ([199.233.59.128]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 41ev31tfr9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 05 Sep 2024 00:47:00 -0700 (PDT) Received: from DC5-EXCH05.marvell.com (10.69.176.209) by DC5-EXCH05.marvell.com (10.69.176.209) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Thu, 5 Sep 2024 00:46:58 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH05.marvell.com (10.69.176.209) with Microsoft SMTP Server id 15.2.1544.4 via Frontend Transport; Thu, 5 Sep 2024 00:46:58 -0700 Received: from hyd1554.caveonetworks.com (unknown [10.29.56.32]) by maili.marvell.com (Postfix) with ESMTP id 005AE3F70A7; Thu, 5 Sep 2024 00:46:56 -0700 (PDT) From: Tejasree Kondoj To: Akhil Goyal CC: Anoob Joseph , Vidya Sagar Velumuri , Subject: [PATCH 11/11] crypto/cnxk: add PMD API to get qp stats Date: Thu, 5 Sep 2024 13:16:31 +0530 Message-ID: <20240905074631.1462357-12-ktejasree@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240905074631.1462357-1-ktejasree@marvell.com> References: <20240905074631.1462357-1-ktejasree@marvell.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-ORIG-GUID: g2ZdKLtQwigRrdbOIO54NJMRKZJIvYiq X-Proofpoint-GUID: g2ZdKLtQwigRrdbOIO54NJMRKZJIvYiq X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.60.29 definitions=2024-09-05_04,2024-09-04_01,2024-09-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 From: Anoob Joseph Add PMD API to get CPT LF(QP) stats. Signed-off-by: Anoob Joseph --- drivers/crypto/cnxk/cnxk_cryptodev_ops.c | 32 +++++++++++++++++++++ drivers/crypto/cnxk/rte_pmd_cnxk_crypto.h | 34 +++++++++++++++++++++++ drivers/crypto/cnxk/version.map | 1 + 3 files changed, 67 insertions(+) diff --git a/drivers/crypto/cnxk/cnxk_cryptodev_ops.c b/drivers/crypto/cnxk/cnxk_cryptodev_ops.c index a7d58a5445..2355bc3737 100644 --- a/drivers/crypto/cnxk/cnxk_cryptodev_ops.c +++ b/drivers/crypto/cnxk/cnxk_cryptodev_ops.c @@ -1161,3 +1161,35 @@ rte_pmd_cnxk_crypto_cptr_write(struct rte_pmd_cnxk_crypto_qptr *qptr, return 0; } + +int +rte_pmd_cnxk_crypto_qp_stats_get(struct rte_pmd_cnxk_crypto_qptr *qptr, + struct rte_pmd_cnxk_crypto_qp_stats *stats) +{ + struct cnxk_cpt_qp *qp = PLT_PTR_CAST(qptr); + struct roc_cpt_lf *lf; + + if (unlikely(qptr == NULL)) { + plt_err("Invalid queue pair pointer"); + return -EINVAL; + } + + if (unlikely(stats == NULL)) { + plt_err("Invalid stats pointer"); + return -EINVAL; + } + + if (unlikely(roc_model_is_cn9k())) { + plt_err("Invalid cnxk model"); + return -EINVAL; + } + + lf = &qp->lf; + + stats->ctx_enc_pkts = plt_read64(lf->rbase + CPT_LF_CTX_ENC_PKT_CNT); + stats->ctx_enc_bytes = plt_read64(lf->rbase + CPT_LF_CTX_ENC_BYTE_CNT); + stats->ctx_dec_bytes = plt_read64(lf->rbase + CPT_LF_CTX_DEC_BYTE_CNT); + stats->ctx_dec_bytes = plt_read64(lf->rbase + CPT_LF_CTX_DEC_BYTE_CNT); + + return 0; +} diff --git a/drivers/crypto/cnxk/rte_pmd_cnxk_crypto.h b/drivers/crypto/cnxk/rte_pmd_cnxk_crypto.h index 454261022b..02278605a2 100644 --- a/drivers/crypto/cnxk/rte_pmd_cnxk_crypto.h +++ b/drivers/crypto/cnxk/rte_pmd_cnxk_crypto.h @@ -30,6 +30,23 @@ struct rte_pmd_cnxk_crypto_qptr; */ struct rte_pmd_cnxk_crypto_cptr; +/** + * + * @brief Crypto CNXK queue pair stats. + * + * This structure represents the queue pair stats retrieved from CPT HW queue. + */ +struct rte_pmd_cnxk_crypto_qp_stats { + /** Packet counter of the packets that used CPT context cache and was encrypted */ + uint64_t ctx_enc_pkts; + /** Byte counter of the packets that used CPT context cache and was encrypted */ + uint64_t ctx_enc_bytes; + /** Packet counter of the packets that used CPT context cache and was decrypted */ + uint64_t ctx_dec_pkts; + /** Byte counter of the packets that used CPT context cache and was decrypted */ + uint64_t ctx_dec_bytes; +}; + /** * @brief Crypto CNXK PMD session structure. * @@ -176,4 +193,21 @@ int rte_pmd_cnxk_crypto_cptr_write(struct rte_pmd_cnxk_crypto_qptr *qptr, struct rte_pmd_cnxk_crypto_cptr *cptr, void *data, uint32_t len); +/** + * Get the HW Queue Pair (LF) stats. + * + * @param qptr + * Pointer obtained with ``rte_pmd_cnxk_crypto_qptr_get``. + * @param[out] stats + * Pointer to the structure where stats will be copied. + * + * @return + * - 0 On success. + * - Negative value on error. + * - -EINVAL if the input parameters are invalid. + */ +__rte_experimental +int rte_pmd_cnxk_crypto_qp_stats_get(struct rte_pmd_cnxk_crypto_qptr *qptr, + struct rte_pmd_cnxk_crypto_qp_stats *stats); + #endif /* _PMD_CNXK_CRYPTO_H_ */ diff --git a/drivers/crypto/cnxk/version.map b/drivers/crypto/cnxk/version.map index 6e51f7be1a..05724e69e4 100644 --- a/drivers/crypto/cnxk/version.map +++ b/drivers/crypto/cnxk/version.map @@ -10,6 +10,7 @@ EXPERIMENTAL { rte_pmd_cnxk_crypto_cptr_get; rte_pmd_cnxk_crypto_cptr_read; rte_pmd_cnxk_crypto_cptr_write; + rte_pmd_cnxk_crypto_qp_stats_get; }; INTERNAL { -- 2.25.1