From patchwork Tue Jun 11 07:07:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhangfei Gao X-Patchwork-Id: 803237 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:e87:b0:35b:5a80:51b4 with SMTP id dz7csp169032wrb; Tue, 11 Jun 2024 00:08:53 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVVfouYK9LLzeB7nMp/xsqAtuMdrE5VlB6sSC6FNkZKbm8gyin4zx8F9E8ainscqQX1++6bwpEtgDejLDW8E5nW X-Google-Smtp-Source: AGHT+IHFj6QZk1wqQgGI33Gdi2Uv5+ZOO1X37T2A2t4otX5+13nN0LDZKB6zKlIyyQFijm/afrKM X-Received: by 2002:a19:ee12:0:b0:52c:8508:464d with SMTP id 2adb3069b0e04-52c850846cfmr3084735e87.55.1718089733449; Tue, 11 Jun 2024 00:08:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1718089733; cv=none; d=google.com; s=arc-20160816; b=wshEj6JaYYfxj5iPrzT0GdckRfaTtLKqlFKSyPvmXeMJnnVRxqOLITeF2y3Bduz8aN O5lINGdSluA4BgQztZyOOzVS3NxQBoVaAgzcCY1uVXpqS0I+cWghf5PBuhdDWdcciQYu Qb7+a4n32d/8no9QG9PJuVRsLNqkbqYmKnB/XXhbWou2KyO+JGlM6UDmUiSkMbkI3bJK Z+TZHOHheWRDvcdDBfRsWJBznkYgE9L2Wg+LeDT7xEbRcJFxTnwXR+gLrKmNVQ3QuTbm xLbci5jfi0AgTBjMFiY5Bq2oAiVXv5a/4SQRP9fnPiu+HrpJEVbLab4B5LmZIyz+3QXJ mTww== 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=WnDkHryYS7OZAWuONVs5cjf1tJG4Y4FcB+r1DfivWCU=; fh=N6ystvY2g7QTpz2QKkAMt/Nu9xETjtRlVAZxgmiIO6M=; b=zvGKzfEIpVulhnado9H+sv8nNlOwx0UlHEO/k/hZqsfj4vXLOw8M2ftIhcsm65HWGG W5ACqLSR4QYuV+Ag8jVFbJd2POlSduFw1ZWaFgn1drYF1unO6P+dCopQiw+dz/80BqBk EtaQ6bdG2U4G3B9EcvOpaImsvu0mmKrKXB41oFi7LlCaPWS4JOmCwvjM5EybJlILjePF 9OZ99VCZ9IJofWOX6Vg5I+uS9QHAQUM8YO2o6K4a0P1Gi91RGx2BvCIBHnUXkPTFC3in 89LcfSH5EtVofoqfOuvJuSU28/9oI36uclE8bbJl6I5PisyjeGC9wjGMv93SR5ooiS91 sOpw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=rgeXh1Pt; 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 ffacd0b85a97d-35f1b0bbb3csi3639247f8f.1004.2024.06.11.00.08.53; Tue, 11 Jun 2024 00:08:53 -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=rgeXh1Pt; 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 4D3BC4067C; Tue, 11 Jun 2024 09:08:51 +0200 (CEST) Received: from mail-pg1-f171.google.com (mail-pg1-f171.google.com [209.85.215.171]) by mails.dpdk.org (Postfix) with ESMTP id 25119400D6 for ; Tue, 11 Jun 2024 09:08:50 +0200 (CEST) Received: by mail-pg1-f171.google.com with SMTP id 41be03b00d2f7-656d8b346d2so3708198a12.2 for ; Tue, 11 Jun 2024 00:08:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1718089729; x=1718694529; 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=WnDkHryYS7OZAWuONVs5cjf1tJG4Y4FcB+r1DfivWCU=; b=rgeXh1PtYNMgTbFZ+kgE/O9WNUcsKy2LVfh4oP6lxdNrAQpqFGZ3wOH07zJvL8oEjo 65cSByX78Il56ofimcaV0Axd39FUYOyyjtQ6yapXZZVlGU8HIDT+2xB2N91Vw0ExMEkN MuRK52fTe8qURodeqkzPcmulN6jOdrQ0SBs++wvDiZsnbUez/2hTi81HZdYWU90ohB+c H6cAgvlY0NE8UMKppSoZHlVfasQ/oowibk+T3i33Pq+a0v76a2ypgGmhOPFv98I/HIwZ 8XvhNsrG82N1Lro+ufVZGg/qMl6m0lVbPUzUdO3mAV5lRP2MsbCRCAG6ybZ3PSCNbgot 55bA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718089729; x=1718694529; 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=WnDkHryYS7OZAWuONVs5cjf1tJG4Y4FcB+r1DfivWCU=; b=hvQjv5IxWNIIsmgIesURoF1UcdTQky1NSQksk9pZUJIySEzl0451XqtN1BZOxjaVZC CNVXiXjtfARwyfmDyJD4egLASUbWq+hH7Tnp+18c3caQQIGOmavZPxb7iW4FWjvcJdFR SaIdPA3nysjhxjeWVl1UVv6sAXXY5BjkvxRi6ovz5/hORxcXBLdTycClnGSKMUj1FFJX JlbzTqEVp8Gofqpzef4ffxWIrE0R33/S4My2NN4d7xDXUHqyC0gQJ3A7kXAiXr5MMSBB PbXs+mkNYmdQzlYG8SCrcRY6X0Imkp1oBUEPiKNOv7A4PTmdV388o7LyFZnSjjn3VTrK tBSQ== X-Gm-Message-State: AOJu0Yx09aRKODjuczQYL1zg3cBoekRR3UeCaNvseZDoeY77fk0Dczs7 QySZSsqDC2kIFYIQBuo5vnB3EnRI6hxrIoLPTyB0T2dlpQcXntitqozlvo6nHec= X-Received: by 2002:a05:6a20:3c8f:b0:1b5:e80d:2fd2 with SMTP id adf61e73a8af0-1b5e80d34a8mr5350220637.46.1718089729003; Tue, 11 Jun 2024 00:08:49 -0700 (PDT) Received: from localhost.localdomain (ec2-52-53-61-205.us-west-1.compute.amazonaws.com. [52.53.61.205]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-705ad947cdasm550945b3a.42.2024.06.11.00.08.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Jun 2024 00:08:48 -0700 (PDT) From: Zhangfei Gao To: Akhil Goyal , Fan Zhang , Ashish Gupta Cc: dev@dpdk.org, Zhangfei Gao Subject: [PATCH v3 1/3] compress/uadk: Introduce UADK compression driver Date: Tue, 11 Jun 2024 07:07:24 +0000 Message-Id: <20240611070726.468-2-zhangfei.gao@linaro.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20240611070726.468-1-zhangfei.gao@linaro.org> References: <20240611070726.468-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 Introduce a new compression & decompression PMD for hardware accelerators based on UADK [1]. 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. Thereby user application can directly use the virtual address for the device DMA, which enhances the performance as well as easy usability. This patch adds the basic framework. [1] https://github.com/Linaro/uadk Signed-off-by: Zhangfei Gao --- MAINTAINERS | 6 ++ doc/guides/compressdevs/features/uadk.ini | 11 +++ doc/guides/compressdevs/index.rst | 1 + doc/guides/compressdevs/uadk.rst | 79 +++++++++++++++++++ drivers/compress/meson.build | 1 + drivers/compress/uadk/meson.build | 30 +++++++ drivers/compress/uadk/uadk_compress_pmd.c | 75 ++++++++++++++++++ .../compress/uadk/uadk_compress_pmd_private.h | 20 +++++ 8 files changed, 223 insertions(+) create mode 100644 doc/guides/compressdevs/features/uadk.ini create mode 100644 doc/guides/compressdevs/uadk.rst create mode 100644 drivers/compress/uadk/meson.build create mode 100644 drivers/compress/uadk/uadk_compress_pmd.c create mode 100644 drivers/compress/uadk/uadk_compress_pmd_private.h 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/features/uadk.ini b/doc/guides/compressdevs/features/uadk.ini new file mode 100644 index 0000000000..0bbdb6c5cf --- /dev/null +++ b/doc/guides/compressdevs/features/uadk.ini @@ -0,0 +1,11 @@ +; +; Refer to default.ini for the full list of available PMD features. +; +; Supported features of 'uadk' compression driver. +; +[Features] +HW Accelerated = Y +Deflate = Y +Crc32 = N +Fixed = Y +Dynamic = Y 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..02fa3c7667 --- /dev/null +++ b/doc/guides/compressdevs/uadk.rst @@ -0,0 +1,79 @@ +.. 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 diff --git a/drivers/compress/meson.build b/drivers/compress/meson.build index b91195b27d..91d7800a4a 100644 --- a/drivers/compress/meson.build +++ b/drivers/compress/meson.build @@ -10,6 +10,7 @@ drivers = [ 'mlx5', 'nitrox', 'octeontx', + 'uadk', 'zlib', ] diff --git a/drivers/compress/uadk/meson.build b/drivers/compress/uadk/meson.build new file mode 100644 index 0000000000..704833bbcf --- /dev/null +++ b/drivers/compress/uadk/meson.build @@ -0,0 +1,30 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright 2024-2025 Huawei Technologies Co.,Ltd. All rights reserved. +# Copyright 2024-2025 Linaro ltd. + +if not is_linux + build = false + reason = 'only supported on Linux' + subdir_done() +endif + +sources = files( + 'uadk_compress_pmd.c', +) + +deps += 'bus_vdev' +dep = dependency('libwd_comp', required: false, method: 'pkg-config') +if not dep.found() + build = false + reason = 'missing dependency, "libwd_comp"' +else + ext_deps += dep +endif + +dep = dependency('libwd', required: false, method: 'pkg-config') +if not dep.found() + build = false + reason = 'missing dependency, "libwd"' +else + ext_deps += dep +endif diff --git a/drivers/compress/uadk/uadk_compress_pmd.c b/drivers/compress/uadk/uadk_compress_pmd.c new file mode 100644 index 0000000000..6ffc22a0d2 --- /dev/null +++ b/drivers/compress/uadk/uadk_compress_pmd.c @@ -0,0 +1,75 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright 2024-2025 Huawei Technologies Co.,Ltd. All rights reserved. + * Copyright 2024-2025 Linaro ltd. + */ + +#include +#include +#include + +#include +#include + +#include "uadk_compress_pmd_private.h" + +static struct rte_compressdev_ops uadk_compress_pmd_ops; + +static int +uadk_compress_probe(struct rte_vdev_device *vdev) +{ + struct rte_compressdev_pmd_init_params init_params = { + "", + rte_socket_id(), + }; + struct rte_compressdev *compressdev; + struct uacce_dev *udev; + const char *name; + + udev = wd_get_accel_dev("deflate"); + if (!udev) + return -ENODEV; + + name = rte_vdev_device_name(vdev); + if (name == NULL) + return -EINVAL; + + compressdev = rte_compressdev_pmd_create(name, &vdev->device, + sizeof(struct uadk_compress_priv), &init_params); + if (compressdev == NULL) { + UADK_LOG(ERR, "driver %s: create failed", init_params.name); + return -ENODEV; + } + + compressdev->dev_ops = &uadk_compress_pmd_ops; + compressdev->dequeue_burst = NULL; + compressdev->enqueue_burst = NULL; + compressdev->feature_flags = RTE_COMPDEV_FF_HW_ACCELERATED; + + return 0; +} + +static int +uadk_compress_remove(struct rte_vdev_device *vdev) +{ + struct rte_compressdev *compressdev; + const char *name; + + name = rte_vdev_device_name(vdev); + if (name == NULL) + return -EINVAL; + + compressdev = rte_compressdev_pmd_get_named_dev(name); + if (compressdev == NULL) + return -ENODEV; + + return rte_compressdev_pmd_destroy(compressdev); +} + +static struct rte_vdev_driver uadk_compress_pmd = { + .probe = uadk_compress_probe, + .remove = uadk_compress_remove, +}; + +#define UADK_COMPRESS_DRIVER_NAME compress_uadk +RTE_PMD_REGISTER_VDEV(UADK_COMPRESS_DRIVER_NAME, uadk_compress_pmd); +RTE_LOG_REGISTER_DEFAULT(uadk_compress_logtype, INFO); diff --git a/drivers/compress/uadk/uadk_compress_pmd_private.h b/drivers/compress/uadk/uadk_compress_pmd_private.h new file mode 100644 index 0000000000..88e9075619 --- /dev/null +++ b/drivers/compress/uadk/uadk_compress_pmd_private.h @@ -0,0 +1,20 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright 2024-2025 Huawei Technologies Co.,Ltd. All rights reserved. + * Copyright 2024-2025 Linaro ltd. + */ + +#ifndef _UADK_COMPRESS_PMD_PRIVATE_H_ +#define _UADK_COMPRESS_PMD_PRIVATE_H_ + +struct uadk_compress_priv { + bool env_init; +}; + +extern int uadk_compress_logtype; + +#define UADK_LOG(level, fmt, ...) \ + rte_log(RTE_LOG_ ## level, uadk_compress_logtype, \ + "%s() line %u: " fmt "\n", __func__, __LINE__, \ + ## __VA_ARGS__) + +#endif /* _UADK_COMPRESS_PMD_PRIVATE_H_ */ From patchwork Tue Jun 11 07:07:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhangfei Gao X-Patchwork-Id: 803238 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:e87:b0:35b:5a80:51b4 with SMTP id dz7csp169068wrb; Tue, 11 Jun 2024 00:09:02 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCV7W8pquj25ptuslSAcxAjOlLL3h33Wu9EyZBujBJXNJGJa/VFPa3Agio++ID/71jfxnhx7GEGiAQyu+9qKo/s8 X-Google-Smtp-Source: AGHT+IFkpg/UOkWVSoCl09K1XqIsX3BszKlnVvQuvYZutrui8GCr0s8CXb9Iq+vEehR7/SL4Kyqs X-Received: by 2002:ac2:4a99:0:b0:523:8cd3:42cb with SMTP id 2adb3069b0e04-52bb9f5e253mr6869078e87.7.1718089742439; Tue, 11 Jun 2024 00:09:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1718089742; cv=none; d=google.com; s=arc-20160816; b=bRTDka1UAOxfrsbJzMyjh9yuQQw5F/ylsscPcTF4XjzCdX2QMUGFkSgTRUV+syc+44 gA34QByBRmFE+8k79efjS7d7lSGN+bdPPOUDvxtZFysmQIG9cj/JOt1v35DklB1KyjL9 9ZIYU3eSaPwq4OIdR+f6oynAOJfRFcK6gBEDmz2rjCY7orpDvmlpjubWVPnQq3AlOn7K jMrYUUK1X2wfAaGZ2pnbk+VYJGb5DDLdXKb+8DpY6Ma3SwhXZIRkx22w99NsWrWFNobM ylM6j7z++okL+nxBm/nNIBTQ+X8muR+9GLyhzfNER/veeUuCNjcyG+nvDHPjqu/zUb1+ 18CA== 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=sm3l/A7A+MGqFfZLROrr+MRGIRiu0XmWtLbP+TZPeQc=; fh=N6ystvY2g7QTpz2QKkAMt/Nu9xETjtRlVAZxgmiIO6M=; b=i3e0oRkWyH/o/YlncnvGI8YKjXyRHmaZj1Z/0IX+0kBZHp7wR7xinJ9GVOMNw0EjH6 iWR32Hvuf9fA1OHYBNGYTsWCHA9TFlMR0TSRiJ1Bh5aEiIdIbUh+Ep+LVWLb7RB7oPFu rkpc992Hp80X7RxgdaYsBCvwTQy/tCWDBBB8DOKqo9PkSYBqH7CvrxE0KHWMUVbFDRp6 WtELbwtUSJMjSuiOO2VTBQkkd7LlB4B24YNam65n9idCT+qvtC3dTmGAzqfTOTJ7e9nD vc47329IDtvl2Gjb88UGqJ0x5nBrURswpvf2TUN/YkiV1yJbf4v+scyqCdHa+O7BlJuc g+Lw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=eoaB7xV2; 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 ffacd0b85a97d-35ef5d0969bsi6680818f8f.220.2024.06.11.00.09.02; Tue, 11 Jun 2024 00:09:02 -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=eoaB7xV2; 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 0A06C40695; Tue, 11 Jun 2024 09:08:56 +0200 (CEST) Received: from mail-pg1-f178.google.com (mail-pg1-f178.google.com [209.85.215.178]) by mails.dpdk.org (Postfix) with ESMTP id 55F7140678 for ; Tue, 11 Jun 2024 09:08:54 +0200 (CEST) Received: by mail-pg1-f178.google.com with SMTP id 41be03b00d2f7-656d8b346d2so3708247a12.2 for ; Tue, 11 Jun 2024 00:08:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1718089733; x=1718694533; 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=sm3l/A7A+MGqFfZLROrr+MRGIRiu0XmWtLbP+TZPeQc=; b=eoaB7xV22m1zBlpKjksgIlg+/gB7z3zbY1NMrAacokuGb77JbwB2WCtR6/pqNDSDL3 rZtXQAyR05KHwtHbYSfVI+Ty/nWkwBP/DX8AAEi1pG8sK2dZ6HSE8+R8sMqeIkYaBCQa D1P/psNEuHTVc9uj/LUFO5SnjrYD26n/l1eG51wS8SjreFfJzFIIofEhut7ATXp7wZWJ /EvobTCsxPVJKS1Ln7fyWTjRTIituGmZKtepCCnOcIPJo1rKgDEeM3pI5qRnDvM4FJsF KZdRnCWGeWHGwNSMYg7EccOTp4k5RIh9HdRmQ1XZc2ggsTgICvds03oVRfBz2Zb7lkV9 t2oQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718089733; x=1718694533; 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=sm3l/A7A+MGqFfZLROrr+MRGIRiu0XmWtLbP+TZPeQc=; b=owJ3ET33eOkdIGGbN6/CCD3OSuS7hGQvGAnsLSSPflhE1NA6pY1NW2VkmhmR0JKqZT IX1QqiNihStH2cznVGGzSuzRi0uZVeJC8AO0EcV2vZf5Eu88Ye+va52es2GyruoRk30e KGqhazPl5mwK+wq8MWv5e2IHqFSct7/JgtHrmWZBDqoHoTAwKLsurvWrgBMb0WTNBJlc SuK+Y0nxsoYhnSD2tXb2nGAD3aH3/+FHf0fOajPcAtGnZCKnWBCCQZM8HjgNAUvCrnku n4hZdNzPNe3cCEOJmgNUqGUPcSskOkplRUA0fHH2le874IXMfavp3Lux4SoPf1mOI5VZ /WLw== X-Gm-Message-State: AOJu0YwOG9JEdV3utJWDVH575z8n5CixZ4Eq6NKtg+CoVrGZGfwui5RI ma/b8jPYEhMflHD+5vo9pefe4UaT0cq3rmwehSYc8P57ZQ4ZfXtN569rKNDERv8= X-Received: by 2002:a05:6a20:3c86:b0:1b7:175a:6756 with SMTP id adf61e73a8af0-1b71769bb95mr5019584637.50.1718089733291; Tue, 11 Jun 2024 00:08:53 -0700 (PDT) Received: from localhost.localdomain (ec2-52-53-61-205.us-west-1.compute.amazonaws.com. [52.53.61.205]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-705ad947cdasm550945b3a.42.2024.06.11.00.08.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Jun 2024 00:08:52 -0700 (PDT) From: Zhangfei Gao To: Akhil Goyal , Fan Zhang , Ashish Gupta Cc: dev@dpdk.org, Zhangfei Gao Subject: [PATCH v3 2/3] compress/uadk: support basic operations Date: Tue, 11 Jun 2024 07:07:25 +0000 Message-Id: <20240611070726.468-3-zhangfei.gao@linaro.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20240611070726.468-1-zhangfei.gao@linaro.org> References: <20240611070726.468-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 Support the basic dev control operations: configure, close, start, stop, infos_get, and queue pairs operations, etc. Signed-off-by: Zhangfei Gao --- drivers/compress/uadk/uadk_compress_pmd.c | 279 +++++++++++++++++- .../compress/uadk/uadk_compress_pmd_private.h | 16 + 2 files changed, 294 insertions(+), 1 deletion(-) diff --git a/drivers/compress/uadk/uadk_compress_pmd.c b/drivers/compress/uadk/uadk_compress_pmd.c index 6ffc22a0d2..9e2dc3e308 100644 --- a/drivers/compress/uadk/uadk_compress_pmd.c +++ b/drivers/compress/uadk/uadk_compress_pmd.c @@ -12,7 +12,284 @@ #include "uadk_compress_pmd_private.h" -static struct rte_compressdev_ops uadk_compress_pmd_ops; +static const struct +rte_compressdev_capabilities uadk_compress_pmd_capabilities[] = { + { /* Deflate */ + .algo = RTE_COMP_ALGO_DEFLATE, + .comp_feature_flags = RTE_COMP_FF_SHAREABLE_PRIV_XFORM | + RTE_COMP_FF_HUFFMAN_FIXED | + RTE_COMP_FF_HUFFMAN_DYNAMIC, + }, + + RTE_COMP_END_OF_CAPABILITIES_LIST() +}; + +static int +uadk_compress_pmd_config(struct rte_compressdev *dev, + struct rte_compressdev_config *config __rte_unused) +{ + struct uadk_compress_priv *priv = dev->data->dev_private; + int ret; + + if (!priv->env_init) { + ret = wd_comp_env_init(NULL); + if (ret < 0) + return -EINVAL; + priv->env_init = true; + } + + return 0; +} + +static int +uadk_compress_pmd_start(struct rte_compressdev *dev __rte_unused) +{ + return 0; +} + +static void +uadk_compress_pmd_stop(struct rte_compressdev *dev __rte_unused) +{ +} + +static int +uadk_compress_pmd_close(struct rte_compressdev *dev) +{ + struct uadk_compress_priv *priv = dev->data->dev_private; + + if (priv->env_init) { + wd_comp_env_uninit(); + priv->env_init = false; + } + + return 0; +} + +static void +uadk_compress_pmd_stats_get(struct rte_compressdev *dev, + struct rte_compressdev_stats *stats) +{ + int qp_id; + + for (qp_id = 0; qp_id < dev->data->nb_queue_pairs; qp_id++) { + struct uadk_compress_qp *qp = dev->data->queue_pairs[qp_id]; + + stats->enqueued_count += qp->qp_stats.enqueued_count; + stats->dequeued_count += qp->qp_stats.dequeued_count; + stats->enqueue_err_count += qp->qp_stats.enqueue_err_count; + stats->dequeue_err_count += qp->qp_stats.dequeue_err_count; + } +} + +static void +uadk_compress_pmd_stats_reset(struct rte_compressdev *dev) +{ + int qp_id; + + for (qp_id = 0; qp_id < dev->data->nb_queue_pairs; qp_id++) { + struct uadk_compress_qp *qp = dev->data->queue_pairs[qp_id]; + + memset(&qp->qp_stats, 0, sizeof(qp->qp_stats)); + } +} + +static void +uadk_compress_pmd_info_get(struct rte_compressdev *dev, + struct rte_compressdev_info *dev_info) +{ + if (dev_info != NULL) { + dev_info->driver_name = dev->device->driver->name; + dev_info->feature_flags = dev->feature_flags; + dev_info->capabilities = uadk_compress_pmd_capabilities; + } +} + +static int +uadk_compress_pmd_qp_release(struct rte_compressdev *dev, uint16_t qp_id) +{ + struct uadk_compress_qp *qp = dev->data->queue_pairs[qp_id]; + + if (qp != NULL) { + rte_ring_free(qp->processed_pkts); + rte_free(qp); + dev->data->queue_pairs[qp_id] = NULL; + } + + return 0; +} + +static int +uadk_pmd_qp_set_unique_name(struct rte_compressdev *dev, + struct uadk_compress_qp *qp) +{ + unsigned int n = snprintf(qp->name, sizeof(qp->name), + "uadk_pmd_%u_qp_%u", + dev->data->dev_id, qp->id); + + if (n >= sizeof(qp->name)) + return -EINVAL; + + return 0; +} + +static struct rte_ring * +uadk_pmd_qp_create_processed_pkts_ring(struct uadk_compress_qp *qp, + unsigned int ring_size, int socket_id) +{ + struct rte_ring *r = qp->processed_pkts; + + if (r) { + if (rte_ring_get_size(r) >= ring_size) { + UADK_LOG(INFO, "Reusing existing ring %s for processed packets", + qp->name); + return r; + } + + UADK_LOG(ERR, "Unable to reuse existing ring %s for processed packets", + qp->name); + return NULL; + } + + return rte_ring_create(qp->name, ring_size, socket_id, + RING_F_EXACT_SZ); +} + +static int +uadk_compress_pmd_qp_setup(struct rte_compressdev *dev, uint16_t qp_id, + uint32_t max_inflight_ops, int socket_id) +{ + struct uadk_compress_qp *qp = NULL; + + /* Free memory prior to re-allocation if needed. */ + if (dev->data->queue_pairs[qp_id] != NULL) + uadk_compress_pmd_qp_release(dev, qp_id); + + /* Allocate the queue pair data structure. */ + qp = rte_zmalloc_socket("uadk PMD Queue Pair", sizeof(*qp), + RTE_CACHE_LINE_SIZE, socket_id); + if (qp == NULL) + return (-ENOMEM); + + qp->id = qp_id; + dev->data->queue_pairs[qp_id] = qp; + + if (uadk_pmd_qp_set_unique_name(dev, qp)) + goto qp_setup_cleanup; + + qp->processed_pkts = uadk_pmd_qp_create_processed_pkts_ring(qp, + max_inflight_ops, socket_id); + if (qp->processed_pkts == NULL) + goto qp_setup_cleanup; + + memset(&qp->qp_stats, 0, sizeof(qp->qp_stats)); + + return 0; + +qp_setup_cleanup: + if (qp) { + rte_free(qp); + qp = NULL; + } + return -EINVAL; +} + +static int +uadk_compress_pmd_xform_create(struct rte_compressdev *dev __rte_unused, + const struct rte_comp_xform *xform, + void **private_xform) +{ + struct wd_comp_sess_setup setup = {0}; + struct sched_params param = {0}; + struct uadk_compress_xform *xfrm; + handle_t handle; + + if (xform == NULL) { + UADK_LOG(ERR, "invalid xform struct"); + return -EINVAL; + } + + xfrm = rte_malloc(NULL, sizeof(struct uadk_compress_xform), 0); + if (xfrm == NULL) + return -ENOMEM; + + switch (xform->type) { + case RTE_COMP_COMPRESS: + switch (xform->compress.algo) { + case RTE_COMP_ALGO_NULL: + break; + case RTE_COMP_ALGO_DEFLATE: + setup.alg_type = WD_DEFLATE; + setup.win_sz = WD_COMP_WS_8K; + setup.comp_lv = WD_COMP_L8; + setup.op_type = WD_DIR_COMPRESS; + param.type = setup.op_type; + param.numa_id = -1; /* choose nearby numa node */ + setup.sched_param = ¶m; + break; + default: + goto err; + } + break; + case RTE_COMP_DECOMPRESS: + switch (xform->decompress.algo) { + case RTE_COMP_ALGO_NULL: + break; + case RTE_COMP_ALGO_DEFLATE: + setup.alg_type = WD_DEFLATE; + setup.comp_lv = WD_COMP_L8; + setup.op_type = WD_DIR_DECOMPRESS; + param.type = setup.op_type; + param.numa_id = -1; /* choose nearby numa node */ + setup.sched_param = ¶m; + break; + default: + goto err; + } + break; + default: + UADK_LOG(ERR, "Algorithm %u is not supported.", xform->type); + goto err; + } + + handle = wd_comp_alloc_sess(&setup); + if (!handle) + goto err; + + xfrm->handle = handle; + xfrm->type = xform->type; + *private_xform = xfrm; + return 0; + +err: + rte_free(xfrm); + return -EINVAL; +} + +static int +uadk_compress_pmd_xform_free(struct rte_compressdev *dev __rte_unused, void *xform) +{ + if (!xform) + return -EINVAL; + + wd_comp_free_sess(((struct uadk_compress_xform *)xform)->handle); + rte_free(xform); + + return 0; +} + +static struct rte_compressdev_ops uadk_compress_pmd_ops = { + .dev_configure = uadk_compress_pmd_config, + .dev_start = uadk_compress_pmd_start, + .dev_stop = uadk_compress_pmd_stop, + .dev_close = uadk_compress_pmd_close, + .stats_get = uadk_compress_pmd_stats_get, + .stats_reset = uadk_compress_pmd_stats_reset, + .dev_infos_get = uadk_compress_pmd_info_get, + .queue_pair_setup = uadk_compress_pmd_qp_setup, + .queue_pair_release = uadk_compress_pmd_qp_release, + .private_xform_create = uadk_compress_pmd_xform_create, + .private_xform_free = uadk_compress_pmd_xform_free, +}; static int uadk_compress_probe(struct rte_vdev_device *vdev) diff --git a/drivers/compress/uadk/uadk_compress_pmd_private.h b/drivers/compress/uadk/uadk_compress_pmd_private.h index 88e9075619..b09569fb94 100644 --- a/drivers/compress/uadk/uadk_compress_pmd_private.h +++ b/drivers/compress/uadk/uadk_compress_pmd_private.h @@ -10,6 +10,22 @@ struct uadk_compress_priv { bool env_init; }; +struct __rte_cache_aligned uadk_compress_qp { + /* Ring for placing process packets */ + struct rte_ring *processed_pkts; + /* Queue pair statistics */ + struct rte_compressdev_stats qp_stats; + /* Queue Pair Identifier */ + uint16_t id; + /* Unique Queue Pair Name */ + char name[RTE_COMPRESSDEV_NAME_MAX_LEN]; +}; + +struct uadk_compress_xform { + handle_t handle; + enum rte_comp_xform_type type; +}; + extern int uadk_compress_logtype; #define UADK_LOG(level, fmt, ...) \ From patchwork Tue Jun 11 07:07:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhangfei Gao X-Patchwork-Id: 803239 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:e87:b0:35b:5a80:51b4 with SMTP id dz7csp169107wrb; Tue, 11 Jun 2024 00:09:09 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXYzleF9aSeRhWu9eVAv3uPIQwNHcf3duBMDcUMLi4ieag02ghC/zPIXcNOLPkxqH9JCJWIyh14lsCK1KAdjh6Z X-Google-Smtp-Source: AGHT+IHHqiiszwWnJ22ZZpz2rAOaYq6iZPz4ZxjkjZhNx1wzM+u1bw8B362+NJNQP1SQTsYdIEO/ X-Received: by 2002:a05:6000:1565:b0:35f:2364:f1d2 with SMTP id ffacd0b85a97d-35f2364f20emr4653164f8f.63.1718089749712; Tue, 11 Jun 2024 00:09:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1718089749; cv=none; d=google.com; s=arc-20160816; b=gX15R3I5DXjF7zRa864l5DJsiyIaSh+HWyHvEqsvJA8Aw0BHBKuecgq8laHjO9Rak0 AlS+pKcXmtHjEhz3mBrMUeGtu0rDPvAy6GtMGRlsVW2y9SSD7yyCBsdeyeaULbiuCp6W aV20rUkf7mNXmq9qQc8CvgryUeDXcmERqaWvuXp00QHuSDM86Z+sseBi6PuyCgqzeiRW tmeLflW9ld2SD4JXvh1isitZ5D4rYc6akmrioJOvXUL4ZFs3NJM2h/u2JN+SYdf4j6bx VQwDmB0AEIWEFRCxILsTL4jSAOkM20SKoFot1vUsvpOAu8LXzpQ38uLQAfZDA8uArnzS /0AQ== 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=9CSlKiGeqURhZXSy5I+ZP4S9a0szDWZjmkJfHa5inRI=; fh=N6ystvY2g7QTpz2QKkAMt/Nu9xETjtRlVAZxgmiIO6M=; b=MEjht0BSyAi4/EPozBLJ6rJP+Avh42DQhAs0zqQg/LAkB5VwwH4cynCAx7GiFuQ9QJ TEtQndH1g2qb6Q4Dp7haOFJKlYsYfSQVdbeYzJmSTOp9BsMKzIDxHWGkGcKGXnj240DE eDFOAALMsSe2Sdm1DUXYnpvew7Rx/NU1rlvFQ40PUXeRBqVaoYEy/Ts2stYY2jG4YTjZ VbYDR63x57gctz80NPSM7POi/KmM3ZhBNuBSXkRdrg4Kwlv+rsV7aKS4TxOXe5nDgFjh /FUMxJ7cmKPOXo2qvSNQ//P3QHsYJ+Z2UPAX1lvIT0P1HaN+Nc+GTmi9c8hjOxQkoVkZ 12uA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Lr84NqRl; 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 ffacd0b85a97d-35f2c4c7b4asi635962f8f.100.2024.06.11.00.09.09; Tue, 11 Jun 2024 00:09:09 -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=Lr84NqRl; 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 4C11640A67; Tue, 11 Jun 2024 09:09:00 +0200 (CEST) Received: from mail-pf1-f174.google.com (mail-pf1-f174.google.com [209.85.210.174]) by mails.dpdk.org (Postfix) with ESMTP id 83128406FF for ; Tue, 11 Jun 2024 09:08:58 +0200 (CEST) Received: by mail-pf1-f174.google.com with SMTP id d2e1a72fcca58-70413de08c7so640828b3a.0 for ; Tue, 11 Jun 2024 00:08:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1718089738; x=1718694538; 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=9CSlKiGeqURhZXSy5I+ZP4S9a0szDWZjmkJfHa5inRI=; b=Lr84NqRlq3VAPaeiEztg4Kl+LpRDth/R1po8lbanzs3/8EdM5EkHK4pEa5jmzAt92D kKJ133hXZvRjCRh3tE+pjUebyKE+evYw3Bs6rlOUqD2EOzigU/9U0dGcrpj6tZCZG0KF qCMU+S5z5kIWo7RLlFPRZw+WdBXfxAJ+KDmh3q9whOmY29vowEnWtdep2tfBIuIhbO2x d3IGdCOJPO2faZ07+lBhSH9da1TnPZ667tApBOphvy19GJV43FKrqcIOEqu6urVzqOKx 9GcSquOgWffLJbU27w8o7Ck2VZ1QlpU7T01eDM/FvTzt/HdkfSIQHiGopMGE2IXNnn28 WfHA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718089738; x=1718694538; 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=9CSlKiGeqURhZXSy5I+ZP4S9a0szDWZjmkJfHa5inRI=; b=p+rHCajsPD4WgwULuLrV968QIaqJwS3Pon/wHFYuqlcq4n6mYNNkTl7XayZ2zNhXQc Ik9MDccjd1gD7S+7FWdegXx5sIxTJwm/hgo9HPfl5PRcttLqnIOtXowd6w7p5xhUrioi QIDjmGLXWO89o1UE4Y7k+dpa2rR6Tt7rpgcJZPWA+L5t6F4NbjJlD6XGShTWtduoa4df kGvmL52te83Iejtc+pn5OxEkUdUwiek0nTqQtV3/xxvWle6hg+oryCgdjh5CWGir1Ri/ LaaNCvCAozbpdYJOmMpIWUwzq6SftfApIiXzOaWC/SlGoyNWBFb6D4UikpslcC3FDYSo iPSA== X-Gm-Message-State: AOJu0YzhSzPVvnIfTYUokmQ43xpZDtYk9T9+U+QiE+KVL6N/0TVbvLhN Q0qWau+2r6iGIQC5fe8O43ahfkuQ7Rr4bp8VZUR+sTGTZZnHGC5o3WqURuOaBoEsIJzfz68xble LF2PKTkaX X-Received: by 2002:a05:6a21:329c:b0:1af:4faf:e4a8 with SMTP id adf61e73a8af0-1b2f9a5f4d8mr11917093637.33.1718089737637; Tue, 11 Jun 2024 00:08:57 -0700 (PDT) Received: from localhost.localdomain (ec2-52-53-61-205.us-west-1.compute.amazonaws.com. [52.53.61.205]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-705ad947cdasm550945b3a.42.2024.06.11.00.08.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Jun 2024 00:08:57 -0700 (PDT) From: Zhangfei Gao To: Akhil Goyal , Fan Zhang , Ashish Gupta Cc: dev@dpdk.org, Zhangfei Gao Subject: [PATCH v3 3/3] compress/uadk: support burst enqueue/dequeue Date: Tue, 11 Jun 2024 07:07:26 +0000 Message-Id: <20240611070726.468-4-zhangfei.gao@linaro.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20240611070726.468-1-zhangfei.gao@linaro.org> References: <20240611070726.468-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, Test: sudo dpdk-test --vdev=compress_uadk RTE>>compressdev_autotest RTE>>quit Signed-off-by: Zhangfei Gao --- doc/guides/compressdevs/uadk.rst | 19 +++++ doc/guides/rel_notes/release_24_07.rst | 5 ++ drivers/compress/uadk/uadk_compress_pmd.c | 88 ++++++++++++++++++++++- 3 files changed, 110 insertions(+), 2 deletions(-) diff --git a/doc/guides/compressdevs/uadk.rst b/doc/guides/compressdevs/uadk.rst index 02fa3c7667..7e7f9f2548 100644 --- a/doc/guides/compressdevs/uadk.rst +++ b/doc/guides/compressdevs/uadk.rst @@ -77,3 +77,22 @@ Test steps 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;