add OCTEON TX2 lookaside IPsec support
Subsystems (3)
v3 cover add OCTEON TX2 lookaside IPsec support
This series adds lookaside IPsec support in OCTEON TX2 PMD.
Features supported:
* IPv4
* ESP
* Tunnel mode
* AES-128/192/256-GCM
v3:
* Fixed PMD documentation and release notes updates
* Squashed enqueue and dequeue patches
* Removed unused code
v2:
* Updated PMD documentation and release notes
* Moved capabilities initialization into probe
* Added patch description to all patches
* Renamed few structures and macros
* Cosmetics and code style fixes
Tejasree Kondoj (5):
crypto/octeontx2: move capabilities initialization into probe net/octeontx2: move otx2_sec_session struct to otx2_security.h crypto/octeontx2: add lookaside SA context definitions crypto/octeontx2: add cryptodev sec registration crypto/octeontx2: add cryptodev sec capabilities
Vamsi Attunuru (3):
crypto/octeontx2: add cryptodev sec misc callbacks crypto/octeontx2: add cryptodev sec session create crypto/octeontx2: add cryptodev sec enqueue and dequeue routines
doc/guides/cryptodevs/features/octeontx2.ini | 1 + doc/guides/cryptodevs/octeontx2.rst | 21 + doc/guides/rel_notes/release_20_08.rst | 5 + drivers/crypto/octeontx2/Makefile | 1 + drivers/crypto/octeontx2/meson.build | 3 +- drivers/crypto/octeontx2/otx2_cryptodev.c | 15 +- drivers/crypto/octeontx2/otx2_cryptodev.h | 8 + .../octeontx2/otx2_cryptodev_capabilities.c | 110 +++- .../octeontx2/otx2_cryptodev_capabilities.h | 21 +- drivers/crypto/octeontx2/otx2_cryptodev_ops.c | 75 ++- drivers/crypto/octeontx2/otx2_cryptodev_sec.c | 540 ++++++++++++++++++ drivers/crypto/octeontx2/otx2_cryptodev_sec.h | 64 +++ drivers/crypto/octeontx2/otx2_ipsec_po.h | 413 ++++++++++++++ drivers/crypto/octeontx2/otx2_ipsec_po_ops.h | 175 ++++++ drivers/crypto/octeontx2/otx2_security.h | 31 + drivers/net/octeontx2/otx2_ethdev_sec.c | 24 +- drivers/net/octeontx2/otx2_ethdev_sec.h | 11 +- drivers/net/octeontx2/otx2_ethdev_sec_tx.h | 1 + 18 files changed, 1485 insertions(+), 34 deletions(-) create mode 100644 drivers/crypto/octeontx2/otx2_cryptodev_sec.c create mode 100644 drivers/crypto/octeontx2/otx2_cryptodev_sec.h create mode 100644 drivers/crypto/octeontx2/otx2_ipsec_po.h create mode 100644 drivers/crypto/octeontx2/otx2_ipsec_po_ops.h create mode 100644 drivers/crypto/octeontx2/otx2_security.h
Signature · 1 line
2.27.0
PATCH v3 1/8 crypto/octeontx2: move capabilities initialization into probe
This patch moves capabilities initialization into probe.
--- drivers/crypto/octeontx2/otx2_cryptodev.c | 2 ++ drivers/crypto/octeontx2/otx2_cryptodev_capabilities.c | 9 ++++++--- drivers/crypto/octeontx2/otx2_cryptodev_capabilities.h | 8 +++++++- drivers/crypto/octeontx2/otx2_cryptodev_ops.c | 2 +- 4 files changed, 16 insertions(+), 5 deletions(-)
drivers/crypto/octeontx2/otx2_cryptodev.c +2 -0
@@ -101,6 +101,8 @@ otx2_cpt_pci_probe(struct rte_pci_driver *pci_drv __rte_unused, goto otx2_dev_fini; } +otx2_crypto_capabilities_init (vf->hw_caps); + dev->feature_flags =RTE_CRYPTODEV_FF_SYMMETRIC_CRYPTO |RTE_CRYPTODEV_FF_HW_ACCELERATED | RTE_CRYPTODEV_FF_SYM_OPERATION_CHAINING |
drivers/crypto/octeontx2/otx2_cryptodev_capabilities.c +6 -3
@@ -737,10 +737,9 @@ cpt_caps_add(const struct rte_cryptodev_capabilities *caps, int nb_caps) cur_pos += nb_caps; } -const struct rte_cryptodev_capabilities * -otx2_cpt_capabilities_get (union cpt_eng_caps *hw_caps) +void +otx2_crypto_capabilities_init (union cpt_eng_caps *hw_caps) { -CPT_CAPS_ADD (hw_caps, mul);CPT_CAPS_ADD (hw_caps, sha1_sha2);CPT_CAPS_ADD (hw_caps, chacha20);
@@ -751,6 +750,10 @@ otx2_cpt_capabilities_get(union cpt_eng_caps *hw_caps)cpt_caps_add (caps_null,RTE_DIM (caps_null));cpt_caps_add (caps_end,RTE_DIM (caps_end)); +} +const struct rte_cryptodev_capabilities * +otx2_cpt_capabilities_get (void ) +{return otx2_cpt_caps; }
drivers/crypto/octeontx2/otx2_cryptodev_capabilities.h +7 -1
@@ -16,11 +16,17 @@ enum otx2_cpt_egrp { OTX2_CPT_EGRP_MAX, }; +/* +* Initialize crypto capabilities for the device +* +*/ +void otx2_crypto_capabilities_init (union cpt_eng_caps *hw_caps); +/* * Get capabilities list for the device * */ const struct rte_cryptodev_capabilities * -otx2_cpt_capabilities_get (union cpt_eng_caps *hw_caps); +otx2_cpt_capabilities_get (void );#endif /* _OTX2_CRYPTODEV_CAPABILITIES_H_ */
drivers/crypto/octeontx2/otx2_cryptodev_ops.c +1 -1
@@ -1071,7 +1071,7 @@ otx2_cpt_dev_info_get(struct rte_cryptodev *dev,if (info !=NULL ) { info->max_nb_queue_pairs = vf->max_queues; info->feature_flags = dev->feature_flags; - info->capabilities =otx2_cpt_capabilities_get (vf->hw_caps); + info->capabilities =otx2_cpt_capabilities_get (); info->sym.max_nb_sessions =0 ; info->driver_id = otx2_cryptodev_driver_id; info->min_mbuf_headroom_req =OTX2_CPT_MIN_HEADROOM_REQ ;
Signature · 1 line
2.27.0
PATCH v3 2/8 net/octeontx2: move otx2_sec_session struct to otx2_security.h
In reply to Tejasree KondojThis patch moves otx2_sec_session structure to otx2_security.h to make it common for inline and lookaside protocol.
--- drivers/crypto/octeontx2/otx2_security.h | 20 ++++++++++++++++++++ drivers/net/octeontx2/otx2_ethdev_sec.c | 1 + drivers/net/octeontx2/otx2_ethdev_sec.h | 10 ---------- drivers/net/octeontx2/otx2_ethdev_sec_tx.h | 1 + 4 files changed, 22 insertions(+), 10 deletions(-) create mode 100644 drivers/crypto/octeontx2/otx2_security.h
drivers/crypto/octeontx2/otx2_security.h new file +20 -0
@@ -0,0 +1,20 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright (C) 2020 Marvell International Ltd. +*/ + +#ifndef __OTX2_SECURITY_H__ +#define __OTX2_SECURITY_H__ + +#include "otx2_ethdev_sec.h" + +union otx2_sec_session_ipsec { +struct otx2_sec_session_ipsec_ip ip; +}; + +struct otx2_sec_session { +union otx2_sec_session_ipsec ipsec; +void *userdata; +/**< Userdata registered by the application */ +} __rte_cache_aligned; + +#endif /* __OTX2_SECURITY_H__ */
drivers/net/octeontx2/otx2_ethdev_sec.c +1 -0
@@ -19,6 +19,7 @@#include "otx2_ethdev_sec.h" #include "otx2_ipsec_fp.h" #include "otx2_sec_idev.h" +#include "otx2_security.h" #define AH_HDR_LEN 12#define AES_GCM_IV_LEN 8
drivers/net/octeontx2/otx2_ethdev_sec.h +0 -10
@@ -116,16 +116,6 @@ struct otx2_sec_session_ipsec_ip {struct otx2_cpt_qp *qp; }; -struct otx2_sec_session_ipsec { -struct otx2_sec_session_ipsec_ip ip; -}; - -struct otx2_sec_session { -struct otx2_sec_session_ipsec ipsec; -void *userdata; -/**< Userdata registered by the application */ -} __rte_cache_aligned; -int otx2_eth_sec_ctx_create (struct rte_eth_dev *eth_dev);void otx2_eth_sec_ctx_destroy (struct rte_eth_dev *eth_dev);
drivers/net/octeontx2/otx2_ethdev_sec_tx.h +1 -0
@@ -9,6 +9,7 @@#include <rte_mbuf.h> #include "otx2_ethdev_sec.h" +#include "otx2_security.h" struct otx2_ipsec_fp_out_hdr {uint32_t ip_id;
Signature · 1 line
2.27.0
PATCH v3 3/8 crypto/octeontx2: add lookaside SA context definitions
In reply to Tejasree KondojThis patch adds lookaside IPsec SA context definitions.
--- drivers/crypto/octeontx2/otx2_cryptodev_sec.h | 58 +++++++++ drivers/crypto/octeontx2/otx2_ipsec_po.h | 110 ++++++++++++++++++ drivers/crypto/octeontx2/otx2_security.h | 2 + drivers/net/octeontx2/otx2_ethdev_sec.h | 1 + 4 files changed, 171 insertions(+) create mode 100644 drivers/crypto/octeontx2/otx2_cryptodev_sec.h create mode 100644 drivers/crypto/octeontx2/otx2_ipsec_po.h
drivers/crypto/octeontx2/otx2_cryptodev_sec.h new file +58 -0
@@ -0,0 +1,58 @@ +/* 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; +union { +uint64_t ucmd_w0; +struct { +uint16_t ucmd_dlen; +uint16_t ucmd_param2; +uint16_t ucmd_param1; +uint16_t ucmd_opcode; + }; + }; + +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__ */
drivers/crypto/octeontx2/otx2_ipsec_po.h new file +110 -0
110 lines not on this page · raw message
drivers/crypto/octeontx2/otx2_security.h +2 -0
@@ -5,10 +5,12 @@#ifndef __OTX2_SECURITY_H__#define __OTX2_SECURITY_H__ +#include "otx2_cryptodev_sec.h" #include "otx2_ethdev_sec.h" union otx2_sec_session_ipsec {struct otx2_sec_session_ipsec_ip ip; +struct otx2_sec_session_ipsec_lp lp; }; struct otx2_sec_session {
drivers/net/octeontx2/otx2_ethdev_sec.h +1 -0
@@ -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
Signature · 1 line
2.27.0
PATCH v3 4/8 crypto/octeontx2: add cryptodev sec registration
In reply to Tejasree KondojThis patch registers security operations with cryptodev.
--- doc/guides/cryptodevs/features/octeontx2.ini | 1 + drivers/crypto/octeontx2/Makefile | 1 + drivers/crypto/octeontx2/meson.build | 3 +- drivers/crypto/octeontx2/otx2_cryptodev.c | 12 ++++- drivers/crypto/octeontx2/otx2_cryptodev_sec.c | 46 +++++++++++++++++++ drivers/crypto/octeontx2/otx2_cryptodev_sec.h | 6 +++ 6 files changed, 67 insertions(+), 2 deletions(-) create mode 100644 drivers/crypto/octeontx2/otx2_cryptodev_sec.c
doc/guides/cryptodevs/features/octeontx2.ini +1 -0
@@ -8,6 +8,7 @@ Symmetric crypto = Y Asymmetric crypto = Y Sym operation chaining = Y HW Accelerated = Y +Protocol offload = Y In Place SGL = Y OOP SGL In LB Out = Y OOP SGL In SGL Out = Y
drivers/crypto/octeontx2/Makefile +1 -0
@@ -38,6 +38,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX2_CRYPTO) += otx2_cryptodev_capabilities.c SRCS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX2_CRYPTO) += otx2_cryptodev_hw_access.c SRCS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX2_CRYPTO) += otx2_cryptodev_mbox.c SRCS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX2_CRYPTO) += otx2_cryptodev_ops.c +SRCS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX2_CRYPTO) += otx2_cryptodev_sec.c # export include files SYMLINK-y-include +=
drivers/crypto/octeontx2/meson.build +2 -1
@@ -17,7 +17,8 @@ sources = files('otx2_cryptodev.c', 'otx2_cryptodev_capabilities.c', 'otx2_cryptodev_hw_access.c', 'otx2_cryptodev_mbox.c', - 'otx2_cryptodev_ops.c') + 'otx2_cryptodev_ops.c', + 'otx2_cryptodev_sec.c') extra_flags = [] # This integrated controller runs only on a arm64 machine, remove 32bit warnings
drivers/crypto/octeontx2/otx2_cryptodev.c +11 -1
@@ -17,6 +17,7 @@#include "otx2_cryptodev_capabilities.h" #include "otx2_cryptodev_mbox.h" #include "otx2_cryptodev_ops.h" +#include "otx2_cryptodev_sec.h" #include "otx2_dev.h" /* CPT common headers */
@@ -103,6 +104,11 @@ otx2_cpt_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,otx2_crypto_capabilities_init (vf->hw_caps); +/* Create security ctx */ + ret =otx2_crypto_sec_ctx_create (dev); +if (ret) + goto otx2_dev_fini; + dev->feature_flags =RTE_CRYPTODEV_FF_SYMMETRIC_CRYPTO |RTE_CRYPTODEV_FF_HW_ACCELERATED | RTE_CRYPTODEV_FF_SYM_OPERATION_CHAINING |
@@ -111,7 +117,8 @@ otx2_cpt_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,RTE_CRYPTODEV_FF_OOP_SGL_IN_SGL_OUT |RTE_CRYPTODEV_FF_ASYMMETRIC_CRYPTO |RTE_CRYPTODEV_FF_RSA_PRIV_OP_KEY_QT | -RTE_CRYPTODEV_FF_SYM_SESSIONLESS ; +RTE_CRYPTODEV_FF_SYM_SESSIONLESS | +RTE_CRYPTODEV_FF_SECURITY ;return 0 ;
@@ -140,6 +147,9 @@ otx2_cpt_pci_remove(struct rte_pci_device *pci_dev)if (dev ==NULL )return -ENODEV ; +/* Destroy security ctx */ +otx2_crypto_sec_ctx_destroy (dev); +return rte_cryptodev_pmd_destroy (dev); }
drivers/crypto/octeontx2/otx2_cryptodev_sec.c new file +46 -0
46 lines not on this page · raw message
drivers/crypto/octeontx2/otx2_cryptodev_sec.h +6 -0
@@ -5,6 +5,8 @@#ifndef __OTX2_CRYPTODEV_SEC_H__#define __OTX2_CRYPTODEV_SEC_H__ +#include <rte_cryptodev.h> +#include "otx2_ipsec_po.h" struct otx2_sec_session_ipsec_lp {
@@ -55,4 +57,8 @@ struct otx2_sec_session_ipsec_lp { uint8_t auth_iv_length; }; +int otx2_crypto_sec_ctx_create (struct rte_cryptodev *crypto_dev); + +void otx2_crypto_sec_ctx_destroy (struct rte_cryptodev *crypto_dev); +#endif /* __OTX2_CRYPTODEV_SEC_H__ */
Signature · 1 line
2.27.0
PATCH v3 5/8 crypto/octeontx2: add cryptodev sec capabilities
In reply to Tejasree KondojThis patch adds lookaside IPsec capabilities.
--- drivers/crypto/octeontx2/otx2_cryptodev.c | 1 + .../octeontx2/otx2_cryptodev_capabilities.c | 101 ++++++++++++++++++ .../octeontx2/otx2_cryptodev_capabilities.h | 13 +++ drivers/crypto/octeontx2/otx2_cryptodev_sec.c | 4 +- 4 files changed, 118 insertions(+), 1 deletion(-)
drivers/crypto/octeontx2/otx2_cryptodev.c +1 -0
@@ -103,6 +103,7 @@ otx2_cpt_pci_probe(struct rte_pci_driver *pci_drv __rte_unused, }otx2_crypto_capabilities_init (vf->hw_caps); +otx2_crypto_sec_capabilities_init (vf->hw_caps);/* Create security ctx */ ret =otx2_crypto_sec_ctx_create (dev);
drivers/crypto/octeontx2/otx2_cryptodev_capabilities.c +101 -0
126 lines not on this page · raw message
drivers/crypto/octeontx2/otx2_cryptodev_capabilities.h +13 -0
@@ -29,4 +29,17 @@ void otx2_crypto_capabilities_init(union cpt_eng_caps *hw_caps);const struct rte_cryptodev_capabilities *otx2_cpt_capabilities_get (void ); +/* +* Initialize security capabilities for the device +* +*/ +void otx2_crypto_sec_capabilities_init (union cpt_eng_caps *hw_caps); + +/* +* Get security capabilities list for the device +* +*/ +const struct rte_security_capability * +otx2_crypto_sec_capabilities_get(void *device __rte_unused); +#endif /* _OTX2_CRYPTODEV_CAPABILITIES_H_ */
drivers/crypto/octeontx2/otx2_cryptodev_sec.c +3 -1
@@ -7,6 +7,8 @@#include <rte_security.h> #include <rte_security_driver.h> +#include "otx2_cryptodev.h" +#include "otx2_cryptodev_capabilities.h" #include "otx2_cryptodev_sec.h" static struct rte_security_ops otx2_crypto_sec_ops = {
@@ -15,7 +17,7 @@ static struct rte_security_ops otx2_crypto_sec_ops = { .session_get_size = NULL, .set_pkt_metadata = NULL, .get_userdata = NULL, - .capabilities_get = NULL + .capabilities_get = otx2_crypto_sec_capabilities_get };int
Signature · 1 line
2.27.0
PATCH v3 6/8 crypto/octeontx2: add cryptodev sec misc callbacks
In reply to Tejasree KondojFrom: Vamsi Attunuru <[email protected]>
This patch adds lookaside IPsec callback functions.
--- drivers/crypto/octeontx2/otx2_cryptodev_sec.c | 34 +++++++++++++++++-- 1 file changed, 31 insertions(+), 3 deletions(-)
drivers/crypto/octeontx2/otx2_cryptodev_sec.c +31 -3
@@ -10,13 +10,41 @@#include "otx2_cryptodev.h" #include "otx2_cryptodev_capabilities.h" #include "otx2_cryptodev_sec.h" +#include "otx2_security.h" + +static unsigned int +otx2_crypto_sec_session_get_size(void *device __rte_unused) +{ +return sizeof (struct otx2_sec_session ); +} + +static int +otx2_crypto_sec_set_pkt_mdata(void *device __rte_unused, +struct rte_security_session *session, + struct rte_mbuf *m, void *params __rte_unused) +{ +/* Set security session as the pkt metadata */ + m->udata64 = (uint64_t )session; + +return 0 ; +} + +static int +otx2_crypto_sec_get_userdata(void *device __rte_unused, uint64_t md, +void **userdata) +{ +/* Retrieve userdata */ + *userdata = (void *)md; + +return 0 ; +}static struct rte_security_ops otx2_crypto_sec_ops = { .session_create =NULL , .session_destroy =NULL , - .session_get_size =NULL , - .set_pkt_metadata =NULL , - .get_userdata =NULL , + .session_get_size = otx2_crypto_sec_session_get_size, + .set_pkt_metadata = otx2_crypto_sec_set_pkt_mdata, + .get_userdata = otx2_crypto_sec_get_userdata, .capabilities_get = otx2_crypto_sec_capabilities_get };
Signature · 1 line
2.27.0
PATCH v3 7/8 crypto/octeontx2: add cryptodev sec session create
In reply to Tejasree KondojFrom: Vamsi Attunuru <[email protected]>
This patch creates session for lookaside IPsec.
--- drivers/crypto/octeontx2/otx2_cryptodev_sec.c | 468 +++++++++++++++++- drivers/crypto/octeontx2/otx2_ipsec_po.h | 295 +++++++++++ drivers/crypto/octeontx2/otx2_security.h | 9 + drivers/net/octeontx2/otx2_ethdev_sec.c | 23 +- 4 files changed, 777 insertions(+), 18 deletions(-)
drivers/crypto/octeontx2/otx2_cryptodev_sec.c +466 -2
@@ -3,15 +3,479 @@*/ #include <rte_cryptodev.h> +#include <rte_esp.h> +#include <rte_ethdev.h> +#include <rte_ip.h> #include <rte_malloc.h> #include <rte_security.h> #include <rte_security_driver.h> +#include <rte_udp.h> #include "otx2_cryptodev.h" #include "otx2_cryptodev_capabilities.h" +#include "otx2_cryptodev_hw_access.h" +#include "otx2_cryptodev_ops.h" #include "otx2_cryptodev_sec.h" #include "otx2_security.h" +static int +ipsec_lp_len_precalc (struct rte_security_ipsec_xform *ipsec, +struct rte_crypto_sym_xform *xform, +struct otx2_sec_session_ipsec_lp *lp) +{ +struct rte_crypto_sym_xform *cipher_xform, *auth_xform; + + lp->partial_len =sizeof (struct rte_ipv4_hdr ); + +if (ipsec->proto ==RTE_SECURITY_IPSEC_SA_PROTO_ESP ) { + lp->partial_len +=sizeof (struct rte_esp_hdr ); + lp->roundup_len =sizeof (struct rte_esp_tail ); + }else if (ipsec->proto ==RTE_SECURITY_IPSEC_SA_PROTO_AH ) { + lp->partial_len +=OTX2_SEC_AH_HDR_LEN ; + }else { +return -EINVAL ; + } + +if (ipsec->options.udp_encap) + lp->partial_len +=sizeof (struct rte_udp_hdr ); + +if (xform->type ==RTE_CRYPTO_SYM_XFORM_AEAD ) { +if (xform->aead.algo ==RTE_CRYPTO_AEAD_AES_GCM ) { + lp->partial_len +=OTX2_SEC_AES_GCM_IV_LEN ; + lp->partial_len +=OTX2_SEC_AES_GCM_MAC_LEN ; + lp->roundup_byte =OTX2_SEC_AES_GCM_ROUNDUP_BYTE_LEN ; +return 0 ; + }else { +return -EINVAL ; + } + } + +if (ipsec->direction ==RTE_SECURITY_IPSEC_SA_DIR_EGRESS ) { + cipher_xform = xform; + auth_xform = xform->next; + }else if (ipsec->direction ==RTE_SECURITY_IPSEC_SA_DIR_INGRESS ) { + auth_xform = xform; + cipher_xform = xform->next; + }else { +return -EINVAL ; + } + +if (cipher_xform->cipher.algo ==RTE_CRYPTO_CIPHER_AES_CBC ) { + lp->partial_len +=OTX2_SEC_AES_CBC_IV_LEN ; + lp->roundup_byte =OTX2_SEC_AES_CBC_ROUNDUP_BYTE_LEN ; + }else { +return -EINVAL ; + } + +if (auth_xform->auth.algo ==RTE_CRYPTO_AUTH_SHA1_HMAC ) + lp->partial_len +=OTX2_SEC_SHA1_HMAC_LEN ; +else +return -EINVAL ; + +return 0 ; +} + +static int +otx2_cpt_enq_sa_write (struct otx2_sec_session_ipsec_lp *lp, +struct otx2_cpt_qp *qptr,uint8_t opcode) +{ +uint64_t lmt_status, time_out; +void *lmtline = qptr->lmtline; +struct otx2_cpt_inst_s inst; +struct otx2_cpt_res *res; +uint64_t *mdata; +int ret =0 ; + +if (unlikely (rte_mempool_get (qptr->meta_info.pool, + (void **)&mdata) <0 )) +return -ENOMEM ; + + res = (struct otx2_cpt_res *)RTE_PTR_ALIGN (mdata,16 ); + res->compcode =CPT_9X_COMP_E_NOTDONE ; + + inst.opcode = opcode | (lp->ctx_len <<8 ); + inst.param1 =0 ; + inst.param2 =0 ; + inst.dlen = lp->ctx_len <<3 ; + inst.dptr =rte_mempool_virt2iova (lp); + inst.rptr =0 ; + inst.cptr =rte_mempool_virt2iova (lp); + inst.egrp =OTX2_CPT_EGRP_SE ; + + inst.u64[0 ] =0 ; + inst.u64[2 ] =0 ; + inst.u64[3 ] =0 ; + inst.res_addr =rte_mempool_virt2iova (res); + +rte_cio_wmb (); + +do { +/* Copy CPT command to LMTLINE */ +otx2_lmt_mov (lmtline, &inst,2 ); + lmt_status =otx2_lmt_submit (qptr->lf_nq_reg); + }while (lmt_status ==0 ); + + time_out =rte_get_timer_cycles () + +DEFAULT_COMMAND_TIMEOUT *rte_get_timer_hz (); + +while (res->compcode ==CPT_9X_COMP_E_NOTDONE ) { +if (rte_get_timer_cycles () > time_out) { +rte_mempool_put (qptr->meta_info.pool, mdata); +otx2_err ("Request timed out" ); +return -ETIMEDOUT ; + } +rte_cio_rmb (); + } + +if (unlikely (res->compcode !=CPT_9X_COMP_E_GOOD )) { + ret = res->compcode; +switch (ret) { +case CPT_9X_COMP_E_INSTERR : +otx2_err ("Request failed with instruction error" ); +break ; +case CPT_9X_COMP_E_FAULT : +otx2_err ("Request failed with DMA fault" ); +break ; +case CPT_9X_COMP_E_HWERR : +otx2_err ("Request failed with hardware error" ); +break ; +default : +otx2_err ("Request failed with unknown hardware " +"completion code : 0x%x" , ret); + } + goto mempool_put; + } + +if (unlikely (res->uc_compcode !=OTX2_IPSEC_PO_CC_SUCCESS )) { + ret = res->uc_compcode; +switch (ret) { +case OTX2_IPSEC_PO_CC_AUTH_UNSUPPORTED : +otx2_err ("Invalid auth type" ); +break ; +case OTX2_IPSEC_PO_CC_ENCRYPT_UNSUPPORTED : +otx2_err ("Invalid encrypt type" ); +break ; +default : +otx2_err ("Request failed with unknown microcode " +"completion code : 0x%x" , ret); + } + } + +mempool_put: +rte_mempool_put (qptr->meta_info.pool, mdata); +return ret; +} + +static void +set_session_misc_attributes (struct otx2_sec_session_ipsec_lp *sess, +struct rte_crypto_sym_xform *crypto_xform, +struct rte_crypto_sym_xform *auth_xform, +struct rte_crypto_sym_xform *cipher_xform) +{ +if (crypto_xform->type ==RTE_CRYPTO_SYM_XFORM_AEAD ) { + sess->iv_offset = crypto_xform->aead.iv.offset; + sess->iv_length = crypto_xform->aead.iv.length; + sess->aad_length = crypto_xform->aead.aad_length; + sess->mac_len = crypto_xform->aead.digest_length; + }else { + sess->iv_offset = cipher_xform->cipher.iv.offset; + sess->iv_length = cipher_xform->cipher.iv.length; + sess->auth_iv_offset = auth_xform->auth.iv.offset; + sess->auth_iv_length = auth_xform->auth.iv.length; + sess->mac_len = auth_xform->auth.digest_length; + } + + sess->ucmd_param1 =OTX2_IPSEC_PO_PER_PKT_IV ; + sess->ucmd_param2 =0 ; +} + +static int +crypto_sec_ipsec_outb_session_create (struct rte_cryptodev *crypto_dev, +struct rte_security_ipsec_xform *ipsec, +struct rte_crypto_sym_xform *crypto_xform, +struct rte_security_session *sec_sess) +{ +struct rte_crypto_sym_xform *auth_xform, *cipher_xform; +const uint8_t *cipher_key, *auth_key; +struct otx2_sec_session_ipsec_lp *lp; +struct otx2_ipsec_po_sa_ctl *ctl; +int cipher_key_len, auth_key_len; +struct otx2_ipsec_po_out_sa *sa; +struct otx2_sec_session *sess; +struct otx2_cpt_inst_s inst; +struct rte_ipv4_hdr *ip; +int ret; + + sess =get_sec_session_private_data (sec_sess); + lp = &sess->ipsec.lp; + + sa = &lp->out_sa; + ctl = &sa->ctl; +if (ctl->valid) { +otx2_err ("SA already registered" ); +return -EINVAL ; + } + +memset (sa,0 ,sizeof (struct otx2_ipsec_po_out_sa )); + +/* Initialize lookaside ipsec private data */ + lp->ip_id =0 ; + lp->seq_lo =1 ; + lp->seq_hi =0 ; + + ret =ipsec_po_sa_ctl_set (ipsec, crypto_xform, ctl); +if (ret) +return ret; + + ret =ipsec_lp_len_precalc (ipsec, crypto_xform, lp); +if (ret) +return ret; + +memcpy (sa->iv.gcm.nonce, &ipsec->salt,4 ); + +if (ipsec->options.udp_encap) { + sa->udp_src =4500 ; + sa->udp_dst =4500 ; + } + +if (ipsec->mode ==RTE_SECURITY_IPSEC_SA_MODE_TUNNEL ) { +/* Start ip id from 1 */ + lp->ip_id =1 ; + +if (ipsec->tunnel.type ==RTE_SECURITY_IPSEC_TUNNEL_IPV4 ) { + ip = &sa->template.ipv4_hdr; + ip->version_ihl =RTE_IPV4_VHL_DEF ; + ip->next_proto_id =IPPROTO_ESP ; + ip->time_to_live = ipsec->tunnel.ipv4.ttl; + ip->type_of_service |= (ipsec->tunnel.ipv4.dscp <<2 ); +if (ipsec->tunnel.ipv4.df) + ip->fragment_offset =BIT (14 ); +memcpy (&ip->src_addr, &ipsec->tunnel.ipv4.src_ip, +sizeof (struct in_addr )); +memcpy (&ip->dst_addr, &ipsec->tunnel.ipv4.dst_ip, +sizeof (struct in_addr )); + }else { +return -EINVAL ; + } + }else { +return -EINVAL ; + } + + cipher_xform = crypto_xform; + auth_xform = crypto_xform->next; + + cipher_key_len =0 ; + auth_key_len =0 ; + +if (crypto_xform->type ==RTE_CRYPTO_SYM_XFORM_AEAD ) { + cipher_key = crypto_xform->aead.key.data; + cipher_key_len = crypto_xform->aead.key.length; + + lp->ctx_len =sizeof (struct otx2_ipsec_po_out_sa ); + lp->ctx_len >>=3 ; +RTE_ASSERT (lp->ctx_len ==OTX2_IPSEC_PO_AES_GCM_OUTB_CTX_LEN ); + }else { + cipher_key = cipher_xform->cipher.key.data; + cipher_key_len = cipher_xform->cipher.key.length; + auth_key = auth_xform->auth.key.data; + auth_key_len = auth_xform->auth.key.length; + +/* TODO: check the ctx len for supporting ALGO */ + lp->ctx_len =sizeof (struct otx2_ipsec_po_out_sa ) >>3 ; +RTE_ASSERT (lp->ctx_len ==OTX2_IPSEC_PO_MAX_OUTB_CTX_LEN ); + } + +if (cipher_key_len !=0 ) +memcpy (sa->cipher_key, cipher_key, cipher_key_len); +else +return -EINVAL ; + +/* Use OPAD & IPAD */ +RTE_SET_USED (auth_key); +RTE_SET_USED (auth_key_len); + + inst.u64[7 ] =0 ; + inst.egrp =OTX2_CPT_EGRP_SE ; + inst.cptr =rte_mempool_virt2iova (sa); + + lp->ucmd_w3 = inst.u64[7 ]; + lp->ucmd_opcode = (lp->ctx_len <<8 ) | + (OTX2_IPSEC_PO_PROCESS_IPSEC_OUTB ); + +set_session_misc_attributes (lp, crypto_xform, + auth_xform, cipher_xform); + +return otx2_cpt_enq_sa_write (lp, crypto_dev->data->queue_pairs[0 ], +OTX2_IPSEC_PO_WRITE_IPSEC_OUTB ); +} + +static int +crypto_sec_ipsec_inb_session_create (struct rte_cryptodev *crypto_dev, +struct rte_security_ipsec_xform *ipsec, +struct rte_crypto_sym_xform *crypto_xform, +struct rte_security_session *sec_sess) +{ +struct rte_crypto_sym_xform *auth_xform, *cipher_xform; +struct otx2_sec_session_ipsec_lp *lp; +struct otx2_ipsec_po_sa_ctl *ctl; +const uint8_t *cipher_key, *auth_key; +int cipher_key_len, auth_key_len; +struct otx2_ipsec_po_in_sa *sa; +struct otx2_sec_session *sess; +struct otx2_cpt_inst_s inst; +int ret; + + sess =get_sec_session_private_data (sec_sess); + lp = &sess->ipsec.lp; + + sa = &lp->in_sa; + ctl = &sa->ctl; + +if (ctl->valid) { +otx2_err ("SA already registered" ); +return -EINVAL ; + } + +memset (sa,0 ,sizeof (struct otx2_ipsec_po_in_sa )); + + ret =ipsec_po_sa_ctl_set (ipsec, crypto_xform, ctl); +if (ret) +return ret; + + auth_xform = crypto_xform; + cipher_xform = crypto_xform->next; + + cipher_key_len =0 ; + auth_key_len =0 ; + +if (crypto_xform->type ==RTE_CRYPTO_SYM_XFORM_AEAD ) { +if (crypto_xform->aead.algo ==RTE_CRYPTO_AEAD_AES_GCM ) +memcpy (sa->iv.gcm.nonce, &ipsec->salt,4 ); + cipher_key = crypto_xform->aead.key.data; + cipher_key_len = crypto_xform->aead.key.length; + + lp->ctx_len = offsetof(struct otx2_ipsec_po_in_sa , + aes_gcm.hmac_key[0]) >> 3; +RTE_ASSERT (lp->ctx_len ==OTX2_IPSEC_PO_AES_GCM_INB_CTX_LEN ); + }else { + cipher_key = cipher_xform->cipher.key.data; + cipher_key_len = cipher_xform->cipher.key.length; + auth_key = auth_xform->auth.key.data; + auth_key_len = auth_xform->auth.key.length; + +/* TODO: check the ctx len for supporting ALGO */ + lp->ctx_len =sizeof (struct otx2_ipsec_po_in_sa ) >>2 ; +RTE_ASSERT (lp->ctx_len ==OTX2_IPSEC_PO_MAX_INB_CTX_LEN ); + } + +if (cipher_key_len !=0 ) +memcpy (sa->cipher_key, cipher_key, cipher_key_len); +else +return -EINVAL ; + +/* Use OPAD & IPAD */ +RTE_SET_USED (auth_key); +RTE_SET_USED (auth_key_len); + + inst.u64[7 ] =0 ; + inst.egrp =OTX2_CPT_EGRP_SE ; + inst.cptr =rte_mempool_virt2iova (sa); + + lp->ucmd_w3 = inst.u64[7 ]; + lp->ucmd_opcode = (lp->ctx_len <<8 ) | + (OTX2_IPSEC_PO_PROCESS_IPSEC_INB ); + +set_session_misc_attributes (lp, crypto_xform, + auth_xform, cipher_xform); + +return otx2_cpt_enq_sa_write (lp, crypto_dev->data->queue_pairs[0 ], +OTX2_IPSEC_PO_WRITE_IPSEC_INB ); +} + +static int +crypto_sec_ipsec_session_create (struct rte_cryptodev *crypto_dev, +struct rte_security_ipsec_xform *ipsec, +struct rte_crypto_sym_xform *crypto_xform, +struct rte_security_session *sess) +{ +int ret; + +if (crypto_dev->data->queue_pairs[0 ] ==NULL ) { +otx2_err ("Setup cpt queue pair before creating sec session" ); +return -EPERM ; + } + + ret =ipsec_po_xform_verify (ipsec, crypto_xform); +if (ret) +return ret; + +if (ipsec->direction ==RTE_SECURITY_IPSEC_SA_DIR_INGRESS ) +return crypto_sec_ipsec_inb_session_create (crypto_dev, ipsec, + crypto_xform, sess); +else +return crypto_sec_ipsec_outb_session_create (crypto_dev, ipsec, + crypto_xform, sess); +} + +static int +otx2_crypto_sec_session_create (void *device, +struct rte_security_session_conf *conf, +struct rte_security_session *sess, +struct rte_mempool *mempool) +{ +struct otx2_sec_session *priv; +int ret; + +if (conf->action_type !=RTE_SECURITY_ACTION_TYPE_LOOKASIDE_PROTOCOL ) +return -ENOTSUP ; + +if (rte_mempool_get (mempool, (void **)&priv)) { +otx2_err ("Could not allocate security session private data" ); +return -ENOMEM ; + } + +set_sec_session_private_data (sess, priv); + + priv->userdata = conf->userdata; + +if (conf->protocol ==RTE_SECURITY_PROTOCOL_IPSEC ) + ret =crypto_sec_ipsec_session_create (device, &conf->ipsec, + conf->crypto_xform, + sess); +else + ret = -ENOTSUP ; + +if (ret) + goto mempool_put; + +return 0 ; + +mempool_put: +rte_mempool_put (mempool, priv); +set_sec_session_private_data (sess,NULL ); +return ret; +} + +static int +otx2_crypto_sec_session_destroy(void *device __rte_unused, +struct rte_security_session *sess) +{ +struct otx2_sec_session *priv; +struct rte_mempool *sess_mp; + + priv =get_sec_session_private_data (sess); + +if (priv ==NULL ) +return 0 ; + + sess_mp =rte_mempool_from_obj (priv); + +set_sec_session_private_data (sess,NULL ); +rte_mempool_put (sess_mp, priv); + +return 0 ; +} +static unsigned int otx2_crypto_sec_session_get_size(void *device __rte_unused) {
@@ -40,8 +504,8 @@ otx2_crypto_sec_get_userdata(void *device __rte_unused, uint64_t md, }static struct rte_security_ops otx2_crypto_sec_ops = { - .session_create =NULL , - .session_destroy =NULL , + .session_create = otx2_crypto_sec_session_create, + .session_destroy = otx2_crypto_sec_session_destroy, .session_get_size = otx2_crypto_sec_session_get_size, .set_pkt_metadata = otx2_crypto_sec_set_pkt_mdata, .get_userdata = otx2_crypto_sec_get_userdata,
drivers/crypto/octeontx2/otx2_ipsec_po.h +295 -0
305 lines not on this page · raw message
drivers/crypto/octeontx2/otx2_security.h +9 -0
@@ -8,6 +8,15 @@#include "otx2_cryptodev_sec.h" #include "otx2_ethdev_sec.h" +#define OTX2_SEC_AH_HDR_LEN 12 +#define OTX2_SEC_AES_GCM_IV_LEN 8 +#define OTX2_SEC_AES_GCM_MAC_LEN 16 +#define OTX2_SEC_AES_CBC_IV_LEN 16 +#define OTX2_SEC_SHA1_HMAC_LEN 12 + +#define OTX2_SEC_AES_GCM_ROUNDUP_BYTE_LEN 4 +#define OTX2_SEC_AES_CBC_ROUNDUP_BYTE_LEN 16 +union otx2_sec_session_ipsec {struct otx2_sec_session_ipsec_ip ip;struct otx2_sec_session_ipsec_lp lp;
drivers/net/octeontx2/otx2_ethdev_sec.c +7 -16
@@ -21,15 +21,6 @@#include "otx2_sec_idev.h" #include "otx2_security.h" -#define AH_HDR_LEN 12 -#define AES_GCM_IV_LEN 8 -#define AES_GCM_MAC_LEN 16 -#define AES_CBC_IV_LEN 16 -#define SHA1_HMAC_LEN 12 - -#define AES_GCM_ROUNDUP_BYTE_LEN 4 -#define AES_CBC_ROUNDUP_BYTE_LEN 16 - struct eth_sec_tag_const { RTE_STD_C11 union {
@@ -238,7 +229,7 @@ ipsec_sa_const_set(struct rte_security_ipsec_xform *ipsec, sess->partial_len +=sizeof (struct rte_esp_hdr ); sess->roundup_len =sizeof (struct rte_esp_tail ); }else if (ipsec->proto ==RTE_SECURITY_IPSEC_SA_PROTO_AH ) { - sess->partial_len +=AH_HDR_LEN ; + sess->partial_len +=OTX2_SEC_AH_HDR_LEN ; }else {return -EINVAL ; }
@@ -248,9 +239,9 @@ ipsec_sa_const_set(struct rte_security_ipsec_xform *ipsec,if (xform->type ==RTE_CRYPTO_SYM_XFORM_AEAD ) {if (xform->aead.algo ==RTE_CRYPTO_AEAD_AES_GCM ) { - sess->partial_len +=AES_GCM_IV_LEN ; - sess->partial_len +=AES_GCM_MAC_LEN ; - sess->roundup_byte =AES_GCM_ROUNDUP_BYTE_LEN ; + sess->partial_len +=OTX2_SEC_AES_GCM_IV_LEN ; + sess->partial_len +=OTX2_SEC_AES_GCM_MAC_LEN ; + sess->roundup_byte =OTX2_SEC_AES_GCM_ROUNDUP_BYTE_LEN ; }return 0 ; }
@@ -265,14 +256,14 @@ ipsec_sa_const_set(struct rte_security_ipsec_xform *ipsec,return -EINVAL ; }if (cipher_xform->cipher.algo ==RTE_CRYPTO_CIPHER_AES_CBC ) { - sess->partial_len +=AES_CBC_IV_LEN ; - sess->roundup_byte =AES_CBC_ROUNDUP_BYTE_LEN ; + sess->partial_len +=OTX2_SEC_AES_CBC_IV_LEN ; + sess->roundup_byte =OTX2_SEC_AES_CBC_ROUNDUP_BYTE_LEN ; }else {return -EINVAL ; }if (auth_xform->auth.algo ==RTE_CRYPTO_AUTH_SHA1_HMAC ) - sess->partial_len +=SHA1_HMAC_LEN ; + sess->partial_len +=OTX2_SEC_SHA1_HMAC_LEN ;else return -EINVAL ;
Signature · 1 line
2.27.0
PATCH v3 8/8 crypto/octeontx2: add cryptodev sec enqueue and dequeue routines
In reply to Tejasree KondojFrom: Vamsi Attunuru <[email protected]>
This patch adds lookaside IPsec enqueue and dequeue routines.
--- doc/guides/cryptodevs/octeontx2.rst | 21 +++ doc/guides/rel_notes/release_20_08.rst | 5 + drivers/crypto/octeontx2/otx2_cryptodev.h | 8 + drivers/crypto/octeontx2/otx2_cryptodev_ops.c | 73 +++++++- drivers/crypto/octeontx2/otx2_ipsec_po.h | 8 + drivers/crypto/octeontx2/otx2_ipsec_po_ops.h | 175 ++++++++++++++++++ 6 files changed, 289 insertions(+), 1 deletion(-) create mode 100644 drivers/crypto/octeontx2/otx2_ipsec_po_ops.h
doc/guides/cryptodevs/octeontx2.rst +21 -0
@@ -158,3 +158,24 @@ application: ./test RTE>>cryptodev_octeontx2_asym_autotest + + +Lookaside IPsec Support +----------------------- + +The OCTEON TX2 SoC can accelerate IPsec traffic in lookaside protocol mode, +with its **cryptographic accelerator (CPT)**. ``OCTEON TX2 crypto PMD`` implements +this as an ``RTE_SECURITY_ACTION_TYPE_LOOKASIDE_PROTOCOL`` offload. + +Refer to :doc:`../prog_guide/rte_security` for more details on protocol offloads. + +This feature can be tested with ipsec-secgw sample application. + + +Features supported +~~~~~~~~~~~~~~~~~~ + +* IPv4 +* ESP +* Tunnel mode +* AES-128/192/256-GCM
doc/guides/rel_notes/release_20_08.rst +5 -0
@@ -196,6 +196,11 @@ New Features Added Chacha20-Poly1305 AEAD algorithm support in OCTEON TX2 crypto PMD. +* **Updated the OCTEON TX2 crypto PMD to support rte_security.** + + Updated the OCTEON TX2 crypto PMD to support ``rte_security`` lookaside + protocol offload for IPsec. + * **Added support for BPF_ABS/BPF_IND load instructions.** Added support for two BPF non-generic instructions:
drivers/crypto/octeontx2/otx2_cryptodev.h +8 -0
@@ -6,6 +6,7 @@#define _OTX2_CRYPTODEV_H_#include "cpt_common.h" +#include "cpt_hw_types.h" #include "otx2_dev.h"
@@ -33,6 +34,13 @@ struct otx2_cpt_vf {/**< CPT device capabilities */ }; +struct cpt_meta_info { +uint64_t deq_op_info[4 ]; +uint64_t comp_code_sz; + union cpt_res_s cpt_res __rte_aligned(16); + struct cpt_request_info cpt_req __rte_aligned(8); +}; +#define CPT_LOGTYPE otx2_cpt_logtypeextern int otx2_cpt_logtype;
drivers/crypto/octeontx2/otx2_cryptodev_ops.c +72 -1
104 lines not on this page · raw message
drivers/crypto/octeontx2/otx2_ipsec_po.h +8 -0
@@ -22,6 +22,8 @@#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 ,
@@ -86,6 +88,12 @@ enum { OTX2_IPSEC_PO_SA_ENCAP_UDP = 1, }; +struct otx2_ipsec_po_out_hdr { +uint32_t ip_id; +uint32_t seq; +uint8_t iv[16 ]; +}; +union otx2_ipsec_po_bit_perfect_iv {uint8_t aes_iv[16 ];uint8_t des_iv[8 ];
drivers/crypto/octeontx2/otx2_ipsec_po_ops.h new file +175 -0
175 lines not on this page · raw message
Signature · 1 line
2.27.0
Quoted 49 lines
This series adds lookaside IPsec support in OCTEON TX2 PMD.
Features supported:
* IPv4
* ESP
* Tunnel mode
* AES-128/192/256-GCMv3:
* Fixed PMD documentation and release notes updates
* Squashed enqueue and dequeue patches
* Removed unused codev2:
* Updated PMD documentation and release notes
* Moved capabilities initialization into probe
* Added patch description to all patches
* Renamed few structures and macros
* Cosmetics and code style fixesTejasree Kondoj (5):
crypto/octeontx2: move capabilities initialization into probe net/octeontx2: moveotx2_sec_sessionstruct tootx2_security.hcrypto/octeontx2: add lookaside SA context definitionscrypto/octeontx2: add cryptodev sec registrationcrypto/octeontx2: add cryptodev sec capabilitiesVamsi Attunuru (3):
crypto/octeontx2: add cryptodev sec misc callbackscrypto/octeontx2: add cryptodev sec session createcrypto/octeontx2: add cryptodev sec enqueue and dequeue routinesdoc/guides/cryptodevs/features/octeontx2.ini | 1 + doc/guides/cryptodevs/octeontx2.rst | 21 + doc/guides/rel_notes/release_20_08.rst | 5 + drivers/crypto/octeontx2/Makefile | 1 + drivers/crypto/octeontx2/meson.build | 3 +- drivers/crypto/octeontx2/otx2_cryptodev.c | 15 +- drivers/crypto/octeontx2/otx2_cryptodev.h | 8 + .../octeontx2/otx2_cryptodev_capabilities.c | 110 +++- .../octeontx2/otx2_cryptodev_capabilities.h | 21 +- drivers/crypto/octeontx2/otx2_cryptodev_ops.c | 75 ++- drivers/crypto/octeontx2/otx2_cryptodev_sec.c | 540 ++++++++++++++++++ drivers/crypto/octeontx2/otx2_cryptodev_sec.h | 64 +++ drivers/crypto/octeontx2/otx2_ipsec_po.h | 413 ++++++++++++++ drivers/crypto/octeontx2/otx2_ipsec_po_ops.h | 175 ++++++ drivers/crypto/octeontx2/otx2_security.h | 31 + drivers/net/octeontx2/otx2_ethdev_sec.c | 24 +-
Quoted 9 lines
drivers/net/octeontx2/otx2_ethdev_sec.h | 11 +- drivers/net/octeontx2/otx2_ethdev_sec_tx.h | 1 + 18 files changed, 1485 insertions(+), 34 deletions(-) create mode 100644 drivers/crypto/octeontx2/otx2_cryptodev_sec.c create mode 100644 drivers/crypto/octeontx2/otx2_cryptodev_sec.h create mode 100644 drivers/crypto/octeontx2/otx2_ipsec_po.h create mode 100644 drivers/crypto/octeontx2/otx2_ipsec_po_ops.h create mode 100644 drivers/crypto/octeontx2/otx2_security.h
Series Acked-by: Anoob Joseph <[email protected]>
Akhil Goyal
AppliedQuoted 60 lines
Quoted 50 lines
This series adds lookaside IPsec support in OCTEON TX2 PMD.
Features supported:
* IPv4
* ESP
* Tunnel mode
* AES-128/192/256-GCMv3:
* Fixed PMD documentation and release notes updates
* Squashed enqueue and dequeue patches
* Removed unused codev2:
* Updated PMD documentation and release notes
* Moved capabilities initialization into probe
* Added patch description to all patches
* Renamed few structures and macros
* Cosmetics and code style fixesTejasree Kondoj (5):
crypto/octeontx2: move capabilities initialization into probe net/octeontx2: moveotx2_sec_sessionstruct tootx2_security.hcrypto/octeontx2: add lookaside SA context definitionscrypto/octeontx2: add cryptodev sec registrationcrypto/octeontx2: add cryptodev sec capabilitiesVamsi Attunuru (3):
crypto/octeontx2: add cryptodev sec misc callbackscrypto/octeontx2: add cryptodev sec session createcrypto/octeontx2: add cryptodev sec enqueue and dequeue routinesdoc/guides/cryptodevs/features/octeontx2.ini | 1 + doc/guides/cryptodevs/octeontx2.rst | 21 + doc/guides/rel_notes/release_20_08.rst | 5 + drivers/crypto/octeontx2/Makefile | 1 + drivers/crypto/octeontx2/meson.build | 3 +- drivers/crypto/octeontx2/otx2_cryptodev.c | 15 +- drivers/crypto/octeontx2/otx2_cryptodev.h | 8 + .../octeontx2/otx2_cryptodev_capabilities.c | 110 +++- .../octeontx2/otx2_cryptodev_capabilities.h | 21 +- drivers/crypto/octeontx2/otx2_cryptodev_ops.c | 75 ++- drivers/crypto/octeontx2/otx2_cryptodev_sec.c | 540 ++++++++++++++++++ drivers/crypto/octeontx2/otx2_cryptodev_sec.h | 64 +++ drivers/crypto/octeontx2/otx2_ipsec_po.h | 413 ++++++++++++++ drivers/crypto/octeontx2/otx2_ipsec_po_ops.h | 175 ++++++ drivers/crypto/octeontx2/otx2_security.h | 31 + drivers/net/octeontx2/otx2_ethdev_sec.c | 24 +-Quoted 9 lines
drivers/net/octeontx2/otx2_ethdev_sec.h | 11 +- drivers/net/octeontx2/otx2_ethdev_sec_tx.h | 1 + 18 files changed, 1485 insertions(+), 34 deletions(-) create mode 100644 drivers/crypto/octeontx2/otx2_cryptodev_sec.c create mode 100644 drivers/crypto/octeontx2/otx2_cryptodev_sec.h create mode 100644 drivers/crypto/octeontx2/otx2_ipsec_po.h create mode 100644 drivers/crypto/octeontx2/otx2_ipsec_po_ops.h create mode 100644 drivers/crypto/octeontx2/otx2_security.h
Quoted 1 line
Series Acked-by: Anoob Joseph <[email protected]>
Series Acked-by: Akhil Goyal <[email protected]>
Applied to dpdk-next-crypto
Some patch titles modified Please check.
Release note also updated.
Re: [dpdk-dev] [PATCH v3 8/8] crypto/octeontx2: add cryptodev sec enqueue and dequeue routines
In reply to Tejasree KondojQuoted 6 lines · Tejasree Kondoj
From: Vamsi Attunuru <[email protected]>
This patch adds lookaside IPsec enqueue and dequeue routines.
Signed-off-by Vamsi Attunuru <[email protected]>Signed-off-by Tejasree Kondoj <[email protected]>
<...>
drivers/crypto/octeontx2/otx2_cryptodev.h struct otx2_cpt_vf { · line 42
Quoted 10 lines
drivers/crypto/octeontx2/otx2_cryptodev.h +6
-0@@ -33,6 +34,13 @@ struct otx2_cpt_vf {/**< CPT device capabilities */ }; +struct cpt_meta_info { +uint64_t deq_op_info[4 ]; +uint64_t comp_code_sz; + union cpt_res_s cpt_res __rte_aligned(16); + struct cpt_request_info cpt_req __rte_aligned(8); +};
"struct cpt_request_info" already has cache size alignment (__rte_cache_aligned) [1].
Trying to align it to 8 bytes is reducing the alignment, gcc & clang seems silently ignoring this case but icc is giving a warning.
Since it is already ignored, and I assume the real intention is not to reduce the alignment, can you please remove the above "__rte_aligned(8)"?
@Thomas, it is still good to have icc around to catch additional issues ;)
[1]
http://lxr.dpdk.org/dpdk/v20.05/source/drivers/common/cpt/cpt_common.h#L79
Re: [dpdk-dev] [EXT] Re: [PATCH v3 8/8] crypto/octeontx2: add cryptodev sec enqueue and dequeue routines
Hi Ferruh,
Please see inline.
Thanks
Tejasree
Quoted 38 lines
-----Original Message-----
From: Ferruh Yigit <[email protected]>
Sent: Monday, July 20, 2020 5:33 PM
To: Tejasree Kondoj <[email protected]>; Akhil Goyal <[email protected]>; Radu Nicolau <[email protected]>
Cc: Vamsi Krishna Attunuru <[email protected]>; Narayana Prasad Raju Athreya <[email protected]>; Anoob Joseph <[email protected]>; [email protected]; Thomas Monjalon <[email protected]>
Subject: [EXT] Re: [dpdk-dev] [PATCH v3 8/8]crypto/octeontx2: add cryptodev sec enqueue and dequeue routinesExternal Email
----------------------------------------------------------------------
Quoted 6 lines · Tejasree Kondoj
From: Vamsi Attunuru <[email protected]>
This patch adds lookaside IPsec enqueue and dequeue routines.
Signed-off-by Vamsi Attunuru <[email protected]>Signed-off-by Tejasree Kondoj <[email protected]><...>
drivers/crypto/octeontx2/otx2_cryptodev.h struct otx2_cpt_vf { · line 41
Quoted 9 lines
drivers/crypto/octeontx2/otx2_cryptodev.h +5
-0@@ -33,6 +34,13 @@ struct otx2_cpt_vf {/**< CPT device capabilities */ }; +struct cpt_meta_info { +uint64_t deq_op_info[4 ]; +uint64_t comp_code_sz; + union cpt_res_s cpt_res __rte_aligned(16); + struct cpt_request_info cpt_req __rte_aligned(8); };"struct
cpt_request_info" already has cache size alignment (__rte_cache_aligned) [1].
Quoted 5 lines
Trying to align it to 8 bytes is reducing the alignment, gcc & clang seems silently ignoring this case but icc is giving a warning.
Since it is already ignored, and I assume the real intention is not to reduce the alignment, can you please remove the above "
__rte_aligned(8)"?
[Tejasree] 'struct cpt_request_info' need not be cache aligned. It will need to be aligned to 8 bytes as used in this patch. Will replace __rte_cache_aligned of 'struct cpt_request_info' with __rte_aligned(8) and remove above __rte_aligned(8). Will submit separate patch as a fix and mention commit id of merged patch (fab634eb87ca) in fixes section. Would that be fine?
Quoted 12 lines
@Thomas, it is still good to have icc around to catch additional issues ;)
[1]
https://urldefense.proofpoint.com/v2/url?u=http-
3A__lxr.dpdk.org_dpdk_v20.05_source_drivers_common_cpt_cpt- 5Fcommon.h- 23L79&d=DwIDaQ&c=nKjWec2b6R0mOyPaz7xtfQ&r=NjpqGUAf6Xc0ZLzxCvv4i df8zRFeSJHioNlG1Wif1Gs&m=KNBzM9j6nc00ue4kkISJLVTLpkDGjg4A4dUjIVFz Rps&s=Q0RPHY0v3g5f0uOh9vv7SKb61aQuQB2RhCDLiOtLZ7s&e=
Re: [dpdk-dev] [EXT] Re: [PATCH v3 8/8] crypto/octeontx2: add cryptodev sec enqueue and dequeue routines
Quoted 48 lines · Tejasree Kondoj
Hi Ferruh,
Please see inline.
Thanks
TejasreeQuoted 41 lines
-----Original Message-----
From: Ferruh Yigit <[email protected]>
Sent: Monday, July 20, 2020 5:33 PM
To: Tejasree Kondoj <[email protected]>; Akhil Goyal <[email protected]>; Radu Nicolau <[email protected]>
Cc: Vamsi Krishna Attunuru <[email protected]>; Narayana Prasad Raju Athreya <[email protected]>; Anoob Joseph <[email protected]>; [email protected]; Thomas Monjalon <[email protected]>
Subject: [EXT] Re: [dpdk-dev] [PATCH v3 8/8]crypto/octeontx2: add cryptodev sec enqueue and dequeue routinesExternal Email
----------------------------------------------------------------------
Quoted 6 lines · Tejasree Kondoj
From: Vamsi Attunuru <[email protected]>
This patch adds lookaside IPsec enqueue and dequeue routines.
Signed-off-by Vamsi Attunuru <[email protected]>Signed-off-by Tejasree Kondoj <[email protected]><...>
drivers/crypto/octeontx2/otx2_cryptodev.h struct otx2_cpt_vf { · line 41
Quoted 9 lines
drivers/crypto/octeontx2/otx2_cryptodev.h +5
-0@@ -33,6 +34,13 @@ struct otx2_cpt_vf {/**< CPT device capabilities */ }; +struct cpt_meta_info { +uint64_t deq_op_info[4 ]; +uint64_t comp_code_sz; + union cpt_res_s cpt_res __rte_aligned(16); + struct cpt_request_info cpt_req __rte_aligned(8); };"struct
cpt_request_info" already has cache size alignment (__rte_cache_aligned) [1].Trying to align it to 8 bytes is reducing the alignment, gcc & clang seems silently ignoring this case but icc is giving a warning.
Quoted 7 lines
Quoted 2 lines
Since it is already ignored, and I assume the real intention is not to reduce the alignment, can you please remove the above "
__rte_aligned(8)"?[Tejasree] 'struct
cpt_request_info' need not be cache aligned. It will need to be aligned to 8 bytes as used in this patch. Will replace__rte_cache_alignedof 'structcpt_request_info' with__rte_aligned(8)and remove above__rte_aligned(8). Will submit separate patch as a fix and mention commit id of merged patch (fab634eb87ca) in fixes section. Would that be fine?
That sounds fine, thanks.
Quoted 12 lines
Quoted 12 lines
@Thomas, it is still good to have icc around to catch additional issues ;)
[1]
https://urldefense.proofpoint.com/v2/url?u=http-
3A__lxr.dpdk.org_dpdk_v20.05_source_drivers_common_cpt_cpt- 5Fcommon.h- 23L79&d=DwIDaQ&c=nKjWec2b6R0mOyPaz7xtfQ&r=NjpqGUAf6Xc0ZLzxCvv4i df8zRFeSJHioNlG1Wif1Gs&m=KNBzM9j6nc00ue4kkISJLVTLpkDGjg4A4dUjIVFz Rps&s=Q0RPHY0v3g5f0uOh9vv7SKb61aQuQB2RhCDLiOtLZ7s&e=