[v2,06/14] drivers: move log wrappers to Intel base drivers

Message ID 20240912082643.1532679-7-david.marchand@redhat.com (mailing list archive)
State Accepted
Delegated to: David Marchand
Headers
Series Use RTE_LOG_LINE in drivers |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

David Marchand Sept. 12, 2024, 8:26 a.m. UTC
Remove _RAW macros and directly call RTE_LOG() where needed in headers
providing wrappers for base drivers code.
This will help later when adding a check on RTE_LOG() use in drivers/.

Signed-off-by: David Marchand <david.marchand@redhat.com>
---
 drivers/common/iavf/iavf_osdep.h      |  8 ++++----
 drivers/common/idpf/base/idpf_osdep.h | 10 +++++-----
 drivers/net/e1000/base/e1000_osdep.h  |  2 +-
 drivers/net/e1000/e1000_logs.h        |  8 ++------
 drivers/net/fm10k/base/fm10k_osdep.h  |  2 +-
 drivers/net/fm10k/fm10k_logs.h        |  7 ++-----
 drivers/net/i40e/base/i40e_osdep.h    |  6 +++---
 drivers/net/i40e/i40e_logs.h          |  7 ++-----
 drivers/net/ice/base/ice_osdep.h      |  2 +-
 drivers/net/ice/ice_logs.h            |  7 ++-----
 drivers/net/igc/base/igc_osdep.h      |  2 +-
 drivers/net/igc/igc_logs.h            |  6 +-----
 drivers/net/ixgbe/base/ixgbe_osdep.h  |  2 +-
 drivers/net/ixgbe/ixgbe_logs.h        |  7 ++-----
 14 files changed, 28 insertions(+), 48 deletions(-)
  

Patch

diff --git a/drivers/common/iavf/iavf_osdep.h b/drivers/common/iavf/iavf_osdep.h
index 263d92400c..1f2b7889cb 100644
--- a/drivers/common/iavf/iavf_osdep.h
+++ b/drivers/common/iavf/iavf_osdep.h
@@ -143,16 +143,16 @@  writeq(uint64_t value, volatile void *addr)
 #define IAVF_WRITE_FLUSH(a) IAVF_READ_REG(a, IAVF_VFGEN_RSTAT)
 
 extern int iavf_common_logger;
+#define RTE_LOGTYPE_IAVF_COMMON iavf_common_logger
 
-#define DEBUGOUT(S)          rte_log(RTE_LOG_DEBUG, iavf_common_logger, S)
-#define DEBUGOUT2(S, A...)   rte_log(RTE_LOG_DEBUG, iavf_common_logger, S, ##A)
+#define DEBUGOUT(S, ...)     RTE_LOG(DEBUG, IAVF_COMMON, S, ## __VA_ARGS__)
+#define DEBUGOUT2(S, ...)    DEBUGOUT(S, ## __VA_ARGS__)
 #define DEBUGFUNC(F)         DEBUGOUT(F "\n")
 
 #define iavf_debug(h, m, s, ...)                                \
 do {                                                            \
 	if (((m) & (h)->debug_mask))                            \
-		rte_log(RTE_LOG_DEBUG, iavf_common_logger,      \
-			"iavf %02x.%x " s,                      \
+		DEBUGOUT("iavf %02x.%x " s,                      \
 			(h)->bus.device, (h)->bus.func,         \
 					##__VA_ARGS__);         \
 } while (0)
diff --git a/drivers/common/idpf/base/idpf_osdep.h b/drivers/common/idpf/base/idpf_osdep.h
index b2af8f443d..e042ef871c 100644
--- a/drivers/common/idpf/base/idpf_osdep.h
+++ b/drivers/common/idpf/base/idpf_osdep.h
@@ -25,6 +25,8 @@ 
 #include <rte_io.h>
 #include <rte_compat.h>
 
+#include "../idpf_common_logs.h"
+
 #define INLINE inline
 #define STATIC static
 
@@ -108,16 +110,14 @@  typedef struct idpf_lock idpf_lock;
 #define FIELD_SIZEOF(t, f) (sizeof(((t *)0)->(f)))
 #define MAKEMASK(m, s) ((m) << (s))
 
-extern int idpf_common_logger;
-
-#define DEBUGOUT(S)		rte_log(RTE_LOG_DEBUG, idpf_common_logger, S)
-#define DEBUGOUT2(S, A...)	rte_log(RTE_LOG_DEBUG, idpf_common_logger, S, ##A)
+#define DEBUGOUT(S, ...)	RTE_LOG(DEBUG, IDPF_COMMON, S, ## __VA_ARGS__)
+#define DEBUGOUT2(S, ...)	DEBUGOUT(S, ## __VA_ARGS__)
 #define DEBUGFUNC(F)		DEBUGOUT(F "\n")
 
 #define idpf_debug(h, m, s, ...)					\
 	do {								\
 		if (((m) & (h)->debug_mask))				\
-			PMD_DRV_LOG_RAW(DEBUG, "idpf %02x.%x " s,       \
+			DEBUGOUT("idpf %02x.%x " s "\n",		\
 					(h)->bus.device, (h)->bus.func,	\
 					##__VA_ARGS__);			\
 	} while (0)
diff --git a/drivers/net/e1000/base/e1000_osdep.h b/drivers/net/e1000/base/e1000_osdep.h
index cd90228cef..6b5d58950f 100644
--- a/drivers/net/e1000/base/e1000_osdep.h
+++ b/drivers/net/e1000/base/e1000_osdep.h
@@ -27,7 +27,7 @@ 
 #define msec_delay_irq(x) DELAY(1000*(x))
 
 #define DEBUGFUNC(F)            DEBUGOUT(F "\n");
-#define DEBUGOUT(S, args...)    PMD_DRV_LOG_RAW(DEBUG, S, ##args)
+#define DEBUGOUT(S, ...)        RTE_LOG(DEBUG, E1000_DRIVER, "%s(): " S, __func__, ## __VA_ARGS__)
 #define DEBUGOUT1(S, args...)   DEBUGOUT(S, ##args)
 #define DEBUGOUT2(S, args...)   DEBUGOUT(S, ##args)
 #define DEBUGOUT3(S, args...)   DEBUGOUT(S, ##args)
diff --git a/drivers/net/e1000/e1000_logs.h b/drivers/net/e1000/e1000_logs.h
index 86f546b0f9..30b5531069 100644
--- a/drivers/net/e1000/e1000_logs.h
+++ b/drivers/net/e1000/e1000_logs.h
@@ -34,13 +34,9 @@  extern int e1000_logtype_tx;
 #endif
 
 extern int e1000_logtype_driver;
-#define PMD_DRV_LOG_RAW(level, fmt, args...) \
-	rte_log(RTE_LOG_ ## level, e1000_logtype_driver, "%s(): " fmt, \
-		__func__, ## args)
-
+#define RTE_LOGTYPE_E1000_DRIVER e1000_logtype_driver
 #define PMD_DRV_LOG(level, fmt, args...) \
-	PMD_DRV_LOG_RAW(level, fmt "\n", ## args)
-
+	RTE_LOG(level, E1000_DRIVER, "%s(): " fmt "\n", __func__, ## args)
 
 /* log init function shared by e1000 and igb drivers */
 void e1000_igb_init_log(void);
diff --git a/drivers/net/fm10k/base/fm10k_osdep.h b/drivers/net/fm10k/base/fm10k_osdep.h
index 25f46c3908..d3e5528575 100644
--- a/drivers/net/fm10k/base/fm10k_osdep.h
+++ b/drivers/net/fm10k/base/fm10k_osdep.h
@@ -24,7 +24,7 @@ 
 
 #define STATIC                  static
 #define DEBUGFUNC(F)            DEBUGOUT(F "\n");
-#define DEBUGOUT(S, args...)    PMD_DRV_LOG_RAW(DEBUG, S, ##args)
+#define DEBUGOUT(S, ...)        RTE_LOG(DEBUG, FM10K_DRIVER, "%s(): " S, __func__, ## __VA_ARGS__)
 #define DEBUGOUT1(S, args...)   DEBUGOUT(S, ##args)
 #define DEBUGOUT2(S, args...)   DEBUGOUT(S, ##args)
 #define DEBUGOUT3(S, args...)   DEBUGOUT(S, ##args)
diff --git a/drivers/net/fm10k/fm10k_logs.h b/drivers/net/fm10k/fm10k_logs.h
index 4f039f8beb..c4c7c977d9 100644
--- a/drivers/net/fm10k/fm10k_logs.h
+++ b/drivers/net/fm10k/fm10k_logs.h
@@ -33,11 +33,8 @@  extern int fm10k_logtype_tx;
 #endif
 
 extern int fm10k_logtype_driver;
-#define PMD_DRV_LOG_RAW(level, fmt, args...) \
-	rte_log(RTE_LOG_ ## level, fm10k_logtype_driver, "%s(): " fmt, \
-		__func__, ## args)
-
+#define RTE_LOGTYPE_FM10K_DRIVER fm10k_logtype_driver
 #define PMD_DRV_LOG(level, fmt, args...) \
-	PMD_DRV_LOG_RAW(level, fmt "\n", ## args)
+	RTE_LOG(level, FM10K_DRIVER, "%s(): " fmt "\n", __func__, ## args)
 
 #endif /* _FM10K_LOGS_H_ */
diff --git a/drivers/net/i40e/base/i40e_osdep.h b/drivers/net/i40e/base/i40e_osdep.h
index aa5dc61841..8960206d8b 100644
--- a/drivers/net/i40e/base/i40e_osdep.h
+++ b/drivers/net/i40e/base/i40e_osdep.h
@@ -82,8 +82,8 @@  typedef enum i40e_status_code i40e_status;
 
 #define FIELD_SIZEOF(t, f) (sizeof(((t*)0)->f))
 
-#define DEBUGOUT(S)        PMD_DRV_LOG_RAW(DEBUG, S)
-#define DEBUGOUT1(S, A...) PMD_DRV_LOG_RAW(DEBUG, S, ##A)
+#define DEBUGOUT(S, ...) RTE_LOG(DEBUG, I40E_DRIVER, "%s(): " S, __func__, ## __VA_ARGS__)
+#define DEBUGOUT1 DEBUGOUT
 
 #define DEBUGFUNC(F) DEBUGOUT(F "\n")
 #define DEBUGOUT2 DEBUGOUT1
@@ -94,7 +94,7 @@  typedef enum i40e_status_code i40e_status;
 #define i40e_debug(h, m, s, ...)                                \
 do {                                                            \
 	if (((m) & (h)->debug_mask))                            \
-		PMD_DRV_LOG_RAW(DEBUG, "i40e %02x.%x " s,       \
+		DEBUGOUT("i40e %02x.%x " s,			\
 			(h)->bus.device, (h)->bus.func,         \
 					##__VA_ARGS__);         \
 } while (0)
diff --git a/drivers/net/i40e/i40e_logs.h b/drivers/net/i40e/i40e_logs.h
index eebe6c5559..fb1f3a4096 100644
--- a/drivers/net/i40e/i40e_logs.h
+++ b/drivers/net/i40e/i40e_logs.h
@@ -30,11 +30,8 @@  extern int i40e_logtype_tx;
 #endif
 
 extern int i40e_logtype_driver;
-#define PMD_DRV_LOG_RAW(level, fmt, args...) \
-	rte_log(RTE_LOG_ ## level, i40e_logtype_driver, "%s(): " fmt, \
-		__func__, ## args)
-
+#define RTE_LOGTYPE_I40E_DRIVER i40e_logtype_driver
 #define PMD_DRV_LOG(level, fmt, args...) \
-	PMD_DRV_LOG_RAW(level, fmt "\n", ## args)
+	RTE_LOG(level, I40E_DRIVER, "%s(): " fmt "\n", __func__, ## args)
 
 #endif /* _I40E_LOGS_H_ */
diff --git a/drivers/net/ice/base/ice_osdep.h b/drivers/net/ice/base/ice_osdep.h
index c17f1bf09f..5f7347023f 100644
--- a/drivers/net/ice/base/ice_osdep.h
+++ b/drivers/net/ice/base/ice_osdep.h
@@ -149,7 +149,7 @@  writeq(uint64_t value, volatile void *addr)
 #define ice_debug(h, m, s, ...)					\
 do {								\
 	if (((m) & (h)->debug_mask))				\
-		PMD_DRV_LOG_RAW(DEBUG, "ice %02x.%x " s,	\
+		RTE_LOG(DEBUG, ICE_DRIVER, "ice %02x.%x " s,	\
 			(h)->bus.device, (h)->bus.func,		\
 					##__VA_ARGS__);		\
 } while (0)
diff --git a/drivers/net/ice/ice_logs.h b/drivers/net/ice/ice_logs.h
index e79980fb63..a54e9d8b59 100644
--- a/drivers/net/ice/ice_logs.h
+++ b/drivers/net/ice/ice_logs.h
@@ -7,6 +7,7 @@ 
 
 extern int ice_logtype_init;
 extern int ice_logtype_driver;
+#define RTE_LOGTYPE_ICE_DRIVER ice_logtype_driver
 
 #define PMD_INIT_LOG(level, fmt, args...) \
 	rte_log(RTE_LOG_ ## level, ice_logtype_init, "%s(): " fmt "\n", \
@@ -32,11 +33,7 @@  extern int ice_logtype_tx;
 #define PMD_TX_LOG(level, fmt, args...) do { } while (0)
 #endif
 
-#define PMD_DRV_LOG_RAW(level, fmt, args...) \
-	rte_log(RTE_LOG_ ## level, ice_logtype_driver, "%s(): " fmt, \
-		__func__, ## args)
-
 #define PMD_DRV_LOG(level, fmt, args...) \
-	PMD_DRV_LOG_RAW(level, fmt "\n", ## args)
+	RTE_LOG(level, ICE_DRIVER, "%s(): " fmt "\n", __func__, ## args)
 
 #endif /* _ICE_LOGS_H_ */
diff --git a/drivers/net/igc/base/igc_osdep.h b/drivers/net/igc/base/igc_osdep.h
index 25090d65ea..4e479eb500 100644
--- a/drivers/net/igc/base/igc_osdep.h
+++ b/drivers/net/igc/base/igc_osdep.h
@@ -27,7 +27,7 @@ 
 #define msec_delay_irq(x) DELAY(1000 * (x))
 
 #define DEBUGFUNC(F)            DEBUGOUT(F "\n")
-#define DEBUGOUT(S, args...)    PMD_DRV_LOG_RAW(DEBUG, S, ##args)
+#define DEBUGOUT(S, ...)        RTE_LOG(DEBUG, IGC_DRIVER, "%s(): " S, __func__, ## __VA_ARGS__)
 #define DEBUGOUT1(S, args...)   DEBUGOUT(S, ##args)
 #define DEBUGOUT2(S, args...)   DEBUGOUT(S, ##args)
 #define DEBUGOUT3(S, args...)   DEBUGOUT(S, ##args)
diff --git a/drivers/net/igc/igc_logs.h b/drivers/net/igc/igc_logs.h
index cca5389eff..4a574f10cb 100644
--- a/drivers/net/igc/igc_logs.h
+++ b/drivers/net/igc/igc_logs.h
@@ -35,12 +35,8 @@  extern int igc_logtype_driver;
 #define PMD_TX_LOG(level, fmt, args...) do { } while (0)
 #endif
 
-#define PMD_DRV_LOG_RAW(level, fmt, args...) \
-	rte_log(RTE_LOG_ ## level, igc_logtype_driver, "%s(): " fmt, \
-		__func__, ## args)
-
 #define PMD_DRV_LOG(level, fmt, args...) \
-	PMD_DRV_LOG_RAW(level, fmt "\n", ## args)
+	RTE_LOG(level, IGC_DRIVER, "%s(): " fmt "\n", __func__, ## args)
 
 #ifdef __cplusplus
 }
diff --git a/drivers/net/ixgbe/base/ixgbe_osdep.h b/drivers/net/ixgbe/base/ixgbe_osdep.h
index e832a7bec8..502f386b56 100644
--- a/drivers/net/ixgbe/base/ixgbe_osdep.h
+++ b/drivers/net/ixgbe/base/ixgbe_osdep.h
@@ -33,7 +33,7 @@ 
 #define msec_delay(x) DELAY(1000*(x))
 
 #define DEBUGFUNC(F)            DEBUGOUT(F "\n");
-#define DEBUGOUT(S, args...)    PMD_DRV_LOG_RAW(DEBUG, S, ##args)
+#define DEBUGOUT(S, ...)        RTE_LOG(DEBUG, IXGBE_DRIVER, "%s(): " S, __func__, ## __VA_ARGS__)
 #define DEBUGOUT1(S, args...)   DEBUGOUT(S, ##args)
 #define DEBUGOUT2(S, args...)   DEBUGOUT(S, ##args)
 #define DEBUGOUT3(S, args...)   DEBUGOUT(S, ##args)
diff --git a/drivers/net/ixgbe/ixgbe_logs.h b/drivers/net/ixgbe/ixgbe_logs.h
index 00ef797ca1..5a2c5ccde0 100644
--- a/drivers/net/ixgbe/ixgbe_logs.h
+++ b/drivers/net/ixgbe/ixgbe_logs.h
@@ -31,11 +31,8 @@  extern int ixgbe_logtype_tx;
 #endif
 
 extern int ixgbe_logtype_driver;
-#define PMD_DRV_LOG_RAW(level, fmt, args...) \
-	rte_log(RTE_LOG_ ## level, ixgbe_logtype_driver, "%s(): " fmt, \
-		__func__, ## args)
-
+#define RTE_LOGTYPE_IXGBE_DRIVER ixgbe_logtype_driver
 #define PMD_DRV_LOG(level, fmt, args...) \
-	PMD_DRV_LOG_RAW(level, fmt "\n", ## args)
+	RTE_LOG(level, IXGBE_DRIVER, "%s(): " fmt "\n", __func__, ## args)
 
 #endif /* _IXGBE_LOGS_H_ */