DPDK patches and discussions
 help / color / mirror / Atom feed
From: <changqing.li@windriver.com>
To: <dev@dpdk.org>
Subject: [PATCH] ethdev_trace.h: Update the trace point function when _TIME_BITS=64
Date: Tue, 22 Apr 2025 19:35:23 +0800	[thread overview]
Message-ID: <20250422113523.867473-1-changqing.li@windriver.com> (raw)

From: Changqing Li <changqing.li@windriver.com>

To support Y2038 issue, for 32bit system, -D_TIME_BITS=64 is passed to
gcc, struct timespec time->tv_sec is 64bit, but size_t is 32bits, so
dpdk will compile failed with error:
../git/lib/ethdev/ethdev_trace.h: In function 'rte_eth_trace_timesync_write_time':
../git/lib/eal/include/rte_common.h:498:55: error: size of unnamed array is negative
  498 | #define RTE_BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)]))

Update the trace point function to fix above issue

Signed-off-by: Changqing Li <changqing.li@windriver.com>
---
 lib/ethdev/ethdev_trace.h | 57 ++++++++++++++++++++++++++++++++++++---
 1 file changed, 53 insertions(+), 4 deletions(-)

diff --git a/lib/ethdev/ethdev_trace.h b/lib/ethdev/ethdev_trace.h
index c65b78590a..20390140dd 100644
--- a/lib/ethdev/ethdev_trace.h
+++ b/lib/ethdev/ethdev_trace.h
@@ -1116,15 +1116,27 @@ RTE_TRACE_POINT(
 	rte_trace_point_emit_int(ret);
 )
 
+#if defined(_TIME_BITS) && _TIME_BITS == 64
 RTE_TRACE_POINT(
 	rte_eth_trace_timesync_write_time,
 	RTE_TRACE_POINT_ARGS(uint16_t port_id, const struct timespec *time,
 		int ret),
 	rte_trace_point_emit_u16(port_id);
-	rte_trace_point_emit_size_t(time->tv_sec);
+	rte_trace_point_emit_u64(time->tv_sec);
 	rte_trace_point_emit_long(time->tv_nsec);
 	rte_trace_point_emit_int(ret);
 )
+#else
+RTE_TRACE_POINT(
+    rte_eth_trace_timesync_write_time,
+    RTE_TRACE_POINT_ARGS(uint16_t port_id, const struct timespec *time,
+        int ret),
+    rte_trace_point_emit_u16(port_id);
+    rte_trace_point_emit_size_t(time->tv_sec);
+    rte_trace_point_emit_long(time->tv_nsec);
+    rte_trace_point_emit_int(ret);
+)
+#endif
 
 RTE_TRACE_POINT(
 	rte_eth_trace_read_clock,
@@ -2146,38 +2158,75 @@ RTE_TRACE_POINT_FP(
 )
 
 /* Called in loop in examples/ptpclient */
+#if defined(_TIME_BITS) && _TIME_BITS == 64
 RTE_TRACE_POINT_FP(
 	rte_eth_trace_timesync_read_rx_timestamp,
 	RTE_TRACE_POINT_ARGS(uint16_t port_id, const struct timespec *timestamp,
 		uint32_t flags, int ret),
 	rte_trace_point_emit_u16(port_id);
-	rte_trace_point_emit_size_t(timestamp->tv_sec);
+	rte_trace_point_emit_u64(timestamp->tv_sec);
 	rte_trace_point_emit_long(timestamp->tv_nsec);
 	rte_trace_point_emit_u32(flags);
 	rte_trace_point_emit_int(ret);
 )
+#else
+RTE_TRACE_POINT_FP(
+    rte_eth_trace_timesync_read_rx_timestamp,
+    RTE_TRACE_POINT_ARGS(uint16_t port_id, const struct timespec *timestamp,
+        uint32_t flags, int ret),
+    rte_trace_point_emit_u16(port_id);
+    rte_trace_point_emit_size_t(timestamp->tv_sec);
+    rte_trace_point_emit_long(timestamp->tv_nsec);
+    rte_trace_point_emit_u32(flags);
+    rte_trace_point_emit_int(ret);
+)
+#endif
 
 /* Called in loop in examples/ptpclient */
+#if defined(_TIME_BITS) && _TIME_BITS == 64
 RTE_TRACE_POINT_FP(
 	rte_eth_trace_timesync_read_tx_timestamp,
 	RTE_TRACE_POINT_ARGS(uint16_t port_id, const struct timespec *timestamp,
 		int ret),
 	rte_trace_point_emit_u16(port_id);
-	rte_trace_point_emit_size_t(timestamp->tv_sec);
+	rte_trace_point_emit_u64(timestamp->tv_sec);
 	rte_trace_point_emit_long(timestamp->tv_nsec);
 	rte_trace_point_emit_int(ret);
 )
+#else
+RTE_TRACE_POINT_FP(
+    rte_eth_trace_timesync_read_tx_timestamp,
+    RTE_TRACE_POINT_ARGS(uint16_t port_id, const struct timespec *timestamp,
+        int ret),
+    rte_trace_point_emit_u16(port_id);
+    rte_trace_point_emit_size_t(timestamp->tv_sec);
+    rte_trace_point_emit_long(timestamp->tv_nsec);
+    rte_trace_point_emit_int(ret);
+)
+#endif
 
 /* Called in loop in examples/ptpclient */
+#if defined(_TIME_BITS) && _TIME_BITS == 64
 RTE_TRACE_POINT_FP(
 	rte_eth_trace_timesync_read_time,
 	RTE_TRACE_POINT_ARGS(uint16_t port_id, const struct timespec *time,
 		int ret),
 	rte_trace_point_emit_u16(port_id);
-	rte_trace_point_emit_size_t(time->tv_sec);
+	rte_trace_point_emit_u64(time->tv_sec);
 	rte_trace_point_emit_long(time->tv_nsec);
 	rte_trace_point_emit_int(ret);
 )
+#else
+RTE_TRACE_POINT_FP(
+    rte_eth_trace_timesync_read_time,
+    RTE_TRACE_POINT_ARGS(uint16_t port_id, const struct timespec *time,
+        int ret),
+    rte_trace_point_emit_u16(port_id);
+    rte_trace_point_emit_size_t(time->tv_sec);
+    rte_trace_point_emit_long(time->tv_nsec);
+    rte_trace_point_emit_int(ret);
+)
+#endif
 
 /* Called in loop in examples/ptpclient */
 RTE_TRACE_POINT_FP(
-- 
2.34.1


             reply	other threads:[~2025-04-22 11:35 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-22 11:35 changqing.li [this message]
2025-04-23  0:39 ` [PATCH V3] " changqing.li

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=20250422113523.867473-1-changqing.li@windriver.com \
    --to=changqing.li@windriver.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).