From patchwork Sat Oct 8 08:37:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhangfei Gao X-Patchwork-Id: 613385 Delivered-To: patch@linaro.org Received: by 2002:a17:522:c983:b0:460:3032:e3c4 with SMTP id kr3csp765459pvb; Sat, 8 Oct 2022 01:39:05 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6CxSyNf3tZnppGH8JH2X3fmStoNZX0o5zD46EcLvN6X6gEUp3YY7QsK63C1NFT/jIX2xIu X-Received: by 2002:a5d:4889:0:b0:22b:214:38dd with SMTP id g9-20020a5d4889000000b0022b021438ddmr6102304wrq.32.1665218344924; Sat, 08 Oct 2022 01:39:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665218344; cv=none; d=google.com; s=arc-20160816; b=J/J0jllnsUgthkpEZMMvCtSzjg4LB1osNLg8y6Em/PQLh1X2yzf9/7H6jEGtM5piEx gDYlxwDhPUK27hljjbhHeA1datXyJGAp8rrS8Ug/bmMN9yYozhlRWrbQVCph1fiE9uht vHkb9swCPFWz741x5gFrcXTGjfEp3loeozc5jeXwTtVgRTyoxane1T+WgM0Lg3fFBM4b dLdtwuNknAgNZhBDfv+zwivJ/YOgGZZhicleVToJIAL8htXHDCk7XCdZuvnqLOQu66Rc tF4XEld6tgIoZJbwbiUgV9TPY/UJEr1r9YpnHDRxXkpim1Chi9bm4SAsn1bSi5PjM0IM +D2w== 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=qUC9fp0Qoodn7SPutnhJBr1WaHzhjLdGw5PF61Q5RSOXIlGhACzlE7LJxg5yHfCnaU VbM4x4o/BU4uWWZUJnxVwkRkui7KJPA2W0G9LcuiRBMkP2AerU+FDyBFasX1dHwZPAMn LQ/A7K7mY1VdmFcWQ095XWYMJrPZVA++aTiM3okfcT5Isjn9AV8pxWyZAiEnaAcSWMQ/ hmxZ8tZVhFFlNxat1kSYe5YHM/KmfhR6XaH1DDFHSoBaR4HL43kvJvceoVFtXiRwwQ+l WO6sQAt7Fwb8yBI4g3zR81YrM5nuRizwLSdVFruA6IEZHZ59nsYgMWqePKhxOUs2lUXr hRWw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=rW76Ox+f; 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 m2-20020a5d64a2000000b0022ec0279d15si2720434wrp.324.2022.10.08.01.39.04; Sat, 08 Oct 2022 01:39:04 -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=rW76Ox+f; 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 10BB742B98; Sat, 8 Oct 2022 10:39:00 +0200 (CEST) Received: from mail-pf1-f177.google.com (mail-pf1-f177.google.com [209.85.210.177]) by mails.dpdk.org (Postfix) with ESMTP id B9FF942B77 for ; Sat, 8 Oct 2022 10:38:58 +0200 (CEST) Received: by mail-pf1-f177.google.com with SMTP id f140so6821801pfa.1 for ; Sat, 08 Oct 2022 01:38:58 -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=rW76Ox+fChuKe0h4VZZPAwjCUbjoknRtYMJSdviS2+rv6H3Vyb91SV+aWZzQEqQFan OY7m3bl+2VMSspotWHd8oy7CtfQgC75TlQ3v0v600RT7iRORqqbzw2nu5jW1Anmspp5V eyKpn+iI2bIIehhUAw4CUox/lsgFVSwD8cqEJ6rONzTshvnWKONQXRxUyeYG+QgXtje8 Rg0wzgpX8zPJLgyq1t/gw/+lFwlpUIPdUA4XaBZ0xK7QS64WEzkWIEpazrBqwByP/uUy iRaEWiN3e2P3ZDDDskqSanPU05z8zAC2ffq3f3PBuMshHAFK4U076w48rAZtp7+3ESsB DCBg== 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=m658Gnrs0cw2L8QhkrBy8zzORLQ66i+rjDgE9rzqb+qxnOV0QOrrAjbXqveKP/ukZo eukFVJDj1tntvtjrtf9/9WMR5r7x5IOw21ixtJSZuhOmatq/UcyqzL5OsfyGTp1hX6CS sRAI8Hc8Gnb4qW3T5k8KmS5KUmFqhGpO3GtscoUM2KgnWrPJip5VOaoW17NCyvRA6nr0 Zh98OYHniMPRAlVHGQkn9MXEWaIn2KgIUfGlob/hSYQt5lskEZHZvIzVjplmXqMUMBIC MWQ5aSwGxcL6iv6dSckovibQxYANmipayoMVRy/owvUng0hZE2SmCT+mVPoK3owoJhz+ JWbg== X-Gm-Message-State: ACrzQf1ofsNlf1z822cAVi0vPa3cUwa1YsnsaMOaImVhvO8rzNMY1Xh4 CpWcR6dc/s4Odq9WZ4g5bodpFw== X-Received: by 2002:a63:eb11:0:b0:45f:eab4:54fa with SMTP id t17-20020a63eb11000000b0045feab454famr2770443pgh.224.1665218337960; Sat, 08 Oct 2022 01:38:57 -0700 (PDT) Received: from localhost.localdomain ([194.5.48.65]) by smtp.gmail.com with ESMTPSA id n1-20020a17090a2bc100b0020a0571b354sm2644371pje.57.2022.10.08.01.38.54 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 08 Oct 2022 01:38:57 -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 resend v3 3/6] crypto/uadk: support enqueue/dequeue operations Date: Sat, 8 Oct 2022 16:37:44 +0800 Message-Id: <20221008083747.6559-4-zhangfei.gao@linaro.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20221008083747.6559-1-zhangfei.gao@linaro.org> References: <20221008083747.6559-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;