From patchwork Thu Sep 29 03:27:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhangfei Gao X-Patchwork-Id: 117092 X-Patchwork-Delegate: gakhil@marvell.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 867ACA00C4; Thu, 29 Sep 2022 05:28:18 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1B6944282D; Thu, 29 Sep 2022 05:28:17 +0200 (CEST) Received: from mail-pg1-f179.google.com (mail-pg1-f179.google.com [209.85.215.179]) by mails.dpdk.org (Postfix) with ESMTP id B422D4113D for ; Thu, 29 Sep 2022 05:28:15 +0200 (CEST) Received: by mail-pg1-f179.google.com with SMTP id q9so307926pgq.8 for ; Wed, 28 Sep 2022 20:28:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date; bh=ETZW2UP3KR9q5o/BAWuTYCKbn5qB4v5IKY/vDqSzcXg=; b=PAp83UYscHlhS07+8HGg7IGMyIfLYfLo+Ao4KgutjAACF92SPpTtLLdnL0I+5ktA6G oQaT07kvxbCCFC/NMER9x72KPqdxSIEIh0+hsvBc6gHpoW1qJyV143w5wbSTASidVAfz A/CTQMmOVw6Nlt6olTDmZRc2SCa6d8FMZbruR29UGnrH59A7MaQpFE5+Dq6Qj6pKibxQ 5qoHbi1zaxcRliOpW6FtSlAeeS5QbJPRAK5CktzIt+FOKGvLHJtPAx+zVdLdwf7l4uoe zimahQEeLu4pab8XNjRTcwFxTzfg+r4NtPZuHaX00tk5LJ7pT8WVSODJVnDG8kRl7EOH uYKA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date; bh=ETZW2UP3KR9q5o/BAWuTYCKbn5qB4v5IKY/vDqSzcXg=; b=WLe9XsEu972xpl4U4Lf5Xc+WG5/rFSikipMpbKpt9rYWgM9n3HBSnQV986/OWv+v1v Xphl3O5nYA6L+6qO3uMSSI02uVJAjOr7zIwDPe4F6v2wZCx6ZcFKtJ2LXP/6387ajDOS vxjjNIeOLoKCEJf0qMe0X8kmsd3ycbBuJc17ZNXoA2n5kKIeHjlqDUjFG2SDwo/ZWIp/ ynGtfqOBNIUCDr9sG5a86W7NpwQ9RhRiqz3N+z++cQqgXDmdOjhQ4l1fL+FkmRtwSKlw tIsDFcqe10cxp8lHoCvj5bRG0DfZfqjoEckmqAFoR8rPPY5ZgnS/9IjULHgrT0eK1ba4 3dag== X-Gm-Message-State: ACrzQf0ejYkftc1aU3PEE1NtpBGvhpRo0/ti/YfevrVv/uZqra0Ied/Y POeyKzwX8t/ss35YV0Ud7zVN2w== X-Google-Smtp-Source: AMsMyM62Htpmv1ePCVnpwdEyQuN/spNMn0bOoP7JkMHG6gkVBt6KLsBhSvDGNOi6K2jYQYIvSSugGQ== X-Received: by 2002:a63:5a0b:0:b0:434:4748:4e7a with SMTP id o11-20020a635a0b000000b0043447484e7amr975232pgb.561.1664422095032; Wed, 28 Sep 2022 20:28:15 -0700 (PDT) Received: from localhost.localdomain ([45.128.198.71]) by smtp.gmail.com with ESMTPSA id gn4-20020a17090ac78400b001fd66d5c42csm2304271pjb.49.2022.09.28.20.28.10 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 28 Sep 2022 20:28:14 -0700 (PDT) From: Zhangfei Gao To: Akhil Goyal , Declan Doherty , Fan Zhang , Ashish Gupta , Ray Kinsella Cc: dev@dpdk.org, acc@openeuler.org, Zhangfei Gao Subject: [PATCH v3 3/6] crypto/uadk: support enqueue/dequeue operations Date: Thu, 29 Sep 2022 11:27:43 +0800 Message-Id: <20220929032746.10659-4-zhangfei.gao@linaro.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220929032746.10659-1-zhangfei.gao@linaro.org> References: <20220929032746.10659-1-zhangfei.gao@linaro.org> MIME-Version: 1.0 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org This commit adds the enqueue and dequeue operations. Signed-off-by: Zhangfei Gao --- drivers/crypto/uadk/uadk_crypto_pmd.c | 53 ++++++++++++++++++++++++++- 1 file changed, 51 insertions(+), 2 deletions(-) diff --git a/drivers/crypto/uadk/uadk_crypto_pmd.c b/drivers/crypto/uadk/uadk_crypto_pmd.c index d6d9f26337..99a10e7d77 100644 --- a/drivers/crypto/uadk/uadk_crypto_pmd.c +++ b/drivers/crypto/uadk/uadk_crypto_pmd.c @@ -238,6 +238,55 @@ static struct rte_cryptodev_ops uadk_crypto_pmd_ops = { .sym_session_clear = NULL, }; +static uint16_t +uadk_crypto_enqueue_burst(void *queue_pair, struct rte_crypto_op **ops, + uint16_t nb_ops) +{ + struct uadk_qp *qp = queue_pair; + struct rte_crypto_op *op; + uint16_t enqd = 0; + int i, ret; + + for (i = 0; i < nb_ops; i++) { + op = ops[i]; + op->status = RTE_CRYPTO_OP_STATUS_NOT_PROCESSED; + + if (op->status == RTE_CRYPTO_OP_STATUS_NOT_PROCESSED) + op->status = RTE_CRYPTO_OP_STATUS_SUCCESS; + + if (op->status != RTE_CRYPTO_OP_STATUS_ERROR) { + ret = rte_ring_enqueue(qp->processed_pkts, (void *)op); + if (ret < 0) + goto enqueue_err; + qp->qp_stats.enqueued_count++; + enqd++; + } else { + /* increment count if failed to enqueue op */ + qp->qp_stats.enqueue_err_count++; + } + } + + return enqd; + +enqueue_err: + qp->qp_stats.enqueue_err_count++; + return enqd; +} + +static uint16_t +uadk_crypto_dequeue_burst(void *queue_pair, struct rte_crypto_op **ops, + uint16_t nb_ops) +{ + struct uadk_qp *qp = queue_pair; + unsigned int nb_dequeued; + + nb_dequeued = rte_ring_dequeue_burst(qp->processed_pkts, + (void **)ops, nb_ops, NULL); + qp->qp_stats.dequeued_count += nb_dequeued; + + return nb_dequeued; +} + static int uadk_cryptodev_probe(struct rte_vdev_device *vdev) { @@ -274,8 +323,8 @@ uadk_cryptodev_probe(struct rte_vdev_device *vdev) dev->dev_ops = &uadk_crypto_pmd_ops; dev->driver_id = uadk_cryptodev_driver_id; - dev->dequeue_burst = NULL; - dev->enqueue_burst = NULL; + dev->dequeue_burst = uadk_crypto_dequeue_burst; + dev->enqueue_burst = uadk_crypto_enqueue_burst; dev->feature_flags = RTE_CRYPTODEV_FF_HW_ACCELERATED; priv = dev->data->dev_private; priv->version = version;