[2/3] net/cnxk: add support to extract HW error for inline IPsec
Checks
Commit Message
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(-)
@@ -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)
@@ -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_ */
@@ -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 {