> Add logging macros and functions for zsda drivers
> 
> Signed-off-by: Hanxiao Li <li.hanx...@zte.com.cn>
> ---
>  drivers/common/zsda/meson.build | 13 +++++++++++++
>  drivers/common/zsda/zsda_logs.c | 19 +++++++++++++++++++
>  drivers/common/zsda/zsda_logs.h | 27 +++++++++++++++++++++++++++
>  drivers/meson.build             |  1 +
>  4 files changed, 60 insertions(+)
>  create mode 100644 drivers/common/zsda/meson.build
>  create mode 100644 drivers/common/zsda/zsda_logs.c
>  create mode 100644 drivers/common/zsda/zsda_logs.h

Compilation failure on this patch.
../drivers/common/zsda/meson.build:11:0: ERROR: File zsda_log.c does not exist.

Please make sure all patches compile without any warnings individually 
> 
> diff --git a/drivers/common/zsda/meson.build
> b/drivers/common/zsda/meson.build
> new file mode 100644
> index 0000000000..d165e0da59
> --- /dev/null
> +++ b/drivers/common/zsda/meson.build
> @@ -0,0 +1,13 @@
> +# SPDX-License-Identifier: BSD-3-Clause
> +# Copyright(c) 2024 ZTE Corporation
> +
> +if is_windows
> +    build = false
> +    reason = 'not supported on Windows'
> +    subdir_done()
> +endif
> +
> +deps += ['bus_pci']
> +sources += files(
> +        'zsda_log.c',
> +        )
> diff --git a/drivers/common/zsda/zsda_logs.c
> b/drivers/common/zsda/zsda_logs.c
> new file mode 100644
> index 0000000000..f76d9d9d0d
> --- /dev/null
> +++ b/drivers/common/zsda/zsda_logs.c
> @@ -0,0 +1,19 @@
> +/* SPDX-License-Identifier: BSD-3-Clause
> + * Copyright(c) 2024 ZTE Corporation
> + */
> +
> +#include <rte_hexdump.h>
> +
> +#include "zsda_logs.h"
> +
> +int
> +zsda_hexdump_log(uint32_t level, uint32_t logtype, const char *title,
> +        const void *buf, unsigned int len)
> +{
> +    if (rte_log_can_log(logtype, level))
> +        rte_hexdump(rte_log_get_stream(), title, buf, len);
> +
> +    return 0;
> +}
> +
> +RTE_LOG_REGISTER_SUFFIX(zsda_logtype_gen, gen, NOTICE);
> diff --git a/drivers/common/zsda/zsda_logs.h
> b/drivers/common/zsda/zsda_logs.h
> new file mode 100644
> index 0000000000..9d77254773
> --- /dev/null
> +++ b/drivers/common/zsda/zsda_logs.h
> @@ -0,0 +1,27 @@
> +/* SPDX-License-Identifier: BSD-3-Clause
> + * Copyright(c) 2024 ZTE Corporation
> + */
> +
> +#ifndef _ZSDA_LOGS_H_
> +#define _ZSDA_LOGS_H_
> +
> +#include <rte_log.h>
> +
> +extern int zsda_logtype_gen;
> +#define RTE_LOGTYPE_ZSDA_GEN zsda_logtype_gen
> +
> +#define ZSDA_LOG(level, ...)             \
> +    RTE_LOG_LINE_PREFIX(level, ZSDA_GEN, "%s(): ", \
> +        __func__, __VA_ARGS__)
> +
> +/**
> + * zsda_hexdump_log - Dump out memory in a special hex dump format.
> + *
> + * Dump out the message buffer in a special hex dump output format with
> + * characters printed for each line of 16 hex values. The message will be 
> sent
> + * to the stream used by the rte_log infrastructure.
> + */
> +int zsda_hexdump_log(uint32_t level, uint32_t logtype, const char *title,
> +             const void *buf, unsigned int len);
> +
> +#endif /* _ZSDA_LOGS_H_ */
> diff --git a/drivers/meson.build b/drivers/meson.build
> index 66931d4241..cdbd3b1c17 100644
> --- a/drivers/meson.build
> +++ b/drivers/meson.build
> @@ -17,6 +17,7 @@ subdirs = [
>          'common/nitrox',  # depends on bus.
>          'common/qat',     # depends on bus.
>          'common/sfc_efx', # depends on bus.
> +        'common/zsda',    # depends on bus.
>          'mempool',        # depends on common and bus.
>          'dma',            # depends on common and bus.
>          'net',            # depends on common, bus, mempool
> --
> 2.27.0

Reply via email to