Skip to contentSkip to conversation

event/octeontx2: add support for event crypto adapter

PATCH Superseded Ankur Dwivedi 3 participants 19 messages Sep 8, 2020 – Oct 8, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover event/octeontx2: add support for event crypto adapter

This patch series adds support for event crypto adapter in op new mode in the OCTEON TX2 event PMD. The functionality has been verified with event crypto adapter test application. Build with meson and ninja is supported.

Ankur Dwivedi (3):
crypto/octeontx2: move functions to helper file
event/octeontx2: add crypto adapter framework
event/octeontx2: add crypto adapter datapath

 drivers/common/cpt/cpt_common.h               |  1 +
 drivers/crypto/octeontx2/meson.build          |  4 +-
 drivers/crypto/octeontx2/otx2_ca_helper.h     | 75 +++++++++++++++
 .../crypto/octeontx2/otx2_crypto_adapter.c    | 77 +++++++++++++++
 .../crypto/octeontx2/otx2_crypto_adapter.h    | 21 ++++
 .../octeontx2/otx2_cryptodev_hw_access.h      | 12 +++
 drivers/crypto/octeontx2/otx2_cryptodev_ops.c | 96 ++++++++-----------
 .../octeontx2/otx2_cryptodev_ops_helper.h     | 74 ++++++++++++++
 drivers/crypto/octeontx2/otx2_cryptodev_qp.h  |  7 ++
 .../rte_pmd_octeontx2_crypto_version.map      | 11 +++
 drivers/event/octeontx2/meson.build           |  3 +-
 drivers/event/octeontx2/otx2_evdev.c          |  5 +
 drivers/event/octeontx2/otx2_worker.h         | 10 +-
 drivers/event/octeontx2/otx2_worker_dual.h    | 11 ++-
 14 files changed, 345 insertions(+), 62 deletions(-)
 create mode 100644 drivers/crypto/octeontx2/otx2_ca_helper.h
 create mode 100644 drivers/crypto/octeontx2/otx2_crypto_adapter.c
 create mode 100644 drivers/crypto/octeontx2/otx2_crypto_adapter.h
 create mode 100644 drivers/crypto/octeontx2/otx2_cryptodev_ops_helper.h
Signature · 1 line
2.28.0
#1 lore raw

PATCH 1/3 crypto/octeontx2: move functions to helper file

Some functions are common across cryptodev pmd and the event crypto adapter. This patch moves them into a helper file.

---
 drivers/crypto/octeontx2/otx2_cryptodev_ops.c | 65 +---------------
 .../octeontx2/otx2_cryptodev_ops_helper.h     | 74 +++++++++++++++++++
 2 files changed, 75 insertions(+), 64 deletions(-)
 create mode 100644 drivers/crypto/octeontx2/otx2_cryptodev_ops_helper.h
drivers/crypto/octeontx2/otx2_cryptodev_ops.c +1 -64
index ccf566d5f..77842b4ad 100644
@@ -13,6 +13,7 @@
 #include "otx2_cryptodev_hw_access.h"
 #include "otx2_cryptodev_mbox.h"
 #include "otx2_cryptodev_ops.h"
+#include "otx2_cryptodev_ops_helper.h"
 #include "otx2_ipsec_po_ops.h"
 #include "otx2_mbox.h"
 #include "otx2_sec_idev.h"
@@ -416,24 +417,6 @@ sym_session_configure(int driver_id, struct rte_crypto_sym_xform *xform,
 	return -ENOTSUP;
 }
 
-static void
-sym_session_clear(int driver_id, struct rte_cryptodev_sym_session *sess)
-{
-	void *priv = get_sym_session_private_data(sess, driver_id);
-	struct rte_mempool *pool;
-
-	if (priv == NULL)
-		return;
-
-	memset(priv, 0, cpt_get_session_size());
-
-	pool = rte_mempool_from_obj(priv);
-
-	set_sym_session_private_data(sess, driver_id, NULL);
-
-	rte_mempool_put(pool, priv);
-}
-
 static __rte_always_inline int32_t __rte_hot
 otx2_cpt_enqueue_req(const struct otx2_cpt_qp *qp,
 		     struct pending_queue *pend_q,
@@ -917,52 +900,6 @@ otx2_cpt_dequeue_post_process(struct otx2_cpt_qp *qp, struct rte_crypto_op *cop,
 	}
 }
 
-static __rte_always_inline uint8_t
-otx2_cpt_compcode_get(struct cpt_request_info *req)
-{
-	volatile struct cpt_res_s_9s *res;
-	uint8_t ret;
-
-	res = (volatile struct cpt_res_s_9s *)req->completion_addr;
-
-	if (unlikely(res->compcode == CPT_9X_COMP_E_NOTDONE)) {
-		if (rte_get_timer_cycles() < req->time_out)
-			return ERR_REQ_PENDING;
-
-		CPT_LOG_DP_ERR("Request timed out");
-		return ERR_REQ_TIMEOUT;
-	}
-
-	if (likely(res->compcode == CPT_9X_COMP_E_GOOD)) {
-		ret = NO_ERR;
-		if (unlikely(res->uc_compcode)) {
-			ret = res->uc_compcode;
-			CPT_LOG_DP_DEBUG("Request failed with microcode error");
-			CPT_LOG_DP_DEBUG("MC completion code 0x%x",
-					 res->uc_compcode);
-		}
-	} else {
-		CPT_LOG_DP_DEBUG("HW completion code 0x%x", res->compcode);
-
-		ret = res->compcode;
-		switch (res->compcode) {
-		case CPT_9X_COMP_E_INSTERR:
-			CPT_LOG_DP_ERR("Request failed with instruction error");
-			break;
-		case CPT_9X_COMP_E_FAULT:
-			CPT_LOG_DP_ERR("Request failed with DMA fault");
-			break;
-		case CPT_9X_COMP_E_HWERR:
-			CPT_LOG_DP_ERR("Request failed with hardware error");
-			break;
-		default:
-			CPT_LOG_DP_ERR("Request failed with unknown completion code");
-		}
-	}
-
-	return ret;
-}
-
 static uint16_t
 otx2_cpt_dequeue_burst(void *qptr, struct rte_crypto_op **ops, uint16_t nb_ops)
 {
drivers/crypto/octeontx2/otx2_cryptodev_ops_helper.h new file +74 -0

74 lines not on this page · raw message

Signature · 1 line
2.28.0
#2 lore raw

PATCH 2/3 event/octeontx2: add crypto adapter framework

In reply to Ankur Dwivedi

The crypto adapter callback functions and associated data structures are added.

---
 drivers/crypto/octeontx2/meson.build          |  4 +-
 .../crypto/octeontx2/otx2_crypto_adapter.c    | 77 +++++++++++++++++++
 .../crypto/octeontx2/otx2_crypto_adapter.h    | 21 +++++
 .../octeontx2/otx2_cryptodev_hw_access.h      | 12 +++
 drivers/crypto/octeontx2/otx2_cryptodev_qp.h  |  7 ++
 .../rte_pmd_octeontx2_crypto_version.map      | 10 +++
 drivers/event/octeontx2/meson.build           |  2 +-
 drivers/event/octeontx2/otx2_evdev.c          |  5 ++
 8 files changed, 136 insertions(+), 2 deletions(-)
 create mode 100644 drivers/crypto/octeontx2/otx2_crypto_adapter.c
 create mode 100644 drivers/crypto/octeontx2/otx2_crypto_adapter.h
drivers/crypto/octeontx2/meson.build +3 -1
index 148ec184a..063a553f2 100644
@@ -10,6 +10,7 @@ deps += ['bus_pci']
 deps += ['common_cpt']
 deps += ['common_octeontx2']
 deps += ['ethdev']
+deps += ['eventdev']
 deps += ['security']
 name = 'octeontx2_crypto'
 
@@ -18,7 +19,8 @@ sources = files('otx2_cryptodev.c',
 		'otx2_cryptodev_hw_access.c',
 		'otx2_cryptodev_mbox.c',
 		'otx2_cryptodev_ops.c',
-		'otx2_cryptodev_sec.c')
+		'otx2_cryptodev_sec.c',
+		'otx2_crypto_adapter.c')
 
 extra_flags = []
 # This integrated controller runs only on a arm64 machine, remove 32bit warnings
drivers/crypto/octeontx2/otx2_crypto_adapter.c new file +77 -0

77 lines not on this page · raw message

drivers/crypto/octeontx2/otx2_crypto_adapter.h new file +21 -0
new file mode 100644
index 000000000..c8f02c0af
@@ -0,0 +1,21 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright (C) 2020 Marvell International Ltd.
+ */
+
+#ifndef _OTX2_CRYPTO_ADAPTER_H_
+#define _OTX2_CRYPTO_ADAPTER_H_
+
+__rte_internal
+int otx2_ca_caps_get(const struct rte_eventdev *dev,
+		const struct rte_cryptodev *cdev, uint32_t *caps);
+
+__rte_internal
+int otx2_ca_qp_add(const struct rte_eventdev *dev,
+		const struct rte_cryptodev *cdev, int32_t queue_pair_id,
+		const struct rte_event *event);
+
+__rte_internal
+int otx2_ca_qp_del(const struct rte_eventdev *dev,
+		const struct rte_cryptodev *cdev, int32_t queue_pair_id);
+
+#endif /* _OTX2_CRYPTO_ADAPTER_H_ */
drivers/crypto/octeontx2/otx2_cryptodev_hw_access.h +12 -0
index 43db6a642..a435818e0 100644
@@ -42,6 +42,7 @@
 #define OTX2_CPT_LF_NQ(a)		(0x400ull | (uint64_t)(a) << 3)
 
 #define OTX2_CPT_AF_LF_CTL(a)		(0x27000ull | (uint64_t)(a) << 3)
+#define OTX2_CPT_AF_LF_CTL2(a)		(0x29000ull | (uint64_t)(a) << 3)
 
 #define OTX2_CPT_LF_BAR2(vf, q_id) \
 		((vf)->otx2_dev.bar2 + \
@@ -110,6 +111,17 @@ union otx2_cpt_af_lf_ctl {
 	} s;
 };
 
+union otx2_cpt_af_lf_ctl2 {
+	uint64_t u;
+	struct {
+		uint64_t exe_no_swap                 : 1;
+		uint64_t exe_ldwb                    : 1;
+		uint64_t reserved_2_31               : 30;
+		uint64_t sso_pf_func                 : 16;
+		uint64_t nix_pf_func                 : 16;
+	} s;
+};
+
 union otx2_cpt_lf_q_grp_ptr {
 	uint64_t u;
 	struct {
drivers/crypto/octeontx2/otx2_cryptodev_qp.h +7 -0
index 9d48da45f..96ff4eb41 100644
@@ -6,6 +6,7 @@
 #define _OTX2_CRYPTODEV_QP_H_
 
 #include <rte_common.h>
+#include <rte_eventdev.h>
 #include <rte_mempool.h>
 #include <rte_spinlock.h>
 
@@ -30,6 +31,12 @@ struct otx2_cpt_qp {
 	/**< Metabuf info required to support operations on the queue pair */
 	rte_iova_t iq_dma_addr;
 	/**< Instruction queue address */
+	struct rte_event ev;
+	/**< Event information required for binding cryptodev queue to
+	 * eventdev queue. Used by crypto adapter.
+	 */
+	uint8_t ca_enable;
+	/**< Set when queue pair is added to crypto adapter */
 };
 
 #endif /* _OTX2_CRYPTODEV_QP_H_ */
drivers/crypto/octeontx2/rte_pmd_octeontx2_crypto_version.map +10 -0
index 4a76d1d52..b47a7ad3e 100644
@@ -1,3 +1,13 @@
 DPDK_21 {
 	local: *;
 };
+
+INTERNAL {
+	global:
+
+	otx2_ca_caps_get;
+	otx2_ca_qp_add;
+	otx2_ca_qp_del;
+
+	local: *;
+};
drivers/event/octeontx2/meson.build +1 -1
index 0ade51cec..8585c54e4 100644
@@ -24,6 +24,6 @@ foreach flag: extra_flags
 	endif
 endforeach
 
-deps += ['bus_pci', 'common_octeontx2', 'mempool_octeontx2', 'pmd_octeontx2']
+deps += ['bus_pci', 'common_octeontx2', 'mempool_octeontx2', 'pmd_octeontx2', 'pmd_octeontx2_crypto']
 
 includes += include_directories('../../crypto/octeontx2')
drivers/event/octeontx2/otx2_evdev.c +5 -0
index b8b57c388..fe21787b6 100644
@@ -12,6 +12,7 @@
 #include <rte_mbuf_pool_ops.h>
 #include <rte_pci.h>
 
+#include "otx2_crypto_adapter.h"
 #include "otx2_evdev_stats.h"
 #include "otx2_evdev.h"
 #include "otx2_irq.h"
@@ -1587,6 +1588,10 @@ static struct rte_eventdev_ops otx2_sso_ops = {
 
 	.timer_adapter_caps_get = otx2_tim_caps_get,
 
+	.crypto_adapter_caps_get = otx2_ca_caps_get,
+	.crypto_adapter_queue_pair_add = otx2_ca_qp_add,
+	.crypto_adapter_queue_pair_del = otx2_ca_qp_del,
+
 	.xstats_get       = otx2_sso_xstats_get,
 	.xstats_reset     = otx2_sso_xstats_reset,
 	.xstats_get_names = otx2_sso_xstats_get_names,
Signature · 1 line
2.28.0
#3 lore raw

PATCH 3/3 event/octeontx2: add crypto adapter datapath

In reply to Ankur Dwivedi

In the op new mode of crypto adapter, the completed crypto operation is submitted to the event device by the OCTEON TX2 crypto PMD. During event device dequeue the result of crypto operation is checked.

---
 drivers/common/cpt/cpt_common.h               |  1 +
 drivers/crypto/octeontx2/otx2_ca_helper.h     | 75 +++++++++++++++++++
 drivers/crypto/octeontx2/otx2_cryptodev_ops.c | 47 ++++++++++++
 .../rte_pmd_octeontx2_crypto_version.map      |  1 +
 drivers/event/octeontx2/meson.build           |  1 +
 drivers/event/octeontx2/otx2_worker.h         | 10 ++-
 drivers/event/octeontx2/otx2_worker_dual.h    | 11 ++-
 7 files changed, 142 insertions(+), 4 deletions(-)
 create mode 100644 drivers/crypto/octeontx2/otx2_ca_helper.h
drivers/common/cpt/cpt_common.h +1 -0
index 0141b2aed..1ce28e90b 100644
@@ -72,6 +72,7 @@ struct cpt_request_info {
 		uint64_t ei3;
 	} ist;
 	uint8_t *rptr;
+	const struct otx2_cpt_qp *qp;
 
 	/** Control path fields */
 	uint64_t time_out;
drivers/crypto/octeontx2/otx2_ca_helper.h new file +75 -0

75 lines not on this page · raw message

drivers/crypto/octeontx2/otx2_cryptodev_ops.c +47 -0

59 lines not on this page · raw message

drivers/crypto/octeontx2/rte_pmd_octeontx2_crypto_version.map +1 -0
index b47a7ad3e..d23764d2c 100644
@@ -5,6 +5,7 @@ DPDK_21 {
 INTERNAL {
 	global:
 
+	otx2_cryptodev_driver_id;
 	otx2_ca_caps_get;
 	otx2_ca_qp_add;
 	otx2_ca_qp_del;
drivers/event/octeontx2/meson.build +1 -0
index 8585c54e4..08863a3e3 100644
@@ -27,3 +27,4 @@ endforeach
 deps += ['bus_pci', 'common_octeontx2', 'mempool_octeontx2', 'pmd_octeontx2', 'pmd_octeontx2_crypto']
 
 includes += include_directories('../../crypto/octeontx2')
+includes += include_directories('../../common/cpt')
drivers/event/octeontx2/otx2_worker.h +8 -2
index 924ff7ff4..5ea2c2de2 100644
@@ -9,6 +9,7 @@
 #include <rte_branch_prediction.h>
 
 #include <otx2_common.h>
+#include "otx2_ca_helper.h"
 #include "otx2_evdev.h"
 #include "otx2_ethdev_sec_tx.h"
 
@@ -66,8 +67,10 @@ otx2_ssogws_get_work(struct otx2_ssogws *ws, struct rte_event *ev,
 	ws->cur_tt = event.sched_type;
 	ws->cur_grp = event.queue_id;
 
-	if (event.sched_type != SSO_TT_EMPTY &&
-	    event.event_type == RTE_EVENT_TYPE_ETHDEV) {
+	if (event.sched_type == SSO_TT_EMPTY)
+		goto setev_and_return;
+
+	if (event.event_type == RTE_EVENT_TYPE_ETHDEV) {
 		otx2_wqe_to_mbuf(get_work1, mbuf, event.sub_event_type,
 				 (uint32_t) event.get_work0, flags, lookup_mem);
 		/* Extracting tstamp, if PTP enabled*/
@@ -76,8 +79,11 @@ otx2_ssogws_get_work(struct otx2_ssogws *ws, struct rte_event *ev,
 		otx2_nix_mbuf_to_tstamp((struct rte_mbuf *)mbuf, ws->tstamp,
 					flags, (uint64_t *)tstamp_ptr);
 		get_work1 = mbuf;
+	} else if (event.event_type == RTE_EVENT_TYPE_CRYPTODEV) {
+		get_work1 = otx2_handle_crypto_event(get_work1);
 	}
 
+setev_and_return:
 	ev->event = event.get_work0;
 	ev->u64 = get_work1;
 
drivers/event/octeontx2/otx2_worker_dual.h +9 -2
index 60aa14cca..4bf4e0170 100644
@@ -9,6 +9,8 @@
 #include <rte_common.h>
 
 #include <otx2_common.h>
+
+#include "otx2_ca_helper.h"
 #include "otx2_evdev.h"
 
 /* SSO Operations */
@@ -63,8 +65,10 @@ otx2_ssogws_dual_get_work(struct otx2_ssogws_state *ws,
 	ws->cur_tt = event.sched_type;
 	ws->cur_grp = event.queue_id;
 
-	if (event.sched_type != SSO_TT_EMPTY &&
-	    event.event_type == RTE_EVENT_TYPE_ETHDEV) {
+	if (event.sched_type == SSO_TT_EMPTY)
+		goto setev_and_return;
+
+	if (event.event_type == RTE_EVENT_TYPE_ETHDEV) {
 		uint8_t port = event.sub_event_type;
 
 		event.sub_event_type = 0;
@@ -82,8 +86,11 @@ otx2_ssogws_dual_get_work(struct otx2_ssogws_state *ws,
 		otx2_nix_mbuf_to_tstamp((struct rte_mbuf *)mbuf, tstamp, flags,
 					(uint64_t *)tstamp_ptr);
 		get_work1 = mbuf;
+	} else if (event.event_type == RTE_EVENT_TYPE_CRYPTODEV) {
+		get_work1 = otx2_handle_crypto_event(get_work1);
 	}
 
+setev_and_return:
 	ev->event = event.get_work0;
 	ev->u64 = get_work1;
 
Signature · 1 line
2.28.0
#4 lore raw

v2 cover event/octeontx2: add support for event crypto adapter

In reply to Ankur Dwivedi

This patch series adds support for event crypto adapter in op new mode in the OCTEON TX2 event PMD. The functionality has been verified with event crypto adapter test application. Build with meson and ninja is supported.

v2:
* In the "event/octeontx2: add crypto adapter datapath" patch, right shifting the req pointer by 3 bits before submit during enqueue. Because of this the right shift during dequeue is not required.

Ankur Dwivedi (3):
crypto/octeontx2: move functions to helper file
event/octeontx2: add crypto adapter framework
event/octeontx2: add crypto adapter datapath

 drivers/common/cpt/cpt_common.h               |  1 +
 drivers/crypto/octeontx2/meson.build          |  4 +-
 drivers/crypto/octeontx2/otx2_ca_helper.h     | 75 +++++++++++++++
 .../crypto/octeontx2/otx2_crypto_adapter.c    | 77 +++++++++++++++
 .../crypto/octeontx2/otx2_crypto_adapter.h    | 21 ++++
 .../octeontx2/otx2_cryptodev_hw_access.h      | 12 +++
 drivers/crypto/octeontx2/otx2_cryptodev_ops.c | 96 ++++++++-----------
 .../octeontx2/otx2_cryptodev_ops_helper.h     | 74 ++++++++++++++
 drivers/crypto/octeontx2/otx2_cryptodev_qp.h  |  7 ++
 .../rte_pmd_octeontx2_crypto_version.map      | 11 +++
 drivers/event/octeontx2/meson.build           |  3 +-
 drivers/event/octeontx2/otx2_evdev.c          |  5 +
 drivers/event/octeontx2/otx2_worker.h         | 10 +-
 drivers/event/octeontx2/otx2_worker_dual.h    | 11 ++-
 14 files changed, 345 insertions(+), 62 deletions(-)
 create mode 100644 drivers/crypto/octeontx2/otx2_ca_helper.h
 create mode 100644 drivers/crypto/octeontx2/otx2_crypto_adapter.c
 create mode 100644 drivers/crypto/octeontx2/otx2_crypto_adapter.h
 create mode 100644 drivers/crypto/octeontx2/otx2_cryptodev_ops_helper.h
Signature · 1 line
2.28.0
#5 lore raw

PATCH v2 1/3 crypto/octeontx2: move functions to helper file

Some functions are common across cryptodev pmd and the event crypto adapter. This patch moves them into a helper file.

---
 drivers/crypto/octeontx2/otx2_cryptodev_ops.c | 65 +---------------
 .../octeontx2/otx2_cryptodev_ops_helper.h     | 74 +++++++++++++++++++
 2 files changed, 75 insertions(+), 64 deletions(-)
 create mode 100644 drivers/crypto/octeontx2/otx2_cryptodev_ops_helper.h
drivers/crypto/octeontx2/otx2_cryptodev_ops.c +1 -64
index ccf566d5f..77842b4ad 100644
@@ -13,6 +13,7 @@
 #include "otx2_cryptodev_hw_access.h"
 #include "otx2_cryptodev_mbox.h"
 #include "otx2_cryptodev_ops.h"
+#include "otx2_cryptodev_ops_helper.h"
 #include "otx2_ipsec_po_ops.h"
 #include "otx2_mbox.h"
 #include "otx2_sec_idev.h"
@@ -416,24 +417,6 @@ sym_session_configure(int driver_id, struct rte_crypto_sym_xform *xform,
 	return -ENOTSUP;
 }
 
-static void
-sym_session_clear(int driver_id, struct rte_cryptodev_sym_session *sess)
-{
-	void *priv = get_sym_session_private_data(sess, driver_id);
-	struct rte_mempool *pool;
-
-	if (priv == NULL)
-		return;
-
-	memset(priv, 0, cpt_get_session_size());
-
-	pool = rte_mempool_from_obj(priv);
-
-	set_sym_session_private_data(sess, driver_id, NULL);
-
-	rte_mempool_put(pool, priv);
-}
-
 static __rte_always_inline int32_t __rte_hot
 otx2_cpt_enqueue_req(const struct otx2_cpt_qp *qp,
 		     struct pending_queue *pend_q,
@@ -917,52 +900,6 @@ otx2_cpt_dequeue_post_process(struct otx2_cpt_qp *qp, struct rte_crypto_op *cop,
 	}
 }
 
-static __rte_always_inline uint8_t
-otx2_cpt_compcode_get(struct cpt_request_info *req)
-{
-	volatile struct cpt_res_s_9s *res;
-	uint8_t ret;
-
-	res = (volatile struct cpt_res_s_9s *)req->completion_addr;
-
-	if (unlikely(res->compcode == CPT_9X_COMP_E_NOTDONE)) {
-		if (rte_get_timer_cycles() < req->time_out)
-			return ERR_REQ_PENDING;
-
-		CPT_LOG_DP_ERR("Request timed out");
-		return ERR_REQ_TIMEOUT;
-	}
-
-	if (likely(res->compcode == CPT_9X_COMP_E_GOOD)) {
-		ret = NO_ERR;
-		if (unlikely(res->uc_compcode)) {
-			ret = res->uc_compcode;
-			CPT_LOG_DP_DEBUG("Request failed with microcode error");
-			CPT_LOG_DP_DEBUG("MC completion code 0x%x",
-					 res->uc_compcode);
-		}
-	} else {
-		CPT_LOG_DP_DEBUG("HW completion code 0x%x", res->compcode);
-
-		ret = res->compcode;
-		switch (res->compcode) {
-		case CPT_9X_COMP_E_INSTERR:
-			CPT_LOG_DP_ERR("Request failed with instruction error");
-			break;
-		case CPT_9X_COMP_E_FAULT:
-			CPT_LOG_DP_ERR("Request failed with DMA fault");
-			break;
-		case CPT_9X_COMP_E_HWERR:
-			CPT_LOG_DP_ERR("Request failed with hardware error");
-			break;
-		default:
-			CPT_LOG_DP_ERR("Request failed with unknown completion code");
-		}
-	}
-
-	return ret;
-}
-
 static uint16_t
 otx2_cpt_dequeue_burst(void *qptr, struct rte_crypto_op **ops, uint16_t nb_ops)
 {
drivers/crypto/octeontx2/otx2_cryptodev_ops_helper.h new file +74 -0

74 lines not on this page · raw message

Signature · 1 line
2.28.0
#6 lore raw

PATCH v2 2/3 event/octeontx2: add crypto adapter framework

In reply to Ankur Dwivedi

The crypto adapter callback functions and associated data structures are added.

---
 drivers/crypto/octeontx2/meson.build          |  4 +-
 .../crypto/octeontx2/otx2_crypto_adapter.c    | 77 +++++++++++++++++++
 .../crypto/octeontx2/otx2_crypto_adapter.h    | 21 +++++
 .../octeontx2/otx2_cryptodev_hw_access.h      | 12 +++
 drivers/crypto/octeontx2/otx2_cryptodev_qp.h  |  7 ++
 .../rte_pmd_octeontx2_crypto_version.map      | 10 +++
 drivers/event/octeontx2/meson.build           |  2 +-
 drivers/event/octeontx2/otx2_evdev.c          |  5 ++
 8 files changed, 136 insertions(+), 2 deletions(-)
 create mode 100644 drivers/crypto/octeontx2/otx2_crypto_adapter.c
 create mode 100644 drivers/crypto/octeontx2/otx2_crypto_adapter.h
drivers/crypto/octeontx2/meson.build +3 -1
index 148ec184a..063a553f2 100644
@@ -10,6 +10,7 @@ deps += ['bus_pci']
 deps += ['common_cpt']
 deps += ['common_octeontx2']
 deps += ['ethdev']
+deps += ['eventdev']
 deps += ['security']
 name = 'octeontx2_crypto'
 
@@ -18,7 +19,8 @@ sources = files('otx2_cryptodev.c',
 		'otx2_cryptodev_hw_access.c',
 		'otx2_cryptodev_mbox.c',
 		'otx2_cryptodev_ops.c',
-		'otx2_cryptodev_sec.c')
+		'otx2_cryptodev_sec.c',
+		'otx2_crypto_adapter.c')
 
 extra_flags = []
 # This integrated controller runs only on a arm64 machine, remove 32bit warnings
drivers/crypto/octeontx2/otx2_crypto_adapter.c new file +77 -0

77 lines not on this page · raw message

drivers/crypto/octeontx2/otx2_crypto_adapter.h new file +21 -0
new file mode 100644
index 000000000..c8f02c0af
@@ -0,0 +1,21 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright (C) 2020 Marvell International Ltd.
+ */
+
+#ifndef _OTX2_CRYPTO_ADAPTER_H_
+#define _OTX2_CRYPTO_ADAPTER_H_
+
+__rte_internal
+int otx2_ca_caps_get(const struct rte_eventdev *dev,
+		const struct rte_cryptodev *cdev, uint32_t *caps);
+
+__rte_internal
+int otx2_ca_qp_add(const struct rte_eventdev *dev,
+		const struct rte_cryptodev *cdev, int32_t queue_pair_id,
+		const struct rte_event *event);
+
+__rte_internal
+int otx2_ca_qp_del(const struct rte_eventdev *dev,
+		const struct rte_cryptodev *cdev, int32_t queue_pair_id);
+
+#endif /* _OTX2_CRYPTO_ADAPTER_H_ */
drivers/crypto/octeontx2/otx2_cryptodev_hw_access.h +12 -0
index 43db6a642..a435818e0 100644
@@ -42,6 +42,7 @@
 #define OTX2_CPT_LF_NQ(a)		(0x400ull | (uint64_t)(a) << 3)
 
 #define OTX2_CPT_AF_LF_CTL(a)		(0x27000ull | (uint64_t)(a) << 3)
+#define OTX2_CPT_AF_LF_CTL2(a)		(0x29000ull | (uint64_t)(a) << 3)
 
 #define OTX2_CPT_LF_BAR2(vf, q_id) \
 		((vf)->otx2_dev.bar2 + \
@@ -110,6 +111,17 @@ union otx2_cpt_af_lf_ctl {
 	} s;
 };
 
+union otx2_cpt_af_lf_ctl2 {
+	uint64_t u;
+	struct {
+		uint64_t exe_no_swap                 : 1;
+		uint64_t exe_ldwb                    : 1;
+		uint64_t reserved_2_31               : 30;
+		uint64_t sso_pf_func                 : 16;
+		uint64_t nix_pf_func                 : 16;
+	} s;
+};
+
 union otx2_cpt_lf_q_grp_ptr {
 	uint64_t u;
 	struct {
drivers/crypto/octeontx2/otx2_cryptodev_qp.h +7 -0
index 9d48da45f..96ff4eb41 100644
@@ -6,6 +6,7 @@
 #define _OTX2_CRYPTODEV_QP_H_
 
 #include <rte_common.h>
+#include <rte_eventdev.h>
 #include <rte_mempool.h>
 #include <rte_spinlock.h>
 
@@ -30,6 +31,12 @@ struct otx2_cpt_qp {
 	/**< Metabuf info required to support operations on the queue pair */
 	rte_iova_t iq_dma_addr;
 	/**< Instruction queue address */
+	struct rte_event ev;
+	/**< Event information required for binding cryptodev queue to
+	 * eventdev queue. Used by crypto adapter.
+	 */
+	uint8_t ca_enable;
+	/**< Set when queue pair is added to crypto adapter */
 };
 
 #endif /* _OTX2_CRYPTODEV_QP_H_ */
drivers/crypto/octeontx2/rte_pmd_octeontx2_crypto_version.map +10 -0
index 4a76d1d52..b47a7ad3e 100644
@@ -1,3 +1,13 @@
 DPDK_21 {
 	local: *;
 };
+
+INTERNAL {
+	global:
+
+	otx2_ca_caps_get;
+	otx2_ca_qp_add;
+	otx2_ca_qp_del;
+
+	local: *;
+};
drivers/event/octeontx2/meson.build +1 -1
index 0ade51cec..8585c54e4 100644
@@ -24,6 +24,6 @@ foreach flag: extra_flags
 	endif
 endforeach
 
-deps += ['bus_pci', 'common_octeontx2', 'mempool_octeontx2', 'pmd_octeontx2']
+deps += ['bus_pci', 'common_octeontx2', 'mempool_octeontx2', 'pmd_octeontx2', 'pmd_octeontx2_crypto']
 
 includes += include_directories('../../crypto/octeontx2')
drivers/event/octeontx2/otx2_evdev.c +5 -0
index b8b57c388..fe21787b6 100644
@@ -12,6 +12,7 @@
 #include <rte_mbuf_pool_ops.h>
 #include <rte_pci.h>
 
+#include "otx2_crypto_adapter.h"
 #include "otx2_evdev_stats.h"
 #include "otx2_evdev.h"
 #include "otx2_irq.h"
@@ -1587,6 +1588,10 @@ static struct rte_eventdev_ops otx2_sso_ops = {
 
 	.timer_adapter_caps_get = otx2_tim_caps_get,
 
+	.crypto_adapter_caps_get = otx2_ca_caps_get,
+	.crypto_adapter_queue_pair_add = otx2_ca_qp_add,
+	.crypto_adapter_queue_pair_del = otx2_ca_qp_del,
+
 	.xstats_get       = otx2_sso_xstats_get,
 	.xstats_reset     = otx2_sso_xstats_reset,
 	.xstats_get_names = otx2_sso_xstats_get_names,
Signature · 1 line
2.28.0
#7 lore raw

PATCH v2 3/3 event/octeontx2: add crypto adapter datapath

In reply to Ankur Dwivedi

In the op new mode of crypto adapter, the completed crypto operation is submitted to the event device by the OCTEON TX2 crypto PMD. During event device dequeue the result of crypto operation is checked.

---
 drivers/common/cpt/cpt_common.h               |  1 +
 drivers/crypto/octeontx2/otx2_ca_helper.h     | 75 +++++++++++++++++++
 drivers/crypto/octeontx2/otx2_cryptodev_ops.c | 47 ++++++++++++
 .../rte_pmd_octeontx2_crypto_version.map      |  1 +
 drivers/event/octeontx2/meson.build           |  1 +
 drivers/event/octeontx2/otx2_worker.h         | 10 ++-
 drivers/event/octeontx2/otx2_worker_dual.h    | 11 ++-
 7 files changed, 142 insertions(+), 4 deletions(-)
 create mode 100644 drivers/crypto/octeontx2/otx2_ca_helper.h
drivers/common/cpt/cpt_common.h +1 -0
index 0141b2aed..1ce28e90b 100644
@@ -72,6 +72,7 @@ struct cpt_request_info {
 		uint64_t ei3;
 	} ist;
 	uint8_t *rptr;
+	const struct otx2_cpt_qp *qp;
 
 	/** Control path fields */
 	uint64_t time_out;
drivers/crypto/octeontx2/otx2_ca_helper.h new file +75 -0

75 lines not on this page · raw message

drivers/crypto/octeontx2/otx2_cryptodev_ops.c +47 -0

59 lines not on this page · raw message

drivers/crypto/octeontx2/rte_pmd_octeontx2_crypto_version.map +1 -0
index b47a7ad3e..d23764d2c 100644
@@ -5,6 +5,7 @@ DPDK_21 {
 INTERNAL {
 	global:
 
+	otx2_cryptodev_driver_id;
 	otx2_ca_caps_get;
 	otx2_ca_qp_add;
 	otx2_ca_qp_del;
drivers/event/octeontx2/meson.build +1 -0
index 8585c54e4..08863a3e3 100644
@@ -27,3 +27,4 @@ endforeach
 deps += ['bus_pci', 'common_octeontx2', 'mempool_octeontx2', 'pmd_octeontx2', 'pmd_octeontx2_crypto']
 
 includes += include_directories('../../crypto/octeontx2')
+includes += include_directories('../../common/cpt')
drivers/event/octeontx2/otx2_worker.h +8 -2
index 924ff7ff4..5ea2c2de2 100644
@@ -9,6 +9,7 @@
 #include <rte_branch_prediction.h>
 
 #include <otx2_common.h>
+#include "otx2_ca_helper.h"
 #include "otx2_evdev.h"
 #include "otx2_ethdev_sec_tx.h"
 
@@ -66,8 +67,10 @@ otx2_ssogws_get_work(struct otx2_ssogws *ws, struct rte_event *ev,
 	ws->cur_tt = event.sched_type;
 	ws->cur_grp = event.queue_id;
 
-	if (event.sched_type != SSO_TT_EMPTY &&
-	    event.event_type == RTE_EVENT_TYPE_ETHDEV) {
+	if (event.sched_type == SSO_TT_EMPTY)
+		goto setev_and_return;
+
+	if (event.event_type == RTE_EVENT_TYPE_ETHDEV) {
 		otx2_wqe_to_mbuf(get_work1, mbuf, event.sub_event_type,
 				 (uint32_t) event.get_work0, flags, lookup_mem);
 		/* Extracting tstamp, if PTP enabled*/
@@ -76,8 +79,11 @@ otx2_ssogws_get_work(struct otx2_ssogws *ws, struct rte_event *ev,
 		otx2_nix_mbuf_to_tstamp((struct rte_mbuf *)mbuf, ws->tstamp,
 					flags, (uint64_t *)tstamp_ptr);
 		get_work1 = mbuf;
+	} else if (event.event_type == RTE_EVENT_TYPE_CRYPTODEV) {
+		get_work1 = otx2_handle_crypto_event(get_work1);
 	}
 
+setev_and_return:
 	ev->event = event.get_work0;
 	ev->u64 = get_work1;
 
drivers/event/octeontx2/otx2_worker_dual.h +9 -2
index 60aa14cca..4bf4e0170 100644
@@ -9,6 +9,8 @@
 #include <rte_common.h>
 
 #include <otx2_common.h>
+
+#include "otx2_ca_helper.h"
 #include "otx2_evdev.h"
 
 /* SSO Operations */
@@ -63,8 +65,10 @@ otx2_ssogws_dual_get_work(struct otx2_ssogws_state *ws,
 	ws->cur_tt = event.sched_type;
 	ws->cur_grp = event.queue_id;
 
-	if (event.sched_type != SSO_TT_EMPTY &&
-	    event.event_type == RTE_EVENT_TYPE_ETHDEV) {
+	if (event.sched_type == SSO_TT_EMPTY)
+		goto setev_and_return;
+
+	if (event.event_type == RTE_EVENT_TYPE_ETHDEV) {
 		uint8_t port = event.sub_event_type;
 
 		event.sub_event_type = 0;
@@ -82,8 +86,11 @@ otx2_ssogws_dual_get_work(struct otx2_ssogws_state *ws,
 		otx2_nix_mbuf_to_tstamp((struct rte_mbuf *)mbuf, tstamp, flags,
 					(uint64_t *)tstamp_ptr);
 		get_work1 = mbuf;
+	} else if (event.event_type == RTE_EVENT_TYPE_CRYPTODEV) {
+		get_work1 = otx2_handle_crypto_event(get_work1);
 	}
 
+setev_and_return:
 	ev->event = event.get_work0;
 	ev->u64 = get_work1;
 
Signature · 1 line
2.28.0
#8 lore raw

Re: [dpdk-dev] [PATCH v2 3/3] event/octeontx2: add crypto adapter datapath

Quoted 8 lines · Ankur Dwivedi

In the op new mode of crypto adapter, the completed crypto operation is submitted to the event device by the OCTEON TX2 crypto PMD. During event device dequeue the result of crypto operation is checked.

drivers/event/octeontx2/otx2_worker.h otx2_ssogws_get_work(struct otx2_ssogws *ws, struct rte_event *ev, · line 71

Quoted 7 lines
drivers/event/octeontx2/otx2_worker.h +2 -2
@@ -66,8 +67,10 @@ otx2_ssogws_get_work(struct otx2_ssogws *ws, struct rte_event *ev,
        ws->cur_tt = event.sched_type;
        ws->cur_grp = event.queue_id;
 
-       if (event.sched_type != SSO_TT_EMPTY &&
-           event.event_type == RTE_EVENT_TYPE_ETHDEV) {
+       if (event.sched_type == SSO_TT_EMPTY)
+               goto setev_and_return;

Please move the security updation under the security flag template to avoid performance impact
on nonsecurity case.

Quoted 13 lines
drivers/event/octeontx2/otx2_worker.h +4 -0
+
+       if (event.event_type == RTE_EVENT_TYPE_ETHDEV) {
                otx2_wqe_to_mbuf(get_work1, mbuf, event.sub_event_type,
                                 (uint32_t) event.get_work0, flags, lookup_mem);
                /* Extracting tstamp, if PTP enabled*/
@@ -76,8 +79,11 @@ otx2_ssogws_get_work(struct otx2_ssogws *ws, struct rte_event *ev,
                otx2_nix_mbuf_to_tstamp((struct rte_mbuf *)mbuf, ws->tstamp,
                                        flags, (uint64_t *)tstamp_ptr);
                get_work1 = mbuf;
+       } else if (event.event_type == RTE_EVENT_TYPE_CRYPTODEV) {
+               get_work1 = otx2_handle_crypto_event(get_work1);
        }
 
#9 lore raw

v3 cover event/octeontx2: add support for event crypto adapter

In reply to Ankur Dwivedi

This patch series adds support for event crypto adapter in op new mode in the OCTEON TX2 event PMD. The functionality has been verified with event crypto adapter test application. Build with meson and ninja is supported.

v3:
* In the "event/octeontx2: add crypto adapter framework" patch, the following changes were made:
- Moved the crypto adapter files from crypto/octeontx2 to event/octeontx2 directory.
- Reused the security flag for crypto adapter implementation.

* In the "event/octeontx2: add crypto adapter datapath" patch, the following changes were made:
- In otx2_ssogws_get_work() and otx2_ssogws_dual_get_work(), the crypto adapter function is called if offload flag has security enabled. This is an additional check apart from checking event type.

v2:
* In the "event/octeontx2: add crypto adapter datapath" patch, right shifting the req pointer by 3 bits before submit during enqueue. Because of this the right shift during dequeue is not required.

Ankur Dwivedi (3):
crypto/octeontx2: move functions to helper file
event/octeontx2: add crypto adapter framework
event/octeontx2: add crypto adapter datapath

 drivers/common/cpt/cpt_common.h               |  1 +
 drivers/crypto/octeontx2/meson.build          |  1 +
 .../octeontx2/otx2_cryptodev_hw_access.h      | 12 +++
 .../crypto/octeontx2/otx2_cryptodev_mbox.h    |  2 +
 drivers/crypto/octeontx2/otx2_cryptodev_ops.c | 96 ++++++++-----------
 .../octeontx2/otx2_cryptodev_ops_helper.h     | 74 ++++++++++++++
 drivers/crypto/octeontx2/otx2_cryptodev_qp.h  |  7 ++
 .../rte_pmd_octeontx2_crypto_version.map      | 10 ++
 drivers/event/octeontx2/meson.build           |  4 +-
 drivers/event/octeontx2/otx2_evdev.c          |  4 +
 drivers/event/octeontx2/otx2_evdev.h          | 11 +++
 .../event/octeontx2/otx2_evdev_crypto_adptr.c | 81 ++++++++++++++++
 .../octeontx2/otx2_evdev_crypto_adptr_dp.h    | 75 +++++++++++++++
 drivers/event/octeontx2/otx2_worker.h         | 28 ++++--
 drivers/event/octeontx2/otx2_worker_dual.h    | 44 +++++----
 15 files changed, 365 insertions(+), 85 deletions(-)
 create mode 100644 drivers/crypto/octeontx2/otx2_cryptodev_ops_helper.h
 create mode 100644 drivers/event/octeontx2/otx2_evdev_crypto_adptr.c
 create mode 100644 drivers/event/octeontx2/otx2_evdev_crypto_adptr_dp.h
Signature · 1 line
2.28.0
#10 lore raw

PATCH v3 1/3 crypto/octeontx2: move functions to helper file

Some functions are common across cryptodev pmd and the event crypto adapter. This patch moves them into a helper file.

---
 drivers/crypto/octeontx2/otx2_cryptodev_ops.c | 65 +---------------
 .../octeontx2/otx2_cryptodev_ops_helper.h     | 74 +++++++++++++++++++
 2 files changed, 75 insertions(+), 64 deletions(-)
 create mode 100644 drivers/crypto/octeontx2/otx2_cryptodev_ops_helper.h
drivers/crypto/octeontx2/otx2_cryptodev_ops.c +1 -64
index 9d51b17dd..1a115e983 100644
@@ -13,6 +13,7 @@
 #include "otx2_cryptodev_hw_access.h"
 #include "otx2_cryptodev_mbox.h"
 #include "otx2_cryptodev_ops.h"
+#include "otx2_cryptodev_ops_helper.h"
 #include "otx2_ipsec_po_ops.h"
 #include "otx2_mbox.h"
 #include "otx2_sec_idev.h"
@@ -416,24 +417,6 @@ sym_session_configure(int driver_id, struct rte_crypto_sym_xform *xform,
 	return -ENOTSUP;
 }
 
-static void
-sym_session_clear(int driver_id, struct rte_cryptodev_sym_session *sess)
-{
-	void *priv = get_sym_session_private_data(sess, driver_id);
-	struct rte_mempool *pool;
-
-	if (priv == NULL)
-		return;
-
-	memset(priv, 0, cpt_get_session_size());
-
-	pool = rte_mempool_from_obj(priv);
-
-	set_sym_session_private_data(sess, driver_id, NULL);
-
-	rte_mempool_put(pool, priv);
-}
-
 static __rte_always_inline int32_t __rte_hot
 otx2_cpt_enqueue_req(const struct otx2_cpt_qp *qp,
 		     struct pending_queue *pend_q,
@@ -914,52 +897,6 @@ otx2_cpt_dequeue_post_process(struct otx2_cpt_qp *qp, struct rte_crypto_op *cop,
 	}
 }
 
-static __rte_always_inline uint8_t
-otx2_cpt_compcode_get(struct cpt_request_info *req)
-{
-	volatile struct cpt_res_s_9s *res;
-	uint8_t ret;
-
-	res = (volatile struct cpt_res_s_9s *)req->completion_addr;
-
-	if (unlikely(res->compcode == CPT_9X_COMP_E_NOTDONE)) {
-		if (rte_get_timer_cycles() < req->time_out)
-			return ERR_REQ_PENDING;
-
-		CPT_LOG_DP_ERR("Request timed out");
-		return ERR_REQ_TIMEOUT;
-	}
-
-	if (likely(res->compcode == CPT_9X_COMP_E_GOOD)) {
-		ret = NO_ERR;
-		if (unlikely(res->uc_compcode)) {
-			ret = res->uc_compcode;
-			CPT_LOG_DP_DEBUG("Request failed with microcode error");
-			CPT_LOG_DP_DEBUG("MC completion code 0x%x",
-					 res->uc_compcode);
-		}
-	} else {
-		CPT_LOG_DP_DEBUG("HW completion code 0x%x", res->compcode);
-
-		ret = res->compcode;
-		switch (res->compcode) {
-		case CPT_9X_COMP_E_INSTERR:
-			CPT_LOG_DP_ERR("Request failed with instruction error");
-			break;
-		case CPT_9X_COMP_E_FAULT:
-			CPT_LOG_DP_ERR("Request failed with DMA fault");
-			break;
-		case CPT_9X_COMP_E_HWERR:
-			CPT_LOG_DP_ERR("Request failed with hardware error");
-			break;
-		default:
-			CPT_LOG_DP_ERR("Request failed with unknown completion code");
-		}
-	}
-
-	return ret;
-}
-
 static uint16_t
 otx2_cpt_dequeue_burst(void *qptr, struct rte_crypto_op **ops, uint16_t nb_ops)
 {
drivers/crypto/octeontx2/otx2_cryptodev_ops_helper.h new file +74 -0

74 lines not on this page · raw message

Signature · 1 line
2.28.0
#11 lore raw

PATCH v3 2/3 event/octeontx2: add crypto adapter framework

In reply to Ankur Dwivedi

The crypto adapter callback functions and associated data structures are added.

---
 drivers/crypto/octeontx2/meson.build          |  1 +
 .../octeontx2/otx2_cryptodev_hw_access.h      | 12 +++
 .../crypto/octeontx2/otx2_cryptodev_mbox.h    |  2 +
 drivers/crypto/octeontx2/otx2_cryptodev_qp.h  |  7 ++
 .../rte_pmd_octeontx2_crypto_version.map      |  9 +++
 drivers/event/octeontx2/meson.build           |  4 +-
 drivers/event/octeontx2/otx2_evdev.c          |  4 +
 drivers/event/octeontx2/otx2_evdev.h          | 11 +++
 .../event/octeontx2/otx2_evdev_crypto_adptr.c | 81 +++++++++++++++++++
 9 files changed, 130 insertions(+), 1 deletion(-)
 create mode 100644 drivers/event/octeontx2/otx2_evdev_crypto_adptr.c
drivers/crypto/octeontx2/meson.build +1 -0
index 148ec184a..41114a5c3 100644
@@ -10,6 +10,7 @@ deps += ['bus_pci']
 deps += ['common_cpt']
 deps += ['common_octeontx2']
 deps += ['ethdev']
+deps += ['eventdev']
 deps += ['security']
 name = 'octeontx2_crypto'
 
drivers/crypto/octeontx2/otx2_cryptodev_hw_access.h +12 -0
index 43db6a642..a435818e0 100644
@@ -42,6 +42,7 @@
 #define OTX2_CPT_LF_NQ(a)		(0x400ull | (uint64_t)(a) << 3)
 
 #define OTX2_CPT_AF_LF_CTL(a)		(0x27000ull | (uint64_t)(a) << 3)
+#define OTX2_CPT_AF_LF_CTL2(a)		(0x29000ull | (uint64_t)(a) << 3)
 
 #define OTX2_CPT_LF_BAR2(vf, q_id) \
 		((vf)->otx2_dev.bar2 + \
@@ -110,6 +111,17 @@ union otx2_cpt_af_lf_ctl {
 	} s;
 };
 
+union otx2_cpt_af_lf_ctl2 {
+	uint64_t u;
+	struct {
+		uint64_t exe_no_swap                 : 1;
+		uint64_t exe_ldwb                    : 1;
+		uint64_t reserved_2_31               : 30;
+		uint64_t sso_pf_func                 : 16;
+		uint64_t nix_pf_func                 : 16;
+	} s;
+};
+
 union otx2_cpt_lf_q_grp_ptr {
 	uint64_t u;
 	struct {
drivers/crypto/octeontx2/otx2_cryptodev_mbox.h +2 -0
index 4bc057774..05efb4049 100644
@@ -21,9 +21,11 @@ int otx2_cpt_queues_detach(const struct rte_cryptodev *dev);
 
 int otx2_cpt_msix_offsets_get(const struct rte_cryptodev *dev);
 
+__rte_internal
 int otx2_cpt_af_reg_read(const struct rte_cryptodev *dev, uint64_t reg,
 			 uint64_t *val);
 
+__rte_internal
 int otx2_cpt_af_reg_write(const struct rte_cryptodev *dev, uint64_t reg,
 			  uint64_t val);
 
drivers/crypto/octeontx2/otx2_cryptodev_qp.h +7 -0
index 9d48da45f..96ff4eb41 100644
@@ -6,6 +6,7 @@
 #define _OTX2_CRYPTODEV_QP_H_
 
 #include <rte_common.h>
+#include <rte_eventdev.h>
 #include <rte_mempool.h>
 #include <rte_spinlock.h>
 
@@ -30,6 +31,12 @@ struct otx2_cpt_qp {
 	/**< Metabuf info required to support operations on the queue pair */
 	rte_iova_t iq_dma_addr;
 	/**< Instruction queue address */
+	struct rte_event ev;
+	/**< Event information required for binding cryptodev queue to
+	 * eventdev queue. Used by crypto adapter.
+	 */
+	uint8_t ca_enable;
+	/**< Set when queue pair is added to crypto adapter */
 };
 
 #endif /* _OTX2_CRYPTODEV_QP_H_ */
drivers/crypto/octeontx2/rte_pmd_octeontx2_crypto_version.map +9 -0
index 4a76d1d52..95ebda255 100644
@@ -1,3 +1,12 @@
 DPDK_21 {
 	local: *;
 };
+
+INTERNAL {
+	global:
+
+	otx2_cpt_af_reg_read;
+	otx2_cpt_af_reg_write;
+
+	local: *;
+};
drivers/event/octeontx2/meson.build +3 -1
index 0ade51cec..6dde86fc7 100644
@@ -6,6 +6,7 @@ sources = files('otx2_worker.c',
 		'otx2_worker_dual.c',
 		'otx2_evdev.c',
 		'otx2_evdev_adptr.c',
+		'otx2_evdev_crypto_adptr.c',
 		'otx2_evdev_irq.c',
 		'otx2_evdev_selftest.c',
 		'otx2_tim_evdev.c',
@@ -24,6 +25,7 @@ foreach flag: extra_flags
 	endif
 endforeach
 
-deps += ['bus_pci', 'common_octeontx2', 'mempool_octeontx2', 'pmd_octeontx2']
+deps += ['bus_pci', 'common_octeontx2', 'mempool_octeontx2', 'pmd_octeontx2', 'pmd_octeontx2_crypto']
 
 includes += include_directories('../../crypto/octeontx2')
+includes += include_directories('../../common/cpt')
drivers/event/octeontx2/otx2_evdev.c +4 -0
index b8b57c388..461ad57f5 100644
@@ -1587,6 +1587,10 @@ static struct rte_eventdev_ops otx2_sso_ops = {
 
 	.timer_adapter_caps_get = otx2_tim_caps_get,
 
+	.crypto_adapter_caps_get = otx2_ca_caps_get,
+	.crypto_adapter_queue_pair_add = otx2_ca_qp_add,
+	.crypto_adapter_queue_pair_del = otx2_ca_qp_del,
+
 	.xstats_get       = otx2_sso_xstats_get,
 	.xstats_reset     = otx2_sso_xstats_reset,
 	.xstats_get_names = otx2_sso_xstats_get_names,
drivers/event/octeontx2/otx2_evdev.h +11 -0
index 873724dd4..4bf715c03 100644
@@ -388,6 +388,17 @@ int otx2_sso_tx_adapter_queue_del(uint8_t id,
 				  const struct rte_eth_dev *eth_dev,
 				  int32_t tx_queue_id);
 
+/* Event crypto adapter API's */
+int otx2_ca_caps_get(const struct rte_eventdev *dev,
+		     const struct rte_cryptodev *cdev, uint32_t *caps);
+
+int otx2_ca_qp_add(const struct rte_eventdev *dev,
+		   const struct rte_cryptodev *cdev, int32_t queue_pair_id,
+		   const struct rte_event *event);
+
+int otx2_ca_qp_del(const struct rte_eventdev *dev,
+		   const struct rte_cryptodev *cdev, int32_t queue_pair_id);
+
 /* Clean up API's */
 typedef void (*otx2_handle_event_t)(void *arg, struct rte_event ev);
 void ssogws_flush_events(struct otx2_ssogws *ws, uint8_t queue_id,
drivers/event/octeontx2/otx2_evdev_crypto_adptr.c new file +81 -0

81 lines not on this page · raw message

Signature · 1 line
2.28.0
#12 lore raw

PATCH v3 3/3 event/octeontx2: add crypto adapter datapath

In reply to Ankur Dwivedi

In the op new mode of crypto adapter, the completed crypto operation is submitted to the event device by the OCTEON TX2 crypto PMD. During event device dequeue the result of crypto operation is checked.

---
 drivers/common/cpt/cpt_common.h               |  1 +
 drivers/crypto/octeontx2/otx2_cryptodev_ops.c | 47 ++++++++++++
 .../rte_pmd_octeontx2_crypto_version.map      |  1 +
 .../octeontx2/otx2_evdev_crypto_adptr_dp.h    | 75 +++++++++++++++++++
 drivers/event/octeontx2/otx2_worker.h         | 28 ++++---
 drivers/event/octeontx2/otx2_worker_dual.h    | 44 ++++++-----
 6 files changed, 168 insertions(+), 28 deletions(-)
 create mode 100644 drivers/event/octeontx2/otx2_evdev_crypto_adptr_dp.h
drivers/common/cpt/cpt_common.h +1 -0
index 0141b2aed..1ce28e90b 100644
@@ -72,6 +72,7 @@ struct cpt_request_info {
 		uint64_t ei3;
 	} ist;
 	uint8_t *rptr;
+	const struct otx2_cpt_qp *qp;
 
 	/** Control path fields */
 	uint64_t time_out;
drivers/crypto/octeontx2/otx2_cryptodev_ops.c +47 -0

59 lines not on this page · raw message

drivers/crypto/octeontx2/rte_pmd_octeontx2_crypto_version.map +1 -0
index 95ebda255..02684781b 100644
@@ -5,6 +5,7 @@ DPDK_21 {
 INTERNAL {
 	global:
 
+	otx2_cryptodev_driver_id;
 	otx2_cpt_af_reg_read;
 	otx2_cpt_af_reg_write;
 
drivers/event/octeontx2/otx2_evdev_crypto_adptr_dp.h new file +75 -0

75 lines not on this page · raw message

drivers/event/octeontx2/otx2_worker.h +18 -10
index 924ff7ff4..ac6bc511c 100644
@@ -10,6 +10,7 @@
 
 #include <otx2_common.h>
 #include "otx2_evdev.h"
+#include "otx2_evdev_crypto_adptr_dp.h"
 #include "otx2_ethdev_sec_tx.h"
 
 /* SSO Operations */
@@ -66,16 +67,23 @@ otx2_ssogws_get_work(struct otx2_ssogws *ws, struct rte_event *ev,
 	ws->cur_tt = event.sched_type;
 	ws->cur_grp = event.queue_id;
 
-	if (event.sched_type != SSO_TT_EMPTY &&
-	    event.event_type == RTE_EVENT_TYPE_ETHDEV) {
-		otx2_wqe_to_mbuf(get_work1, mbuf, event.sub_event_type,
-				 (uint32_t) event.get_work0, flags, lookup_mem);
-		/* Extracting tstamp, if PTP enabled*/
-		tstamp_ptr = *(uint64_t *)(((struct nix_wqe_hdr_s *)get_work1)
-					     + OTX2_SSO_WQE_SG_PTR);
-		otx2_nix_mbuf_to_tstamp((struct rte_mbuf *)mbuf, ws->tstamp,
-					flags, (uint64_t *)tstamp_ptr);
-		get_work1 = mbuf;
+	if (event.sched_type != SSO_TT_EMPTY) {
+		if ((flags & NIX_RX_OFFLOAD_SECURITY_F) &&
+		    (event.event_type == RTE_EVENT_TYPE_CRYPTODEV)) {
+			get_work1 = otx2_handle_crypto_event(get_work1);
+		} else if (event.event_type == RTE_EVENT_TYPE_ETHDEV) {
+			otx2_wqe_to_mbuf(get_work1, mbuf, event.sub_event_type,
+					 (uint32_t) event.get_work0, flags,
+					 lookup_mem);
+			/* Extracting tstamp, if PTP enabled*/
+			tstamp_ptr = *(uint64_t *)(((struct nix_wqe_hdr_s *)
+						     get_work1) +
+						     OTX2_SSO_WQE_SG_PTR);
+			otx2_nix_mbuf_to_tstamp((struct rte_mbuf *)mbuf,
+						ws->tstamp, flags,
+						(uint64_t *)tstamp_ptr);
+			get_work1 = mbuf;
+		}
 	}
 
 	ev->event = event.get_work0;
drivers/event/octeontx2/otx2_worker_dual.h +26 -18

57 lines not on this page · raw message

Signature · 1 line
2.28.0
#13 lore raw

v4 cover event/octeontx2: add support for event crypto adapter

In reply to Ankur Dwivedi

This patch series adds support for event crypto adapter in op new mode in the OCTEON TX2 event PMD. The functionality has been verified with event crypto adapter test application. Build with meson and ninja is supported.

v4:
* In the "event/octeontx2: add crypto adapter datapath" patch, replaced rte_cio_wmb with rte_io_wmb, to resolve compilation error.

v3:
* In the "event/octeontx2: add crypto adapter framework" patch, the following changes were made:
- Moved the crypto adapter files from crypto/octeontx2 to event/octeontx2 directory.
- Reused the security flag for crypto adapter implementation.

* In the "event/octeontx2: add crypto adapter datapath" patch, the following changes were made:
- In otx2_ssogws_get_work() and otx2_ssogws_dual_get_work(), the crypto adapter function is called if offload flag has security enabled. This is an additional check apart from checking event type.

v2:
* In the "event/octeontx2: add crypto adapter datapath" patch, right shifting the req pointer by 3 bits before submit during enqueue. Because of this the right shift during dequeue is not required.

Ankur Dwivedi (3):
crypto/octeontx2: move functions to helper file
event/octeontx2: add crypto adapter framework
event/octeontx2: add crypto adapter datapath

 drivers/common/cpt/cpt_common.h               |  1 +
 drivers/crypto/octeontx2/meson.build          |  1 +
 .../octeontx2/otx2_cryptodev_hw_access.h      | 12 +++
 .../crypto/octeontx2/otx2_cryptodev_mbox.h    |  2 +
 drivers/crypto/octeontx2/otx2_cryptodev_ops.c | 96 ++++++++-----------
 .../octeontx2/otx2_cryptodev_ops_helper.h     | 74 ++++++++++++++
 drivers/crypto/octeontx2/otx2_cryptodev_qp.h  |  7 ++
 .../rte_pmd_octeontx2_crypto_version.map      | 10 ++
 drivers/event/octeontx2/meson.build           |  4 +-
 drivers/event/octeontx2/otx2_evdev.c          |  4 +
 drivers/event/octeontx2/otx2_evdev.h          | 11 +++
 .../event/octeontx2/otx2_evdev_crypto_adptr.c | 81 ++++++++++++++++
 .../octeontx2/otx2_evdev_crypto_adptr_dp.h    | 75 +++++++++++++++
 drivers/event/octeontx2/otx2_worker.h         | 28 ++++--
 drivers/event/octeontx2/otx2_worker_dual.h    | 44 +++++----
 15 files changed, 365 insertions(+), 85 deletions(-)
 create mode 100644 drivers/crypto/octeontx2/otx2_cryptodev_ops_helper.h
 create mode 100644 drivers/event/octeontx2/otx2_evdev_crypto_adptr.c
 create mode 100644 drivers/event/octeontx2/otx2_evdev_crypto_adptr_dp.h
Signature · 1 line
2.28.0
#14 lore raw

PATCH v4 1/3 crypto/octeontx2: move functions to helper file

Some functions are common across cryptodev pmd and the event crypto adapter. This patch moves them into a helper file.

---
 drivers/crypto/octeontx2/otx2_cryptodev_ops.c | 65 +---------------
 .../octeontx2/otx2_cryptodev_ops_helper.h     | 74 +++++++++++++++++++
 2 files changed, 75 insertions(+), 64 deletions(-)
 create mode 100644 drivers/crypto/octeontx2/otx2_cryptodev_ops_helper.h
drivers/crypto/octeontx2/otx2_cryptodev_ops.c +1 -64
index d38365a33..027fd0d47 100644
@@ -13,6 +13,7 @@
 #include "otx2_cryptodev_hw_access.h"
 #include "otx2_cryptodev_mbox.h"
 #include "otx2_cryptodev_ops.h"
+#include "otx2_cryptodev_ops_helper.h"
 #include "otx2_ipsec_po_ops.h"
 #include "otx2_mbox.h"
 #include "otx2_sec_idev.h"
@@ -416,24 +417,6 @@ sym_session_configure(int driver_id, struct rte_crypto_sym_xform *xform,
 	return -ENOTSUP;
 }
 
-static void
-sym_session_clear(int driver_id, struct rte_cryptodev_sym_session *sess)
-{
-	void *priv = get_sym_session_private_data(sess, driver_id);
-	struct rte_mempool *pool;
-
-	if (priv == NULL)
-		return;
-
-	memset(priv, 0, cpt_get_session_size());
-
-	pool = rte_mempool_from_obj(priv);
-
-	set_sym_session_private_data(sess, driver_id, NULL);
-
-	rte_mempool_put(pool, priv);
-}
-
 static __rte_always_inline int32_t __rte_hot
 otx2_cpt_enqueue_req(const struct otx2_cpt_qp *qp,
 		     struct pending_queue *pend_q,
@@ -919,52 +902,6 @@ otx2_cpt_dequeue_post_process(struct otx2_cpt_qp *qp, struct rte_crypto_op *cop,
 	}
 }
 
-static __rte_always_inline uint8_t
-otx2_cpt_compcode_get(struct cpt_request_info *req)
-{
-	volatile struct cpt_res_s_9s *res;
-	uint8_t ret;
-
-	res = (volatile struct cpt_res_s_9s *)req->completion_addr;
-
-	if (unlikely(res->compcode == CPT_9X_COMP_E_NOTDONE)) {
-		if (rte_get_timer_cycles() < req->time_out)
-			return ERR_REQ_PENDING;
-
-		CPT_LOG_DP_ERR("Request timed out");
-		return ERR_REQ_TIMEOUT;
-	}
-
-	if (likely(res->compcode == CPT_9X_COMP_E_GOOD)) {
-		ret = NO_ERR;
-		if (unlikely(res->uc_compcode)) {
-			ret = res->uc_compcode;
-			CPT_LOG_DP_DEBUG("Request failed with microcode error");
-			CPT_LOG_DP_DEBUG("MC completion code 0x%x",
-					 res->uc_compcode);
-		}
-	} else {
-		CPT_LOG_DP_DEBUG("HW completion code 0x%x", res->compcode);
-
-		ret = res->compcode;
-		switch (res->compcode) {
-		case CPT_9X_COMP_E_INSTERR:
-			CPT_LOG_DP_ERR("Request failed with instruction error");
-			break;
-		case CPT_9X_COMP_E_FAULT:
-			CPT_LOG_DP_ERR("Request failed with DMA fault");
-			break;
-		case CPT_9X_COMP_E_HWERR:
-			CPT_LOG_DP_ERR("Request failed with hardware error");
-			break;
-		default:
-			CPT_LOG_DP_ERR("Request failed with unknown completion code");
-		}
-	}
-
-	return ret;
-}
-
 static uint16_t
 otx2_cpt_dequeue_burst(void *qptr, struct rte_crypto_op **ops, uint16_t nb_ops)
 {
drivers/crypto/octeontx2/otx2_cryptodev_ops_helper.h new file +74 -0

74 lines not on this page · raw message

Signature · 1 line
2.28.0
#15 lore raw

PATCH v4 2/3 event/octeontx2: add crypto adapter framework

In reply to Ankur Dwivedi

The crypto adapter callback functions and associated data structures are added.

---
 drivers/crypto/octeontx2/meson.build          |  1 +
 .../octeontx2/otx2_cryptodev_hw_access.h      | 12 +++
 .../crypto/octeontx2/otx2_cryptodev_mbox.h    |  2 +
 drivers/crypto/octeontx2/otx2_cryptodev_qp.h  |  7 ++
 .../rte_pmd_octeontx2_crypto_version.map      |  9 +++
 drivers/event/octeontx2/meson.build           |  4 +-
 drivers/event/octeontx2/otx2_evdev.c          |  4 +
 drivers/event/octeontx2/otx2_evdev.h          | 11 +++
 .../event/octeontx2/otx2_evdev_crypto_adptr.c | 81 +++++++++++++++++++
 9 files changed, 130 insertions(+), 1 deletion(-)
 create mode 100644 drivers/event/octeontx2/otx2_evdev_crypto_adptr.c
drivers/crypto/octeontx2/meson.build +1 -0
index 148ec184a..41114a5c3 100644
@@ -10,6 +10,7 @@ deps += ['bus_pci']
 deps += ['common_cpt']
 deps += ['common_octeontx2']
 deps += ['ethdev']
+deps += ['eventdev']
 deps += ['security']
 name = 'octeontx2_crypto'
 
drivers/crypto/octeontx2/otx2_cryptodev_hw_access.h +12 -0
index 43db6a642..a435818e0 100644
@@ -42,6 +42,7 @@
 #define OTX2_CPT_LF_NQ(a)		(0x400ull | (uint64_t)(a) << 3)
 
 #define OTX2_CPT_AF_LF_CTL(a)		(0x27000ull | (uint64_t)(a) << 3)
+#define OTX2_CPT_AF_LF_CTL2(a)		(0x29000ull | (uint64_t)(a) << 3)
 
 #define OTX2_CPT_LF_BAR2(vf, q_id) \
 		((vf)->otx2_dev.bar2 + \
@@ -110,6 +111,17 @@ union otx2_cpt_af_lf_ctl {
 	} s;
 };
 
+union otx2_cpt_af_lf_ctl2 {
+	uint64_t u;
+	struct {
+		uint64_t exe_no_swap                 : 1;
+		uint64_t exe_ldwb                    : 1;
+		uint64_t reserved_2_31               : 30;
+		uint64_t sso_pf_func                 : 16;
+		uint64_t nix_pf_func                 : 16;
+	} s;
+};
+
 union otx2_cpt_lf_q_grp_ptr {
 	uint64_t u;
 	struct {
drivers/crypto/octeontx2/otx2_cryptodev_mbox.h +2 -0
index 4bc057774..05efb4049 100644
@@ -21,9 +21,11 @@ int otx2_cpt_queues_detach(const struct rte_cryptodev *dev);
 
 int otx2_cpt_msix_offsets_get(const struct rte_cryptodev *dev);
 
+__rte_internal
 int otx2_cpt_af_reg_read(const struct rte_cryptodev *dev, uint64_t reg,
 			 uint64_t *val);
 
+__rte_internal
 int otx2_cpt_af_reg_write(const struct rte_cryptodev *dev, uint64_t reg,
 			  uint64_t val);
 
drivers/crypto/octeontx2/otx2_cryptodev_qp.h +7 -0
index 9d48da45f..96ff4eb41 100644
@@ -6,6 +6,7 @@
 #define _OTX2_CRYPTODEV_QP_H_
 
 #include <rte_common.h>
+#include <rte_eventdev.h>
 #include <rte_mempool.h>
 #include <rte_spinlock.h>
 
@@ -30,6 +31,12 @@ struct otx2_cpt_qp {
 	/**< Metabuf info required to support operations on the queue pair */
 	rte_iova_t iq_dma_addr;
 	/**< Instruction queue address */
+	struct rte_event ev;
+	/**< Event information required for binding cryptodev queue to
+	 * eventdev queue. Used by crypto adapter.
+	 */
+	uint8_t ca_enable;
+	/**< Set when queue pair is added to crypto adapter */
 };
 
 #endif /* _OTX2_CRYPTODEV_QP_H_ */
drivers/crypto/octeontx2/rte_pmd_octeontx2_crypto_version.map +9 -0
index 4a76d1d52..95ebda255 100644
@@ -1,3 +1,12 @@
 DPDK_21 {
 	local: *;
 };
+
+INTERNAL {
+	global:
+
+	otx2_cpt_af_reg_read;
+	otx2_cpt_af_reg_write;
+
+	local: *;
+};
drivers/event/octeontx2/meson.build +3 -1
index 0ade51cec..6dde86fc7 100644
@@ -6,6 +6,7 @@ sources = files('otx2_worker.c',
 		'otx2_worker_dual.c',
 		'otx2_evdev.c',
 		'otx2_evdev_adptr.c',
+		'otx2_evdev_crypto_adptr.c',
 		'otx2_evdev_irq.c',
 		'otx2_evdev_selftest.c',
 		'otx2_tim_evdev.c',
@@ -24,6 +25,7 @@ foreach flag: extra_flags
 	endif
 endforeach
 
-deps += ['bus_pci', 'common_octeontx2', 'mempool_octeontx2', 'pmd_octeontx2']
+deps += ['bus_pci', 'common_octeontx2', 'mempool_octeontx2', 'pmd_octeontx2', 'pmd_octeontx2_crypto']
 
 includes += include_directories('../../crypto/octeontx2')
+includes += include_directories('../../common/cpt')
drivers/event/octeontx2/otx2_evdev.c +4 -0
index b8b57c388..461ad57f5 100644
@@ -1587,6 +1587,10 @@ static struct rte_eventdev_ops otx2_sso_ops = {
 
 	.timer_adapter_caps_get = otx2_tim_caps_get,
 
+	.crypto_adapter_caps_get = otx2_ca_caps_get,
+	.crypto_adapter_queue_pair_add = otx2_ca_qp_add,
+	.crypto_adapter_queue_pair_del = otx2_ca_qp_del,
+
 	.xstats_get       = otx2_sso_xstats_get,
 	.xstats_reset     = otx2_sso_xstats_reset,
 	.xstats_get_names = otx2_sso_xstats_get_names,
drivers/event/octeontx2/otx2_evdev.h +11 -0
index 873724dd4..4bf715c03 100644
@@ -388,6 +388,17 @@ int otx2_sso_tx_adapter_queue_del(uint8_t id,
 				  const struct rte_eth_dev *eth_dev,
 				  int32_t tx_queue_id);
 
+/* Event crypto adapter API's */
+int otx2_ca_caps_get(const struct rte_eventdev *dev,
+		     const struct rte_cryptodev *cdev, uint32_t *caps);
+
+int otx2_ca_qp_add(const struct rte_eventdev *dev,
+		   const struct rte_cryptodev *cdev, int32_t queue_pair_id,
+		   const struct rte_event *event);
+
+int otx2_ca_qp_del(const struct rte_eventdev *dev,
+		   const struct rte_cryptodev *cdev, int32_t queue_pair_id);
+
 /* Clean up API's */
 typedef void (*otx2_handle_event_t)(void *arg, struct rte_event ev);
 void ssogws_flush_events(struct otx2_ssogws *ws, uint8_t queue_id,
drivers/event/octeontx2/otx2_evdev_crypto_adptr.c new file +81 -0

81 lines not on this page · raw message

Signature · 1 line
2.28.0
#16 lore raw

PATCH v4 3/3 event/octeontx2: add crypto adapter datapath

In reply to Ankur Dwivedi

In the op new mode of crypto adapter, the completed crypto operation is submitted to the event device by the OCTEON TX2 crypto PMD. During event device dequeue the result of crypto operation is checked.

---
 drivers/common/cpt/cpt_common.h               |  1 +
 drivers/crypto/octeontx2/otx2_cryptodev_ops.c | 47 ++++++++++++
 .../rte_pmd_octeontx2_crypto_version.map      |  1 +
 .../octeontx2/otx2_evdev_crypto_adptr_dp.h    | 75 +++++++++++++++++++
 drivers/event/octeontx2/otx2_worker.h         | 28 ++++---
 drivers/event/octeontx2/otx2_worker_dual.h    | 44 ++++++-----
 6 files changed, 168 insertions(+), 28 deletions(-)
 create mode 100644 drivers/event/octeontx2/otx2_evdev_crypto_adptr_dp.h
drivers/common/cpt/cpt_common.h +1 -0
index 0141b2aed..1ce28e90b 100644
@@ -72,6 +72,7 @@ struct cpt_request_info {
 		uint64_t ei3;
 	} ist;
 	uint8_t *rptr;
+	const struct otx2_cpt_qp *qp;
 
 	/** Control path fields */
 	uint64_t time_out;
drivers/crypto/octeontx2/otx2_cryptodev_ops.c +47 -0

59 lines not on this page · raw message

drivers/crypto/octeontx2/rte_pmd_octeontx2_crypto_version.map +1 -0
index 95ebda255..02684781b 100644
@@ -5,6 +5,7 @@ DPDK_21 {
 INTERNAL {
 	global:
 
+	otx2_cryptodev_driver_id;
 	otx2_cpt_af_reg_read;
 	otx2_cpt_af_reg_write;
 
drivers/event/octeontx2/otx2_evdev_crypto_adptr_dp.h new file +75 -0

75 lines not on this page · raw message

drivers/event/octeontx2/otx2_worker.h +18 -10
index cde1288d9..3a3ec0fd4 100644
@@ -10,6 +10,7 @@
 
 #include <otx2_common.h>
 #include "otx2_evdev.h"
+#include "otx2_evdev_crypto_adptr_dp.h"
 #include "otx2_ethdev_sec_tx.h"
 
 /* SSO Operations */
@@ -66,16 +67,23 @@ otx2_ssogws_get_work(struct otx2_ssogws *ws, struct rte_event *ev,
 	ws->cur_tt = event.sched_type;
 	ws->cur_grp = event.queue_id;
 
-	if (event.sched_type != SSO_TT_EMPTY &&
-	    event.event_type == RTE_EVENT_TYPE_ETHDEV) {
-		otx2_wqe_to_mbuf(get_work1, mbuf, event.sub_event_type,
-				 (uint32_t) event.get_work0, flags, lookup_mem);
-		/* Extracting tstamp, if PTP enabled*/
-		tstamp_ptr = *(uint64_t *)(((struct nix_wqe_hdr_s *)get_work1)
-					     + OTX2_SSO_WQE_SG_PTR);
-		otx2_nix_mbuf_to_tstamp((struct rte_mbuf *)mbuf, ws->tstamp,
-					flags, (uint64_t *)tstamp_ptr);
-		get_work1 = mbuf;
+	if (event.sched_type != SSO_TT_EMPTY) {
+		if ((flags & NIX_RX_OFFLOAD_SECURITY_F) &&
+		    (event.event_type == RTE_EVENT_TYPE_CRYPTODEV)) {
+			get_work1 = otx2_handle_crypto_event(get_work1);
+		} else if (event.event_type == RTE_EVENT_TYPE_ETHDEV) {
+			otx2_wqe_to_mbuf(get_work1, mbuf, event.sub_event_type,
+					 (uint32_t) event.get_work0, flags,
+					 lookup_mem);
+			/* Extracting tstamp, if PTP enabled*/
+			tstamp_ptr = *(uint64_t *)(((struct nix_wqe_hdr_s *)
+						     get_work1) +
+						     OTX2_SSO_WQE_SG_PTR);
+			otx2_nix_mbuf_to_tstamp((struct rte_mbuf *)mbuf,
+						ws->tstamp, flags,
+						(uint64_t *)tstamp_ptr);
+			get_work1 = mbuf;
+		}
 	}
 
 	ev->event = event.get_work0;
drivers/event/octeontx2/otx2_worker_dual.h +26 -18

57 lines not on this page · raw message

Signature · 1 line
2.28.0
#17 lore raw
In reply to Ankur Dwivedi
Quoted 61 lines

This patch series adds support for event crypto adapter in op new mode in the OCTEON TX2 event PMD. The functionality has been verified with event crypto adapter test application. Build with meson and ninja is supported.

v4:
* In the "event/octeontx2: add crypto adapter datapath" patch, replaced rte_cio_wmb with rte_io_wmb, to resolve compilation error.

v3:
* In the "event/octeontx2: add crypto adapter framework" patch, the following changes were made:
- Moved the crypto adapter files from crypto/octeontx2 to event/octeontx2 directory.
- Reused the security flag for crypto adapter implementation.

* In the "event/octeontx2: add crypto adapter datapath" patch, the following changes were made:
- In otx2_ssogws_get_work() and otx2_ssogws_dual_get_work(), the crypto adapter function is called if offload flag has security enabled. This is an additional check apart from checking event type.

v2:
* In the "event/octeontx2: add crypto adapter datapath" patch, right shifting the req pointer by 3 bits before submit during enqueue. Because of this the right shift during dequeue is not required.

Ankur Dwivedi (3):
crypto/octeontx2: move functions to helper file
event/octeontx2: add crypto adapter framework
event/octeontx2: add crypto adapter datapath

drivers/common/cpt/cpt_common.h               |  1 +
drivers/crypto/octeontx2/meson.build          |  1 +
.../octeontx2/otx2_cryptodev_hw_access.h      | 12 +++
.../crypto/octeontx2/otx2_cryptodev_mbox.h    |  2 +
drivers/crypto/octeontx2/otx2_cryptodev_ops.c | 96 ++++++++---------
--
.../octeontx2/otx2_cryptodev_ops_helper.h     | 74 ++++++++++++++
drivers/crypto/octeontx2/otx2_cryptodev_qp.h  |  7 ++
.../rte_pmd_octeontx2_crypto_version.map      | 10 ++
drivers/event/octeontx2/meson.build           |  4 +-
drivers/event/octeontx2/otx2_evdev.c          |  4 +
drivers/event/octeontx2/otx2_evdev.h          | 11 +++
.../event/octeontx2/otx2_evdev_crypto_adptr.c | 81
++++++++++++++++
.../octeontx2/otx2_evdev_crypto_adptr_dp.h    | 75 +++++++++++++++
drivers/event/octeontx2/otx2_worker.h         | 28 ++++--
drivers/event/octeontx2/otx2_worker_dual.h    | 44 +++++----
15 files changed, 365 insertions(+), 85 deletions(-)

create mode 100644 drivers/crypto/octeontx2/otx2_cryptodev_ops_helper.h create mode 100644 drivers/event/octeontx2/otx2_evdev_crypto_adptr.c create mode 100644 drivers/event/octeontx2/otx2_evdev_crypto_adptr_dp.h

--
2.28.0

#18 lore raw
Quoted 2 lines · Pavan Nikhilesh Bhagavatula

Series applied to dpdk-next-eventdev/for-main. Thanks.

Quoted 62 lines
Quoted 61 lines

This patch series adds support for event crypto adapter in op new mode in the OCTEON TX2 event PMD. The functionality has been verified with event crypto adapter test application. Build with meson and ninja is supported.

v4:
* In the "event/octeontx2: add crypto adapter datapath" patch, replaced rte_cio_wmb with rte_io_wmb, to resolve compilation error.

v3:
* In the "event/octeontx2: add crypto adapter framework" patch, the following changes were made:
- Moved the crypto adapter files from crypto/octeontx2 to event/octeontx2 directory.
- Reused the security flag for crypto adapter implementation.

* In the "event/octeontx2: add crypto adapter datapath" patch, the following changes were made:
- In otx2_ssogws_get_work() and otx2_ssogws_dual_get_work(), the crypto adapter function is called if offload flag has security enabled. This is an additional check apart from checking event type.

v2:
* In the "event/octeontx2: add crypto adapter datapath" patch, right shifting the req pointer by 3 bits before submit during enqueue. Because of this the right shift during dequeue is not required.

Ankur Dwivedi (3):
crypto/octeontx2: move functions to helper file
event/octeontx2: add crypto adapter framework
event/octeontx2: add crypto adapter datapath

drivers/common/cpt/cpt_common.h               |  1 +
drivers/crypto/octeontx2/meson.build          |  1 +
.../octeontx2/otx2_cryptodev_hw_access.h      | 12 +++
.../crypto/octeontx2/otx2_cryptodev_mbox.h    |  2 +
drivers/crypto/octeontx2/otx2_cryptodev_ops.c | 96 ++++++++---------
--
.../octeontx2/otx2_cryptodev_ops_helper.h     | 74 ++++++++++++++
drivers/crypto/octeontx2/otx2_cryptodev_qp.h  |  7 ++
.../rte_pmd_octeontx2_crypto_version.map      | 10 ++
drivers/event/octeontx2/meson.build           |  4 +-
drivers/event/octeontx2/otx2_evdev.c          |  4 +
drivers/event/octeontx2/otx2_evdev.h          | 11 +++
.../event/octeontx2/otx2_evdev_crypto_adptr.c | 81
++++++++++++++++
.../octeontx2/otx2_evdev_crypto_adptr_dp.h    | 75 +++++++++++++++
drivers/event/octeontx2/otx2_worker.h         | 28 ++++--
drivers/event/octeontx2/otx2_worker_dual.h    | 44 +++++----
15 files changed, 365 insertions(+), 85 deletions(-)

create mode 100644 drivers/crypto/octeontx2/otx2_cryptodev_ops_helper.h create mode 100644 drivers/event/octeontx2/otx2_evdev_crypto_adptr.c create mode 100644 drivers/event/octeontx2/otx2_evdev_crypto_adptr_dp.h

--
2.28.0