[v2,02/20] regex/mlx5: add log utils
diff mbox series

Message ID 1594587541-110442-3-git-send-email-orika@mellanox.com
State Superseded, archived
Delegated to: Thomas Monjalon
Headers show
Series
  • add Mellanox RegEx PMD
Related show

Checks

Context Check Description
ci/Intel-compilation fail apply issues
ci/checkpatch success coding style OK

Commit Message

Ori Kam July 12, 2020, 8:58 p.m. UTC
From: Yuval Avnery <yuvalav@mellanox.com>

Add the DRV_LOG macro which should be used for error prints.

Signed-off-by: Yuval Avnery <yuvalav@mellanox.com>
Acked-by: Ori Kam <orika@mellanox.com>

---
 drivers/regex/mlx5/Makefile           |  1 +
 drivers/regex/mlx5/mlx5_regex.c       |  4 ++++
 drivers/regex/mlx5/mlx5_regex_utils.h | 19 +++++++++++++++++++
 3 files changed, 24 insertions(+)
 create mode 100644 drivers/regex/mlx5/mlx5_regex_utils.h

Comments

Thomas Monjalon July 15, 2020, 5:32 p.m. UTC | #1
12/07/2020 22:58, Ori Kam:
> From: Yuval Avnery <yuvalav@mellanox.com>
> 
> Add the DRV_LOG macro which should be used for error prints.

Should be MLX5_REGEX_LOG

> +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)

Was it tested?
I don't see where the log type is registered.

Please use RTE_LOG_REGISTER

Patch
diff mbox series

diff --git a/drivers/regex/mlx5/Makefile b/drivers/regex/mlx5/Makefile
index 1a16ab2..f495659 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 b942a75..06826a6 100644
--- a/drivers/regex/mlx5/mlx5_regex.c
+++ b/drivers/regex/mlx5/mlx5_regex.c
@@ -3,3 +3,7 @@ 
  */
 
 #include "mlx5_regex.h"
+#include "mlx5_regex_utils.h"
+
+int mlx5_regex_logtype;
+
diff --git a/drivers/regex/mlx5/mlx5_regex_utils.h b/drivers/regex/mlx5/mlx5_regex_utils.h
new file mode 100644
index 0000000..adca846
--- /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 <mlx5_common.h>
+
+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_ */