Skip to contentSkip to conversation

add tx timestamp tests

PATCH Applied Pavel Begunkov 2 participants 4 messages Jun 30, 2025 io_uring

lore
Share & tools
lore
#0 lore raw

v2 cover add tx timestamp tests

Add definitions / tests test for tx timestamping io_uring API. See

https://lore.kernel.org/all/[email protected]/

Pavel Begunkov (2):
Sync io_uring.h with tx timestamp api
tests: add a tx timestamp test

 src/include/liburing/io_uring.h |  16 ++
 test/Makefile                   |   1 +
 test/timestamp.c                | 373 ++++++++++++++++++++++++++++++++
 3 files changed, 390 insertions(+)
 create mode 100644 test/timestamp.c
Signature · 1 line
2.49.0
#1 lore raw

PATCH v2 1/2 Sync io_uring.h with tx timestamp api

---
 src/include/liburing/io_uring.h | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
src/include/liburing/io_uring.h +16 -0
index 73d29976..94de038d 100644
@@ -915,6 +915,22 @@ enum io_uring_socket_op {
 	SOCKET_URING_OP_SIOCOUTQ,
 	SOCKET_URING_OP_GETSOCKOPT,
 	SOCKET_URING_OP_SETSOCKOPT,
+	SOCKET_URING_OP_TX_TIMESTAMP,
+};
+
+/*
+ * SOCKET_URING_OP_TX_TIMESTAMP definitions
+ */
+
+#define IORING_TIMESTAMP_HW_SHIFT	16
+/* The cqe->flags bit from which the timestamp type is stored */
+#define IORING_TIMESTAMP_TYPE_SHIFT	(IORING_TIMESTAMP_HW_SHIFT + 1)
+/* The cqe->flags flag signifying whether it's a hardware timestamp */
+#define IORING_CQE_F_TSTAMP_HW		((__u32)1 << IORING_TIMESTAMP_HW_SHIFT);
+
+struct io_timespec {
+	__u64		tv_sec;
+	__u64		tv_nsec;
 };
 
 /* Zero copy receive refill queue entry */
Signature · 1 line
2.49.0
#2 lore raw

PATCH v2 2/2 tests: add a tx timestamp test

In reply to Pavel Begunkov

Add a test for tx timestamping io_uring API.

https://lore.kernel.org/all/[email protected]/

The test itself is just an adapted version of txtimestamp.c kernel selftest.

---
 test/Makefile    |   1 +
 test/timestamp.c | 373 +++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 374 insertions(+)
 create mode 100644 test/timestamp.c
test/Makefile +1 -0
index ee09f5a8..99b272d7 100644
@@ -249,6 +249,7 @@ test_srcs := \
 	xattr.c \
 	zcrx.c \
 	vec-regbuf.c \
+	timestamp.c \
 	# EOL
 
 # Please keep this list sorted alphabetically.
test/timestamp.c new file +373 -0

373 lines not on this page · raw message

Signature · 1 line
2.49.0
maintainer Applied
#3 lore raw
In reply to Pavel Begunkov
Quoted 9 lines · Pavel Begunkov

Add definitions / tests test for tx timestamping io_uring API. See

https://lore.kernel.org/all/[email protected]/

Pavel Begunkov (2):
Sync io_uring.h with tx timestamp api
tests: add a tx timestamp test

[...]

Applied, thanks!

[1/2] Sync io_uring.h with tx timestamp api

      commit: 2b11d4753496335cec916d3c0a46c181ea79c6b6
[2/2] tests: add a tx timestamp test
      commit: 21224848af24d379d54fbf1bd43a60861fe19f9b

Best regards,

Signature · 1 line
Jens Axboe