DPDK patches and discussions
 help / color / mirror / Atom feed
From: Tejasree Kondoj <ktejasree@marvell.com>
To: Akhil Goyal <akhil.goyal@nxp.com>, Radu Nicolau <radu.nicolau@intel.com>
Cc: Vamsi Attunuru <vattunuru@marvell.com>,
	Narayana Prasad <pathreya@marvell.com>,
	Anoob Joseph <anoobj@marvell.com>,
	Tejasree Kondoj <ktejasree@marvell.com>, <dev@dpdk.org>
Subject: [dpdk-dev] [PATCH 8/8] crypto/octeontx2: add cryptodev sec dequeue routine
Date: Tue, 23 Jun 2020 17:42:28 +0530	[thread overview]
Message-ID: <20200623121228.10355-9-ktejasree@marvell.com> (raw)
In-Reply-To: <20200623121228.10355-1-ktejasree@marvell.com>

From: Vamsi Attunuru <vattunuru@marvell.com>

Signed-off-by: Vamsi Attunuru <vattunuru@marvell.com>
Signed-off-by: Tejasree Kondoj <ktejasree@marvell.com>
---
 drivers/crypto/octeontx2/otx2_cryptodev_ops.c | 37 +++++++++++++++++++
 drivers/crypto/octeontx2/otx2_ipsec_po.h      | 30 +++++++++++++++
 2 files changed, 67 insertions(+)

diff --git a/drivers/crypto/octeontx2/otx2_cryptodev_ops.c b/drivers/crypto/octeontx2/otx2_cryptodev_ops.c
index d796488def..43bb9a5fdf 100644
--- a/drivers/crypto/octeontx2/otx2_cryptodev_ops.c
+++ b/drivers/crypto/octeontx2/otx2_cryptodev_ops.c
@@ -832,11 +832,48 @@ otx2_cpt_asym_post_process(struct rte_crypto_op *cop,
 	}
 }
 
+static void
+otx2_cpt_sec_post_process(struct rte_crypto_op *cop, uintptr_t *rsp)
+{
+	struct cpt_request_info *req = (struct cpt_request_info *)rsp[2];
+	vq_cmd_word0_t *word0 = (vq_cmd_word0_t *)&req->ist.ei0;
+	struct rte_crypto_sym_op *sym_op = cop->sym;
+	struct rte_mbuf *m = sym_op->m_src;
+	struct rte_ipv4_hdr *ip;
+	uint16_t m_len;
+	int mdata_len;
+	char *data;
+
+	mdata_len = (int)rsp[3];
+	rte_pktmbuf_trim(m, mdata_len);
+
+	if ((word0->s.opcode & 0xff) == OTX2_IPSEC_PO_PROCESS_IPSEC_INB) {
+		data = rte_pktmbuf_mtod(m, char *);
+		ip = (struct rte_ipv4_hdr *)(data + OTX2_IPSEC_PO_INB_RPTR_HDR);
+
+		m_len = rte_be_to_cpu_16(ip->total_length);
+
+		m->data_len = m_len;
+		m->pkt_len = m_len;
+		m->data_off += OTX2_IPSEC_PO_INB_RPTR_HDR;
+	}
+}
+
 static inline void
 otx2_cpt_dequeue_post_process(struct otx2_cpt_qp *qp, struct rte_crypto_op *cop,
 			      uintptr_t *rsp, uint8_t cc)
 {
 	if (cop->type == RTE_CRYPTO_OP_TYPE_SYMMETRIC) {
+		if (cop->sess_type == RTE_CRYPTO_OP_SECURITY_SESSION) {
+			if (likely(cc == OTX2_IPSEC_PO_CC_SUCCESS)) {
+				otx2_cpt_sec_post_process(cop, rsp);
+				cop->status = RTE_CRYPTO_OP_STATUS_SUCCESS;
+			} else
+				cop->status = RTE_CRYPTO_OP_STATUS_ERROR;
+
+			return;
+		}
+
 		if (likely(cc == NO_ERR)) {
 			/* Verify authentication data if required */
 			if (unlikely(rsp[2]))
diff --git a/drivers/crypto/octeontx2/otx2_ipsec_po.h b/drivers/crypto/octeontx2/otx2_ipsec_po.h
index d127f310b7..f74ae2e598 100644
--- a/drivers/crypto/octeontx2/otx2_ipsec_po.h
+++ b/drivers/crypto/octeontx2/otx2_ipsec_po.h
@@ -22,10 +22,40 @@
 #define OTX2_IPSEC_PO_PROCESS_IPSEC_OUTB   0x23
 #define OTX2_IPSEC_PO_PROCESS_IPSEC_INB    0x24
 
+#define OTX2_IPSEC_PO_INB_RPTR_HDR         0x8
+
 enum otx2_ipsec_po_comp_e {
 	OTX2_IPSEC_PO_CC_SUCCESS = 0x00,
 	OTX2_IPSEC_PO_CC_AUTH_UNSUPPORTED = 0xB0,
 	OTX2_IPSEC_PO_CC_ENCRYPT_UNSUPPORTED = 0xB1,
+	OTX2_IPSEC_PO_CC_I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OTX2_IPSEC_PO_CC_IPV6_SELECTOR_MATCH = 0xCC,
+	OTX2_IPSEC_PO_CC_IPV6_UDP_PAYLOAD_CSUM_MISMATCH = 0xCE,
 };
 
 enum {
-- 
2.27.0


  parent reply	other threads:[~2020-06-23 11:20 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-23 12:12 [dpdk-dev] [PATCH 0/8] add OCTEON TX2 lookaside IPsec support Tejasree Kondoj
2020-06-23 12:12 ` [dpdk-dev] [PATCH 1/8] net/octeontx2: move otx2_sec_session struct to otx2_security.h Tejasree Kondoj
2020-06-23 12:12 ` [dpdk-dev] [PATCH 2/8] crypto/octeontx2: add lookaside SA context definitions Tejasree Kondoj
2020-07-01 20:46   ` Akhil Goyal
2020-07-02  9:29     ` Anoob Joseph
2020-07-02  9:38       ` Akhil Goyal
2020-07-02 10:00         ` Anoob Joseph
2020-07-02 10:40           ` Akhil Goyal
2020-06-23 12:12 ` [dpdk-dev] [PATCH 3/8] crypto/octeontx2: add cryptodev sec registration Tejasree Kondoj
2020-07-01 20:59   ` Akhil Goyal
2020-07-02 10:26     ` Tejasree Kondoj
2020-06-23 12:12 ` [dpdk-dev] [PATCH 4/8] crypto/octeontx2: add cryptodev sec capabilities Tejasree Kondoj
2020-07-01 21:07   ` Akhil Goyal
2020-07-02 10:32     ` Tejasree Kondoj
2020-07-02 10:36       ` Akhil Goyal
2020-06-23 12:12 ` [dpdk-dev] [PATCH 5/8] crypto/octeontx2: add cryptodev sec misc callbacks Tejasree Kondoj
2020-06-23 12:12 ` [dpdk-dev] [PATCH 6/8] crypto/octeontx2: add cryptodev sec session create Tejasree Kondoj
2020-06-23 12:12 ` [dpdk-dev] [PATCH 7/8] crypto/octeontx2: add cryptodev sec enqueue routine Tejasree Kondoj
2020-06-23 12:12 ` Tejasree Kondoj [this message]
2020-07-01 20:54 ` [dpdk-dev] [PATCH 0/8] add OCTEON TX2 lookaside IPsec support Akhil Goyal
2020-07-02 10:23   ` Tejasree Kondoj

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=20200623121228.10355-9-ktejasree@marvell.com \
    --to=ktejasree@marvell.com \
    --cc=akhil.goyal@nxp.com \
    --cc=anoobj@marvell.com \
    --cc=dev@dpdk.org \
    --cc=pathreya@marvell.com \
    --cc=radu.nicolau@intel.com \
    --cc=vattunuru@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).