From patchwork Wed Oct 19 12:57:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhangfei Gao X-Patchwork-Id: 616436 Delivered-To: patch@linaro.org Received: by 2002:a17:522:c983:b0:460:3032:e3c4 with SMTP id kr3csp274360pvb; Wed, 19 Oct 2022 06:04:31 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7CBCbYKaoOC6RtKKMWE0s3S9FhsGiX5efujDWpH/uSERb36ANQsmRU+7cIay7enwUyt0KI X-Received: by 2002:a05:600c:4e0e:b0:3c6:fbc5:e2c3 with SMTP id b14-20020a05600c4e0e00b003c6fbc5e2c3mr7319446wmq.120.1666184670837; Wed, 19 Oct 2022 06:04:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666184670; cv=none; d=google.com; s=arc-20160816; b=g5tBXCC4hQoyGab8PNA9T9Atq9qRiiW3/sVXf8NrVvbyMz10AjOiU5QD77gUeqx7Av NghqYZhnvNIuERHDcLFPITzNdg/Ad9SDi/0s/zQGJY4NPxkYIVsKlqA4VkxrvN9Oa6X3 1XkkiXuSJsVPW7ztECoNOuPY34pb0b8/J/1qpYvG+43BwnFzkqtJlqg3wmIELUrzey3l 2QjzsSo2Of53NN/iWHXBI/dg8E+ZO8QcQt5bcVCqkAbzw0MoJkxs1KH199+22+p45EZM vxdrsyfXj0y7zxrotBpsKGo2xXvepE4/iRfK+pDOgxdxbmNkXs5y685rB26WfUn7+07o oKpg== 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=2dU0jBqimPaqD7wisR+m/lJ8t9u0tfSMOkV6toBUYNk=; b=IeZBkkIQe8ddlOf7qdXsoxFkQfRkEikLy7Dvk7Fx9qwfiSJ9ehxUUTa0VyXkVA3tQ9 ZmWr0GPpVW639TnyuVJHfMO/0CEpcDxqixY1jF+8341wj+wDzT/wvB2Zl0sr/minpsJc bWWeB6+p3iq6eFMbRXCnY2UTzd/glJX3Q//CNTQCPtzMugh8mhczePWz7sHs5EYOskBG IQU5KacecOySInkpXeM91ble1/kOihoD4QmaxxB3Q7IwgzuXKBLS623U1a2R2sTLDX7i jJHuisDkK8i4+E5s5JK057LhsehEAU9JfN6UnVMeSwn8JVKh5CzUZFFPbRPVIoAeLs7q pjkw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=tiRIc9Rv; 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 bx13-20020a5d5b0d000000b0022e4b627d18si10032117wrb.204.2022.10.19.06.04.30; Wed, 19 Oct 2022 06:04:30 -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=tiRIc9Rv; 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 D234942BAC; Wed, 19 Oct 2022 15:04:15 +0200 (CEST) Received: from mail-wr1-f54.google.com (mail-wr1-f54.google.com [209.85.221.54]) by mails.dpdk.org (Postfix) with ESMTP id AD54942B91 for ; Wed, 19 Oct 2022 15:04:11 +0200 (CEST) Received: by mail-wr1-f54.google.com with SMTP id f11so29022410wrm.6 for ; Wed, 19 Oct 2022 06:04:11 -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=2dU0jBqimPaqD7wisR+m/lJ8t9u0tfSMOkV6toBUYNk=; b=tiRIc9Rvu6zhHOe7la0NeXKnWb5gbKoD+At2Rd1x+qiqtumPnK8GnvL5OvPPxA/VPG Zy2JXmXASRvgHPuKMN1hEytshKSBGU6lbv5ks3zdrXNLLmutt8OG6Xb6xRRQnKy+1dX2 yB36Mxr4JD6bGjbbmvuY6cr6JBxMVHU9GgQXoctyHAPhSunk9Z2nkeslfESwmuyX6AOk gi2vd6loK1yJombUCbKH+0vhasXxYQeHcw0pCdy5xXdmTM4Bu0uJSLYAjBVj07FZREY3 fYwABThkUDZT3PBEaROO+csLYb1BkcONi/SCtUVm9KeL0jFsN29xLAMwR35N64RF6lKZ JaTg== 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=2dU0jBqimPaqD7wisR+m/lJ8t9u0tfSMOkV6toBUYNk=; b=CAvhcl6tjeCfUoDq49yQSghdNtzxwF8GdBHa5/X8DJY4Co2W5KWTGjr+sTMxv4uK9b fUb0BVdb9C0T11nGB+l07ygHlZnfE+zkylYTK68c6lJCj2B18aTutxaiBKvNH8DEctjo v3f3ft1PM5YipAMmbjl0M6oG3pWd/gcC7R72Om0rePHOFf9ixSGyj32PdqUFdZbrzKAj CuhNCbCiOihWngP55a5zJLFvfSlMdZ8Bk8EsWWgsi+HW+hmw+J4uMGik31NsK+htF6eK hO13aMET7/5oJ9AGncqKVtY8BRnamCWaXPZsLxUCbuiJE2ei4dhCdZJMbCF3zc7FaBkN y9pg== X-Gm-Message-State: ACrzQf1nUcoWH931cWXbINPQoGz+4Kn2tG9wBetfa4R6s1wQB4iDozNu +tXRGL9OSzmcNCMljmDSKBt11Q== X-Received: by 2002:a5d:64a8:0:b0:22e:409f:a3cb with SMTP id m8-20020a5d64a8000000b0022e409fa3cbmr5054450wrp.168.1666184650980; Wed, 19 Oct 2022 06:04:10 -0700 (PDT) Received: from localhost.localdomain ([213.146.143.36]) by smtp.gmail.com with ESMTPSA id b7-20020adfe307000000b0022cbf4cda62sm16807051wrj.27.2022.10.19.06.04.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Oct 2022 06:04:10 -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 v4 3/6] crypto/uadk: support enqueue/dequeue operations Date: Wed, 19 Oct 2022 20:57:50 +0800 Message-Id: <20221019125753.1700071-4-zhangfei.gao@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221019125753.1700071-1-zhangfei.gao@linaro.org> References: <20221019125753.1700071-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 1d1a4b2897..051d6726b0 100644 --- a/drivers/crypto/uadk/uadk_crypto_pmd.c +++ b/drivers/crypto/uadk/uadk_crypto_pmd.c @@ -240,6 +240,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) { @@ -276,8 +325,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;