From patchwork Thu Oct 27 03:25:02 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhangfei Gao X-Patchwork-Id: 619172 Delivered-To: patch@linaro.org Received: by 2002:a17:522:c983:b0:460:3032:e3c4 with SMTP id kr3csp21591pvb; Wed, 26 Oct 2022 20:32:15 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7U3ztJrEdJAu63lz3CsNDmYGZ5CmQb09tBtSTO9LauzPtXVr4kI7Yc/pDOvPvz8Uvjt/Sw X-Received: by 2002:a05:6000:144a:b0:22e:4d74:c1f7 with SMTP id v10-20020a056000144a00b0022e4d74c1f7mr30804485wrx.86.1666841535652; Wed, 26 Oct 2022 20:32:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666841535; cv=none; d=google.com; s=arc-20160816; b=Z4a+tBhIzdZSAXsKUoWdLvImKZNxQt8sGct4/c84cJYP7h2683KunXwOaaNNAZxsIj Gk9mhyoy0cHsh04GsaESdpAL4jkV+yB8SzJ7R3X/y/wbXaWJlKOcA8VeHTajcG2idLBm 8qQtRBCcaC3L460znLy2rk+WNJzk7L0Xh45v03NxNwiBaC11YmUmxFE/Jp/5+6JXl8y1 HeBZPxCCBt29sBr5XHh7UsRD2b8F8pFiiifFyfoCnPspHos+gPMIK8E8U+Vv8bki9Wnq GNursirD9rI7y1jxJwx/G0hbpENdLM7GZoj5PkTvcRrM1BZG/k/tSxznlXFoNodL9BFR oZHA== 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=0f730MI5xFLZu9Gj6VslkDhim9LH5VwH2Yu4k+F9juo=; b=Sxe+JJsag1/8rjJKMIIMCqJsSlkJdLHCJqI7WdfnSe6J7168hLOzg0d7yghTh7qtKk SAJJ3vX2TElKP9JurFWKER+oCwv3TCf1A7fmvPb5ehYitpxvzjYSkZfpaTeKUprK8oQe zn5+YE4xCoJALfca/0rXYC+DMMNz8XfLgqQnSV6ltSlb9TPmfKEJv6opLk+ybj9RCqjH p1EMLcthPjb86ffcSshyDRHOEXAsEI5Aom5DwBVm04JAP2d13M6YsmcOLgF9mM95mBrS WO0SxolWiK2YazipIL5Bz3n9A/Q5HUoFZVqIhFUQQogl0efpeGUwrUE2qzKZ6+bwIkMk WIOg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=SmjNrE7Z; 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 v7-20020a5d6787000000b0023678d753bcsi5249399wru.1000.2022.10.26.20.32.15; Wed, 26 Oct 2022 20:32:15 -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=SmjNrE7Z; 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 3A61542BA6; Thu, 27 Oct 2022 05:32:03 +0200 (CEST) Received: from mail-wm1-f46.google.com (mail-wm1-f46.google.com [209.85.128.46]) by mails.dpdk.org (Postfix) with ESMTP id 79BF242B6F for ; Thu, 27 Oct 2022 05:31:59 +0200 (CEST) Received: by mail-wm1-f46.google.com with SMTP id l16-20020a05600c4f1000b003c6c0d2a445so164621wmq.4 for ; Wed, 26 Oct 2022 20:31:59 -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=0f730MI5xFLZu9Gj6VslkDhim9LH5VwH2Yu4k+F9juo=; b=SmjNrE7ZILIQ9DMgixTbkfTTixRTFnxCc33okdzVZZYdVn2c3B1aUmOVvPOdvHltKq vrMwejhKg0Cl5V0tBWDxphTMqizB0VPeowJHZQiWP8+QDByO4YK1q3avLGh2VzEyvPog zM2Io5R+t8UU1gR6GgxTJMj7GMDSoHMm+jRgjfuJ4WyvddMP7gB8atAnEOi0w9Fitv8W cKrMsJxNfgHUIUUfsqAShk7KXNZa/6Aen8+ZtZs2cHq7CAYK2SIVZ1D3AqaCUrKpZMvU vCCDLUjCMdGvpyR4WRdPHtvF3sE+nTmefsrNI7QhRAT12EtAA3v79bAJYFkeDBb78EjG I+Jg== 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=0f730MI5xFLZu9Gj6VslkDhim9LH5VwH2Yu4k+F9juo=; b=kBtdD5gm1U3qqiwGVeGrZrVLMKGXBg1QAtXdYp0SvfDDFuT7v5/oCYn8q0rYf7mwt5 qjgtMyMZtBCyBmJMv+1aZIcLId9paWGcdu4imrDGo4u+isWgoTA2xcCgwfiJkNL2WxEL yhGh/VUrYw7qW2QavMr0+z1A15AMaqvv5J8Yy9ttXXdLlkeHYimcLB5ngSE0WwMEy+HH nKaydr3ICKKLxRbml/bvB22MFd8hAfrMy7S+ppck8EwmqlQU4q/PoQq+i15m3lEvxyYW 05PZrUVeiY8OLcmv3GX9JrxPZ4QVrV1PXMW4fHMTBQu365a0HRBbpgqLFf8LGoxsJyCP hC7g== X-Gm-Message-State: ACrzQf1ART/YEfWPfDRoyJSY2AA5WXbkPZdWPFN0ttBa6pepJHT3vtyK mXDi0IPe7xgOFzcAJp8wlfYrySsOeTxWnPmO X-Received: by 2002:a05:600c:4f55:b0:3ce:ec0c:2a60 with SMTP id m21-20020a05600c4f5500b003ceec0c2a60mr4323281wmq.159.1666841519279; Wed, 26 Oct 2022 20:31:59 -0700 (PDT) Received: from localhost.localdomain ([213.146.143.36]) by smtp.gmail.com with ESMTPSA id c12-20020a05600c0a4c00b003c83465ccbfsm3339220wmq.35.2022.10.26.20.31.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Oct 2022 20:31:58 -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 v7 3/6] crypto/uadk: support enqueue/dequeue operations Date: Thu, 27 Oct 2022 11:25:02 +0800 Message-Id: <20221027032505.1948351-4-zhangfei.gao@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221027032505.1948351-1-zhangfei.gao@linaro.org> References: <20221027032505.1948351-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;