[PATCH v18 09/15] compress/zsda: add compression algo match

Hanxiao Li li.hanxiao at zte.com.cn
Mon Oct 28 09:11:59 CET 2024


Add compression algo match.

Signed-off-by: Hanxiao Li <li.hanxiao at zte.com.cn>
---
 drivers/common/zsda/meson.build   |  2 +-
 drivers/compress/zsda/zsda_comp.c | 34 +++++++++++++++++++++++++++++++
 drivers/compress/zsda/zsda_comp.h | 16 +++++++++++++++
 3 files changed, 51 insertions(+), 1 deletion(-)
 create mode 100644 drivers/compress/zsda/zsda_comp.c
 create mode 100644 drivers/compress/zsda/zsda_comp.h

diff --git a/drivers/common/zsda/meson.build b/drivers/common/zsda/meson.build
index db00937a28..4d24951cdd 100644
--- a/drivers/common/zsda/meson.build
+++ b/drivers/common/zsda/meson.build
@@ -20,7 +20,7 @@ zsda_compress_path = 'compress/zsda'
 zsda_compress_relpath = '../../' + zsda_compress_path
 includes += include_directories(zsda_compress_relpath)
 if zsda_compress
-	foreach f: ['zsda_comp_pmd.c']
+	foreach f: ['zsda_comp_pmd.c', 'zsda_comp.c']
 		sources += files(join_paths(zsda_compress_relpath, f))
 	endforeach
 endif
diff --git a/drivers/compress/zsda/zsda_comp.c b/drivers/compress/zsda/zsda_comp.c
new file mode 100644
index 0000000000..2519dfc247
--- /dev/null
+++ b/drivers/compress/zsda/zsda_comp.c
@@ -0,0 +1,34 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2024 ZTE Corporation
+ */
+
+#include "zsda_comp.h"
+
+int
+zsda_comp_match(const void *op_in)
+{
+	const struct rte_comp_op *op = op_in;
+	const struct zsda_comp_xform *xform = op->private_xform;
+
+	if (op->op_type != RTE_COMP_OP_STATELESS)
+		return 0;
+
+	if (xform->type != RTE_COMP_COMPRESS)
+		return 0;
+
+	return 1;
+}
+
+int
+zsda_decomp_match(const void *op_in)
+{
+	const struct rte_comp_op *op = op_in;
+	const struct zsda_comp_xform *xform = op->private_xform;
+
+	if (op->op_type != RTE_COMP_OP_STATELESS)
+		return 0;
+
+	if (xform->type != RTE_COMP_DECOMPRESS)
+		return 0;
+	return 1;
+}
diff --git a/drivers/compress/zsda/zsda_comp.h b/drivers/compress/zsda/zsda_comp.h
new file mode 100644
index 0000000000..b1c6571c54
--- /dev/null
+++ b/drivers/compress/zsda/zsda_comp.h
@@ -0,0 +1,16 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2024 ZTE Corporation
+ */
+
+#ifndef _ZSDA_COMP_H_
+#define _ZSDA_COMP_H_
+
+#include "zsda_comp_pmd.h"
+
+__rte_unused int
+zsda_comp_match(const void *op_in);
+
+__rte_unused int
+zsda_decomp_match(const void *op_in);
+
+#endif /* _ZSDA_COMP_H_ */
-- 
2.27.0
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mails.dpdk.org/archives/dev/attachments/20241028/b4373db2/attachment-0001.htm>


More information about the dev mailing list