DPDK patches and discussions
 help / color / mirror / Atom feed
From: David Marchand <david.marchand@redhat.com>
To: dev@dpdk.org
Cc: Jingjing Wu <jingjing.wu@intel.com>
Subject: [PATCH v2 06/14] drivers: move log wrappers to Intel base drivers
Date: Thu, 12 Sep 2024 10:26:32 +0200	[thread overview]
Message-ID: <20240912082643.1532679-7-david.marchand@redhat.com> (raw)
In-Reply-To: <20240912082643.1532679-1-david.marchand@redhat.com>

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

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_ */
-- 
2.46.0


  parent reply	other threads:[~2024-09-12  8:27 UTC|newest]

Thread overview: 47+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-07 14:54 [PATCH 00/11] Use RTE_LOG_LINE in drivers David Marchand
2024-09-07 14:54 ` [PATCH 01/11] devtools: fix forbidden token check with multiple files David Marchand
2024-09-07 14:54 ` [PATCH 02/11] devtools: report all warnings in forbidden token check David Marchand
2024-09-07 14:54 ` [PATCH 03/11] net/dpaa: remove broken debug macros David Marchand
2024-09-07 14:54 ` [PATCH 04/11] net/sfc: fix driver logtype token David Marchand
2024-09-08  8:35   ` Andrew Rybchenko
2024-09-07 14:54 ` [PATCH 05/11] drivers: reuse default logtype for SFC drivers David Marchand
2024-09-08  8:44   ` Andrew Rybchenko
2024-09-07 14:54 ` [PATCH 06/11] drivers: move log wrappers to Intel base drivers David Marchand
2024-09-07 14:54 ` [PATCH 07/11] net/txgbe: move wrapper to base driver David Marchand
2024-09-09  6:18   ` Jiawen Wu
2024-09-09  6:50     ` David Marchand
2024-09-09  7:23       ` Jiawen Wu
2024-09-07 14:54 ` [PATCH 08/11] drivers: replace logging helpers David Marchand
2024-09-07 14:54 ` [PATCH 09/11] drivers: remove redundant newline from logs David Marchand
2024-09-09  1:09   ` fengchengwen
2024-09-07 14:54 ` [PATCH 10/11] drivers: split multilines log messages David Marchand
2024-09-07 14:54 ` [PATCH 11/11] drivers: use per line logging in helpers David Marchand
2024-09-08  8:55   ` Andrew Rybchenko
2024-09-09  6:55     ` David Marchand
2024-09-09  7:23       ` Andrew Rybchenko
2024-09-09  1:19   ` fengchengwen
2024-09-10 10:56   ` David Marchand
2024-09-12  8:26 ` [PATCH v2 00/14] Use RTE_LOG_LINE in drivers David Marchand
2024-09-12  8:26   ` [PATCH v2 01/14] devtools: fix forbidden token check with multiple files David Marchand
2024-09-12 13:54     ` Thomas Monjalon
2024-09-12  8:26   ` [PATCH v2 02/14] devtools: report all warnings in forbidden token check David Marchand
2024-09-12 14:10     ` Thomas Monjalon
2024-09-12  8:26   ` [PATCH v2 03/14] net/dpaa: remove broken debug macros David Marchand
2024-10-01 10:18     ` Thomas Monjalon
2024-10-01 12:08       ` David Marchand
2024-10-01 13:00         ` Hemant Agrawal
2024-09-12  8:26   ` [PATCH v2 04/14] net/sfc: fix driver logtype token David Marchand
2024-09-12  8:26   ` [PATCH v2 05/14] drivers: reuse default logtype for SFC drivers David Marchand
2024-09-12  8:26   ` David Marchand [this message]
2024-09-12  8:26   ` [PATCH v2 07/14] net/txgbe: move wrapper to base driver David Marchand
2024-09-12  8:26   ` [PATCH v2 08/14] event/dlb2: fix base driver logs David Marchand
2024-09-12  8:26   ` [PATCH v2 09/14] event/dsw: use a dynamic logtype David Marchand
2024-09-12  8:26   ` [PATCH v2 10/14] drivers: replace logging helpers David Marchand
2024-09-12  8:26   ` [PATCH v2 11/14] drivers: remove redundant newline from logs David Marchand
2024-09-12  8:26   ` [PATCH v2 12/14] drivers: split multilines log messages David Marchand
2024-09-12  8:26   ` [PATCH v2 13/14] net/octeon_ep: avoid warning on uninitialized variable David Marchand
2024-09-12  8:26   ` [PATCH v2 14/14] drivers: use per line logging in helpers David Marchand
2024-10-01 12:10     ` Thomas Monjalon
2024-09-16  9:32   ` [PATCH v2 00/14] Use RTE_LOG_LINE in drivers David Marchand
2024-09-16 15:13   ` Patrick Robb
2024-10-04 13:04   ` David Marchand

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240912082643.1532679-7-david.marchand@redhat.com \
    --to=david.marchand@redhat.com \
    --cc=dev@dpdk.org \
    --cc=jingjing.wu@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).