common/cpt: improve structures used in datapath
Subsystems (2)
PATCH 1/3 common/cpt: improve structures used in datapath
--- drivers/common/cpt/cpt_common.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/common/cpt/cpt_common.h +5 -5
@@ -60,14 +60,14 @@ struct rid {* */ struct pending_queue { +/** Pending requests count */ +uint64_t pending_count; +/** Array of pending requests */ +struct rid *rid_queue;/** Tail of queue to be used for enqueue */ uint16_t enq_tail;/** Head of queue to be used for dequeue */ uint16_t deq_head; -/** Array of pending requests */ -struct rid *rid_queue; -/** Pending requests count */ -uint64_t pending_count; };struct cpt_request_info {
@@ -86,6 +86,6 @@ struct cpt_request_info {/** Control path fields */ uint64_t time_out; uint8_t extra_time; -}; +} __rte_cache_aligned;#endif /* _CPT_COMMON_H_ */
Signature · 1 line
2.7.4
PATCH 2/3 common/cpt: redesign propagation of error
The check for prep_req is good enough to flag error. The return var passed around is redundant. Fixing this. Also making the functions return correct error values in case of various failures.
In addition, adding unlikely flag for all error checks.
--- drivers/common/cpt/cpt_request_mgr.h | 12 +- drivers/common/cpt/cpt_ucode.h | 318 ++++++++++++++++++++--------------- 2 files changed, 189 insertions(+), 141 deletions(-)
drivers/common/cpt/cpt_request_mgr.h +6 -6
@@ -111,17 +111,17 @@ cpt_pmd_crypto_operation(struct cpt_instance *instance, cpt_op = sess->cpt_op; - mdata = &(cptvf->meta_info); -if (likely (cpt_op &CPT_OP_CIPHER_MASK )) - prep_req =fill_fc_params (op, sess, &mdata, &ret); + ret =fill_fc_params (op, sess, &cptvf->meta_info, &mdata, + &prep_req);else - prep_req =fill_digest_params (op, sess, &mdata, &ret); + ret =fill_digest_params (op, sess, &cptvf->meta_info, + &mdata, &prep_req); -if (unlikely (!prep_req)) { +if (unlikely (ret)) {CPT_LOG_DP_ERR ("prep cryto req : op %p, cpt_op 0x%x " "ret 0x%x" , op, (unsigned int )cpt_op, ret); - goto req_fail; +return ret; }/* Enqueue prepared instruction to HW */
drivers/common/cpt/cpt_ucode.h +183 -135
656 lines not on this page · raw message
Signature · 1 line
2.7.4
PATCH 3/3 crypto/octeontx: move device specific code to driver
In reply to Anoob JosephMoving upper level enqueue/dequeue routines to driver. The h/w interface used to submit request has enough differences to substantiate the need for separate routines.
--- drivers/common/cpt/cpt_common.h | 6 - drivers/common/cpt/cpt_mcode_defines.h | 12 + drivers/common/cpt/cpt_request_mgr.h | 185 --------------- drivers/crypto/octeontx/Makefile | 3 +- drivers/crypto/octeontx/meson.build | 2 +- drivers/crypto/octeontx/otx_cryptodev_hw_access.h | 2 + drivers/crypto/octeontx/otx_cryptodev_ops.c | 262 ++++++++++++++++++++-- 7 files changed, 255 insertions(+), 217 deletions(-) delete mode 100644 drivers/common/cpt/cpt_request_mgr.h
drivers/common/cpt/cpt_common.h +0 -6
@@ -9,12 +9,6 @@* This file defines common macros and structs */ -/* -* Macros to determine CPT model. Driver makefile will define CPT_MODEL -* accordingly -*/ -#define CRYPTO_OCTEONTX 0x1 -#define TIME_IN_RESET_COUNT 5/* Default command timeout in seconds */
drivers/common/cpt/cpt_mcode_defines.h +12 -0
@@ -383,4 +383,16 @@ typedef mc_hash_type_t auth_type_t;#define SESS_PRIV (__sess) \ (void *)((uint8_t *)__sess + sizeof(struct cpt_sess_misc)) +/* +* Get the session size +* +* @return +* - session size +*/ +static __rte_always_inline unsigned int +cpt_get_session_size (void ) +{ +unsigned int ctx_len =sizeof (struct cpt_ctx ); +return (sizeof (struct cpt_sess_misc ) +RTE_ALIGN_CEIL (ctx_len,8 )); +}#endif /* _CPT_MCODE_DEFINES_H_ */
drivers/common/cpt/cpt_request_mgr.h deleted +0 -185
185 lines not on this page · raw message
drivers/crypto/octeontx/Makefile +2 -1
@@ -20,8 +20,9 @@ LDLIBS += -lrte_common_cpt VPATH += $(RTE_SDK)/drivers/crypto/octeontx -CFLAGS += -O3 -DCPT_MODEL=CRYPTO_OCTEONTX +CFLAGS += -O3 CFLAGS += -I$(RTE_SDK)/drivers/common/cpt +CFLAGS += -DALLOW_EXPERIMENTAL_API # PMD code SRCS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX_CRYPTO) += otx_cryptodev.c
drivers/crypto/octeontx/meson.build +1 -1
@@ -8,6 +8,7 @@ deps += ['bus_pci'] deps += ['common_cpt'] name = 'octeontx_crypto' +allow_experimental_apis = true sources = files('otx_cryptodev.c', 'otx_cryptodev_capabilities.c', 'otx_cryptodev_hw_access.c',
@@ -15,4 +16,3 @@ sources = files('otx_cryptodev.c', 'otx_cryptodev_ops.c') includes += include_directories('../../common/cpt') -cflags += '-DCPT_MODEL=CRYPTO_OCTEONTX'
drivers/crypto/octeontx/otx_cryptodev_hw_access.h +2 -0
@@ -39,6 +39,8 @@struct cpt_instance {uint32_t queue_id;uintptr_t rsvd; +struct rte_mempool *sess_mp; +struct rte_mempool *sess_mp_priv; };struct command_chunk {
drivers/crypto/octeontx/otx_cryptodev_ops.c +238 -24
318 lines not on this page · raw message
Signature · 1 line
2.7.4
Hi Akhil,
Can you review this series and share your thoughts?
Thanks,
Anoob
Quoted 50 lines
-----Original Message-----
From: Anoob Joseph
Sent: Saturday, March 2, 2019 12:12 AM
To: Akhil Goyal <[email protected]>; Pablo de Lara <[email protected]>
Cc: Anoob Joseph <[email protected]>; Jerin Jacob Kollanukkaran <[email protected]>; Narayana Prasad Raju Athreya <[email protected]>; Suheil Chandran <[email protected]>; Ankur Dwivedi <[email protected]>; [email protected]
Subject: [PATCH 1/3] common/cpt: improve structures used in datapathSigned-off-by Ankur Dwivedi <[email protected]>Signed-off-by Anoob Joseph <[email protected]>--- drivers/common/cpt/cpt_common.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)(quoted diff) +0
-0
b/drivers/common/cpt/cpt_common.hindex 8461cd6..8568d5b 100644drivers/common/cpt/cpt_common.h +5
-6@@ -60,14 +60,14 @@ struct rid {* */ struct pending_queue { +/** Pending requests count */ +uint64_t pending_count; +/** Array of pending requests */ +struct rid *rid_queue;/** Tail of queue to be used for enqueue */ uint16_t enq_tail;/** Head of queue to be used for dequeue */ uint16_t deq_head; -/** Array of pending requests */ -struct rid *rid_queue; -/** Pending requests count */ -uint64_t pending_count; };struct cpt_request_info {@@ -86,6 +86,6 @@ struct cpt_request_info {/** Control path fields */ uint64_t time_out; uint8_t extra_time; -}; +} __rte_cache_aligned;#endif /* _CPT_COMMON_H_ */ --2.7.4
Quoted 6 lines · Anoob Joseph
Hi Akhil,
Can you review this series and share your thoughts?
Thanks,
Anoob
Patchset applied to dpdk-next-crypto
Thanks.