Add compression algo match. Signed-off-by: Hanxiao Li --- drivers/common/zsda/meson.build | 2 +- drivers/compress/zsda/zsda_comp.c | 34 +++++++++++++++++++++++++++++++ drivers/compress/zsda/zsda_comp.h | 23 +++++++++++++++++++++ 3 files changed, 58 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 66f5bae150..1de28aff7a 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..d3698418a3 --- /dev/null +++ b/drivers/compress/zsda/zsda_comp.h @@ -0,0 +1,23 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2024 ZTE Corporation + */ + +#ifndef _ZSDA_COMP_H_ +#define _ZSDA_COMP_H_ + +#include + +#include "zsda_common.h" +#include "zsda_device.h" +#include "zsda_qp.h" + +struct zsda_comp_xform { + enum rte_comp_xform_type type; + enum rte_comp_checksum_type checksum_type; +}; + +int zsda_comp_match(const void *op_in); + +int zsda_decomp_match(const void *op_in); + +#endif /* _ZSDA_COMP_H_ */ -- 2.27.0