From: Yuval Avnery Date: Mon, 20 Jul 2020 06:26:06 +0000 (+0000) Subject: regex/mlx5: add log macros X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=215b122376dc33758ce89e374bb6653a329873d4;p=dpdk.git regex/mlx5: add log macros Add the MLX5_REGEX_LOG macro which should be used for error prints. Signed-off-by: Yuval Avnery Acked-by: Ori Kam --- diff --git a/drivers/regex/mlx5/Makefile b/drivers/regex/mlx5/Makefile index d9a1573839..fa32cda5bf 100644 --- a/drivers/regex/mlx5/Makefile +++ b/drivers/regex/mlx5/Makefile @@ -15,6 +15,7 @@ CFLAGS += -std=c11 -Wall -Wextra CFLAGS += -g CFLAGS += -I$(RTE_SDK)/drivers/common/mlx5 CFLAGS += -I$(BUILDDIR)/drivers/common/mlx5 +CFLAGS += -I$(RTE_SDK)/drivers/common/mlx5/linux CFLAGS += -D_BSD_SOURCE CFLAGS += -D_DEFAULT_SOURCE CFLAGS += -D_XOPEN_SOURCE=600 diff --git a/drivers/regex/mlx5/mlx5_regex.c b/drivers/regex/mlx5/mlx5_regex.c index b942a7511d..922c23630f 100644 --- a/drivers/regex/mlx5/mlx5_regex.c +++ b/drivers/regex/mlx5/mlx5_regex.c @@ -3,3 +3,8 @@ */ #include "mlx5_regex.h" +#include "mlx5_regex_utils.h" + +int mlx5_regex_logtype; + +RTE_LOG_REGISTER(mlx5_regex_logtype, pmd.regex.mlx5, NOTICE) diff --git a/drivers/regex/mlx5/mlx5_regex_utils.h b/drivers/regex/mlx5/mlx5_regex_utils.h new file mode 100644 index 0000000000..adca846ee5 --- /dev/null +++ b/drivers/regex/mlx5/mlx5_regex_utils.h @@ -0,0 +1,19 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright 2020 Mellanox Technologies, Ltd + */ + +#ifndef RTE_PMD_MLX5_REGEX_UTILS_H_ +#define RTE_PMD_MLX5_REGEX_UTILS_H_ + +#include + +extern int mlx5_regex_logtype; + +#define MLX5_REGEX_LOG_PREFIX "regex_mlx5" +/* Generic printf()-like logging macro with automatic line feed. */ +#define DRV_LOG(level, ...) \ + PMD_DRV_LOG_(level, mlx5_regex_logtype, MLX5_REGEX_LOG_PREFIX, \ + __VA_ARGS__ PMD_DRV_LOG_STRIP PMD_DRV_LOG_OPAREN, \ + PMD_DRV_LOG_CPAREN) + +#endif /* RTE_PMD_MLX5_REGEX_UTILS_H_ */