From: Tejasree Kondoj <ktejasree@marvell.com>
To: Akhil Goyal <gakhil@marvell.com>
Cc: Anoob Joseph <anoobj@marvell.com>,
Vidya Sagar Velumuri <vvelumuri@marvell.com>, <dev@dpdk.org>
Subject: [PATCH 11/11] crypto/cnxk: add PMD API to get qp stats
Date: Thu, 5 Sep 2024 13:16:31 +0530 [thread overview]
Message-ID: <20240905074631.1462357-12-ktejasree@marvell.com> (raw)
In-Reply-To: <20240905074631.1462357-1-ktejasree@marvell.com>
From: Anoob Joseph <anoobj@marvell.com>
Add PMD API to get CPT LF(QP) stats.
Signed-off-by: Anoob Joseph <anoobj@marvell.com>
---
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
next prev parent reply other threads:[~2024-09-05 7:47 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-05 7:46 [PATCH 00/11] fixes and improvements to cnxk crypto PMD Tejasree Kondoj
2024-09-05 7:46 ` [PATCH 01/11] crypto/cnxk: align passthrough data for SM ciphers Tejasree Kondoj
2024-09-05 7:46 ` [PATCH 02/11] crypto/cnxk: add multi segment support for Rx inject Tejasree Kondoj
2024-09-05 7:46 ` [PATCH 03/11] common/cnxk: ensure CPTR is 128B aligned Tejasree Kondoj
2024-09-05 7:46 ` [PATCH 04/11] common/cnxk: rearrange to remove hole Tejasree Kondoj
2024-09-05 7:46 ` [PATCH 05/11] common/cnxk: remove abort from flush API Tejasree Kondoj
2024-09-05 7:46 ` [PATCH 06/11] common/cnxk: move algo enums to common Tejasree Kondoj
2024-09-05 7:46 ` [PATCH 07/11] crypto/cnxk: use opaque pointer for PMD APIs Tejasree Kondoj
2024-09-05 7:46 ` [PATCH 08/11] crypto/cnxk: add PMD API for getting CPTR Tejasree Kondoj
2024-09-05 7:46 ` [PATCH 09/11] crypto/cnxk: add PMD API to flush CTX Tejasree Kondoj
2024-09-05 7:46 ` [PATCH 10/11] crypto/cnxk: add CPTR read and write Tejasree Kondoj
2024-09-05 7:46 ` Tejasree Kondoj [this message]
2024-10-09 10:53 ` [PATCH 11/11] crypto/cnxk: add PMD API to get qp stats Thomas Monjalon
2024-09-18 5:37 ` [PATCH 00/11] fixes and improvements to cnxk crypto PMD Akhil Goyal
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240905074631.1462357-12-ktejasree@marvell.com \
--to=ktejasree@marvell.com \
--cc=anoobj@marvell.com \
--cc=dev@dpdk.org \
--cc=gakhil@marvell.com \
--cc=vvelumuri@marvell.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).