add cn9k lookaside IPsec support
Subsystems (2)
v2 cover add cn9k lookaside IPsec support
This series adds lookaside IPsec support in cnxk crypto PMD for Marvell CN9K SOC.
Changes in v2:
- Fixed release notes
- Squashed patches and reduced no of patches from 8 to 6
Archana Muniganti (6):
crypto/cnxk: add cn9k security ctx
common/cnxk: add cn9k IPsec microcode defines crypto/cnxk: add cn9k security session ops crypto/cnxk: add cn9k lookaside IPsec datapath crypto/cnxk: update tailroom requirement crypto/cnxk: update feature flag for cn9k lookaside IPsec
doc/guides/cryptodevs/cnxk.rst | 14 +- doc/guides/cryptodevs/features/cn9k.ini | 1 + doc/guides/rel_notes/release_21_11.rst | 1 + drivers/common/cnxk/roc_cpt.h | 1 + drivers/common/cnxk/roc_ie_on.h | 158 +++++- drivers/crypto/cnxk/cn9k_cryptodev.c | 11 + drivers/crypto/cnxk/cn9k_cryptodev_ops.c | 78 ++- drivers/crypto/cnxk/cn9k_ipsec.c | 610 +++++++++++++++++++++++ drivers/crypto/cnxk/cn9k_ipsec.h | 46 ++ drivers/crypto/cnxk/cn9k_ipsec_la_ops.h | 90 ++++ drivers/crypto/cnxk/cnxk_cryptodev.c | 6 +- drivers/crypto/cnxk/cnxk_cryptodev_ops.c | 2 +- drivers/crypto/cnxk/cnxk_cryptodev_ops.h | 1 + drivers/crypto/cnxk/meson.build | 1 + 14 files changed, 1002 insertions(+), 18 deletions(-) create mode 100644 drivers/crypto/cnxk/cn9k_ipsec.c create mode 100644 drivers/crypto/cnxk/cn9k_ipsec.h create mode 100644 drivers/crypto/cnxk/cn9k_ipsec_la_ops.h
Signature · 1 line
2.22.0
PATCH v2 1/6 crypto/cnxk: add cn9k security ctx
Add security ctx in cn9k crypto PMD.
--- drivers/crypto/cnxk/cn9k_cryptodev.c | 9 +++++++++ 1 file changed, 9 insertions(+)
drivers/crypto/cnxk/cn9k_cryptodev.c +9 -0
@@ -14,6 +14,7 @@#include "cn9k_cryptodev_ops.h" #include "cnxk_cryptodev.h" #include "cnxk_cryptodev_capabilities.h" +#include "cnxk_cryptodev_sec.h" #include "roc_api.h"
@@ -77,6 +78,11 @@ cn9k_cpt_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,plt_err ("Failed to add engine group rc=%d" , rc); goto dev_fini; } + +/* Create security context */ + rc =cnxk_crypto_sec_ctx_create (dev); +if (rc) + goto dev_fini; } dev->dev_ops = &cn9k_cpt_ops;
@@ -117,6 +123,9 @@ cn9k_cpt_pci_remove(struct rte_pci_device *pci_dev)if (dev ==NULL )return -ENODEV ; +/* Destroy security context */ +cnxk_crypto_sec_ctx_destroy (dev); +if (rte_eal_process_type () ==RTE_PROC_PRIMARY ) { vf = dev->data->dev_private; ret =roc_cpt_dev_fini (&vf->cpt);
Signature · 1 line
2.22.0
PATCH v2 2/6 common/cnxk: add cn9k IPsec microcode defines
In reply to Archana MunigantiMicrocode IE opcodes support IPsec operations. Add defines and structs defined by microcode.
--- drivers/common/cnxk/roc_cpt.h | 1 + drivers/common/cnxk/roc_ie_on.h | 158 ++++++++++++++++++++++++++++++-- 2 files changed, 150 insertions(+), 9 deletions(-)
drivers/common/cnxk/roc_cpt.h +1 -0
@@ -47,6 +47,7 @@#define ROC_CPT_AES_GCM_MAC_LEN 16#define ROC_CPT_AES_CBC_IV_LEN 16#define ROC_CPT_SHA1_HMAC_LEN 12 +#define ROC_CPT_SHA2_HMAC_LEN 16#define ROC_CPT_AUTH_KEY_LEN_MAX 64#define ROC_CPT_DES3_KEY_LEN 24
drivers/common/cnxk/roc_ie_on.h +149 -9
173 lines not on this page · raw message
Signature · 1 line
2.22.0
PATCH v2 3/6 crypto/cnxk: add cn9k security session ops
In reply to Archana MunigantiAdd security session ops.
--- drivers/crypto/cnxk/cn9k_cryptodev.c | 2 + drivers/crypto/cnxk/cn9k_ipsec.c | 610 +++++++++++++++++++++++++++ drivers/crypto/cnxk/cn9k_ipsec.h | 46 ++ drivers/crypto/cnxk/meson.build | 1 + 4 files changed, 659 insertions(+) create mode 100644 drivers/crypto/cnxk/cn9k_ipsec.c create mode 100644 drivers/crypto/cnxk/cn9k_ipsec.h
drivers/crypto/cnxk/cn9k_cryptodev.c +2 -0
@@ -12,6 +12,7 @@#include "cn9k_cryptodev.h" #include "cn9k_cryptodev_ops.h" +#include "cn9k_ipsec.h" #include "cnxk_cryptodev.h" #include "cnxk_cryptodev_capabilities.h" #include "cnxk_cryptodev_sec.h"
@@ -92,6 +93,7 @@ cn9k_cpt_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,cnxk_cpt_caps_populate (vf);cn9k_cpt_set_enqdeq_fns (dev); +cn9k_sec_ops_override ();return 0 ;
drivers/crypto/cnxk/cn9k_ipsec.c new file +610 -0
610 lines not on this page · raw message
drivers/crypto/cnxk/cn9k_ipsec.h new file +46 -0
46 lines not on this page · raw message
drivers/crypto/cnxk/meson.build +1 -0
@@ -11,6 +11,7 @@ endif sources = files( 'cn9k_cryptodev.c', 'cn9k_cryptodev_ops.c', + 'cn9k_ipsec.c', 'cn10k_cryptodev.c', 'cn10k_cryptodev_ops.c', 'cn10k_ipsec.c',
Signature · 1 line
2.22.0
PATCH v2 4/6 crypto/cnxk: add cn9k lookaside IPsec datapath
In reply to Archana MunigantiAdds support for cn9k lookaside enqueue and dequeue operations.
--- drivers/crypto/cnxk/cn9k_cryptodev_ops.c | 78 +++++++++++++++++++- drivers/crypto/cnxk/cn9k_ipsec_la_ops.h | 90 ++++++++++++++++++++++++ 2 files changed, 166 insertions(+), 2 deletions(-) create mode 100644 drivers/crypto/cnxk/cn9k_ipsec_la_ops.h
drivers/crypto/cnxk/cn9k_cryptodev_ops.c +76 -2
@@ -5,10 +5,13 @@#include <rte_cryptodev.h> #include <rte_cryptodev_pmd.h> #include <rte_event_crypto_adapter.h> +#include <rte_ip.h> #include <rte_vect.h> #include "cn9k_cryptodev.h" #include "cn9k_cryptodev_ops.h" +#include "cn9k_ipsec.h" +#include "cn9k_ipsec_la_ops.h" #include "cnxk_ae.h" #include "cnxk_cryptodev.h" #include "cnxk_cryptodev_ops.h"
@@ -34,6 +37,36 @@ cn9k_cpt_sym_inst_fill(struct cnxk_cpt_qp *qp, struct rte_crypto_op *op,return ret; } +static __rte_always_inline int __rte_hot +cn9k_cpt_sec_inst_fill (struct rte_crypto_op *op, +struct cpt_inflight_req *infl_req, +struct cpt_inst_s *inst) +{ +struct rte_crypto_sym_op *sym_op = op->sym; +struct cn9k_sec_session *priv; +struct cn9k_ipsec_sa *sa; + +if (unlikely (sym_op->m_dst && sym_op->m_dst != sym_op->m_src)) { +plt_dp_err ("Out of place is not supported" ); +return -ENOTSUP ; + } + +if (unlikely (!rte_pktmbuf_is_contiguous (sym_op->m_src))) { +plt_dp_err ("Scatter Gather mode is not supported" ); +return -ENOTSUP ; + } + + priv =get_sec_session_private_data (op->sym->sec_session); + sa = &priv->sa; + +if (sa->dir ==RTE_SECURITY_IPSEC_SA_DIR_EGRESS ) +return process_outb_sa (op, sa, inst); + + infl_req->op_flags |=CPT_OP_FLAGS_IPSEC_DIR_INBOUND ; + +return process_inb_sa (op, sa, inst); +} +static inline struct cnxk_se_sess *cn9k_cpt_sym_temp_sess_create (struct cnxk_cpt_qp *qp,struct rte_crypto_op *op) {
@@ -80,7 +113,10 @@ cn9k_cpt_inst_prep(struct cnxk_cpt_qp *qp, struct rte_crypto_op *op, sym_op->session, cn9k_cryptodev_driver_id); ret =cn9k_cpt_sym_inst_fill (qp, op, sess, infl_req, inst); - }else { + inst->w7.u64 = sess->cpt_inst_w7; + }else if (op->sess_type ==RTE_CRYPTO_OP_SECURITY_SESSION ) + ret =cn9k_cpt_sec_inst_fill (op, infl_req, inst); +else { sess =cn9k_cpt_sym_temp_sess_create (qp, op);if (unlikely (sess ==NULL )) {plt_dp_err ("Could not create temp session" );
@@ -94,8 +130,8 @@ cn9k_cpt_inst_prep(struct cnxk_cpt_qp *qp, struct rte_crypto_op *op, op->sym->session);rte_mempool_put (qp->sess_mp, op->sym->session); } + inst->w7.u64 = sess->cpt_inst_w7; } - inst->w7.u64 = sess->cpt_inst_w7; }else if (op->type ==RTE_CRYPTO_OP_TYPE_ASYMMETRIC ) {struct rte_crypto_asym_op *asym_op;struct cnxk_ae_sess *sess;
@@ -348,6 +384,39 @@ cn9k_cpt_crypto_adapter_enqueue(uintptr_t tag_op, struct rte_crypto_op *op)return 1 ; } +static inline void +cn9k_cpt_sec_post_process (struct rte_crypto_op *cop, +struct cpt_inflight_req *infl_req) +{ +struct rte_crypto_sym_op *sym_op = cop->sym; +struct rte_mbuf *m = sym_op->m_src; +struct rte_ipv6_hdr *ip6; +struct rte_ipv4_hdr *ip; +uint16_t m_len =0 ; +char *data; + +if (infl_req->op_flags &CPT_OP_FLAGS_IPSEC_DIR_INBOUND ) { + data = rte_pktmbuf_mtod(m, char *); + + ip = (struct rte_ipv4_hdr *)(data +ROC_IE_ON_INB_RPTR_HDR ); + +if (((ip->version_ihl &0xf0 ) >>RTE_IPV4_IHL_MULTIPLIER ) == +IPVERSION ) { + m_len =rte_be_to_cpu_16 (ip->total_length); + }else { +PLT_ASSERT (((ip->version_ihl &0xf0 ) >> +RTE_IPV4_IHL_MULTIPLIER ) ==6 ); + ip6 = (struct rte_ipv6_hdr *)ip; + m_len =rte_be_to_cpu_16 (ip6->payload_len) + +sizeof (struct rte_ipv6_hdr ); + } + + m->data_len = m_len; + m->pkt_len = m_len; + m->data_off +=ROC_IE_ON_INB_RPTR_HDR ; + } +} +static inline void cn9k_cpt_dequeue_post_process (struct cnxk_cpt_qp *qp,struct rte_crypto_op *cop,struct cpt_inflight_req *infl_req)
@@ -370,6 +439,11 @@ cn9k_cpt_dequeue_post_process(struct cnxk_cpt_qp *qp, struct rte_crypto_op *cop, cop->status =RTE_CRYPTO_OP_STATUS_SUCCESS ;if (cop->type ==RTE_CRYPTO_OP_TYPE_SYMMETRIC ) { +if (cop->sess_type ==RTE_CRYPTO_OP_SECURITY_SESSION ) { +cn9k_cpt_sec_post_process (cop, infl_req); +return ; + } +/* Verify authentication data if required */ if (unlikely (infl_req->op_flags &CPT_OP_FLAGS_AUTH_VERIFY )) {
drivers/crypto/cnxk/cn9k_ipsec_la_ops.h new file +90 -0
90 lines not on this page · raw message
Signature · 1 line
2.22.0
PATCH v2 5/6 crypto/cnxk: update tailroom requirement
In reply to Archana MunigantiUpdate min tailroom to reflect IPsec additions.
PMD crypto_cn9k & crypto_cn10k would have packet
grow into tailroom post IPsec processing.
--- drivers/crypto/cnxk/cnxk_cryptodev_ops.c | 2 +- drivers/crypto/cnxk/cnxk_cryptodev_ops.h | 1 + 2 files changed, 2 insertions(+), 1 deletion(-)
drivers/crypto/cnxk/cnxk_cryptodev_ops.c +1 -1
@@ -155,7 +155,7 @@ cnxk_cpt_dev_info_get(struct rte_cryptodev *dev, info->capabilities =cnxk_crypto_capabilities_get (vf); info->sym.max_nb_sessions =0 ; info->min_mbuf_headroom_req =CNXK_CPT_MIN_HEADROOM_REQ ; - info->min_mbuf_tailroom_req =0 ; + info->min_mbuf_tailroom_req =CNXK_CPT_MIN_TAILROOM_REQ ; } static void
drivers/crypto/cnxk/cnxk_cryptodev_ops.h +1 -0
@@ -11,6 +11,7 @@#include "roc_api.h" #define CNXK_CPT_MIN_HEADROOM_REQ 24 +#define CNXK_CPT_MIN_TAILROOM_REQ 102/* Default command timeout in seconds */ #define DEFAULT_COMMAND_TIMEOUT 4
Signature · 1 line
2.22.0
PATCH v2 6/6 crypto/cnxk: update feature flag for cn9k lookaside IPsec
In reply to Archana MunigantiUpdate device feature flag to support lookaside IPsec for cn9k.
--- doc/guides/cryptodevs/cnxk.rst | 14 ++++++++++++-- doc/guides/cryptodevs/features/cn9k.ini | 1 + doc/guides/rel_notes/release_21_11.rst | 1 + drivers/crypto/cnxk/cnxk_cryptodev.c | 6 ++---- 4 files changed, 16 insertions(+), 6 deletions(-)
doc/guides/cryptodevs/cnxk.rst +12 -2
@@ -222,10 +222,20 @@ This feature can be tested with ipsec-secgw sample application. Supported OCTEON cnxk SoCs ~~~~~~~~~~~~~~~~~~~~~~~~~~ +- CN9XX - CN10XX -Features supported -~~~~~~~~~~~~~~~~~~ +CN9XX Features supported +~~~~~~~~~~~~~~~~~~~~~~~~ + +* IPv4 +* ESP +* Tunnel mode +* UDP Encapsulation +* AES-128/192/256-GCM + +CN10XX Features supported +~~~~~~~~~~~~~~~~~~~~~~~~~ * IPv4 * ESP
doc/guides/cryptodevs/features/cn9k.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
doc/guides/rel_notes/release_21_11.rst +1 -0
@@ -67,6 +67,7 @@ New Features * Added AES-CBC SHA1-HMAC support in lookaside protocol (IPsec) for CN10K. * Added Transport mode support in lookaside protocol (IPsec) for CN10K. * Added UDP encapsulation support in lookaside protocol (IPsec) for CN10K. + * Added support for lookaside protocol (IPsec) offload for CN9K. * **Added support for event crypto adapter on Marvell CN10K and CN9K.**
drivers/crypto/cnxk/cnxk_cryptodev.c +2 -4
@@ -21,10 +21,8 @@ cnxk_cpt_default_ff_get(void)RTE_CRYPTODEV_FF_OOP_SGL_IN_LB_OUT |RTE_CRYPTODEV_FF_OOP_SGL_IN_SGL_OUT |RTE_CRYPTODEV_FF_SYM_SESSIONLESS | -RTE_CRYPTODEV_FF_DIGEST_ENCRYPTED ; - -if (roc_model_is_cn10k ()) - ff |=RTE_CRYPTODEV_FF_SECURITY ; +RTE_CRYPTODEV_FF_DIGEST_ENCRYPTED | +RTE_CRYPTODEV_FF_SECURITY ;return ff; }
Signature · 1 line
2.22.0
Quoted 31 lines
This series adds lookaside IPsec support in cnxk crypto PMD for Marvell CN9K SOC.
Changes in v2:
- Fixed release notes
- Squashed patches and reduced no of patches from 8 to 6Archana Muniganti (6):
crypto/cnxk: add cn9k security ctx
common/cnxk: add cn9k IPsec microcode definescrypto/cnxk: add cn9k security session opscrypto/cnxk: add cn9k lookaside IPsec datapathcrypto/cnxk: update tailroom requirementcrypto/cnxk: update feature flag for cn9k lookaside IPsecdoc/guides/cryptodevs/cnxk.rst | 14 +- doc/guides/cryptodevs/features/cn9k.ini | 1 + doc/guides/rel_notes/release_21_11.rst | 1 + drivers/common/cnxk/roc_cpt.h | 1 + drivers/common/cnxk/roc_ie_on.h | 158 +++++- drivers/crypto/cnxk/cn9k_cryptodev.c | 11 + drivers/crypto/cnxk/cn9k_cryptodev_ops.c | 78 ++- drivers/crypto/cnxk/cn9k_ipsec.c | 610 +++++++++++++++++++++++ drivers/crypto/cnxk/cn9k_ipsec.h | 46 ++ drivers/crypto/cnxk/cn9k_ipsec_la_ops.h | 90 ++++ drivers/crypto/cnxk/cnxk_cryptodev.c | 6 +- drivers/crypto/cnxk/cnxk_cryptodev_ops.c | 2 +- drivers/crypto/cnxk/cnxk_cryptodev_ops.h | 1 + drivers/crypto/cnxk/meson.build | 1 + 14 files changed, 1002 insertions(+), 18 deletions(-) create mode 100644
Quoted 6 lines
drivers/crypto/cnxk/cn9k_ipsec.ccreate mode 100644drivers/crypto/cnxk/cn9k_ipsec.hcreate mode 100644drivers/crypto/cnxk/cn9k_ipsec_la_ops.h--
2.22.0
Series Acked-by: Anoob Joseph <[email protected]>
Akhil Goyal
AppliedQuoted 25 lines
This series adds lookaside IPsec support in cnxk crypto PMD for Marvell CN9K SOC.
Changes in v2:
- Fixed release notes
- Squashed patches and reduced no of patches from 8 to 6Archana Muniganti (6):
crypto/cnxk: add cn9k security ctx
common/cnxk: add cn9k IPsec microcode definescrypto/cnxk: add cn9k security session opscrypto/cnxk: add cn9k lookaside IPsec datapathcrypto/cnxk: update tailroom requirementcrypto/cnxk: update feature flag for cn9k lookaside IPsecdoc/guides/cryptodevs/cnxk.rst | 14 +- doc/guides/cryptodevs/features/cn9k.ini | 1 + doc/guides/rel_notes/release_21_11.rst | 1 + drivers/common/cnxk/roc_cpt.h | 1 + drivers/common/cnxk/roc_ie_on.h | 158 +++++- drivers/crypto/cnxk/cn9k_cryptodev.c | 11 + drivers/crypto/cnxk/cn9k_cryptodev_ops.c | 78 ++- drivers/crypto/cnxk/cn9k_ipsec.c | 610 +++++++++++++++++++++++ drivers/crypto/cnxk/cn9k_ipsec.h | 46 ++ drivers/crypto/cnxk/cn9k_ipsec_la_ops.h | 90 ++++
Quoted 9 lines
drivers/crypto/cnxk/cnxk_cryptodev.c | 6 +- drivers/crypto/cnxk/cnxk_cryptodev_ops.c | 2 +- drivers/crypto/cnxk/cnxk_cryptodev_ops.h | 1 + drivers/crypto/cnxk/meson.build | 1 + 14 files changed, 1002 insertions(+), 18 deletions(-) create mode 100644 drivers/crypto/cnxk/cn9k_ipsec.c create mode 100644 drivers/crypto/cnxk/cn9k_ipsec.h create mode 100644 drivers/crypto/cnxk/cn9k_ipsec_la_ops.h
Applied to dpdk-next-crypto
Thanks.