[dpdk-dev] [dpdk-dev v11 2/4] cryptodev: add raw crypto data-path APIs
Akhil Goyal
akhil.goyal at nxp.com
Sat Oct 10 21:38:39 CEST 2020
Hi Fan,
>
> This patch adds raw data-path APIs for enqueue and dequeue
> operations to cryptodev. The APIs support flexible user-define
> enqueue and dequeue behaviors.
>
> Signed-off-by: Fan Zhang <roy.fan.zhang at intel.com>
> Signed-off-by: Piotr Bronowski <piotrx.bronowski at intel.com>
> Acked-by: Adam Dybkowski <adamx.dybkowski at intel.com>
> ---
> doc/guides/cryptodevs/features/default.ini | 1 +
> doc/guides/cryptodevs/features/qat.ini | 1 +
> doc/guides/prog_guide/cryptodev_lib.rst | 97 +++++
> doc/guides/rel_notes/release_20_11.rst | 7 +
> lib/librte_cryptodev/rte_cryptodev.c | 80 ++++
> lib/librte_cryptodev/rte_cryptodev.h | 367 +++++++++++++++++-
> lib/librte_cryptodev/rte_cryptodev_pmd.h | 51 ++-
> .../rte_cryptodev_version.map | 10 +
> 8 files changed, 611 insertions(+), 3 deletions(-)
>
The release notes should be updated just above aesni_mb crypto PMD updates
+* **Added raw data-path APIs for cryptodev library.**
+
+ Cryptodev is added with raw data-path APIs to accelerate external
+ libraries or applications which need to avail fast cryptodev
+ enqueue/dequeue operations but does not necessarily depends on
+ mbufs and cryptodev operation mempools.
+
I have following diff which should be incorporated in this patch.
Qat.ini file should be updated in the 3/4 patch.
Release notes update is also missing for QAT.
diff --git a/doc/guides/cryptodevs/features/qat.ini b/doc/guides/cryptodevs/features/qat.ini
index 9e82f2886..6cc09cde7 100644
--- a/doc/guides/cryptodevs/features/qat.ini
+++ b/doc/guides/cryptodevs/features/qat.ini
@@ -17,6 +17,7 @@ Digest encrypted = Y
Asymmetric sessionless = Y
RSA PRIV OP KEY EXP = Y
RSA PRIV OP KEY QT = Y
-Sym raw data path API = Y
;
; Supported crypto algorithms of the 'qat' crypto driver.
diff --git a/doc/guides/prog_guide/cryptodev_lib.rst b/doc/guides/prog_guide/cryptodev_lib.rst
index 8ba800122..7fb3022bd 100644
--- a/doc/guides/prog_guide/cryptodev_lib.rst
+++ b/doc/guides/prog_guide/cryptodev_lib.rst
@@ -696,9 +696,9 @@ the status buffer provided by the user):
are stored. The crypto device will then start enqueuing all of them at
once.
-Calling ``rte_cryptodev_configure_raw_dp_context`` with the parameter
+Calling ``rte_cryptodev_configure_raw_dp_ctx`` with the parameter
``is_update`` set as 0 twice without the enqueue function returning status 1 or
-``rte_cryptodev_dp_enqueue_done`` function call in between will invalidate any
+``rte_cryptodev_raw_enqueue_done`` function call in between will invalidate any
descriptors stored in the device queue but not enqueued. This feature is useful
when the user wants to abandon partially enqueued data for a failed enqueue
burst operation and try enqueuing in a whole later.
diff --git a/lib/librte_cryptodev/rte_cryptodev.c b/lib/librte_cryptodev/rte_cryptodev.c
index 7a143c4b9..3d95ac6ea 100644
--- a/lib/librte_cryptodev/rte_cryptodev.c
+++ b/lib/librte_cryptodev/rte_cryptodev.c
@@ -1833,13 +1833,6 @@ rte_cryptodev_raw_enqueue_done(struct rte_crypto_raw_dp_ctx *ctx,
return (*ctx->enqueue_done)(ctx->qp_data, ctx->drv_ctx_data, n);
}
-int
-rte_cryptodev_raw_dequeue_done(struct rte_crypto_raw_dp_ctx *ctx,
- uint32_t n)
-{
- return (*ctx->dequeue_done)(ctx->qp_data, ctx->drv_ctx_data, n);
-}
-
uint32_t
rte_cryptodev_raw_dequeue_burst(struct rte_crypto_raw_dp_ctx *ctx,
rte_cryptodev_raw_get_dequeue_count_t get_dequeue_count,
@@ -1852,6 +1845,13 @@ rte_cryptodev_raw_dequeue_burst(struct rte_crypto_raw_dp_ctx *ctx,
is_user_data_array, n_success_jobs, status);
}
+int
+rte_cryptodev_raw_dequeue_done(struct rte_crypto_raw_dp_ctx *ctx,
+ uint32_t n)
+{
+ return (*ctx->dequeue_done)(ctx->qp_data, ctx->drv_ctx_data, n);
+}
+
/** Initialise rte_crypto_op mempool element */
static void
rte_crypto_op_init(struct rte_mempool *mempool,
diff --git a/lib/librte_cryptodev/rte_cryptodev.h b/lib/librte_cryptodev/rte_cryptodev.h
index 840a1c54c..79cfa46c8 100644
--- a/lib/librte_cryptodev/rte_cryptodev.h
+++ b/lib/librte_cryptodev/rte_cryptodev.h
@@ -459,7 +459,7 @@ rte_cryptodev_asym_get_xform_enum(enum rte_crypto_asym_xform_type *xform_enum,
#define RTE_CRYPTODEV_FF_NON_BYTE_ALIGNED_DATA (1ULL << 23)
/**< Support operations on data which is not byte aligned */
#define RTE_CRYPTODEV_FF_SYM_RAW_DP (1ULL << 24)
-/**< Support accelerated specific raw data-path APIs */
+/**< Support accelerator specific symmetric raw data-path APIs */
/**
* Get the name of a crypto device feature flag
@@ -1344,7 +1344,7 @@ union rte_cryptodev_session_ctx {
};
/**
- * Enqueue a data vector into device queue but the driver will not start
+ * Enqueue a data vector into device queue but the driver may or may not start
* processing until rte_cryptodev_raw_enqueue_done() is called.
*
* @param qp Driver specific queue pair data.
@@ -1357,7 +1357,7 @@ union rte_cryptodev_session_ctx {
* @return
* - The number of descriptors successfully enqueued.
* - Possible enqueue status written by the driver:
- * - 1: The descriptors are enqueued successfully.
+ * - positive integer: number of descriptors enqueued successfully.
* - 0: The descriptors are stored into device queue but are not processed
* until rte_cryptodev_raw_enqueue_done() is called.
* - negative integer: failure.
@@ -1451,7 +1451,7 @@ typedef void (*rte_cryptodev_raw_post_dequeue_t)(void *user_data,
* @return
* - The number of descriptors successfully dequeued.
* - Possible dequeue status written by the driver:
- * - 1: The descriptors are dequeued successfully.
+ * - positive integer: Number of descriptors dequeued successfully.
* - 0: The descriptors are fetched from queue pair but are not freed
* until rte_cryptodev_raw_dequeue_done() is called.
* - negative integer: Error occurred when dequeuing.
@@ -1475,8 +1475,8 @@ typedef uint32_t (*cryptodev_sym_raw_dequeue_burst_t)(void *qp,
* - The user data pointer retrieved from device queue or NULL if no
* descriptor is ready for dequeue.
* - Possible dequeue status written by the driver:
- * - 1: The descriptors are dequeued successfully.
- * - 0: The descriptors are fetched from queue pair but are not freed
+ * - 1: The descriptor is dequeued successfully.
+ * - 0: The descriptor is fetched from queue pair but is not freed
* until rte_cryptodev_raw_dequeue_done() is called.
* - negative integer: Error occurred when dequeuing.
*/
@@ -1487,7 +1487,7 @@ typedef void * (*cryptodev_sym_raw_dequeue_t)(
/**
* Context data for raw data-path API crypto process. The buffer of this
* structure is to be allocated by the user application with the size equal
- * or bigger than rte_cryptodev_raw_get_dp_context_size() returned value.
+ * or bigger than rte_cryptodev_get_raw_dp_ctx_size() returned value.
*
* NOTE: the buffer is to be used and maintained by the cryptodev driver, the
* user should NOT alter the buffer content to avoid application or system
@@ -1510,11 +1510,6 @@ struct rte_crypto_raw_dp_ctx {
/**
* Configure raw data-path context data.
*
- * NOTE:
- * After the context data is configured, the user should call
- * rte_cryptodev_raw_attach_session() before using it in
- * rte_cryptodev_raw_enqueue/dequeue function call.
- *
* @param dev_id The device identifier.
* @param qp_id The index of the queue pair from which to
* retrieve processed packets. The value must be
@@ -1596,7 +1591,7 @@ rte_cryptodev_raw_enqueue_burst(struct rte_crypto_raw_dp_ctx *ctx,
/**
* Start processing all enqueued descriptors from last
- * rte_cryptodev_raw_configure_dp_context() call.
+ * rte_cryptodev_configure_raw_dp_ctx() call.
*
* @param ctx The initialized raw data-path context data.
* @param n The total number of submitted descriptors.
@@ -1656,8 +1651,8 @@ rte_cryptodev_raw_dequeue_burst(struct rte_crypto_raw_dp_ctx *ctx,
* - The user data pointer retrieved from device queue or NULL if no
* descriptor is ready for dequeue.
* - Possible dequeue status written by the driver:
- * - 1: The descriptors are dequeued successfully.
- * - 0: The descriptors are fetched from queue pair but are not freed
+ * - 1: The descriptor is dequeued successfully.
+ * - 0: The descriptor is fetched from queue pair but is not freed
* until rte_cryptodev_raw_dequeue_done() is called.
* - negative integer: Error occurred when dequeuing.
*/
diff --git a/lib/librte_cryptodev/rte_cryptodev_pmd.h b/lib/librte_cryptodev/rte_cryptodev_pmd.h
index d6be69903..ea8694ca5 100644
--- a/lib/librte_cryptodev/rte_cryptodev_pmd.h
+++ b/lib/librte_cryptodev/rte_cryptodev_pmd.h
@@ -329,7 +329,7 @@ typedef uint32_t (*cryptodev_sym_cpu_crypto_process_t)
typedef int (*cryptodev_sym_get_raw_dp_ctx_size_t)(struct rte_cryptodev *dev);
/**
- * Typedef that the driver provided to configure data-path context.
+ * Typedef that the driver provided to configure raw data-path context.
*
* @param dev Crypto device pointer.
* @param qp_id Crypto device queue pair index.
@@ -392,10 +392,10 @@ struct rte_cryptodev_ops {
struct {
cryptodev_sym_get_raw_dp_ctx_size_t
sym_get_raw_dp_ctx_size;
- /**< Get data path service context data size. */
+ /**< Get raw data path context data size. */
cryptodev_sym_configure_raw_dp_ctx_t
sym_configure_raw_dp_ctx;
- /**< Initialize crypto service ctx data. */
+ /**< Configure raw data path ctx data. */
};
};
};
More information about the dev
mailing list