From patchwork Mon Apr 22 14:31:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhangfei Gao X-Patchwork-Id: 790965 Delivered-To: patch@linaro.org Received: by 2002:adf:e6ca:0:b0:346:15ad:a2a with SMTP id y10csp2390974wrm; Mon, 22 Apr 2024 07:31:42 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXhsxVZNHaKXoEOOgeZGT91NFkD9RFiIyhcedesElnVhIioN19U1vfsLYAQETKVNmGRTCd5zSAMpfovsSo/9rxO X-Google-Smtp-Source: AGHT+IEgpksunvMKSml5/jfOJ6L9rCdCVL/bCpjOgXVLoCx7Qd5T3tfOiSh0/SDGLezi3/XJr+UN X-Received: by 2002:a5d:4d4b:0:b0:34a:9b75:cb95 with SMTP id a11-20020a5d4d4b000000b0034a9b75cb95mr4266433wru.37.1713796301898; Mon, 22 Apr 2024 07:31:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1713796301; cv=none; d=google.com; s=arc-20160816; b=lfRC5xz+uIe/uoI8k9ajy8habk4USTkRU3/uxoghGFBH36A+QrtKW79A7JRwaOc4qy 3aPnWvvTfqlki05m2O7OkuCrkPZS0dniUAqtiX/0m1lyhi0OK7GqpZg2BUcTi+m+39o9 yVvZYJdgbL0ayUPLE07TM5JAzqdDO0vLgensf3stOwvQ6IO0ZFFrxosJf4YGWsGTx+D8 8xG6a0ZMEY4wcPwSpNqrWCsilo5p3NNZHMArwSPWpyORAlwDFgDCp9rW3279cmg0Cs2R CRUndfJx3xEGJLWYYXbctjCxb/rNKMt3wZmnFOlFfvRXOz8qi8e008+/l+X5Ji/mGQgK ORUQ== 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=Bke7GsIMNdY53LfN2ieTrVMGxeO10Vi7ref4oetuTNQ=; fh=N6ystvY2g7QTpz2QKkAMt/Nu9xETjtRlVAZxgmiIO6M=; b=bfNPnTHwucjq0mtTGkpscK5XhOfSstUl993j0Pu37zSLmAi7EFqzYFzapGLY8Ahkwl hJn3m/A+g4pEz09BHCN7Z2imRJOnBABzN1pk7SnB2yisI9dSLBbUOvbAbP8melbDS8eV wMS4LLwUzGK+Pu5jmwm2qBvL3opUL19+gknsbGjxWBh2DgO1T88URW5agapGp644xKbe eL2HBajkDx3difnMYjK5pk19+Mj4lGaGQW8OCh7U7030WT3CtN4h632tm60dBm1ZtBKg sIwb/phdFS61qgd6hB+ogZ8zSwAmeRbUN2tTokvN7Id/9mZILm4Qmb17rX7gsQ3+bLxd UcBw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=q1eBOl4d; 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 j9-20020adfe509000000b0033cdf3e881csi4789760wrm.1039.2024.04.22.07.31.41; Mon, 22 Apr 2024 07:31:41 -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=q1eBOl4d; 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 mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3E3A040696; Mon, 22 Apr 2024 16:31:25 +0200 (CEST) Received: from mail-pj1-f50.google.com (mail-pj1-f50.google.com [209.85.216.50]) by mails.dpdk.org (Postfix) with ESMTP id 79F8F40648 for ; Mon, 22 Apr 2024 16:31:23 +0200 (CEST) Received: by mail-pj1-f50.google.com with SMTP id 98e67ed59e1d1-2a53b331400so2865740a91.1 for ; Mon, 22 Apr 2024 07:31:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1713796283; x=1714401083; darn=dpdk.org; 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=Bke7GsIMNdY53LfN2ieTrVMGxeO10Vi7ref4oetuTNQ=; b=q1eBOl4dyq9bw/o6Vcxypf/aROBdlUZONFSe2uMZC8AhxpiA2faowg+df259LsBDOl d0+/M/ETWMP1K/9umFkKzWnoN/BlJx/4LYi+8JtNXqQd5VYDRi1QiIVDuyawuzhHslds 6+CW+Gi/KEdt3MlttRyLGh5VJb+Qw0Op/SBoN8167qtBBxoJk0gyu11t/Ve4KyYtXmJM xCXoov60fZNrLbGRgU3qxR4oSRN+Ky0/0oEdl7fbE7PBZJoViUwmdszu31uiDDsHw4P7 KE6lRHav+zk44PGqtDtp3mi7aE54NSImqPhcW3qVtexmfi40YJP/gds2dRy2T5hjfXPV 4fVg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713796283; x=1714401083; 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=Bke7GsIMNdY53LfN2ieTrVMGxeO10Vi7ref4oetuTNQ=; b=SH5Vds8/IlN9IOcGsxAHmu93HAID4wWAf6bt6sM9FoSoybymaUYgVYXyiH8/FebIjc Rq14ZWQLsbNb1W6eqONAUVJSusLGBBcNIKkr3oPc/5N08JwnUGHYQDspTNS+WChYZ5Hh kzh6fMw+tQf3U2CF6aeCGNaARwrKe9cophr6oAwLjFkWcCgS/19jSLQsVnN0FGi8wISu JEu6Ez2+gpj6lXxnsB9eJXlG4PzGuq5y1IltNC4brnQkbposzoaSuN4C3RrkZwFu0Pzl 9cj5DT3S4M1Izq14DHeWFrm0RQ0FOzvXMBazECaQTDGpzPavZ9wGFDTHfRxF44hrcUau zhSQ== X-Gm-Message-State: AOJu0YzoJp3PR+wn73rtsABLftSwzSxcL5ct827b7F1GJVWgcKSY3Oie zPKkaNcHqPq5bUsaY6cgmQ9xZWyvWFa2xrrWdmSgFSH1xI7tRTiCLlzKmIGq/TY= X-Received: by 2002:a17:90a:5d04:b0:2a0:4c3b:2c39 with SMTP id s4-20020a17090a5d0400b002a04c3b2c39mr9829014pji.23.1713796282666; Mon, 22 Apr 2024 07:31:22 -0700 (PDT) Received: from localhost.localdomain ([121.37.54.139]) by smtp.gmail.com with ESMTPSA id v17-20020a17090ad59100b0029c19285192sm9481284pju.44.2024.04.22.07.31.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Apr 2024 07:31:22 -0700 (PDT) From: Zhangfei Gao To: Akhil Goyal , Fan Zhang , Ashish Gupta Cc: dev@dpdk.org, Zhangfei Gao Subject: [PATCH 3/3] compress/uadk: support burst enqueue/dequeue Date: Mon, 22 Apr 2024 14:31:02 +0000 Message-Id: <20240422143102.251-4-zhangfei.gao@linaro.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20240422143102.251-1-zhangfei.gao@linaro.org> References: <20240422143102.251-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 burst enqueue and dequeue operations. Signed-off-by: Zhangfei Gao --- drivers/compress/uadk/uadk_compress_pmd.c | 88 ++++++++++++++++++++++- 1 file changed, 86 insertions(+), 2 deletions(-) diff --git a/drivers/compress/uadk/uadk_compress_pmd.c b/drivers/compress/uadk/uadk_compress_pmd.c index 25858855e6..312aa5c744 100644 --- a/drivers/compress/uadk/uadk_compress_pmd.c +++ b/drivers/compress/uadk/uadk_compress_pmd.c @@ -331,6 +331,90 @@ static struct rte_compressdev_ops uadk_compress_pmd_ops = { .stream_free = NULL, }; +static uint16_t +uadk_compress_pmd_enqueue_burst_sync(void *queue_pair, + struct rte_comp_op **ops, uint16_t nb_ops) +{ + struct uadk_qp *qp = queue_pair; + struct uadk_stream *stream; + struct rte_comp_op *op; + uint16_t enqd = 0; + int i, ret = 0; + + for (i = 0; i < nb_ops; i++) { + op = ops[i]; + + if (op->op_type == RTE_COMP_OP_STATEFUL) { + op->status = RTE_COMP_OP_STATUS_INVALID_ARGS; + } else { + /* process stateless ops */ + stream = (struct uadk_stream *)op->private_xform; + if (stream) { + struct wd_comp_req req = {0}; + uint16_t dst_len = rte_pktmbuf_data_len(op->m_dst); + + req.src = rte_pktmbuf_mtod(op->m_src, uint8_t *); + req.src_len = op->src.length; + req.dst = rte_pktmbuf_mtod(op->m_dst, uint8_t *); + req.dst_len = dst_len; + req.op_type = (enum wd_comp_op_type)stream->type; + req.cb = NULL; + req.data_fmt = WD_FLAT_BUF; + do { + ret = wd_do_comp_sync(stream->handle, &req); + } while (ret == -WD_EBUSY); + + op->consumed += req.src_len; + + if (req.dst_len <= dst_len) { + op->produced += req.dst_len; + op->status = RTE_COMP_OP_STATUS_SUCCESS; + } else { + op->status = RTE_COMP_OP_STATUS_OUT_OF_SPACE_TERMINATED; + } + + if (ret) { + op->status = RTE_COMP_OP_STATUS_ERROR; + break; + } + } else { + op->status = RTE_COMP_OP_STATUS_INVALID_ARGS; + } + } + + /* Whatever is out of op, put it into completion queue with + * its status + */ + if (!ret) + ret = rte_ring_enqueue(qp->processed_pkts, (void *)op); + + if (unlikely(ret)) { + /* increment count if failed to enqueue op */ + qp->qp_stats.enqueue_err_count++; + } else { + qp->qp_stats.enqueued_count++; + enqd++; + } + } + + return enqd; +} + +static uint16_t +uadk_compress_pmd_dequeue_burst_sync(void *queue_pair, + struct rte_comp_op **ops, + uint16_t nb_ops) +{ + struct uadk_qp *qp = queue_pair; + unsigned int nb_dequeued = 0; + + 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_compress_probe(struct rte_vdev_device *vdev) { @@ -358,8 +442,8 @@ uadk_compress_probe(struct rte_vdev_device *vdev) } compressdev->dev_ops = &uadk_compress_pmd_ops; - compressdev->dequeue_burst = NULL; - compressdev->enqueue_burst = NULL; + compressdev->dequeue_burst = uadk_compress_pmd_dequeue_burst_sync; + compressdev->enqueue_burst = uadk_compress_pmd_enqueue_burst_sync; compressdev->feature_flags = RTE_COMPDEV_FF_HW_ACCELERATED; return 0;