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: Tejasree Kondoj <ktejasree@marvell.com>,
	Narayana Prasad <pathreya@marvell.com>,
	Anoob Joseph <anoobj@marvell.com>,
	Vamsi Attunuru <vattunuru@marvell.com>, <dev@dpdk.org>
Subject: [dpdk-dev] [PATCH 2/8] crypto/octeontx2: add lookaside SA context definitions
Date: Tue, 23 Jun 2020 17:42:22 +0530	[thread overview]
Message-ID: <20200623121228.10355-3-ktejasree@marvell.com> (raw)
In-Reply-To: <20200623121228.10355-1-ktejasree@marvell.com>

Signed-off-by: Vamsi Attunuru <vattunuru@marvell.com>
Signed-off-by: Tejasree Kondoj <ktejasree@marvell.com>
---
 drivers/crypto/octeontx2/otx2_cryptodev_sec.h |  52 ++++++++
 drivers/crypto/octeontx2/otx2_ipsec_po.h      | 119 ++++++++++++++++++
 drivers/crypto/octeontx2/otx2_security.h      |   2 +
 drivers/net/octeontx2/otx2_ethdev_sec.h       |   1 +
 4 files changed, 174 insertions(+)
 create mode 100644 drivers/crypto/octeontx2/otx2_cryptodev_sec.h
 create mode 100644 drivers/crypto/octeontx2/otx2_ipsec_po.h

diff --git a/drivers/crypto/octeontx2/otx2_cryptodev_sec.h b/drivers/crypto/octeontx2/otx2_cryptodev_sec.h
new file mode 100644
index 0000000000..af62207d07
--- /dev/null
+++ b/drivers/crypto/octeontx2/otx2_cryptodev_sec.h
@@ -0,0 +1,52 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright (C) 2020 Marvell International Ltd.
+ */
+
+#ifndef __OTX2_CRYPTODEV_SEC_H__
+#define __OTX2_CRYPTODEV_SEC_H__
+
+#include "otx2_ipsec_po.h"
+
+struct otx2_sec_session_ipsec_lp {
+	RTE_STD_C11
+	union {
+		/* Inbound SA */
+		struct otx2_ipsec_po_in_sa in_sa;
+		/* Outbound SA */
+		struct otx2_ipsec_po_out_sa out_sa;
+	};
+
+	uint64_t ucmd_w3;
+	uint16_t ucmd_opcode;
+	uint16_t ucmd_param1;
+	uint16_t ucmd_param2;
+
+	uint8_t partial_len;
+	uint8_t roundup_len;
+	uint8_t roundup_byte;
+	uint16_t ip_id;
+	union {
+		uint64_t esn;
+		struct {
+			uint32_t seq_lo;
+			uint32_t seq_hi;
+		};
+	};
+
+	/** Context length in 8-byte words */
+	size_t ctx_len;
+	/** Auth IV offset in bytes */
+	uint16_t auth_iv_offset;
+	/** IV offset in bytes */
+	uint16_t iv_offset;
+	/** AAD length */
+	uint16_t aad_length;
+	/** MAC len in bytes */
+	uint8_t mac_len;
+	/** IV length in bytes */
+	uint8_t iv_length;
+	/** Auth IV length in bytes */
+	uint8_t auth_iv_length;
+};
+
+#endif /* __OTX2_CRYPTODEV_SEC_H__ */
diff --git a/drivers/crypto/octeontx2/otx2_ipsec_po.h b/drivers/crypto/octeontx2/otx2_ipsec_po.h
new file mode 100644
index 0000000000..602b9d10e2
--- /dev/null
+++ b/drivers/crypto/octeontx2/otx2_ipsec_po.h
@@ -0,0 +1,119 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(C) 2020 Marvell International Ltd.
+ */
+
+#ifndef __OTX2_IPSEC_PO_H__
+#define __OTX2_IPSEC_PO_H__
+
+#include <rte_crypto_sym.h>
+#include <rte_ip.h>
+#include <rte_security.h>
+
+union bit_perfect_iv {
+	uint8_t aes_iv[16];
+	uint8_t des_iv[8];
+	struct {
+		uint8_t nonce[4];
+		uint8_t iv[8];
+		uint8_t counter[4];
+	} misc; /* For GCM/GMAC/CTR/CCM */
+};
+
+struct ip_selector {
+	uint8_t src_port[4];
+	uint8_t dest_port[4];
+	RTE_STD_C11
+	union {
+		struct {
+			uint8_t src_addr[8];
+			uint8_t dest_addr[8];
+		} ipv4;
+		struct {
+			uint8_t src_addr[32];
+			uint8_t dest_addr[32];
+		} ipv6;
+	};
+};
+
+struct otx2_ipsec_po_sa_ctl {
+	rte_be32_t spi          : 32;
+	uint64_t exp_proto_inter_frag : 8;
+	uint64_t rsvd_42_40   : 3;
+	uint64_t esn_en       : 1;
+	uint64_t rsvd_45_44   : 2;
+	uint64_t encap_type   : 2;
+	uint64_t enc_type     : 3;
+	uint64_t rsvd_48      : 1;
+	uint64_t auth_type    : 4;
+	uint64_t valid        : 1;
+	uint64_t direction    : 1;
+	uint64_t outer_ip_ver : 1;
+	uint64_t inner_ip_ver : 1;
+	uint64_t ipsec_mode   : 1;
+	uint64_t ipsec_proto  : 1;
+	uint64_t aes_key_len  : 2;
+};
+
+struct otx2_ipsec_po_in_sa {
+	/* w0 */
+	struct otx2_ipsec_po_sa_ctl ctl;
+
+	/* w1-w4 */
+	uint8_t cipher_key[32];
+
+	/* w5-w6 */
+	union bit_perfect_iv iv;
+
+	/* w7 */
+	uint32_t esn_hi;
+	uint32_t esn_low;
+
+	/* w8 */
+	uint8_t udp_encap[8];
+
+	/* w9-w23 */
+	RTE_STD_C11
+	struct {
+		uint8_t hmac_key[48];
+		struct ip_selector sel_checks;
+	} aes_gcm;
+};
+
+struct ip_template {
+	union {
+		RTE_STD_C11
+		uint8_t raw[252];
+		struct {
+			struct rte_ipv4_hdr hdr;
+			uint8_t unused[40];
+		} ipv4;
+
+		struct {
+			struct rte_ipv6_hdr hdr;
+			uint8_t unused[208];
+		} ipv6;
+	};
+};
+
+struct otx2_ipsec_po_out_sa {
+	/* w0 */
+	struct otx2_ipsec_po_sa_ctl ctl;
+
+	/* w1-w4 */
+	uint8_t cipher_key[32];
+
+	/* w5-w6 */
+	union bit_perfect_iv iv;
+
+	/* w7 */
+	uint32_t esn_hi;
+	uint32_t esn_low;
+
+	/* w8-w39 */
+	RTE_STD_C11
+	struct ip_template templt;
+	uint16_t udp_src;
+	uint16_t udp_dst;
+};
+
+#endif /* __OTX2_IPSEC_PO_H__ */
diff --git a/drivers/crypto/octeontx2/otx2_security.h b/drivers/crypto/octeontx2/otx2_security.h
index 275d69b6a5..e76cd843c7 100644
--- a/drivers/crypto/octeontx2/otx2_security.h
+++ b/drivers/crypto/octeontx2/otx2_security.h
@@ -5,11 +5,13 @@
 #ifndef __OTX2_SECURITY_H__
 #define __OTX2_SECURITY_H__
 
+#include "otx2_cryptodev_sec.h"
 #include "otx2_ethdev_sec.h"
 #include "otx2_ipsec_fp.h"
 
 union otx2_sec_session_ipsec {
 	struct otx2_sec_session_ipsec_ip ip;
+	struct otx2_sec_session_ipsec_lp lp;
 };
 
 struct otx2_sec_session {
diff --git a/drivers/net/octeontx2/otx2_ethdev_sec.h b/drivers/net/octeontx2/otx2_ethdev_sec.h
index 22025d0d0c..298b00bf89 100644
--- a/drivers/net/octeontx2/otx2_ethdev_sec.h
+++ b/drivers/net/octeontx2/otx2_ethdev_sec.h
@@ -8,6 +8,7 @@
 #include <rte_ethdev.h>
 
 #include "otx2_ipsec_fp.h"
+#include "otx2_ipsec_po.h"
 
 #define OTX2_CPT_RES_ALIGN		16
 #define OTX2_NIX_SEND_DESC_ALIGN	16
-- 
2.27.0


  parent reply	other threads:[~2020-06-23 11:19 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 ` Tejasree Kondoj [this message]
2020-07-01 20:46   ` [dpdk-dev] [PATCH 2/8] crypto/octeontx2: add lookaside SA context definitions 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 ` [dpdk-dev] [PATCH 8/8] crypto/octeontx2: add cryptodev sec dequeue routine Tejasree Kondoj
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-3-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).