Re: [PATCH 04/16] crypto/cpt/base: add hardware enq/deq API for CPT
From: De Lara Guarch, Pablo <hidden>
Date: 2018-06-19 14:36:21
-----Original Message----- From: Anoob Joseph [mailto:anoob.joseph@caviumnetworks.com] Sent: Friday, June 8, 2018 5:45 PM To: Akhil Goyal <redacted>; De Lara Guarch, Pablo [off-list ref]; Thomas Monjalon [off-list ref] Cc: Ankur Dwivedi <redacted>; Jerin Jacob [off-list ref]; Murthy NSSR [off-list ref]; Narayana Prasad [off-list ref]; Nithin Dabilpuram [off-list ref]; Ragothaman Jayaraman [off-list ref]; Srisivasubramanian Srinivasan [off-list ref]; dev@dpdk.org Subject: [PATCH 04/16] crypto/cpt/base: add hardware enq/deq API for CPT
No need to use "for CPT" here, as the "crypto/cpt/base" already states that. Same applies in other patches.
quoted hunk ↗ jump to hunk
From: Ankur Dwivedi <redacted> Adds hardware enqueue/dequeue API of instructions to a queue pair for Cavium CPT device. Signed-off-by: Ankur Dwivedi <redacted> Signed-off-by: Murthy NSSR <redacted> Signed-off-by: Nithin Dabilpuram <redacted> Signed-off-by: Ragothaman Jayaraman [off-list ref] Signed-off-by: Srisivasubramanian Srinivasan [off-list ref] --- drivers/crypto/cpt/base/cpt.h | 102 +++++++ drivers/crypto/cpt/base/cpt_device.c | 4 +- drivers/crypto/cpt/base/cpt_request_mgr.c | 424 ++++++++++++++++++++++++++++++ drivers/crypto/cpt/base/cpt_request_mgr.h | 75 ++++++ 4 files changed, 603 insertions(+), 2 deletions(-) create mode 100644 drivers/crypto/cpt/base/cpt.h create mode 100644 drivers/crypto/cpt/base/cpt_request_mgr.c create mode 100644 drivers/crypto/cpt/base/cpt_request_mgr.hdiff --git a/drivers/crypto/cpt/base/cpt.h b/drivers/crypto/cpt/base/cpt.h newfile mode 100644 index 0000000..11407ae--- /dev/null +++ b/drivers/crypto/cpt/base/cpt.h
...
+/* cpt instance */
+struct cpt_instance {
+ /* 0th cache line */Is this comment useful for only 12 bytes of data? ...
quoted hunk ↗ jump to hunk
diff --git a/drivers/crypto/cpt/base/cpt_device.cb/drivers/crypto/cpt/base/cpt_device.c index b7cd5b5..a50e5b8 100644--- a/drivers/crypto/cpt/base/cpt_device.c +++ b/drivers/crypto/cpt/base/cpt_device.c@@ -193,7 +193,7 @@ int cptvf_get_resource(struct cpt_vf *dev, uint64_t *next_ptr; uint64_t pg_sz = sysconf(_SC_PAGESIZE); - PMD_DRV_LOG(DEBUG, "Initializing csp resource %s\n", cptvf-quoted
dev_name);+ PMD_DRV_LOG(DEBUG, "Initializing cpt resource %s\n", cptvf-quoted
dev_name);
This should be "cpt resource" since the beginning, in the patch that introduced this line. Same below.
quoted hunk ↗ jump to hunk
cpt_instance = &cptvf->instance;@@ -323,7 +323,7 @@ int cptvf_put_resource(cpt_instance_t *instance) return -EINVAL; } - PMD_DRV_LOG(DEBUG, "Releasing csp device %s\n", cptvf-quoted
dev_name);+ PMD_DRV_LOG(DEBUG, "Releasing cpt device %s\n", cptvf-quoted
dev_name);rz = (struct rte_memzone *)instance->rsvd; rte_memzone_free(rz);diff --git a/drivers/crypto/cpt/base/cpt_request_mgr.cb/drivers/crypto/cpt/base/cpt_request_mgr.c new file mode 100644 index 0000000..8b9b1ff--- /dev/null +++ b/drivers/crypto/cpt/base/cpt_request_mgr.c@@ -0,0 +1,424 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2017 Cavium, Inc + */ + +#include "cpt_request_mgr.h" +#include "cpt_debug.h" +#include <rte_atomic.h>
Same comment about the includes applies here. Separate them with blank lines, between external and internal to DPDK includes.
+
+#define MOD_INC(i, l) ((i) == (l - 1) ? (i) = 0 : (i)++)
+
+#define __hot __attribute__((hot))
+
+static inline uint64_t cpu_cycles(void) {
+ return rte_get_timer_cycles();
+}
+
+static inline uint64_t cpu_cycles_freq(void) {
+ return rte_get_timer_hz();
+}
+
+static inline void *
+get_cpt_inst(struct command_queue *cqueue, void *req) {
+ (void)req;
+ PMD_TX_LOG(DEBUG, "CPT queue idx %u, req %p\n", cqueue->idx, req);
+ return &cqueue->qhead[cqueue->idx * CPT_INST_SIZE]; }
+
+static inline void
+mark_cpt_inst(struct cpt_vf *cptvf,
+ struct command_queue *queue,
+ uint32_t ring_door_bell)
+{
+#ifdef CMD_DEBUGTry to avoid this compile time checks, as Jerin suggested.
+ /* DEBUG */
+ {