Add crypto dequeue datapath configuration for zsda device. Signed-off-by: Hanxiao Li --- drivers/crypto/zsda/zsda_crypto.c | 16 ++++++++++++++++ drivers/crypto/zsda/zsda_crypto.h | 2 ++ drivers/crypto/zsda/zsda_crypto_pmd.c | 12 ++++++++++-- 3 files changed, 28 insertions(+), 2 deletions(-) diff --git a/drivers/crypto/zsda/zsda_crypto.c b/drivers/crypto/zsda/zsda_crypto.c index 66ae2a804e..58fdde8ec8 100644 --- a/drivers/crypto/zsda/zsda_crypto.c +++ b/drivers/crypto/zsda/zsda_crypto.c @@ -254,3 +254,19 @@ zsda_hash_wqe_build(void *op_in, const struct zsda_queue *queue, return ret; } + +int +zsda_crypto_callback(void *cookie_in, struct zsda_cqe *cqe) +{ + struct zsda_op_cookie *tmp_cookie = cookie_in; + struct rte_crypto_op *op = tmp_cookie->op; + + if (!(CQE_ERR0(cqe->err0) || CQE_ERR1(cqe->err1))) + op->status = RTE_CRYPTO_OP_STATUS_SUCCESS; + else { + op->status = RTE_CRYPTO_OP_STATUS_ERROR; + return ZSDA_FAILED; + } + + return ZSDA_SUCCESS; +} diff --git a/drivers/crypto/zsda/zsda_crypto.h b/drivers/crypto/zsda/zsda_crypto.h index 09cc5ce755..3a8019d48f 100644 --- a/drivers/crypto/zsda/zsda_crypto.h +++ b/drivers/crypto/zsda/zsda_crypto.h @@ -42,4 +42,6 @@ int zsda_cipher_wqe_build(void *op_in, const struct zsda_queue *queue, int zsda_hash_wqe_build(void *op_in, const struct zsda_queue *queue, void **op_cookies, const uint16_t new_tail); +int zsda_crypto_callback(void *cookie_in, struct zsda_cqe *cqe); + #endif /* _ZSDA_CRYPTO_H_ */ diff --git a/drivers/crypto/zsda/zsda_crypto_pmd.c b/drivers/crypto/zsda/zsda_crypto_pmd.c index af5192d1cd..e2b22a881b 100644 --- a/drivers/crypto/zsda/zsda_crypto_pmd.c +++ b/drivers/crypto/zsda/zsda_crypto_pmd.c @@ -143,7 +143,7 @@ zsda_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id, task_q_info.nb_des = nb_des; task_q_info.socket_id = socket_id; task_q_info.qp_id = qp_id; - task_q_info.rx_cb = NULL; + task_q_info.rx_cb = zsda_crypto_callback; task_q_info.type = ZSDA_SERVICE_CRYPRO_ENCRY; task_q_info.service_str = "encry"; @@ -243,6 +243,14 @@ zsda_crypto_enqueue_op_burst(void *qp, struct rte_crypto_op **ops, nb_ops); } +static uint16_t +zsda_crypto_dequeue_op_burst(void *qp, struct rte_crypto_op **ops, + uint16_t nb_ops) +{ + return zsda_dequeue_burst((struct zsda_qp *)qp, (void **)ops, + nb_ops); +} + int zsda_crypto_dev_create(struct zsda_pci_device *zsda_pci_dev) { @@ -283,7 +291,7 @@ zsda_crypto_dev_create(struct zsda_pci_device *zsda_pci_dev) cryptodev->dev_ops = &crypto_zsda_ops; cryptodev->enqueue_burst = zsda_crypto_enqueue_op_burst; - cryptodev->dequeue_burst = NULL; + cryptodev->dequeue_burst = zsda_crypto_dequeue_op_burst; cryptodev->feature_flags = 0; crypto_dev_priv = cryptodev->data->dev_private; -- 2.27.0