DPDK patches and discussions
 help / color / mirror / Atom feed
From: Nithin Dabilpuram <ndabilpuram@marvell.com>
To: <jerinj@marvell.com>, Nithin Dabilpuram <ndabilpuram@marvell.com>,
	"Kiran Kumar K" <kirankumark@marvell.com>,
	Sunil Kumar Kori <skori@marvell.com>,
	Satha Rao <skoteshwar@marvell.com>
Cc: <dev@dpdk.org>, <ferruh.yigit@intel.com>
Subject: [PATCH v2 08/10] net/cnxk: improve inbound inline error handling for cn9k
Date: Fri, 21 Jan 2022 17:34:22 +0530	[thread overview]
Message-ID: <20220121120424.28166-8-ndabilpuram@marvell.com> (raw)
In-Reply-To: <20220121120424.28166-1-ndabilpuram@marvell.com>

Improve inbound inline error handling for CN9K in terms of
packet delivered to application for different kinds of errors.

Signed-off-by: Nithin Dabilpuram <ndabilpuram@marvell.com>
---
 drivers/common/cnxk/roc_ie_on.h | 16 ++++++++++++-
 drivers/net/cnxk/cn9k_rx.h      | 50 +++++++++++++++++++++++++++++++++++++++--
 2 files changed, 63 insertions(+), 3 deletions(-)

diff --git a/drivers/common/cnxk/roc_ie_on.h b/drivers/common/cnxk/roc_ie_on.h
index 53591c6..376e698 100644
--- a/drivers/common/cnxk/roc_ie_on.h
+++ b/drivers/common/cnxk/roc_ie_on.h
@@ -188,7 +188,21 @@ struct roc_ie_on_inb_sa {
 #define ROC_IE_ONF_MAJOR_OP_PROCESS_INBOUND_IPSEC  0x26UL
 
 /* Ucode completion codes */
-#define ROC_IE_ONF_UCC_SUCCESS 0
+#define ROC_IE_ON_UCC_SUCCESS		  0
+#define ROC_IE_ON_UCC_ENC_TYPE_ERR	  0xB1
+#define ROC_IE_ON_UCC_IP_VER_ERR	  0xB2
+#define ROC_IE_ON_UCC_PROTO_ERR		  0xB3
+#define ROC_IE_ON_UCC_CTX_INVALID	  0xB4
+#define ROC_IE_ON_UCC_CTX_DIR_MISMATCH	  0xB5
+#define ROC_IE_ON_UCC_IP_PAYLOAD_TYPE_ERR 0xB6
+#define ROC_IE_ON_UCC_CTX_FLAG_MISMATCH	  0xB7
+#define ROC_IE_ON_UCC_SPI_MISMATCH	  0xBE
+#define ROC_IE_ON_UCC_IP_CHKSUM_ERR	  0xBF
+#define ROC_IE_ON_UCC_AUTH_ERR		  0xC3
+#define ROC_IE_ON_UCC_PADDING_INVALID	  0xC4
+#define ROC_IE_ON_UCC_SA_MISMATCH	  0xCC
+#define ROC_IE_ON_UCC_L2_HDR_INFO_ERR	  0xCF
+#define ROC_IE_ON_UCC_L2_HDR_LEN_ERR	  0xE0
 
 struct roc_ie_onf_sa_ctl {
 	uint32_t spi;
diff --git a/drivers/net/cnxk/cn9k_rx.h b/drivers/net/cnxk/cn9k_rx.h
index 225bb41..cbb6299 100644
--- a/drivers/net/cnxk/cn9k_rx.h
+++ b/drivers/net/cnxk/cn9k_rx.h
@@ -211,6 +211,52 @@ ipsec_antireplay_check(struct roc_onf_ipsec_inb_sa *sa,
 	return rc;
 }
 
+static inline uint64_t
+nix_rx_sec_mbuf_err_update(const union nix_rx_parse_u *rx, uint16_t res,
+			   uint64_t *rearm_val, uint16_t *len)
+{
+	uint8_t uc_cc = res >> 8;
+	uint8_t cc = res & 0xFF;
+	uint64_t data_off;
+	uint64_t ol_flags;
+	uint16_t m_len;
+
+	if (unlikely(cc != CPT_COMP_GOOD))
+		return RTE_MBUF_F_RX_SEC_OFFLOAD |
+		       RTE_MBUF_F_RX_SEC_OFFLOAD_FAILED;
+
+	data_off = *rearm_val & (BIT_ULL(16) - 1);
+	m_len = rx->cn9k.pkt_lenm1 + 1;
+
+	switch (uc_cc) {
+	case ROC_IE_ON_UCC_IP_PAYLOAD_TYPE_ERR:
+	case ROC_IE_ON_UCC_AUTH_ERR:
+	case ROC_IE_ON_UCC_PADDING_INVALID:
+		/* Adjust data offset to start at copied L2 */
+		data_off += ROC_ONF_IPSEC_INB_SPI_SEQ_SZ +
+			    ROC_ONF_IPSEC_INB_MAX_L2_SZ;
+		ol_flags = RTE_MBUF_F_RX_SEC_OFFLOAD |
+			   RTE_MBUF_F_RX_SEC_OFFLOAD_FAILED;
+		break;
+	case ROC_IE_ON_UCC_CTX_INVALID:
+	case ROC_IE_ON_UCC_SPI_MISMATCH:
+	case ROC_IE_ON_UCC_SA_MISMATCH:
+		/* Return as normal packet */
+		ol_flags = 0;
+		break;
+	default:
+		/* Return as error packet after updating packet lengths */
+		ol_flags = RTE_MBUF_F_RX_SEC_OFFLOAD |
+			   RTE_MBUF_F_RX_SEC_OFFLOAD_FAILED;
+		break;
+	}
+
+	*len = m_len;
+	*rearm_val = *rearm_val & ~(BIT_ULL(16) - 1);
+	*rearm_val |= data_off;
+	return ol_flags;
+}
+
 static __rte_always_inline uint64_t
 nix_rx_sec_mbuf_update(const struct nix_cqe_hdr_s *cq, struct rte_mbuf *m,
 		       uintptr_t sa_base, uint64_t *rearm_val, uint16_t *len)
@@ -236,8 +282,8 @@ nix_rx_sec_mbuf_update(const struct nix_cqe_hdr_s *cq, struct rte_mbuf *m,
 
 	rte_prefetch0((void *)data);
 
-	if (unlikely(res != (CPT_COMP_GOOD | ROC_IE_ONF_UCC_SUCCESS << 8)))
-		return RTE_MBUF_F_RX_SEC_OFFLOAD | RTE_MBUF_F_RX_SEC_OFFLOAD_FAILED;
+	if (unlikely(res != (CPT_COMP_GOOD | ROC_IE_ON_UCC_SUCCESS << 8)))
+		return nix_rx_sec_mbuf_err_update(rx, res, rearm_val, len);
 
 	data += lcptr;
 	/* 20 bits of tag would have the SPI */
-- 
2.8.4


  parent reply	other threads:[~2022-01-21 12:05 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-09  9:13 [PATCH 1/8] common/cnxk: fix shift offset for tl3 length disable Nithin Dabilpuram
2021-12-09  9:13 ` [PATCH 2/8] common/cnxk: use for loop in shaper profiles cleanup Nithin Dabilpuram
2022-01-19 16:20   ` Jerin Jacob
2021-12-09  9:13 ` [PATCH 3/8] common/cnxk: change order of frag sizes and infos Nithin Dabilpuram
2022-01-19 16:25   ` Jerin Jacob
2022-01-21 10:03   ` Ferruh Yigit
2021-12-09  9:13 ` [PATCH 4/8] common/cnxk: reset stale values on error debug registers Nithin Dabilpuram
2022-01-19 16:25   ` Jerin Jacob
2021-12-09  9:13 ` [PATCH 5/8] common/cnxk: always use single qint with NIX Nithin Dabilpuram
2022-01-19 16:28   ` Jerin Jacob
2021-12-09  9:13 ` [PATCH 6/8] common/cnxk: handle issues from static analysis Nithin Dabilpuram
2022-01-19 16:44   ` Jerin Jacob
2022-01-21 10:05   ` Ferruh Yigit
2021-12-09  9:13 ` [PATCH 7/8] net/cnxk: improve inbound inline error handling for cn9k Nithin Dabilpuram
2022-01-21 10:06   ` Ferruh Yigit
2021-12-09  9:13 ` [PATCH 8/8] net/cnxk: synchronize inline session create and destroy Nithin Dabilpuram
2022-01-19 16:45   ` Jerin Jacob
2022-01-19 16:15 ` [PATCH 1/8] common/cnxk: fix shift offset for tl3 length disable Jerin Jacob
2022-01-21 10:08   ` Ferruh Yigit
2022-01-21 10:24     ` Nithin Kumar Dabilpuram
2022-01-21 12:04 ` [PATCH v2 01/10] common/cnxk: fix shift offset for TL3 " Nithin Dabilpuram
2022-01-21 12:04   ` [PATCH v2 02/10] common/cnxk: use for loop in shaper profiles cleanup Nithin Dabilpuram
2022-01-21 12:04   ` [PATCH v2 03/10] common/cnxk: fix byte order of frag sizes and infos Nithin Dabilpuram
2022-01-21 12:04   ` [PATCH v2 04/10] common/cnxk: reset stale values on error debug registers Nithin Dabilpuram
2022-01-21 12:04   ` [PATCH v2 05/10] common/cnxk: always use single interrupt ID with NIX Nithin Dabilpuram
2022-01-21 17:16     ` Kevin Traynor
2022-01-23  7:45       ` Jerin Jacob
2022-01-21 12:04   ` [PATCH v2 06/10] common/cnxk: fix null pointer dereferences Nithin Dabilpuram
2022-01-21 12:04   ` [PATCH v2 07/10] common/cnxk: fix uninitialized variable issues Nithin Dabilpuram
2022-01-21 12:04   ` Nithin Dabilpuram [this message]
2022-01-21 12:04   ` [PATCH v2 09/10] common/cnxk: set UDP ports for IPsec UDP encapsulation Nithin Dabilpuram
2022-01-21 12:04   ` [PATCH v2 10/10] net/cnxk: synchronize inline session create and destroy Nithin Dabilpuram

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=20220121120424.28166-8-ndabilpuram@marvell.com \
    --to=ndabilpuram@marvell.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    --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).