From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id D0357440C5; Sat, 25 May 2024 16:08:27 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 7ADCC4067E; Sat, 25 May 2024 16:08:15 +0200 (CEST) Received: from mail-wm1-f47.google.com (mail-wm1-f47.google.com [209.85.128.47]) by mails.dpdk.org (Postfix) with ESMTP id 95E4D4067C for ; Sat, 25 May 2024 16:08:14 +0200 (CEST) Received: by mail-wm1-f47.google.com with SMTP id 5b1f17b1804b1-4202959b060so70286645e9.2 for ; Sat, 25 May 2024 07:08:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1716646094; x=1717250894; 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=Y1W1pdOkI2cq4ZC1gjw6rGGvn90uMO/AlofvovYWD+M=; b=GvUWOetMDq+RsfDJy/DjTZYjH9XU7MB/3sJQyj2AYzhbxWk0t/I9Go45Rt7ahCPsd0 lFGXFs4PGiLzJu/d1wU8BA3642FeiO7qHJoguV9ASX8rCGDkzs+EkxcULeM14ctHAy/i yVnoDAytbdHl6+jfiGEVXInGaVSM9HX4sDWt5KighGE4FV4b1FFKHfoJqepA6i5RnKS2 KoCE/jhSEw7zzHXHgH2BkWL8Nuzrb6iWTZR42L/ZDAfCwRB6IK1+h1Jo6IvqEopKQwQ3 1VoQE7DLhfeSWqrY13kzpw9hQhW0t2O52trFyHrt3VRDkGgYoam2ol316jc+dvHgfMfo CiWA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716646094; x=1717250894; 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=Y1W1pdOkI2cq4ZC1gjw6rGGvn90uMO/AlofvovYWD+M=; b=XcWRqZ3ZJeMzTURlbP3qkDfFvxJM3580d63Y/Tmqv/0HwWZlmUezV5TYXgIuE+NnLj oq7yfZCliSFLdOwN1uBWAAg3BKK8oi/6PzBsisr5rtqGLuKNUfDabzslpSyngvGn1tLO pUtYGhkDV3FyqzXytzzjC/yNHXwDsNPKiSTGdpsc13qZAFuw+5aDiLUmE5wi0svBX7dY 9nRbcW7MlEA/MpcCllwAejh33N4zG2M5litnN+FM4G/dbqTdXwiHr3Btd4HR22jOVGTA HLVXRyzfiK2UonUmHm35momKgKXAkt+g7XcL7iqIntzvxtwq69k6jZ/+FSJ8NGuMeOL8 Rqiw== X-Gm-Message-State: AOJu0YzU/b1dgmma3tFZRvvnZjCYrz0JqFSK+YXl0J/an9oA37TF7yG6 JqYMZ/K+oZueK5b9pVfJ9EhIlD8IaQI6rGrZfzsszgJnN01q5ZnvLeDuMfElpIo= X-Google-Smtp-Source: AGHT+IH+Y8AAZu9m2LAdX1T+DYwwboUVD7k+CXsxyer/+BAAUIUwmcDcKGzVS0IkxnM+zpjC/8Zwug== X-Received: by 2002:a05:600c:584c:b0:41c:f64:2f5 with SMTP id 5b1f17b1804b1-42108a0bb54mr39484975e9.36.1716646094184; Sat, 25 May 2024 07:08:14 -0700 (PDT) Received: from localhost.localdomain (ec2-54-151-66-232.us-west-1.compute.amazonaws.com. [54.151.66.232]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42100f134cesm81969625e9.18.2024.05.25.07.08.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 25 May 2024 07:08:13 -0700 (PDT) From: Zhangfei Gao To: Akhil Goyal , Fan Zhang , Ashish Gupta Cc: dev@dpdk.org, Zhangfei Gao Subject: [PATCH v2 3/3] compress/uadk: support burst enqueue/dequeue Date: Sat, 25 May 2024 14:07:53 +0000 Message-Id: <20240525140753.122-4-zhangfei.gao@linaro.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20240525140753.122-1-zhangfei.gao@linaro.org> References: <20240525140753.122-1-zhangfei.gao@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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, and adds compressdev uadk info to doc Signed-off-by: Zhangfei Gao --- MAINTAINERS | 6 ++ doc/guides/compressdevs/index.rst | 1 + doc/guides/compressdevs/uadk.rst | 98 +++++++++++++++++++++++ doc/guides/rel_notes/release_24_07.rst | 5 ++ drivers/compress/uadk/uadk_compress_pmd.c | 88 +++++++++++++++++++- 5 files changed, 196 insertions(+), 2 deletions(-) create mode 100644 doc/guides/compressdevs/uadk.rst diff --git a/MAINTAINERS b/MAINTAINERS index c9adff9846..8e541d23e5 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1213,6 +1213,12 @@ F: drivers/compress/octeontx/ F: doc/guides/compressdevs/octeontx.rst F: doc/guides/compressdevs/features/octeontx.ini +HiSilicon UADK compress +M: Zhangfei Gao +F: drivers/compress/uadk/ +F: doc/guides/compressdevs/uadk.rst +F: doc/guides/compressdevs/features/uadk.ini + Intel QuickAssist M: Kai Ji F: drivers/compress/qat/ diff --git a/doc/guides/compressdevs/index.rst b/doc/guides/compressdevs/index.rst index 849f211688..87ed4f72a4 100644 --- a/doc/guides/compressdevs/index.rst +++ b/doc/guides/compressdevs/index.rst @@ -15,4 +15,5 @@ Compression Device Drivers nitrox octeontx qat_comp + uadk zlib diff --git a/doc/guides/compressdevs/uadk.rst b/doc/guides/compressdevs/uadk.rst new file mode 100644 index 0000000000..7e7f9f2548 --- /dev/null +++ b/doc/guides/compressdevs/uadk.rst @@ -0,0 +1,98 @@ +.. SPDX-License-Identifier: BSD-3-Clause + Copyright 2024-2025 Huawei Technologies Co.,Ltd. All rights reserved. + Copyright 2024-2025 Linaro ltd. + +UADK Compression Poll Mode Driver +================================= + +UADK compression PMD provides poll mode compression & decompression driver +All compression operations are using UADK library compression API, which is +algorithm-level API, abstracting accelerators' low-level implementations. + +UADK compression PMD relies on `UADK library `_. + +UADK is a framework for user applications to access hardware accelerators. +UADK relies on IOMMU SVA (Shared Virtual Address) feature, +which shares the same page table between IOMMU and MMU. +As a result, the user application can directly use the virtual address for +device DMA, which enhances performance as well as easy usability. + + +Features +-------- + +UADK compression PMD has support for: + +Compression/Decompression algorithm: + + * DEFLATE - using Fixed and Dynamic Huffman encoding + +Window size support: + + * 32K + + +Test steps +---------- + +#. Build UADK + + .. code-block:: console + + git clone https://github.com/Linaro/uadk.git + cd uadk + mkdir build + ./autogen.sh + ./configure --prefix=$PWD/build + make + make install + + .. note:: + + Without ``--prefix``, UADK will be installed to ``/usr/local/lib`` by default. + + .. note:: + + If get error: "cannot find -lnuma", please install the libnuma-dev. + +#. Run pkg-config libwd to ensure env is setup correctly + + .. code-block:: console + + export PKG_CONFIG_PATH=$PWD/build/lib/pkgconfig + pkg-config libwd --cflags --libs -I/usr/local/include -L/usr/local/lib -lwd + + .. note:: + + export ``PKG_CONFIG_PATH`` is required on demand, + not needed if UADK is installed to ``/usr/local/lib``. + +#. Build DPDK + + .. code-block:: console + + cd dpdk + mkdir build + meson setup build (--reconfigure) + cd build + ninja + sudo ninja install + +#. Prepare hugepages for DPDK (see also :doc:`../tools/hugepages`) + + .. code-block:: console + + echo 1024 > /sys/devices/system/node/node0/hugepages/hugepages-2048kB/nr_hugepages + echo 1024 > /sys/devices/system/node/node1/hugepages/hugepages-2048kB/nr_hugepages + echo 1024 > /sys/devices/system/node/node2/hugepages/hugepages-2048kB/nr_hugepages + echo 1024 > /sys/devices/system/node/node3/hugepages/hugepages-2048kB/nr_hugepages + mkdir -p /mnt/huge_2mb + mount -t hugetlbfs none /mnt/huge_2mb -o pagesize=2MB + +#. Run test app + + .. code-block:: console + + sudo dpdk-test --vdev=compress_uadk + RTE>>compressdev_autotest + RTE>>quit diff --git a/doc/guides/rel_notes/release_24_07.rst b/doc/guides/rel_notes/release_24_07.rst index a69f24cf99..a7574045f0 100644 --- a/doc/guides/rel_notes/release_24_07.rst +++ b/doc/guides/rel_notes/release_24_07.rst @@ -24,6 +24,11 @@ DPDK Release 24.07 New Features ------------ +* **Added UADK compress driver.** + + Added a new compress driver for the UADK library. See the + :doc:`../compressdevs/uadk` guide for more details on this new driver. + .. This section should contain new features added in this release. Sample format: diff --git a/drivers/compress/uadk/uadk_compress_pmd.c b/drivers/compress/uadk/uadk_compress_pmd.c index 9e2dc3e308..1f4c4cfd00 100644 --- a/drivers/compress/uadk/uadk_compress_pmd.c +++ b/drivers/compress/uadk/uadk_compress_pmd.c @@ -291,6 +291,90 @@ static struct rte_compressdev_ops uadk_compress_pmd_ops = { .private_xform_free = uadk_compress_pmd_xform_free, }; +static uint16_t +uadk_compress_pmd_enqueue_burst_sync(void *queue_pair, + struct rte_comp_op **ops, uint16_t nb_ops) +{ + struct uadk_compress_qp *qp = queue_pair; + struct uadk_compress_xform *xform; + 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 */ + xform = op->private_xform; + if (xform) { + 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)xform->type; + req.cb = NULL; + req.data_fmt = WD_FLAT_BUF; + do { + ret = wd_do_comp_sync(xform->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_compress_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) { @@ -318,8 +402,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; -- 2.25.1