cryptodev: add enqueue and dequeue callbacks
[dpdk.git] / lib / librte_cryptodev / rte_cryptodev.c
index 2ce606a..40f55a3 100644 (file)
@@ -57,7 +57,6 @@ static struct rte_cryptodev_global cryptodev_globals = {
 /* spinlock for crypto device callbacks */
 static rte_spinlock_t rte_cryptodev_cb_lock = RTE_SPINLOCK_INITIALIZER;
 
-
 /**
  * The user application callback description.
  *
@@ -313,7 +312,6 @@ rte_cryptodev_sym_capability_get(uint8_t dev_id,
        }
 
        return NULL;
-
 }
 
 static int
@@ -450,6 +448,122 @@ rte_cryptodev_asym_xform_capability_check_modlen(
        return 0;
 }
 
+/* spinlock for crypto device enq callbacks */
+static rte_spinlock_t rte_cryptodev_callback_lock = RTE_SPINLOCK_INITIALIZER;
+
+static void
+cryptodev_cb_cleanup(struct rte_cryptodev *dev)
+{
+       struct rte_cryptodev_cb_rcu *list;
+       struct rte_cryptodev_cb *cb, *next;
+       uint16_t qp_id;
+
+       if (dev->enq_cbs == NULL && dev->deq_cbs == NULL)
+               return;
+
+       for (qp_id = 0; qp_id < dev->data->nb_queue_pairs; qp_id++) {
+               list = &dev->enq_cbs[qp_id];
+               cb = list->next;
+               while (cb != NULL) {
+                       next = cb->next;
+                       rte_free(cb);
+                       cb = next;
+               }
+
+               rte_free(list->qsbr);
+       }
+
+       for (qp_id = 0; qp_id < dev->data->nb_queue_pairs; qp_id++) {
+               list = &dev->deq_cbs[qp_id];
+               cb = list->next;
+               while (cb != NULL) {
+                       next = cb->next;
+                       rte_free(cb);
+                       cb = next;
+               }
+
+               rte_free(list->qsbr);
+       }
+
+       rte_free(dev->enq_cbs);
+       dev->enq_cbs = NULL;
+       rte_free(dev->deq_cbs);
+       dev->deq_cbs = NULL;
+}
+
+static int
+cryptodev_cb_init(struct rte_cryptodev *dev)
+{
+       struct rte_cryptodev_cb_rcu *list;
+       struct rte_rcu_qsbr *qsbr;
+       uint16_t qp_id;
+       size_t size;
+
+       /* Max thread set to 1, as one DP thread accessing a queue-pair */
+       const uint32_t max_threads = 1;
+
+       dev->enq_cbs = rte_zmalloc(NULL,
+                                  sizeof(struct rte_cryptodev_cb_rcu) *
+                                  dev->data->nb_queue_pairs, 0);
+       if (dev->enq_cbs == NULL) {
+               CDEV_LOG_ERR("Failed to allocate memory for enq callbacks");
+               return -ENOMEM;
+       }
+
+       dev->deq_cbs = rte_zmalloc(NULL,
+                                  sizeof(struct rte_cryptodev_cb_rcu) *
+                                  dev->data->nb_queue_pairs, 0);
+       if (dev->deq_cbs == NULL) {
+               CDEV_LOG_ERR("Failed to allocate memory for deq callbacks");
+               rte_free(dev->enq_cbs);
+               return -ENOMEM;
+       }
+
+       /* Create RCU QSBR variable */
+       size = rte_rcu_qsbr_get_memsize(max_threads);
+
+       for (qp_id = 0; qp_id < dev->data->nb_queue_pairs; qp_id++) {
+               list = &dev->enq_cbs[qp_id];
+               qsbr = rte_zmalloc(NULL, size, RTE_CACHE_LINE_SIZE);
+               if (qsbr == NULL) {
+                       CDEV_LOG_ERR("Failed to allocate memory for RCU on "
+                               "queue_pair_id=%d", qp_id);
+                       goto cb_init_err;
+               }
+
+               if (rte_rcu_qsbr_init(qsbr, max_threads)) {
+                       CDEV_LOG_ERR("Failed to initialize for RCU on "
+                               "queue_pair_id=%d", qp_id);
+                       goto cb_init_err;
+               }
+
+               list->qsbr = qsbr;
+       }
+
+       for (qp_id = 0; qp_id < dev->data->nb_queue_pairs; qp_id++) {
+               list = &dev->deq_cbs[qp_id];
+               qsbr = rte_zmalloc(NULL, size, RTE_CACHE_LINE_SIZE);
+               if (qsbr == NULL) {
+                       CDEV_LOG_ERR("Failed to allocate memory for RCU on "
+                               "queue_pair_id=%d", qp_id);
+                       goto cb_init_err;
+               }
+
+               if (rte_rcu_qsbr_init(qsbr, max_threads)) {
+                       CDEV_LOG_ERR("Failed to initialize for RCU on "
+                               "queue_pair_id=%d", qp_id);
+                       goto cb_init_err;
+               }
+
+               list->qsbr = qsbr;
+       }
+
+       return 0;
+
+cb_init_err:
+       cryptodev_cb_cleanup(dev);
+       return -ENOMEM;
+}
 
 const char *
 rte_cryptodev_get_feature_name(uint64_t flag)
@@ -668,8 +782,13 @@ rte_cryptodev_data_alloc(uint8_t dev_id, struct rte_cryptodev_data **data,
                mz = rte_memzone_reserve(mz_name,
                                sizeof(struct rte_cryptodev_data),
                                socket_id, 0);
-       } else
+               CDEV_LOG_DEBUG("PRIMARY:reserved memzone for %s (%p)",
+                               mz_name, mz);
+       } else {
                mz = rte_memzone_lookup(mz_name);
+               CDEV_LOG_DEBUG("SECONDARY:looked up memzone for %s (%p)",
+                               mz_name, mz);
+       }
 
        if (mz == NULL)
                return -ENOMEM;
@@ -700,8 +819,14 @@ rte_cryptodev_data_free(uint8_t dev_id, struct rte_cryptodev_data **data)
        RTE_ASSERT(*data == mz->addr);
        *data = NULL;
 
-       if (rte_eal_process_type() == RTE_PROC_PRIMARY)
+       if (rte_eal_process_type() == RTE_PROC_PRIMARY) {
+               CDEV_LOG_DEBUG("PRIMARY:free memzone of %s (%p)",
+                               mz_name, mz);
                return rte_memzone_free(mz);
+       } else {
+               CDEV_LOG_DEBUG("SECONDARY:don't free memzone of %s (%p)",
+                               mz_name, mz);
+       }
 
        return 0;
 }
@@ -758,8 +883,15 @@ rte_cryptodev_pmd_allocate(const char *name, int socket_id)
                        cryptodev->data->dev_id = dev_id;
                        cryptodev->data->socket_id = socket_id;
                        cryptodev->data->dev_started = 0;
+                       CDEV_LOG_DEBUG("PRIMARY:init data");
                }
 
+               CDEV_LOG_DEBUG("Data for %s: dev_id %d, socket %d, started %d",
+                               cryptodev->data->name,
+                               cryptodev->data->dev_id,
+                               cryptodev->data->socket_id,
+                               cryptodev->data->dev_started);
+
                /* init user callbacks */
                TAILQ_INIT(&(cryptodev->link_intr_cbs));
 
@@ -911,6 +1043,10 @@ rte_cryptodev_configure(uint8_t dev_id, struct rte_cryptodev_config *config)
 
        RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_configure, -ENOTSUP);
 
+       rte_spinlock_lock(&rte_cryptodev_callback_lock);
+       cryptodev_cb_cleanup(dev);
+       rte_spinlock_unlock(&rte_cryptodev_callback_lock);
+
        /* Setup new number of queue pairs and reconfigure device. */
        diag = rte_cryptodev_queue_pairs_config(dev, config->nb_queue_pairs,
                        config->socket_id);
@@ -920,11 +1056,18 @@ rte_cryptodev_configure(uint8_t dev_id, struct rte_cryptodev_config *config)
                return diag;
        }
 
+       rte_spinlock_lock(&rte_cryptodev_callback_lock);
+       diag = cryptodev_cb_init(dev);
+       rte_spinlock_unlock(&rte_cryptodev_callback_lock);
+       if (diag) {
+               CDEV_LOG_ERR("Callback init failed for dev_id=%d", dev_id);
+               return diag;
+       }
+
        rte_cryptodev_trace_configure(dev_id, config);
        return (*dev->dev_ops->dev_configure)(dev, config);
 }
 
-
 int
 rte_cryptodev_start(uint8_t dev_id)
 {
@@ -1024,6 +1167,35 @@ rte_cryptodev_close(uint8_t dev_id)
        return 0;
 }
 
+int
+rte_cryptodev_get_qp_status(uint8_t dev_id, uint16_t queue_pair_id)
+{
+       struct rte_cryptodev *dev;
+
+       if (!rte_cryptodev_pmd_is_valid_dev(dev_id)) {
+               CDEV_LOG_ERR("Invalid dev_id=%" PRIu8, dev_id);
+               return -EINVAL;
+       }
+
+       dev = &rte_crypto_devices[dev_id];
+       if (queue_pair_id >= dev->data->nb_queue_pairs) {
+               CDEV_LOG_ERR("Invalid queue_pair_id=%d", queue_pair_id);
+               return -EINVAL;
+       }
+       void **qps = dev->data->queue_pairs;
+
+       if (qps[queue_pair_id]) {
+               CDEV_LOG_DEBUG("qp %d on dev %d is initialised",
+                       queue_pair_id, dev_id);
+               return 1;
+       }
+
+       CDEV_LOG_DEBUG("qp %d on dev %d is not initialised",
+               queue_pair_id, dev_id);
+
+       return 0;
+}
+
 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)
@@ -1091,6 +1263,275 @@ rte_cryptodev_queue_pair_setup(uint8_t dev_id, uint16_t queue_pair_id,
                        socket_id);
 }
 
+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)
+{
+       struct rte_cryptodev *dev;
+       struct rte_cryptodev_cb_rcu *list;
+       struct rte_cryptodev_cb *cb, *tail;
+
+       if (!cb_fn) {
+               CDEV_LOG_ERR("Callback is NULL on dev_id=%d", dev_id);
+               rte_errno = EINVAL;
+               return NULL;
+       }
+
+       if (!rte_cryptodev_pmd_is_valid_dev(dev_id)) {
+               CDEV_LOG_ERR("Invalid dev_id=%d", dev_id);
+               rte_errno = ENODEV;
+               return NULL;
+       }
+
+       dev = &rte_crypto_devices[dev_id];
+       if (qp_id >= dev->data->nb_queue_pairs) {
+               CDEV_LOG_ERR("Invalid queue_pair_id=%d", qp_id);
+               rte_errno = ENODEV;
+               return NULL;
+       }
+
+       cb = rte_zmalloc(NULL, sizeof(*cb), 0);
+       if (cb == NULL) {
+               CDEV_LOG_ERR("Failed to allocate memory for callback on "
+                            "dev=%d, queue_pair_id=%d", dev_id, qp_id);
+               rte_errno = ENOMEM;
+               return NULL;
+       }
+
+       rte_spinlock_lock(&rte_cryptodev_callback_lock);
+
+       cb->fn = cb_fn;
+       cb->arg = cb_arg;
+
+       /* Add the callbacks in fifo order. */
+       list = &dev->enq_cbs[qp_id];
+       tail = list->next;
+
+       if (tail) {
+               while (tail->next)
+                       tail = tail->next;
+               /* Stores to cb->fn and cb->param should complete before
+                * cb is visible to data plane.
+                */
+               __atomic_store_n(&tail->next, cb, __ATOMIC_RELEASE);
+       } else {
+               /* Stores to cb->fn and cb->param should complete before
+                * cb is visible to data plane.
+                */
+               __atomic_store_n(&list->next, cb, __ATOMIC_RELEASE);
+       }
+
+       rte_spinlock_unlock(&rte_cryptodev_callback_lock);
+
+       return cb;
+}
+
+int
+rte_cryptodev_remove_enq_callback(uint8_t dev_id,
+                                 uint16_t qp_id,
+                                 struct rte_cryptodev_cb *cb)
+{
+       struct rte_cryptodev *dev;
+       struct rte_cryptodev_cb **prev_cb, *curr_cb;
+       struct rte_cryptodev_cb_rcu *list;
+       int ret;
+
+       ret = -EINVAL;
+
+       if (!cb) {
+               CDEV_LOG_ERR("Callback is NULL");
+               return -EINVAL;
+       }
+
+       if (!rte_cryptodev_pmd_is_valid_dev(dev_id)) {
+               CDEV_LOG_ERR("Invalid dev_id=%d", dev_id);
+               return -ENODEV;
+       }
+
+       dev = &rte_crypto_devices[dev_id];
+       if (qp_id >= dev->data->nb_queue_pairs) {
+               CDEV_LOG_ERR("Invalid queue_pair_id=%d", qp_id);
+               return -ENODEV;
+       }
+
+       rte_spinlock_lock(&rte_cryptodev_callback_lock);
+       if (dev->enq_cbs == NULL) {
+               CDEV_LOG_ERR("Callback not initialized");
+               goto cb_err;
+       }
+
+       list = &dev->enq_cbs[qp_id];
+       if (list == NULL) {
+               CDEV_LOG_ERR("Callback list is NULL");
+               goto cb_err;
+       }
+
+       if (list->qsbr == NULL) {
+               CDEV_LOG_ERR("Rcu qsbr is NULL");
+               goto cb_err;
+       }
+
+       prev_cb = &list->next;
+       for (; *prev_cb != NULL; prev_cb = &curr_cb->next) {
+               curr_cb = *prev_cb;
+               if (curr_cb == cb) {
+                       /* Remove the user cb from the callback list. */
+                       __atomic_store_n(prev_cb, curr_cb->next,
+                               __ATOMIC_RELAXED);
+                       ret = 0;
+                       break;
+               }
+       }
+
+       if (!ret) {
+               /* Call sync with invalid thread id as this is part of
+                * control plane API
+                */
+               rte_rcu_qsbr_synchronize(list->qsbr, RTE_QSBR_THRID_INVALID);
+               rte_free(cb);
+       }
+
+cb_err:
+       rte_spinlock_unlock(&rte_cryptodev_callback_lock);
+       return ret;
+}
+
+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)
+{
+       struct rte_cryptodev *dev;
+       struct rte_cryptodev_cb_rcu *list;
+       struct rte_cryptodev_cb *cb, *tail;
+
+       if (!cb_fn) {
+               CDEV_LOG_ERR("Callback is NULL on dev_id=%d", dev_id);
+               rte_errno = EINVAL;
+               return NULL;
+       }
+
+       if (!rte_cryptodev_pmd_is_valid_dev(dev_id)) {
+               CDEV_LOG_ERR("Invalid dev_id=%d", dev_id);
+               rte_errno = ENODEV;
+               return NULL;
+       }
+
+       dev = &rte_crypto_devices[dev_id];
+       if (qp_id >= dev->data->nb_queue_pairs) {
+               CDEV_LOG_ERR("Invalid queue_pair_id=%d", qp_id);
+               rte_errno = ENODEV;
+               return NULL;
+       }
+
+       cb = rte_zmalloc(NULL, sizeof(*cb), 0);
+       if (cb == NULL) {
+               CDEV_LOG_ERR("Failed to allocate memory for callback on "
+                            "dev=%d, queue_pair_id=%d", dev_id, qp_id);
+               rte_errno = ENOMEM;
+               return NULL;
+       }
+
+       rte_spinlock_lock(&rte_cryptodev_callback_lock);
+
+       cb->fn = cb_fn;
+       cb->arg = cb_arg;
+
+       /* Add the callbacks in fifo order. */
+       list = &dev->deq_cbs[qp_id];
+       tail = list->next;
+
+       if (tail) {
+               while (tail->next)
+                       tail = tail->next;
+               /* Stores to cb->fn and cb->param should complete before
+                * cb is visible to data plane.
+                */
+               __atomic_store_n(&tail->next, cb, __ATOMIC_RELEASE);
+       } else {
+               /* Stores to cb->fn and cb->param should complete before
+                * cb is visible to data plane.
+                */
+               __atomic_store_n(&list->next, cb, __ATOMIC_RELEASE);
+       }
+
+       rte_spinlock_unlock(&rte_cryptodev_callback_lock);
+
+       return cb;
+}
+
+int
+rte_cryptodev_remove_deq_callback(uint8_t dev_id,
+                                 uint16_t qp_id,
+                                 struct rte_cryptodev_cb *cb)
+{
+       struct rte_cryptodev *dev;
+       struct rte_cryptodev_cb **prev_cb, *curr_cb;
+       struct rte_cryptodev_cb_rcu *list;
+       int ret;
+
+       ret = -EINVAL;
+
+       if (!cb) {
+               CDEV_LOG_ERR("Callback is NULL");
+               return -EINVAL;
+       }
+
+       if (!rte_cryptodev_pmd_is_valid_dev(dev_id)) {
+               CDEV_LOG_ERR("Invalid dev_id=%d", dev_id);
+               return -ENODEV;
+       }
+
+       dev = &rte_crypto_devices[dev_id];
+       if (qp_id >= dev->data->nb_queue_pairs) {
+               CDEV_LOG_ERR("Invalid queue_pair_id=%d", qp_id);
+               return -ENODEV;
+       }
+
+       rte_spinlock_lock(&rte_cryptodev_callback_lock);
+       if (dev->enq_cbs == NULL) {
+               CDEV_LOG_ERR("Callback not initialized");
+               goto cb_err;
+       }
+
+       list = &dev->deq_cbs[qp_id];
+       if (list == NULL) {
+               CDEV_LOG_ERR("Callback list is NULL");
+               goto cb_err;
+       }
+
+       if (list->qsbr == NULL) {
+               CDEV_LOG_ERR("Rcu qsbr is NULL");
+               goto cb_err;
+       }
+
+       prev_cb = &list->next;
+       for (; *prev_cb != NULL; prev_cb = &curr_cb->next) {
+               curr_cb = *prev_cb;
+               if (curr_cb == cb) {
+                       /* Remove the user cb from the callback list. */
+                       __atomic_store_n(prev_cb, curr_cb->next,
+                               __ATOMIC_RELAXED);
+                       ret = 0;
+                       break;
+               }
+       }
+
+       if (!ret) {
+               /* Call sync with invalid thread id as this is part of
+                * control plane API
+                */
+               rte_rcu_qsbr_synchronize(list->qsbr, RTE_QSBR_THRID_INVALID);
+               rte_free(cb);
+       }
+
+cb_err:
+       rte_spinlock_unlock(&rte_cryptodev_callback_lock);
+       return ret;
+}
 
 int
 rte_cryptodev_stats_get(uint8_t dev_id, struct rte_cryptodev_stats *stats)
@@ -1131,7 +1572,6 @@ rte_cryptodev_stats_reset(uint8_t dev_id)
        (*dev->dev_ops->stats_reset)(dev);
 }
 
-
 void
 rte_cryptodev_info_get(uint8_t dev_id, struct rte_cryptodev_info *dev_info)
 {
@@ -1153,7 +1593,6 @@ rte_cryptodev_info_get(uint8_t dev_id, struct rte_cryptodev_info *dev_info)
        dev_info->device = dev->device;
 }
 
-
 int
 rte_cryptodev_callback_register(uint8_t dev_id,
                        enum rte_cryptodev_event_type event,
@@ -1265,7 +1704,6 @@ rte_cryptodev_pmd_callback_process(struct rte_cryptodev *dev,
        rte_spinlock_unlock(&rte_cryptodev_cb_lock);
 }
 
-
 int
 rte_cryptodev_sym_session_init(uint8_t dev_id,
                struct rte_cryptodev_sym_session *sess,
@@ -1285,7 +1723,7 @@ rte_cryptodev_sym_session_init(uint8_t dev_id,
 
        dev = rte_cryptodev_pmd_get_dev(dev_id);
 
-       if (sess == NULL || xforms == NULL || dev == NULL)
+       if (sess == NULL || xforms == NULL || dev == NULL || mp == NULL)
                return -EINVAL;
 
        if (mp->elt_size < sess_priv_sz)
@@ -1403,24 +1841,39 @@ rte_cryptodev_sym_session_data_size(struct rte_cryptodev_sym_session *sess)
                        sess->user_data_sz;
 }
 
+static uint8_t
+rte_cryptodev_sym_is_valid_session_pool(struct rte_mempool *mp)
+{
+       struct rte_cryptodev_sym_session_pool_private_data *pool_priv;
+
+       if (!mp)
+               return 0;
+
+       pool_priv = rte_mempool_get_priv(mp);
+
+       if (!pool_priv || mp->private_data_size < sizeof(*pool_priv) ||
+                       pool_priv->nb_drivers != nb_drivers ||
+                       mp->elt_size <
+                               rte_cryptodev_sym_get_header_session_size()
+                               + pool_priv->user_data_sz)
+               return 0;
+
+       return 1;
+}
+
 struct rte_cryptodev_sym_session *
 rte_cryptodev_sym_session_create(struct rte_mempool *mp)
 {
        struct rte_cryptodev_sym_session *sess;
        struct rte_cryptodev_sym_session_pool_private_data *pool_priv;
 
-       if (!mp) {
+       if (!rte_cryptodev_sym_is_valid_session_pool(mp)) {
                CDEV_LOG_ERR("Invalid mempool\n");
                return NULL;
        }
 
        pool_priv = rte_mempool_get_priv(mp);
 
-       if (!pool_priv || mp->private_data_size < sizeof(*pool_priv)) {
-               CDEV_LOG_ERR("Invalid mempool\n");
-               return NULL;
-       }
-
        /* Allocate a session structure from the session pool */
        if (rte_mempool_get(mp, (void **)&sess)) {
                CDEV_LOG_ERR("couldn't get object from session mempool");
@@ -1445,6 +1898,20 @@ struct rte_cryptodev_asym_session *
 rte_cryptodev_asym_session_create(struct rte_mempool *mp)
 {
        struct rte_cryptodev_asym_session *sess;
+       unsigned int session_size =
+                       rte_cryptodev_asym_get_header_session_size();
+
+       if (!mp) {
+               CDEV_LOG_ERR("invalid mempool\n");
+               return NULL;
+       }
+
+       /* Verify if provided mempool can hold elements big enough. */
+       if (mp->elt_size < session_size) {
+               CDEV_LOG_ERR(
+                       "mempool elements too small to hold session objects");
+               return NULL;
+       }
 
        /* Allocate a session structure from the session pool */
        if (rte_mempool_get(mp, (void **)&sess)) {
@@ -1455,7 +1922,7 @@ rte_cryptodev_asym_session_create(struct rte_mempool *mp)
        /* Clear device session pointer.
         * Include the flag indicating presence of private data
         */
-       memset(sess, 0, (sizeof(void *) * nb_drivers) + sizeof(uint8_t));
+       memset(sess, 0, session_size);
 
        rte_cryptodev_trace_asym_session_create(mp, sess);
        return sess;
@@ -1701,6 +2168,86 @@ rte_cryptodev_sym_cpu_crypto_process(uint8_t dev_id,
        return dev->dev_ops->sym_cpu_process(dev, sess, ofs, vec);
 }
 
+int
+rte_cryptodev_get_raw_dp_ctx_size(uint8_t dev_id)
+{
+       struct rte_cryptodev *dev;
+       int32_t size = sizeof(struct rte_crypto_raw_dp_ctx);
+       int32_t priv_size;
+
+       if (!rte_cryptodev_pmd_is_valid_dev(dev_id))
+               return -EINVAL;
+
+       dev = rte_cryptodev_pmd_get_dev(dev_id);
+
+       if (*dev->dev_ops->sym_get_raw_dp_ctx_size == NULL ||
+               !(dev->feature_flags & RTE_CRYPTODEV_FF_SYM_RAW_DP)) {
+               return -ENOTSUP;
+       }
+
+       priv_size = (*dev->dev_ops->sym_get_raw_dp_ctx_size)(dev);
+       if (priv_size < 0)
+               return -ENOTSUP;
+
+       return RTE_ALIGN_CEIL((size + priv_size), 8);
+}
+
+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)
+{
+       struct rte_cryptodev *dev;
+
+       if (!rte_cryptodev_get_qp_status(dev_id, qp_id))
+               return -EINVAL;
+
+       dev = rte_cryptodev_pmd_get_dev(dev_id);
+       if (!(dev->feature_flags & RTE_CRYPTODEV_FF_SYM_RAW_DP)
+                       || dev->dev_ops->sym_configure_raw_dp_ctx == NULL)
+               return -ENOTSUP;
+
+       return (*dev->dev_ops->sym_configure_raw_dp_ctx)(dev, qp_id, ctx,
+                       sess_type, session_ctx, is_update);
+}
+
+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)
+{
+       return (*ctx->enqueue_burst)(ctx->qp_data, ctx->drv_ctx_data, vec,
+                       ofs, user_data, enqueue_status);
+}
+
+int
+rte_cryptodev_raw_enqueue_done(struct rte_crypto_raw_dp_ctx *ctx,
+               uint32_t n)
+{
+       return (*ctx->enqueue_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,
+       rte_cryptodev_raw_post_dequeue_t post_dequeue,
+       void **out_user_data, uint8_t is_user_data_array,
+       uint32_t *n_success_jobs, int *status)
+{
+       return (*ctx->dequeue_burst)(ctx->qp_data, ctx->drv_ctx_data,
+               get_dequeue_count, post_dequeue, out_user_data,
+               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,