From patchwork Wed Oct 26 10:54:26 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhangfei Gao X-Patchwork-Id: 618810 Delivered-To: patch@linaro.org Received: by 2002:a17:522:c983:b0:460:3032:e3c4 with SMTP id kr3csp317204pvb; Wed, 26 Oct 2022 04:01:39 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4CuEtgrnhqFupF0gKTU0qxAnt8B2MFypwC7imRd17mAvN5UCHo0UTUDlLMi+1S07QFYShK X-Received: by 2002:a5d:59c6:0:b0:235:fae6:354c with SMTP id v6-20020a5d59c6000000b00235fae6354cmr22176099wry.713.1666782098810; Wed, 26 Oct 2022 04:01:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666782098; cv=none; d=google.com; s=arc-20160816; b=D/4W4cW+pFrM6msGdazaEV8E4nPSNrNFNRD+pH0qxH8e5FenfZlnRjSTLGFLkc/w6R +6YsLKphhRE+S1OvVDXip5XHEFt/IRf3S/IMDO3vt9oGSzwm2XibHxpLBvLHUrdT9wOY sFgXYOsp4WVMnUrRDEG0CBeZY9DTRQ0EZ8aXvhx/aLy35g5W7nUqYzmW+FRMdeReKylA jpEgfTUBZ9nF+huP05NQKIy6EhHp6xHY/3SjQnnAvcZwO4m4JltmYOapfq5j18D1pSyS btHguKO290t7+bJi0B5bEqSj/O0li7lCx0shSfNyGHHsV0jiXRUIMmvDHxHwZ+DN8wwr 1JMg== 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=gCo/lEt/vnZnd2GQBv7rIYWCKFZr1IXcB/HdSoa8dvw=; b=jyJFBsBz3dzDTe/Cb5oxzTkNm97xkH2YjdznPSeH6Uhx1ea+ug4juDvDbMRJtFisFS lOwhuvnUTMxu2S0I3QzcdHRwxw54JPFRFkahn1KTYENE2ESUrMCjISuOykAh8c/6QCyH bKa5Wg/2v5XLICX+hGxuL1Moy8+k3tW/aC42/U/eWIUo1v1J2cPCdktxzOWbAn9XlMLj kwjr0RcbpayZFUOYIrNee0CNykZ4gtZCjnmBaYaTHH9rv/KNZoMznl2ynK+I/iQ3hoAx e7r7utGCb9SRrG/VuwLuEB6+38YwcwREsmKYnWtmVX++8l/cm+l1T8r/s3/mzoFntJsJ 0Htw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=uAsD8ADd; 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 h186-20020a1c21c3000000b003c7174bdb82si1232229wmh.32.2022.10.26.04.01.38; Wed, 26 Oct 2022 04:01:38 -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=uAsD8ADd; 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 F3AA342BAD; Wed, 26 Oct 2022 13:01:23 +0200 (CEST) Received: from mail-wm1-f42.google.com (mail-wm1-f42.google.com [209.85.128.42]) by mails.dpdk.org (Postfix) with ESMTP id 06E5841153 for ; Wed, 26 Oct 2022 13:01:19 +0200 (CEST) Received: by mail-wm1-f42.google.com with SMTP id c7-20020a05600c0ac700b003c6cad86f38so1197942wmr.2 for ; Wed, 26 Oct 2022 04:01:19 -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=gCo/lEt/vnZnd2GQBv7rIYWCKFZr1IXcB/HdSoa8dvw=; b=uAsD8ADdIJBHN4NwT7NXN6qBN7c9aiyNoGvmocw/lDGkDUOEUophdRyV9ywKPkA63r bpqrPuMtAib/AwaXJZ2txJFFDWkDnw5u6zODEnh+ZDtEAdA776OQyhdkth55HQufoUvI cK8EMRDKZTlObYrhDrlm49jacIJOCn8zQD69ECYXW41FP8YbdvQ8yfUdKl3ZpCA87Aqu u2iY2gzjqfHE2cAzM1DmJKZgcmMKfeN/vK3CqM9Gac5gWDBBduTMp5HZWmY5DQvncr3P HD1RBfZWSyWZogGKWXbzJ1loRklKwPi5STsSpKIgkDmCM5k+JD/R5v5Yztt9/yrLSTh7 Yq/Q== 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=gCo/lEt/vnZnd2GQBv7rIYWCKFZr1IXcB/HdSoa8dvw=; b=15kZH4dzab7d+7beEfwhloqScMVi9tfi6jQ9b96hLuzlk+nfSM9Mdo/GrQtkR/4Dze 5sTtWdrEFNUL3rYhGNQEdFvZxBCEoMY+/aJ4Rh1dnnbfGo3rkJJlsYeIJFs5vSc/o3ay FBjxJsmVHnp8m/slUUmecMqD5PpU9HDhFfHAsgdLfwgAf2bBfNIjm3z09n52nUYoCMtO LUe5qJasQyBWcyGmUPAjlxjtXDasM5sWsfpswrFZBHkM3Wgplak2PEutx5EcSzLu9PYW /qnDvuINymVzg01nKQnxg3C4ogj9RxCJCbggwMqJFCh0q4dYoAdGG5c1+v/tIQUNSJeo Cy+g== X-Gm-Message-State: ACrzQf1BEhelnxnqEWpcB4mietaVdJa/yUt88/3j9iiB8u5WSHL+uL5G Df40kCA/UgFQSHHEIWyXem1puA== X-Received: by 2002:a05:600c:1c9d:b0:3c5:8081:1fc4 with SMTP id k29-20020a05600c1c9d00b003c580811fc4mr2044549wms.161.1666782079710; Wed, 26 Oct 2022 04:01:19 -0700 (PDT) Received: from localhost.localdomain ([213.146.143.36]) by smtp.gmail.com with ESMTPSA id h14-20020a5d688e000000b0023660f6cecfsm4856094wru.80.2022.10.26.04.01.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Oct 2022 04:01:19 -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 v6 3/6] crypto/uadk: support enqueue/dequeue operations Date: Wed, 26 Oct 2022 18:54:26 +0800 Message-Id: <20221026105429.1899867-4-zhangfei.gao@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221026105429.1899867-1-zhangfei.gao@linaro.org> References: <20221026105429.1899867-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 b383029a45..b889dac8b0 100644 --- a/drivers/crypto/uadk/uadk_crypto_pmd.c +++ b/drivers/crypto/uadk/uadk_crypto_pmd.c @@ -208,6 +208,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) { @@ -244,8 +293,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;