net/sfc: fix jumbo frame flag condition for MTU set
[dpdk.git] / lib / librte_cryptodev / rte_cryptodev.h
index 437b8a9..ae34f33 100644 (file)
@@ -23,6 +23,9 @@ extern "C" {
 #include "rte_dev.h"
 #include <rte_common.h>
 #include <rte_config.h>
+#include <rte_rcu_qsbr.h>
+
+#include "rte_cryptodev_trace_fp.h"
 
 extern const char **rte_cyptodev_names;
 
@@ -452,7 +455,12 @@ rte_cryptodev_asym_get_xform_enum(enum rte_crypto_asym_xform_type *xform_enum,
 /**< Support asymmetric session-less operations */
 #define        RTE_CRYPTODEV_FF_SYM_CPU_CRYPTO                 (1ULL << 21)
 /**< Support symmetric cpu-crypto processing */
-
+#define RTE_CRYPTODEV_FF_SYM_SESSIONLESS               (1ULL << 22)
+/**< Support symmetric session-less operations */
+#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 accelerator specific symmetric raw data-path APIs */
 
 /**
  * Get the name of a crypto device feature flag
@@ -515,6 +523,30 @@ struct rte_cryptodev_qp_conf {
        /**< The mempool for creating sess private data in sessionless mode */
 };
 
+/**
+ * Function type used for processing crypto ops when enqueue/dequeue burst is
+ * called.
+ *
+ * The callback function is called on enqueue/dequeue burst immediately.
+ *
+ * @param      dev_id          The identifier of the device.
+ * @param      qp_id           The index of the queue pair on which ops are
+ *                             enqueued/dequeued. The value must be in the
+ *                             range [0, nb_queue_pairs - 1] previously
+ *                             supplied to *rte_cryptodev_configure*.
+ * @param      ops             The address of an array of *nb_ops* pointers
+ *                             to *rte_crypto_op* structures which contain
+ *                             the crypto operations to be processed.
+ * @param      nb_ops          The number of operations to process.
+ * @param      user_param      The arbitrary user parameter passed in by the
+ *                             application when the callback was originally
+ *                             registered.
+ * @return                     The number of ops to be enqueued to the
+ *                             crypto device.
+ */
+typedef uint16_t (*rte_cryptodev_callback_fn)(uint16_t dev_id, uint16_t qp_id,
+               struct rte_crypto_op **ops, uint16_t nb_ops, void *user_param);
+
 /**
  * Typedef for application callback function to be registered by application
  * software for notification of device events
@@ -712,6 +744,23 @@ extern int
 rte_cryptodev_queue_pair_setup(uint8_t dev_id, uint16_t queue_pair_id,
                const struct rte_cryptodev_qp_conf *qp_conf, int socket_id);
 
+/**
+ * Get the status of queue pairs setup on a specific crypto device
+ *
+ * @param      dev_id          Crypto device identifier.
+ * @param      queue_pair_id   The index of the queue pairs to set up. The
+ *                             value must be in the range [0, nb_queue_pair
+ *                             - 1] previously supplied to
+ *                             rte_cryptodev_configure().
+ * @return
+ *   - 0: qp was not configured
+ *      - 1: qp was configured
+ *      - -EINVAL: device was not configured
+ */
+__rte_experimental
+int
+rte_cryptodev_get_qp_status(uint8_t dev_id, uint16_t queue_pair_id);
+
 /**
  * Get the number of queue pairs on a specific crypto device
  *
@@ -798,7 +847,6 @@ rte_cryptodev_callback_unregister(uint8_t dev_id,
                enum rte_cryptodev_event_type event,
                rte_cryptodev_cb_fn cb_fn, void *cb_arg);
 
-
 typedef uint16_t (*dequeue_pkt_burst_t)(void *qp,
                struct rte_crypto_op **ops,     uint16_t nb_ops);
 /**< Dequeue processed packets from queue pair of a device. */
@@ -815,6 +863,30 @@ struct rte_cryptodev_callback;
 /** Structure to keep track of registered callbacks */
 TAILQ_HEAD(rte_cryptodev_cb_list, rte_cryptodev_callback);
 
+/**
+ * Structure used to hold information about the callbacks to be called for a
+ * queue pair on enqueue/dequeue.
+ */
+struct rte_cryptodev_cb {
+       struct rte_cryptodev_cb *next;
+       /**< Pointer to next callback */
+       rte_cryptodev_callback_fn fn;
+       /**< Pointer to callback function */
+       void *arg;
+       /**< Pointer to argument */
+};
+
+/**
+ * @internal
+ * Structure used to hold information about the RCU for a queue pair.
+ */
+struct rte_cryptodev_cb_rcu {
+       struct rte_cryptodev_cb *next;
+       /**< Pointer to next callback */
+       struct rte_rcu_qsbr *qsbr;
+       /**< RCU QSBR variable per queue pair */
+};
+
 /** The data structure associated with each crypto device. */
 struct rte_cryptodev {
        dequeue_pkt_burst_t dequeue_burst;
@@ -843,6 +915,12 @@ struct rte_cryptodev {
        __extension__
        uint8_t attached : 1;
        /**< Flag indicating the device is attached */
+
+       struct rte_cryptodev_cb_rcu *enq_cbs;
+       /**< User application callback for pre enqueue processing */
+
+       struct rte_cryptodev_cb_rcu *deq_cbs;
+       /**< User application callback for post dequeue processing */
 } __rte_cache_aligned;
 
 void *
@@ -921,9 +999,33 @@ rte_cryptodev_dequeue_burst(uint8_t dev_id, uint16_t qp_id,
 {
        struct rte_cryptodev *dev = &rte_cryptodevs[dev_id];
 
+       rte_cryptodev_trace_dequeue_burst(dev_id, qp_id, (void **)ops, nb_ops);
        nb_ops = (*dev->dequeue_burst)
                        (dev->data->queue_pairs[qp_id], ops, nb_ops);
-
+#ifdef RTE_CRYPTO_CALLBACKS
+       if (unlikely(dev->deq_cbs != NULL)) {
+               struct rte_cryptodev_cb_rcu *list;
+               struct rte_cryptodev_cb *cb;
+
+               /* __ATOMIC_RELEASE memory order was used when the
+                * call back was inserted into the list.
+                * Since there is a clear dependency between loading
+                * cb and cb->fn/cb->next, __ATOMIC_ACQUIRE memory order is
+                * not required.
+                */
+               list = &dev->deq_cbs[qp_id];
+               rte_rcu_qsbr_thread_online(list->qsbr, 0);
+               cb = __atomic_load_n(&list->next, __ATOMIC_RELAXED);
+
+               while (cb != NULL) {
+                       nb_ops = cb->fn(dev_id, qp_id, ops, nb_ops,
+                                       cb->arg);
+                       cb = cb->next;
+               };
+
+               rte_rcu_qsbr_thread_offline(list->qsbr, 0);
+       }
+#endif
        return nb_ops;
 }
 
@@ -964,6 +1066,32 @@ rte_cryptodev_enqueue_burst(uint8_t dev_id, uint16_t qp_id,
 {
        struct rte_cryptodev *dev = &rte_cryptodevs[dev_id];
 
+#ifdef RTE_CRYPTO_CALLBACKS
+       if (unlikely(dev->enq_cbs != NULL)) {
+               struct rte_cryptodev_cb_rcu *list;
+               struct rte_cryptodev_cb *cb;
+
+               /* __ATOMIC_RELEASE memory order was used when the
+                * call back was inserted into the list.
+                * Since there is a clear dependency between loading
+                * cb and cb->fn/cb->next, __ATOMIC_ACQUIRE memory order is
+                * not required.
+                */
+               list = &dev->enq_cbs[qp_id];
+               rte_rcu_qsbr_thread_online(list->qsbr, 0);
+               cb = __atomic_load_n(&list->next, __ATOMIC_RELAXED);
+
+               while (cb != NULL) {
+                       nb_ops = cb->fn(dev_id, qp_id, ops, nb_ops,
+                                       cb->arg);
+                       cb = cb->next;
+               };
+
+               rte_rcu_qsbr_thread_offline(list->qsbr, 0);
+       }
+#endif
+
+       rte_cryptodev_trace_enqueue_burst(dev_id, qp_id, (void **)ops, nb_ops);
        return (*dev->enqueue_burst)(
                        dev->data->queue_pairs[qp_id], ops, nb_ops);
 }
@@ -1294,6 +1422,554 @@ rte_cryptodev_sym_cpu_crypto_process(uint8_t dev_id,
        struct rte_cryptodev_sym_session *sess, union rte_crypto_sym_ofs ofs,
        struct rte_crypto_sym_vec *vec);
 
+/**
+ * Get the size of the raw data-path context buffer.
+ *
+ * @param      dev_id          The device identifier.
+ *
+ * @return
+ *   - If the device supports raw data-path APIs, return the context size.
+ *   - If the device does not support the APIs, return -1.
+ */
+__rte_experimental
+int
+rte_cryptodev_get_raw_dp_ctx_size(uint8_t dev_id);
+
+/**
+ * Union of different crypto session types, including session-less xform
+ * pointer.
+ */
+union rte_cryptodev_session_ctx {
+       struct rte_cryptodev_sym_session *crypto_sess;
+       struct rte_crypto_sym_xform *xform;
+       struct rte_security_session *sec_sess;
+};
+
+/**
+ * Enqueue a vectorized operation descriptor into the 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.
+ * @param      drv_ctx         Driver specific context data.
+ * @param      vec             Vectorized operation descriptor.
+ * @param      ofs             Start and stop offsets for auth and cipher
+ *                             operations.
+ * @param      user_data       The array of user data for dequeue later.
+ * @param      enqueue_status  Driver written value to specify the
+ *                             enqueue status. Possible values:
+ *                             - 1: The number of operations returned are
+ *                                  enqueued successfully.
+ *                             - 0: The number of operations returned are
+ *                                  cached into the queue but are not processed
+ *                                  until rte_cryptodev_raw_enqueue_done() is
+ *                                  called.
+ *                             - negative integer: Error occurred.
+ * @return
+ *   - The number of operations in the descriptor successfully enqueued or
+ *     cached into the queue but not enqueued yet, depends on the
+ *     "enqueue_status" value.
+ */
+typedef uint32_t (*cryptodev_sym_raw_enqueue_burst_t)(
+       void *qp, uint8_t *drv_ctx, struct rte_crypto_sym_vec *vec,
+       union rte_crypto_sym_ofs ofs, void *user_data[], int *enqueue_status);
+
+/**
+ * Enqueue single raw data vector into the 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.
+ * @param      drv_ctx         Driver specific context data.
+ * @param      data_vec        The buffer data vector.
+ * @param      n_data_vecs     Number of buffer data vectors.
+ * @param      ofs             Start and stop offsets for auth and cipher
+ *                             operations.
+ * @param      iv              IV virtual and IOVA addresses
+ * @param      digest          digest virtual and IOVA addresses
+ * @param      aad_or_auth_iv  AAD or auth IV virtual and IOVA addresses,
+ *                             depends on the algorithm used.
+ * @param      user_data       The user data.
+ * @return
+ *   - 1: The data vector is enqueued successfully.
+ *   - 0: The data vector is cached into the queue but is not processed
+ *        until rte_cryptodev_raw_enqueue_done() is called.
+ *   - negative integer: failure.
+ */
+typedef int (*cryptodev_sym_raw_enqueue_t)(
+       void *qp, uint8_t *drv_ctx, struct rte_crypto_vec *data_vec,
+       uint16_t n_data_vecs, union rte_crypto_sym_ofs ofs,
+       struct rte_crypto_va_iova_ptr *iv,
+       struct rte_crypto_va_iova_ptr *digest,
+       struct rte_crypto_va_iova_ptr *aad_or_auth_iv,
+       void *user_data);
+
+/**
+ * Inform the cryptodev queue pair to start processing or finish dequeuing all
+ * enqueued/dequeued operations.
+ *
+ * @param      qp              Driver specific queue pair data.
+ * @param      drv_ctx         Driver specific context data.
+ * @param      n               The total number of processed operations.
+ * @return
+ *   - On success return 0.
+ *   - On failure return negative integer.
+ */
+typedef int (*cryptodev_sym_raw_operation_done_t)(void *qp, uint8_t *drv_ctx,
+       uint32_t n);
+
+/**
+ * Typedef that the user provided for the driver to get the dequeue count.
+ * The function may return a fixed number or the number parsed from the user
+ * data stored in the first processed operation.
+ *
+ * @param      user_data       Dequeued user data.
+ * @return
+ *  - The number of operations to be dequeued.
+ **/
+typedef uint32_t (*rte_cryptodev_raw_get_dequeue_count_t)(void *user_data);
+
+/**
+ * Typedef that the user provided to deal with post dequeue operation, such
+ * as filling status.
+ *
+ * @param      user_data       Dequeued user data.
+ * @param      index           Index number of the processed descriptor.
+ * @param      is_op_success   Operation status provided by the driver.
+ **/
+typedef void (*rte_cryptodev_raw_post_dequeue_t)(void *user_data,
+       uint32_t index, uint8_t is_op_success);
+
+/**
+ * Dequeue a burst of symmetric crypto processing.
+ *
+ * @param      qp                      Driver specific queue pair data.
+ * @param      drv_ctx                 Driver specific context data.
+ * @param      get_dequeue_count       User provided callback function to
+ *                                     obtain dequeue operation count.
+ * @param      post_dequeue            User provided callback function to
+ *                                     post-process a dequeued operation.
+ * @param      out_user_data           User data pointer array to be retrieve
+ *                                     from device queue. In case of
+ *                                     *is_user_data_array* is set there
+ *                                     should be enough room to store all
+ *                                     user data.
+ * @param      is_user_data_array      Set 1 if every dequeued user data will
+ *                                     be written into out_user_data array.
+ *                                     Set 0 if only the first user data will
+ *                                     be written into out_user_data array.
+ * @param      n_success               Driver written value to specific the
+ *                                     total successful operations count.
+ * @param      dequeue_status          Driver written value to specify the
+ *                                     dequeue status. Possible values:
+ *                                     - 1: Successfully dequeued the number
+ *                                          of operations returned. The user
+ *                                          data previously set during enqueue
+ *                                          is stored in the "out_user_data".
+ *                                     - 0: The number of operations returned
+ *                                          are completed and the user data is
+ *                                          stored in the "out_user_data", but
+ *                                          they are not freed from the queue
+ *                                          until
+ *                                          rte_cryptodev_raw_dequeue_done()
+ *                                          is called.
+ *                                     - negative integer: Error occurred.
+ * @return
+ *   - The number of operations dequeued or completed but not freed from the
+ *     queue, depends on "dequeue_status" value.
+ */
+typedef uint32_t (*cryptodev_sym_raw_dequeue_burst_t)(void *qp,
+       uint8_t *drv_ctx,
+       rte_cryptodev_raw_get_dequeue_count_t get_dequeue_count,
+       rte_cryptodev_raw_post_dequeue_t post_dequeue,
+       void **out_user_data, uint8_t is_user_data_array,
+       uint32_t *n_success, int *dequeue_status);
+
+/**
+ * Dequeue a symmetric crypto processing.
+ *
+ * @param      qp                      Driver specific queue pair data.
+ * @param      drv_ctx                 Driver specific context data.
+ * @param      dequeue_status          Driver written value to specify the
+ *                                     dequeue status. Possible values:
+ *                                     - 1: Successfully dequeued a operation.
+ *                                          The user data is returned.
+ *                                     - 0: The first operation in the queue
+ *                                          is completed and the user data
+ *                                          previously set during enqueue is
+ *                                          returned, but it is not freed from
+ *                                          the queue until
+ *                                          rte_cryptodev_raw_dequeue_done() is
+ *                                          called.
+ *                                     - negative integer: Error occurred.
+ * @param      op_status               Driver written value to specify
+ *                                     operation status.
+ * @return
+ *   - The user data pointer retrieved from device queue or NULL if no
+ *     operation is ready for dequeue.
+ */
+typedef void * (*cryptodev_sym_raw_dequeue_t)(
+               void *qp, uint8_t *drv_ctx, int *dequeue_status,
+               enum rte_crypto_op_status *op_status);
+
+/**
+ * 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_get_raw_dp_ctx_size() returned value.
+ */
+struct rte_crypto_raw_dp_ctx {
+       void *qp_data;
+
+       cryptodev_sym_raw_enqueue_t enqueue;
+       cryptodev_sym_raw_enqueue_burst_t enqueue_burst;
+       cryptodev_sym_raw_operation_done_t enqueue_done;
+       cryptodev_sym_raw_dequeue_t dequeue;
+       cryptodev_sym_raw_dequeue_burst_t dequeue_burst;
+       cryptodev_sym_raw_operation_done_t dequeue_done;
+
+       /* Driver specific context data */
+       __extension__ uint8_t drv_ctx_data[];
+};
+
+/**
+ * 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
+ *                             in the range [0, nb_queue_pair - 1] previously
+ *                             supplied to rte_cryptodev_configure().
+ * @param      ctx             The raw data-path context data.
+ * @param      sess_type       session type.
+ * @param      session_ctx     Session context data.
+ * @param      is_update       Set 0 if it is to initialize the ctx.
+ *                             Set 1 if ctx is initialized and only to update
+ *                             session context data.
+ * @return
+ *   - On success return 0.
+ *   - On failure return negative integer.
+ */
+__rte_experimental
+int
+rte_cryptodev_configure_raw_dp_ctx(uint8_t dev_id, uint16_t qp_id,
+       struct rte_crypto_raw_dp_ctx *ctx,
+       enum rte_crypto_op_sess_type sess_type,
+       union rte_cryptodev_session_ctx session_ctx,
+       uint8_t is_update);
+
+/**
+ * Enqueue a vectorized operation descriptor into the device queue but the
+ * driver may or may not start processing until rte_cryptodev_raw_enqueue_done()
+ * is called.
+ *
+ * @param      ctx             The initialized raw data-path context data.
+ * @param      vec             Vectorized operation descriptor.
+ * @param      ofs             Start and stop offsets for auth and cipher
+ *                             operations.
+ * @param      user_data       The array of user data for dequeue later.
+ * @param      enqueue_status  Driver written value to specify the
+ *                             enqueue status. Possible values:
+ *                             - 1: The number of operations returned are
+ *                                  enqueued successfully.
+ *                             - 0: The number of operations returned are
+ *                                  cached into the queue but are not processed
+ *                                  until rte_cryptodev_raw_enqueue_done() is
+ *                                  called.
+ *                             - negative integer: Error occurred.
+ * @return
+ *   - The number of operations in the descriptor successfully enqueued or
+ *     cached into the queue but not enqueued yet, depends on the
+ *     "enqueue_status" value.
+ */
+__rte_experimental
+uint32_t
+rte_cryptodev_raw_enqueue_burst(struct rte_crypto_raw_dp_ctx *ctx,
+       struct rte_crypto_sym_vec *vec, union rte_crypto_sym_ofs ofs,
+       void **user_data, int *enqueue_status);
+
+/**
+ * Enqueue single raw data vector into the device queue but the driver may or
+ * may not start processing until rte_cryptodev_raw_enqueue_done() is called.
+ *
+ * @param      ctx             The initialized raw data-path context data.
+ * @param      data_vec        The buffer data vector.
+ * @param      n_data_vecs     Number of buffer data vectors.
+ * @param      ofs             Start and stop offsets for auth and cipher
+ *                             operations.
+ * @param      iv              IV virtual and IOVA addresses
+ * @param      digest          digest virtual and IOVA addresses
+ * @param      aad_or_auth_iv  AAD or auth IV virtual and IOVA addresses,
+ *                             depends on the algorithm used.
+ * @param      user_data       The user data.
+ * @return
+ *   - 1: The data vector is enqueued successfully.
+ *   - 0: The data vector is cached into the queue but is not processed
+ *        until rte_cryptodev_raw_enqueue_done() is called.
+ *   - negative integer: failure.
+ */
+__rte_experimental
+static __rte_always_inline int
+rte_cryptodev_raw_enqueue(struct rte_crypto_raw_dp_ctx *ctx,
+       struct rte_crypto_vec *data_vec, uint16_t n_data_vecs,
+       union rte_crypto_sym_ofs ofs,
+       struct rte_crypto_va_iova_ptr *iv,
+       struct rte_crypto_va_iova_ptr *digest,
+       struct rte_crypto_va_iova_ptr *aad_or_auth_iv,
+       void *user_data)
+{
+       return (*ctx->enqueue)(ctx->qp_data, ctx->drv_ctx_data, data_vec,
+               n_data_vecs, ofs, iv, digest, aad_or_auth_iv, user_data);
+}
+
+/**
+ * Start processing all enqueued operations from last
+ * rte_cryptodev_configure_raw_dp_ctx() call.
+ *
+ * @param      ctx     The initialized raw data-path context data.
+ * @param      n       The number of operations cached.
+ * @return
+ *   - On success return 0.
+ *   - On failure return negative integer.
+ */
+__rte_experimental
+int
+rte_cryptodev_raw_enqueue_done(struct rte_crypto_raw_dp_ctx *ctx,
+               uint32_t n);
+
+/**
+ * Dequeue a burst of symmetric crypto processing.
+ *
+ * @param      ctx                     The initialized raw data-path context
+ *                                     data.
+ * @param      get_dequeue_count       User provided callback function to
+ *                                     obtain dequeue operation count.
+ * @param      post_dequeue            User provided callback function to
+ *                                     post-process a dequeued operation.
+ * @param      out_user_data           User data pointer array to be retrieve
+ *                                     from device queue. In case of
+ *                                     *is_user_data_array* is set there
+ *                                     should be enough room to store all
+ *                                     user data.
+ * @param      is_user_data_array      Set 1 if every dequeued user data will
+ *                                     be written into out_user_data array.
+ *                                     Set 0 if only the first user data will
+ *                                     be written into out_user_data array.
+ * @param      n_success               Driver written value to specific the
+ *                                     total successful operations count.
+ * @param      dequeue_status          Driver written value to specify the
+ *                                     dequeue status. Possible values:
+ *                                     - 1: Successfully dequeued the number
+ *                                          of operations returned. The user
+ *                                          data previously set during enqueue
+ *                                          is stored in the "out_user_data".
+ *                                     - 0: The number of operations returned
+ *                                          are completed and the user data is
+ *                                          stored in the "out_user_data", but
+ *                                          they are not freed from the queue
+ *                                          until
+ *                                          rte_cryptodev_raw_dequeue_done()
+ *                                          is called.
+ *                                     - negative integer: Error occurred.
+ * @return
+ *   - The number of operations dequeued or completed but not freed from the
+ *     queue, depends on "dequeue_status" value.
+ */
+__rte_experimental
+uint32_t
+rte_cryptodev_raw_dequeue_burst(struct rte_crypto_raw_dp_ctx *ctx,
+       rte_cryptodev_raw_get_dequeue_count_t get_dequeue_count,
+       rte_cryptodev_raw_post_dequeue_t post_dequeue,
+       void **out_user_data, uint8_t is_user_data_array,
+       uint32_t *n_success, int *dequeue_status);
+
+/**
+ * Dequeue a symmetric crypto processing.
+ *
+ * @param      ctx                     The initialized raw data-path context
+ *                                     data.
+ * @param      dequeue_status          Driver written value to specify the
+ *                                     dequeue status. Possible values:
+ *                                     - 1: Successfully dequeued a operation.
+ *                                          The user data is returned.
+ *                                     - 0: The first operation in the queue
+ *                                          is completed and the user data
+ *                                          previously set during enqueue is
+ *                                          returned, but it is not freed from
+ *                                          the queue until
+ *                                          rte_cryptodev_raw_dequeue_done() is
+ *                                          called.
+ *                                     - negative integer: Error occurred.
+ * @param      op_status               Driver written value to specify
+ *                                     operation status.
+ * @return
+ *   - The user data pointer retrieved from device queue or NULL if no
+ *     operation is ready for dequeue.
+ */
+__rte_experimental
+static __rte_always_inline void *
+rte_cryptodev_raw_dequeue(struct rte_crypto_raw_dp_ctx *ctx,
+               int *dequeue_status, enum rte_crypto_op_status *op_status)
+{
+       return (*ctx->dequeue)(ctx->qp_data, ctx->drv_ctx_data, dequeue_status,
+                       op_status);
+}
+
+/**
+ * Inform the queue pair dequeue operations is finished.
+ *
+ * @param      ctx     The initialized raw data-path context data.
+ * @param      n       The number of operations.
+ * @return
+ *   - On success return 0.
+ *   - On failure return negative integer.
+ */
+__rte_experimental
+int
+rte_cryptodev_raw_dequeue_done(struct rte_crypto_raw_dp_ctx *ctx,
+               uint32_t n);
+
+/**
+ * Add a user callback for a given crypto device and queue pair which will be
+ * called on crypto ops enqueue.
+ *
+ * This API configures a function to be called for each burst of crypto ops
+ * received on a given crypto device queue pair. The return value is a pointer
+ * that can be used later to remove the callback using
+ * rte_cryptodev_remove_enq_callback().
+ *
+ * Callbacks registered by application would not survive
+ * rte_cryptodev_configure() as it reinitializes the callback list.
+ * It is user responsibility to remove all installed callbacks before
+ * calling rte_cryptodev_configure() to avoid possible memory leakage.
+ * Application is expected to call add API after rte_cryptodev_configure().
+ *
+ * Multiple functions can be registered per queue pair & they are called
+ * in the order they were added. The API does not restrict on maximum number
+ * of callbacks.
+ *
+ * @param      dev_id          The identifier of the device.
+ * @param      qp_id           The index of the queue pair on which ops are
+ *                             to be enqueued for processing. The value
+ *                             must be in the range [0, nb_queue_pairs - 1]
+ *                             previously supplied to
+ *                             *rte_cryptodev_configure*.
+ * @param      cb_fn           The callback function
+ * @param      cb_arg          A generic pointer parameter which will be passed
+ *                             to each invocation of the callback function on
+ *                             this crypto device and queue pair.
+ *
+ * @return
+ *  - NULL on error & rte_errno will contain the error code.
+ *  - On success, a pointer value which can later be used to remove the
+ *    callback.
+ */
+
+__rte_experimental
+struct rte_cryptodev_cb *
+rte_cryptodev_add_enq_callback(uint8_t dev_id,
+                              uint16_t qp_id,
+                              rte_cryptodev_callback_fn cb_fn,
+                              void *cb_arg);
+
+/**
+ * Remove a user callback function for given crypto device and queue pair.
+ *
+ * This function is used to remove enqueue callbacks that were added to a
+ * crypto device queue pair using rte_cryptodev_add_enq_callback().
+ *
+ *
+ *
+ * @param      dev_id          The identifier of the device.
+ * @param      qp_id           The index of the queue pair on which ops are
+ *                             to be enqueued. The value must be in the
+ *                             range [0, nb_queue_pairs - 1] previously
+ *                             supplied to *rte_cryptodev_configure*.
+ * @param      cb              Pointer to user supplied callback created via
+ *                             rte_cryptodev_add_enq_callback().
+ *
+ * @return
+ *   -  0: Success. Callback was removed.
+ *   - <0: The dev_id or the qp_id is out of range, or the callback
+ *         is NULL or not found for the crypto device queue pair.
+ */
+
+__rte_experimental
+int rte_cryptodev_remove_enq_callback(uint8_t dev_id,
+                                     uint16_t qp_id,
+                                     struct rte_cryptodev_cb *cb);
+
+/**
+ * Add a user callback for a given crypto device and queue pair which will be
+ * called on crypto ops dequeue.
+ *
+ * This API configures a function to be called for each burst of crypto ops
+ * received on a given crypto device queue pair. The return value is a pointer
+ * that can be used later to remove the callback using
+ * rte_cryptodev_remove_deq_callback().
+ *
+ * Callbacks registered by application would not survive
+ * rte_cryptodev_configure() as it reinitializes the callback list.
+ * It is user responsibility to remove all installed callbacks before
+ * calling rte_cryptodev_configure() to avoid possible memory leakage.
+ * Application is expected to call add API after rte_cryptodev_configure().
+ *
+ * Multiple functions can be registered per queue pair & they are called
+ * in the order they were added. The API does not restrict on maximum number
+ * of callbacks.
+ *
+ * @param      dev_id          The identifier of the device.
+ * @param      qp_id           The index of the queue pair on which ops are
+ *                             to be dequeued. The value must be in the
+ *                             range [0, nb_queue_pairs - 1] previously
+ *                             supplied to *rte_cryptodev_configure*.
+ * @param      cb_fn           The callback function
+ * @param      cb_arg          A generic pointer parameter which will be passed
+ *                             to each invocation of the callback function on
+ *                             this crypto device and queue pair.
+ *
+ * @return
+ *   - NULL on error & rte_errno will contain the error code.
+ *   - On success, a pointer value which can later be used to remove the
+ *     callback.
+ */
+
+__rte_experimental
+struct rte_cryptodev_cb *
+rte_cryptodev_add_deq_callback(uint8_t dev_id,
+                              uint16_t qp_id,
+                              rte_cryptodev_callback_fn cb_fn,
+                              void *cb_arg);
+
+/**
+ * Remove a user callback function for given crypto device and queue pair.
+ *
+ * This function is used to remove dequeue callbacks that were added to a
+ * crypto device queue pair using rte_cryptodev_add_deq_callback().
+ *
+ *
+ *
+ * @param      dev_id          The identifier of the device.
+ * @param      qp_id           The index of the queue pair on which ops are
+ *                             to be dequeued. The value must be in the
+ *                             range [0, nb_queue_pairs - 1] previously
+ *                             supplied to *rte_cryptodev_configure*.
+ * @param      cb              Pointer to user supplied callback created via
+ *                             rte_cryptodev_add_deq_callback().
+ *
+ * @return
+ *   -  0: Success. Callback was removed.
+ *   - <0: The dev_id or the qp_id is out of range, or the callback
+ *         is NULL or not found for the crypto device queue pair.
+ */
+__rte_experimental
+int rte_cryptodev_remove_deq_callback(uint8_t dev_id,
+                                     uint16_t qp_id,
+                                     struct rte_cryptodev_cb *cb);
+
 #ifdef __cplusplus
 }
 #endif