From patchwork Mon Oct 24 13:44:06 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhangfei Gao X-Patchwork-Id: 617866 Delivered-To: patch@linaro.org Received: by 2002:a17:522:c983:b0:460:3032:e3c4 with SMTP id kr3csp2734982pvb; Mon, 24 Oct 2022 06:51:07 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5f74ZSRuUx/4VS0HAawSUojr5sZh/lwQVuqZCnbfQ7lld43OG1UraaJUXh0Emh5tyVeIYK X-Received: by 2002:a5d:4d12:0:b0:236:751a:9c90 with SMTP id z18-20020a5d4d12000000b00236751a9c90mr2495498wrt.609.1666619467680; Mon, 24 Oct 2022 06:51:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666619467; cv=none; d=google.com; s=arc-20160816; b=Us0m6hbZ+IVxYNB2Cryzf/ICLLmO39GmFgTMIBHpp8rGayv11UM/ZIkLU1LGuMSVv4 9hnQHrvDlkcAa60slNENweZW674xsEi+gqxKDhwVLZgCzaErFP+xs1WtzsAwRLWDtbV3 jCHEwPreNUd+Rb5emjZCHIjBVBWnjFBFDd3BEUBuQbdOgUKGr16zM23kaKi3U5SMXOsx 43EKPZfi10FKahFzL5NJwTi05vmmcY6DdOTjR9CuwKu1CHnG4RlerRx5FJLLkIAsWXhU ANqGJNfGAsUwzybtTXxQ7PeRMoG1bFBpmoey7RGCJ+xZbdD8LsCA7FHuoOx5Sr4UuuP6 8u1w== 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=4yN1+ofZn83pAuuI5gjHoVUjM27nMh/m+fPyBicItYU=; b=Be30vU6HMx4Frs0v1cmulFHNXZZv4L9l4tK4UuidkytULcXWN/kf82NOL31PfQOE4C 42BORmw/Bsm3ybC6rw8MvAhk0t4Dq/5G2hkth+bxE8MNJBRCSfZRCNEkjRZXG2EXkcg1 zq4IgWgbd2pnoKaY5XhLZUT643aVsilJo/iB0KDf4uGF5M8GQw3ZHzd+iAbp5w1AjyZP YLWJS+0w5Hjfe+FJO93Kib8LsI3J9J6r7w90Fd4ZORNBI3JQrVZgjvXP+z1mDtIUkdd4 fuZqf0/vVPXYVz+nU2M02OYd2sGPcDOy+J9PTJ53fmvsKT1tBcJsZ5dXdcYTycBeG5xD J3GQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=IGE0SpuY; 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 b14-20020a05600003ce00b00225885fca43si20527068wrg.184.2022.10.24.06.51.07; Mon, 24 Oct 2022 06:51:07 -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=IGE0SpuY; 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 3B38042BBB; Mon, 24 Oct 2022 15:50:56 +0200 (CEST) Received: from mail-wm1-f51.google.com (mail-wm1-f51.google.com [209.85.128.51]) by mails.dpdk.org (Postfix) with ESMTP id BEF6042BA5 for ; Mon, 24 Oct 2022 15:50:51 +0200 (CEST) Received: by mail-wm1-f51.google.com with SMTP id y10so6668420wma.0 for ; Mon, 24 Oct 2022 06:50:51 -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 :message-id:reply-to; bh=4yN1+ofZn83pAuuI5gjHoVUjM27nMh/m+fPyBicItYU=; b=IGE0SpuYU5zZZrRr81TRJRhNhBJYqsid619AQNeXtXmTG8TJK+bsvSwS/yidw3UsFk ePpu9jdROJzLlAVhYs0oDQaOXTfYp1dG2F90Eeel7pj7umGbGRAptM7dDwoXqu/3cZQe 33Rin9k8WyqoMCJTfpIexrC+tVAYsseXuCTXm3yuMFaG61XawuGl5VtMeX8a6TuWalgV Nv4eaMUWLYCjysgmW8vxsPimpsUsZ4Ktdt5xBhAa26AYdakNZNjxC8oiZZNmJuIvBe2p Y7ZY2UQlJNWc0EcOqHV6yh4Qw59HRllQrtYjenm5e+mLpExHBAJ4u4L/y/Sey247Uj7z yBRA== 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:message-id:reply-to; bh=4yN1+ofZn83pAuuI5gjHoVUjM27nMh/m+fPyBicItYU=; b=M1UORhO4uGpwzFyes9scJCBQxGyr2DWisgN+8TStBwbzhVn56JsxOT621LCeMQ4iyf +5UrPdL1ML3PZTKcktgu2MeI6KpahTKw8ehw9Gktr6NZTt1V8jqVRTv1lestD4q1irqK Gw5z4oS/9Zvknb8NkVcD40C2DFIsLVPa/9knHPLcGBvulUitmtpIdOnKJJEg6+t3v0rR kw59c2/+onn5vfYhl5pZpRuKmYlGCDIBlCNEvcpU308NH1yuEgdUYSNGliZLWntpbLeN K8qKSDQUd1GPWNz1XxJxT06BmbVDF7zw7Z29W8Pv6oShxSfVxCKb9M9czBcASOBVv7jZ 4WHQ== X-Gm-Message-State: ACrzQf3qdhUS7pUomo0+C5u4iDxhzbGNGgKubX8IH6I51JF3VgBqPFma xT2/xArQ1z9tbKJdgUHEAWeErQ== X-Received: by 2002:a05:600c:5252:b0:3c6:f478:96e6 with SMTP id fc18-20020a05600c525200b003c6f47896e6mr29718753wmb.75.1666619451509; Mon, 24 Oct 2022 06:50:51 -0700 (PDT) Received: from localhost.localdomain ([213.146.143.36]) by smtp.gmail.com with ESMTPSA id t8-20020a0560001a4800b00236644228cfsm5764108wry.43.2022.10.24.06.50.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Oct 2022 06:50:51 -0700 (PDT) From: Zhangfei Gao To: Akhil Goyal , Declan Doherty , Fan Zhang , Ashish Gupta , Ray Kinsella , "thomas@monjalon.net" Cc: dev@dpdk.org, acc@openeuler.org, Zhangfei Gao Subject: [PATCH resend v5 3/6] crypto/uadk: support enqueue/dequeue operations Date: Mon, 24 Oct 2022 21:44:06 +0800 Message-Id: <20221024134409.1896776-4-zhangfei.gao@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221024134409.1896776-1-zhangfei.gao@linaro.org> References: <20221024134409.1896776-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 7116899ca5..84cb1dab25 100644 --- a/drivers/crypto/uadk/uadk_crypto_pmd.c +++ b/drivers/crypto/uadk/uadk_crypto_pmd.c @@ -239,6 +239,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) { @@ -275,8 +324,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;