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: 610567 Delivered-To: patch@linaro.org Received: by 2002:a17:522:c983:b0:460:3032:e3c4 with SMTP id kr3csp647671pvb; Wed, 28 Sep 2022 20:28:18 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6A9qtJqYLDq8lu1F5GwGdgnttrUzehORv1GJmNUrRWQKd6BitAwYA7vqSfY/irl1AyW08t X-Received: by 2002:a05:600c:2608:b0:3b4:8dac:342a with SMTP id h8-20020a05600c260800b003b48dac342amr631115wma.102.1664422098760; Wed, 28 Sep 2022 20:28:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664422098; cv=none; d=google.com; s=arc-20160816; b=ebVj5gYPez7039VC2N6M4jGRHFVZMxc5+pviLZbBwkyoe3dFszvoPIys0lfrdfEnAG Lg3iSK/z8k6TdUgTbyz5yjxMqxSOmAORVxO0uD4WYuAlAud2OPElzXRhAS0FauXjqilB rblRI/a5bbZSQTwph9ulumS5UcToSE95XeVZl+oZ4YOppvYRNQHC+5Hmx4gFvs0/Rad6 7o2RjKXro2LTaEAxQr2eX8eI0GkpBarbq8A13o/gFuukZJeR0aoMQD0p+JtZYWjnnZQX r8QtUgbnoro2yDY9fMKbmzePkGlz9rVVHCJEFxuyFIZv3eVmGq1HaDnZ5J6zljRHyxnG KRWg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ETZW2UP3KR9q5o/BAWuTYCKbn5qB4v5IKY/vDqSzcXg=; b=DnQqm1H1vSG3E3i31HKGCIm8vHF6KxI+xGvg3NimRFsuI2ILaEbVWsqaeR1XVdkdjR 3VB1H7zuOlWIsWBUKicUcWo83uZVBtQjbS2D7RPv7rrd+3je8QdBwiH2A1RdUimAZqIg yI663YknIbpuCteCwUys8SSUSWhPUzLzXS2Gb7wxnrwE+r/LScMmP+KQKxcPK5Pn4KAF D4N/WvDNipwcPSv5yOhER7+coRzELA0NxeyKWHZpT50sv/jfA7rqkC2HimseKTgp6CIk EILBf/NNEtBbt37rGUa1CAUxoH+pYDdc8R8G1SP6A3K48OxbvJ9bzUma1WuecChjLLNr aRaQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=PAp83UYs; spf=pass (google.com: domain of dev-bounces@dpdk.org designates 217.70.189.124 as permitted sender) smtp.mailfrom=dev-bounces@dpdk.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from mails.dpdk.org (mails.dpdk.org. [217.70.189.124]) by mx.google.com with ESMTP id m2-20020a056000024200b0022afe25134asi2996322wrz.191.2022.09.28.20.28.18; Wed, 28 Sep 2022 20:28:18 -0700 (PDT) Received-SPF: pass (google.com: domain of dev-bounces@dpdk.org designates 217.70.189.124 as permitted sender) client-ip=217.70.189.124; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=PAp83UYs; spf=pass (google.com: domain of dev-bounces@dpdk.org designates 217.70.189.124 as permitted sender) smtp.mailfrom=dev-bounces@dpdk.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org 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-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;