From: Zhangfei Gao <zhangfei.gao@linaro.org>
To: Akhil Goyal <gakhil@marvell.com>,
Fan Zhang <fanzhang.oss@gmail.com>,
Ashish Gupta <ashish.gupta@marvell.com>
Cc: dev@dpdk.org, Zhangfei Gao <zhangfei.gao@linaro.org>
Subject: [PATCH v2 1/3] compress/uadk: Introduce UADK compression driver
Date: Sat, 25 May 2024 14:07:51 +0000 [thread overview]
Message-ID: <20240525140753.122-2-zhangfei.gao@linaro.org> (raw)
In-Reply-To: <20240525140753.122-1-zhangfei.gao@linaro.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.
Test:
sudo dpdk-test --vdev=compress_uadk
RTE>>compressdev_autotest
RTE>>quit
[1] https://github.com/Linaro/uadk
Signed-off-by: Zhangfei Gao <zhangfei.gao@linaro.org>
---
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 +++++
4 files changed, 126 insertions(+)
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/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 <bus_vdev_driver.h>
+#include <rte_compressdev_pmd.h>
+#include <rte_malloc.h>
+
+#include <uadk/wd_comp.h>
+#include <uadk/wd_sched.h>
+
+#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_ */
--
2.25.1
next prev parent reply other threads:[~2024-05-25 14:08 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-25 14:07 [PATCH v2 0/3] " Zhangfei Gao
2024-05-25 14:07 ` Zhangfei Gao [this message]
2024-05-25 14:07 ` [PATCH v2 2/3] compress/uadk: support basic operations Zhangfei Gao
2024-05-25 14:07 ` [PATCH v2 3/3] compress/uadk: support burst enqueue/dequeue Zhangfei Gao
2024-06-07 11:49 ` [EXTERNAL] " Akhil Goyal
2024-06-07 13:54 ` Zhangfei Gao
2024-06-10 6:27 ` Akhil Goyal
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240525140753.122-2-zhangfei.gao@linaro.org \
--to=zhangfei.gao@linaro.org \
--cc=ashish.gupta@marvell.com \
--cc=dev@dpdk.org \
--cc=fanzhang.oss@gmail.com \
--cc=gakhil@marvell.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).