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: 139611 X-Patchwork-Delegate: gakhil@marvell.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 99EAE43EDB; Mon, 22 Apr 2024 16:31:41 +0200 (CEST) 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-Google-Smtp-Source: AGHT+IFihvHJ8D+pzCXKB/AlYawLNFsz6Gmh8oo1omfub80tEX6KHXPr+YZza3cSa46CQysowOI6pw== 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;