From patchwork Fri Oct 21 08:38:15 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhangfei Gao X-Patchwork-Id: 617149 Delivered-To: patch@linaro.org Received: by 2002:a17:522:c983:b0:460:3032:e3c4 with SMTP id kr3csp825487pvb; Fri, 21 Oct 2022 01:45:03 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6xta1f0StQyTsJ4yT30fdwUUuOFerHL1A4+QGuLyIOq4ODyhGGV82LTVJYFjfUMz5qvtlV X-Received: by 2002:a5d:64ee:0:b0:22c:df95:532f with SMTP id g14-20020a5d64ee000000b0022cdf95532fmr11323811wri.61.1666341903426; Fri, 21 Oct 2022 01:45:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666341903; cv=none; d=google.com; s=arc-20160816; b=cDFm2WrcN2Ixu2PaFmnfGCkdAuLGlyZ+eW/yENBH4qwnEuWbc9Y4bz3zvQrT5wxp+a dn6ow+zqwvwrSHP+CiAqegJTuSOwyreOkH0J8inevD/ZR0ivTOw2zYdbC0DO6WId7kRT LlJIjPew+HaMVJPddVAsBUO1DdLNfQc6wRz74B3KWD6pxAO/mMQ37XjJl+ROPVAo/up8 vmgnynAQWs2AHlziHgmzfMW8E72+/lr3MmzGQZlYT2A1griox9TMaW17IHuUBryvxEvq 0DenZlrrU907EQyJb4V16enH6oUek+dsL10F4um1m3ApxKKm0x1GpQ4T55T59A5Pfg3G 4QhQ== 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=JxOvQspdB6Fb/JYjTIJNI+ZsbUEHHrieWhXAIEUpRyc=; b=NPvvxUj/k/kD0afvf9B9d8/ZKL8BhGuejgDY6LKH+w8oaXRXe+tE0Znv0su5pUhde0 OuUknmn6eJf9NBW9tAwsjebmQqB1RmlVBDJLxx33na2sWo+BIxM1ymy5D1xKQgD0b+yh 1xf2bn4Y+TwCd+6uK1rBfMHX8H7j1nkroYwtPqj/cNr3ZJy/gdRanf+9T6Gia3EmBJ7X wWpmCm++JZ9Eck4X5CQLz/vuhhJXKgyerHQwkJ8IpB1t7cSgMrIzIZKws5c/2GsbW0yw 1GHuWmDE+T9bbWJFYkAEQcTOcNooplP4sca2as1zXaJv9NkkRBUtaZUmicgef9lMUflC HKKw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=VqetDzuo; 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 11-20020a056000156b00b0022e33d82434si15805938wrz.874.2022.10.21.01.45.03; Fri, 21 Oct 2022 01:45:03 -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=VqetDzuo; 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 376C042BE1; Fri, 21 Oct 2022 10:44:50 +0200 (CEST) Received: from mail-wr1-f50.google.com (mail-wr1-f50.google.com [209.85.221.50]) by mails.dpdk.org (Postfix) with ESMTP id 6B67C42BCB for ; Fri, 21 Oct 2022 10:44:47 +0200 (CEST) Received: by mail-wr1-f50.google.com with SMTP id w18so3727314wro.7 for ; Fri, 21 Oct 2022 01:44:47 -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=JxOvQspdB6Fb/JYjTIJNI+ZsbUEHHrieWhXAIEUpRyc=; b=VqetDzuoatfoihKm08G3qor2b3+ScCavy0C5ne626qMk4WJ20NLJry32J9dECkQAOY /l5PK6h+bARZT1t5qcmdHJrOxtjgyklAfnlcJ1SSIKdYpMdlQ24MyqiUtqJQu45B5QkV IeSm9phE8H1xoupkp7TwhKIKz22Ozk77ZzsxSh/NEYSjusuX5SzQm04Dvv8FnyqRIPoU NvFynZ2Oy9tIYiwadskkgXxMNkiz4DXGH8nSulsMu6CDzQjGNTeUs8nPMHSdw9smowQs oMvMTjiFc3qxj0OIiEcnfCJb9tXd0K6tF/HVyFsD+6gSeqY7+l3vd5VVlIk5/t8v3gYv 5KGw== 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=JxOvQspdB6Fb/JYjTIJNI+ZsbUEHHrieWhXAIEUpRyc=; b=pK0yL2envATEgyYZYwnYVtP7c9y/BBanzzw5Sh6lYGOgSjvbXougqJihfxyCmmTuAu nMJ0RIERWYKYeFJFiKzTeT5zcuIjqF6Y05Jq9wUpmkJ6MTFvnjWngnqEDq1nmUE8uN82 Aw33/GK80ChcgDl8d+u2H+WrZmXxRp4rL9UG4Dh+lFP5kAI5tVll18DGyPM32JKf7qfy gRROEAP4gXMvN2XvC7PUDo/ufkGy3H4nu+gcWdmKkdoPfFhXJbuDDTQIKfz8hOAEl6Fq b7or/oFZAalbvihwyaXX7fBRS6BH3hKU6WH+P6wvjYWYrnk2RWyKXAYjzYFAfav0PYHu ZR3Q== X-Gm-Message-State: ACrzQf3kr+oV0RdBL25dJM1OOPjWf8RzQHQT2D/iRN+DuXqqyUgxXZq3 aMfylImxHfsXC/iSKn6V8UVZEQ== X-Received: by 2002:a05:6000:2c5:b0:22f:5242:12fe with SMTP id o5-20020a05600002c500b0022f524212femr11446669wry.401.1666341887190; Fri, 21 Oct 2022 01:44:47 -0700 (PDT) Received: from localhost.localdomain ([213.146.143.36]) by smtp.gmail.com with ESMTPSA id c15-20020adfe74f000000b0022cd59331b2sm17755453wrn.95.2022.10.21.01.44.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Oct 2022 01:44:46 -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 v5 3/6] crypto/uadk: support enqueue/dequeue operations Date: Fri, 21 Oct 2022 16:38:15 +0800 Message-Id: <20221021083818.1821116-4-zhangfei.gao@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221021083818.1821116-1-zhangfei.gao@linaro.org> References: <20221021083818.1821116-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 ed4ac09071..0ad0d8e177 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;