DPDK patches and discussions
 help / color / mirror / Atom feed
From: Nithin Dabilpuram <ndabilpuram@marvell.com>
To: Nithin Dabilpuram <ndabilpuram@marvell.com>,
	Kiran Kumar K <kirankumark@marvell.com>,
	Sunil Kumar Kori <skori@marvell.com>,
	Satha Rao <skoteshwar@marvell.com>
Cc: <jerinj@marvell.com>, <dev@dpdk.org>
Subject: [PATCH 2/3] net/cnxk: add support to extract HW error for inline IPsec
Date: Mon, 16 Oct 2023 12:34:36 +0530	[thread overview]
Message-ID: <20231016070437.2295803-2-ndabilpuram@marvell.com> (raw)
In-Reply-To: <20231016070437.2295803-1-ndabilpuram@marvell.com>

Add PMD API support to extract HW error code from mbuf's processed
by inline IPsec inbound.

Signed-off-by: Nithin Dabilpuram <ndabilpuram@marvell.com>
---
 drivers/net/cnxk/cn10k_ethdev_sec.c | 18 ++++++++++++++++++
 drivers/net/cnxk/rte_pmd_cnxk.h     | 17 +++++++++++++++++
 drivers/net/cnxk/version.map        |  6 +++++-
 3 files changed, 40 insertions(+), 1 deletion(-)

diff --git a/drivers/net/cnxk/cn10k_ethdev_sec.c b/drivers/net/cnxk/cn10k_ethdev_sec.c
index 9a831634da..b54795565d 100644
--- a/drivers/net/cnxk/cn10k_ethdev_sec.c
+++ b/drivers/net/cnxk/cn10k_ethdev_sec.c
@@ -1184,6 +1184,24 @@ rte_pmd_cnxk_hw_sa_write(void *device, struct rte_security_session *sess,
 	return 0;
 }
 
+void *
+rte_pmd_cnxk_inl_ipsec_res(struct rte_mbuf *mbuf)
+{
+	const union nix_rx_parse_u *rx;
+	uint16_t desc_size;
+	uintptr_t wqe;
+
+	if (!mbuf || !(mbuf->ol_flags & RTE_MBUF_F_RX_SEC_OFFLOAD))
+		return NULL;
+
+	wqe = (uintptr_t)(mbuf + 1);
+	rx = (const union nix_rx_parse_u *)(wqe + 8);
+	desc_size = (rx->desc_sizem1 + 1) * 16;
+
+	/* cpt_res_s sits after SG list at 16B aligned address */
+	return (void *)(wqe + 64 + desc_size);
+}
+
 static int
 cn10k_eth_sec_session_stats_get(void *device, struct rte_security_session *sess,
 			    struct rte_security_stats *stats)
diff --git a/drivers/net/cnxk/rte_pmd_cnxk.h b/drivers/net/cnxk/rte_pmd_cnxk.h
index d7eadd582d..7827c33ac9 100644
--- a/drivers/net/cnxk/rte_pmd_cnxk.h
+++ b/drivers/net/cnxk/rte_pmd_cnxk.h
@@ -96,4 +96,21 @@ int rte_pmd_cnxk_hw_sa_read(void *device, struct rte_security_session *sess,
 __rte_experimental
 int rte_pmd_cnxk_hw_sa_write(void *device, struct rte_security_session *sess,
 			     void *data, uint32_t len);
+
+/**
+ * Get pointer to CPT result info for inline inbound processed pkt.
+ *
+ * It is recommended to use this API only when mbuf indicates packet
+ * was processed with inline IPsec and there was a failure with the same i.e
+ * mbuf->ol_flags indicates (RTE_MBUF_F_RX_SEC_OFFLOAD | RTE_MBUF_F_RX_SEC_OFFLOAD_FAILED).
+ *
+ * @param mbuf
+ *   Pointer to packet that was just received and was processed with Inline IPsec.
+ *
+ * @return
+ *   - Pointer to mbuf location where CPT result info is stored on success.
+ *   - NULL on failure.
+ */
+__rte_experimental
+void *rte_pmd_cnxk_inl_ipsec_res(struct rte_mbuf *mbuf);
 #endif /* _PMD_CNXK_H_ */
diff --git a/drivers/net/cnxk/version.map b/drivers/net/cnxk/version.map
index 7ae6d80bf0..77f574bb16 100644
--- a/drivers/net/cnxk/version.map
+++ b/drivers/net/cnxk/version.map
@@ -3,10 +3,14 @@ DPDK_24 {
 };
 
 EXPERIMENTAL {
+	global:
+
 	# added in 22.07
-	global:
 	rte_pmd_cnxk_hw_sa_read;
 	rte_pmd_cnxk_hw_sa_write;
+
+	# added in 23.11
+	rte_pmd_cnxk_inl_ipsec_res;
 };
 
 INTERNAL {
-- 
2.25.1


  reply	other threads:[~2023-10-16  7:05 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-16  7:04 [PATCH 1/3] net/cnxk: fix data offset extract logic in vector function Nithin Dabilpuram
2023-10-16  7:04 ` Nithin Dabilpuram [this message]
2023-10-16  7:04 ` [PATCH 3/3] common/cnxk: check for error code in MAC address set Nithin Dabilpuram
2023-10-18  5:34   ` Jerin Jacob

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=20231016070437.2295803-2-ndabilpuram@marvell.com \
    --to=ndabilpuram@marvell.com \
    --cc=dev@dpdk.org \
    --cc=jerinj@marvell.com \
    --cc=kirankumark@marvell.com \
    --cc=skori@marvell.com \
    --cc=skoteshwar@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).