From: David Marchand <david.marchand@redhat.com>
To: dev@dpdk.org
Cc: Abdullah Sevincer <abdullah.sevincer@intel.com>
Subject: [PATCH v2 08/14] event/dlb2: fix base driver logs
Date: Thu, 12 Sep 2024 10:26:34 +0200 [thread overview]
Message-ID: <20240912082643.1532679-9-david.marchand@redhat.com> (raw)
In-Reply-To: <20240912082643.1532679-1-david.marchand@redhat.com>
DLB2_(HW_)?(INFO|ERR|DEBUG) are defined in osdep.h for base/ driver code
to log messages.
The base/ driver should not bypass those macros, directly calling
DLB2_LOG_(INFO|ERR|DEBUG).
Besides, DLB2_LOG_* macros always append a \n, meaning that most of the
logs coming from the base/ driver code have double \n.
This patch fixes osdep.h macro definition, then remove a few direct calls
to DLB2_LOG_* (and adjust \n accordingly).
Signed-off-by: David Marchand <david.marchand@redhat.com>
---
drivers/event/dlb2/dlb2_log.h | 7 +++----
drivers/event/dlb2/pf/base/dlb2_osdep.h | 16 +++++++++++++---
drivers/event/dlb2/pf/base/dlb2_resource.c | 18 +++++++++---------
3 files changed, 25 insertions(+), 16 deletions(-)
diff --git a/drivers/event/dlb2/dlb2_log.h b/drivers/event/dlb2/dlb2_log.h
index 54d6a3011f..81908af71f 100644
--- a/drivers/event/dlb2/dlb2_log.h
+++ b/drivers/event/dlb2/dlb2_log.h
@@ -6,12 +6,11 @@
#define _DLB2_EVDEV_LOG_H_
extern int eventdev_dlb2_log_level;
-#define RTE_LOGTYPE_EVENTDEV_DLB2_LOG_LEVEL eventdev_dlb2_log_level
+#define RTE_LOGTYPE_EVENTDEV_DLB2 eventdev_dlb2_log_level
/* Dynamic logging */
#define DLB2_LOG_IMPL(level, fmt, args...) \
- rte_log(RTE_LOG_ ## level, eventdev_dlb2_log_level, "%s" fmt "\n", \
- __func__, ##args)
+ RTE_LOG(level, EVENTDEV_DLB2, "%s" fmt "\n", __func__, ##args)
#define DLB2_LOG_INFO(fmt, args...) \
DLB2_LOG_IMPL(INFO, fmt, ## args)
@@ -21,6 +20,6 @@ extern int eventdev_dlb2_log_level;
/* remove debug logs at compile time unless actually debugging */
#define DLB2_LOG_DBG(fmt, args...) \
- RTE_LOG_DP(DEBUG, EVENTDEV_DLB2_LOG_LEVEL, fmt, ## args)
+ RTE_LOG_DP(DEBUG, EVENTDEV_DLB2, fmt, ## args)
#endif /* _DLB2_EVDEV_LOG_H_ */
diff --git a/drivers/event/dlb2/pf/base/dlb2_osdep.h b/drivers/event/dlb2/pf/base/dlb2_osdep.h
index 06d69f39b1..16c5e3b797 100644
--- a/drivers/event/dlb2/pf/base/dlb2_osdep.h
+++ b/drivers/event/dlb2/pf/base/dlb2_osdep.h
@@ -41,13 +41,13 @@
/* Map to PMDs logging interface */
#define DLB2_ERR(dev, fmt, args...) \
- DLB2_LOG_ERR(fmt, ## args)
+ RTE_LOG(ERR, EVENTDEV_DLB2, "%s" fmt, __func__, ## args)
#define DLB2_INFO(dev, fmt, args...) \
- DLB2_LOG_INFO(fmt, ## args)
+ RTE_LOG(INFO, EVENTDEV_DLB2, "%s" fmt, __func__, ## args)
#define DLB2_DEBUG(dev, fmt, args...) \
- DLB2_LOG_DBG(fmt, ## args)
+ RTE_LOG_DP(DEBUG, EVENTDEV_DLB2, fmt, ## args)
/**
* os_udelay() - busy-wait for a number of microseconds
@@ -139,6 +139,16 @@ static inline void os_fence_hcw(struct dlb2_hw *hw, u64 *pp_addr)
DLB2_ERR(dlb2, __VA_ARGS__); \
} while (0)
+/**
+ * DLB2_HW_INFO() - log an error message
+ * @dlb2: dlb2_hw handle for a particular device.
+ * @...: variable string args.
+ */
+#define DLB2_HW_INFO(dlb2, ...) do { \
+ RTE_SET_USED(dlb2); \
+ DLB2_INFO(dlb2, __VA_ARGS__); \
+} while (0)
+
/**
* DLB2_HW_DBG() - log an info message
* @dlb2: dlb2_hw handle for a particular device.
diff --git a/drivers/event/dlb2/pf/base/dlb2_resource.c b/drivers/event/dlb2/pf/base/dlb2_resource.c
index 7ce3e3531c..3004902118 100644
--- a/drivers/event/dlb2/pf/base/dlb2_resource.c
+++ b/drivers/event/dlb2/pf/base/dlb2_resource.c
@@ -841,7 +841,7 @@ dlb2_get_pp_allocation(struct dlb2_hw *hw, int cpu, int port_type)
dlb2_dev->enqueue_four = dlb2_movdir64b;
- DLB2_LOG_INFO(" for %s: cpu core used in pp profiling: %d\n",
+ DLB2_HW_INFO(hw, " for %s: cpu core used in pp profiling: %d\n",
is_ldb ? "LDB" : "DIR", cpu);
memset(cos_cycles, 0, num_sort * sizeof(struct dlb2_pp_thread_data));
@@ -854,7 +854,7 @@ dlb2_get_pp_allocation(struct dlb2_hw *hw, int cpu, int port_type)
err = rte_thread_attr_init(&th_attr);
if (err != 0) {
- DLB2_LOG_ERR(": thread attribute failed! err=%d", err);
+ DLB2_HW_ERR(hw, ": thread attribute failed! err=%d\n", err);
return;
}
CPU_SET(cpu, &th_attr.cpuset);
@@ -862,7 +862,7 @@ dlb2_get_pp_allocation(struct dlb2_hw *hw, int cpu, int port_type)
err = rte_thread_create(&thread, &th_attr,
&dlb2_pp_profile_func, &dlb2_thread_data[i]);
if (err) {
- DLB2_LOG_ERR(": thread creation failed! err=%d", err);
+ DLB2_HW_ERR(hw, ": thread creation failed! err=%d\n", err);
return;
}
@@ -871,7 +871,7 @@ dlb2_get_pp_allocation(struct dlb2_hw *hw, int cpu, int port_type)
err = rte_thread_join(thread, NULL);
if (err) {
- DLB2_LOG_ERR(": thread join failed! err=%d", err);
+ DLB2_HW_ERR(hw, ": thread join failed! err=%d\n", err);
return;
}
@@ -911,7 +911,7 @@ dlb2_get_pp_allocation(struct dlb2_hw *hw, int cpu, int port_type)
for (i = 0; i < num_ports; i++) {
port_allocations[i] = dlb2_thread_data[i].pp;
- DLB2_LOG_INFO(": pp %d cycles %d", port_allocations[i],
+ DLB2_HW_INFO(hw, ": pp %d cycles %d\n", port_allocations[i],
dlb2_thread_data[i].cycles);
}
@@ -929,7 +929,7 @@ dlb2_resource_probe(struct dlb2_hw *hw, const void *probe_args)
}
if (mask && rte_eal_parse_coremask(mask, cores)) {
- DLB2_LOG_ERR(": Invalid producer coremask=%s", mask);
+ DLB2_HW_ERR(hw, ": Invalid producer coremask=%s\n", mask);
return -1;
}
@@ -956,7 +956,7 @@ dlb2_resource_probe(struct dlb2_hw *hw, const void *probe_args)
break;
}
} else if (is_pcore) {
- DLB2_LOG_ERR("Producer coremask(%s) must be a subset of EAL coremask",
+ DLB2_HW_ERR(hw, "Producer coremask(%s) must be a subset of EAL coremask\n",
mask);
return -1;
}
@@ -4599,7 +4599,7 @@ dlb2_verify_create_ldb_port_args(struct dlb2_hw *hw,
return -EINVAL;
}
- DLB2_LOG_INFO(": LDB: cos=%d port:%d\n", id, port->id.phys_id);
+ DLB2_HW_INFO(hw, ": LDB: cos=%d port:%d\n", id, port->id.phys_id);
/* Check cache-line alignment */
if ((cq_dma_base & 0x3F) != 0) {
@@ -4826,7 +4826,7 @@ dlb2_verify_create_dir_port_args(struct dlb2_hw *hw,
resp->status = DLB2_ST_DIR_PORTS_UNAVAILABLE;
return -EINVAL;
}
- DLB2_LOG_INFO(": DIR: port:%d is_producer=%d\n",
+ DLB2_HW_INFO(hw, ": DIR: port:%d is_producer=%d\n",
pq->id.phys_id, args->is_producer);
}
--
2.46.0
next prev parent reply other threads:[~2024-09-12 8:27 UTC|newest]
Thread overview: 42+ 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-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 ` [PATCH v2 06/14] drivers: move log wrappers to Intel base drivers David Marchand
2024-09-12 8:26 ` [PATCH v2 07/14] net/txgbe: move wrapper to base driver David Marchand
2024-09-12 8:26 ` David Marchand [this message]
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-09-16 9:32 ` [PATCH v2 00/14] Use RTE_LOG_LINE in drivers David Marchand
2024-09-16 15:13 ` Patrick Robb
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-9-david.marchand@redhat.com \
--to=david.marchand@redhat.com \
--cc=abdullah.sevincer@intel.com \
--cc=dev@dpdk.org \
/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).