add tx timestamp tests
cover add tx timestamp tests
Reworked into a liburing test selftest/.../txtimestamp.c
Pavel Begunkov (2):
Sync io_uring.h with tx timestamp api
tests: timestamp example
src/include/liburing/io_uring.h | 16 ++ test/Makefile | 1 + test/timestamp.c | 376 ++++++++++++++++++++++++++++++++ 3 files changed, 393 insertions(+) create mode 100644 test/timestamp.c
Signature · 1 line
2.49.0
PATCH 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
@@ -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
PATCH 2/2 tests: timestamp example
In reply to Pavel Begunkov--- test/Makefile | 1 + test/timestamp.c | 376 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 377 insertions(+) create mode 100644 test/timestamp.c
test/Makefile +1 -0
@@ -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 +376 -0
376 lines not on this page · raw message
Signature · 1 line
2.49.0
Jens Axboe
maintainerRe: [PATCH 2/2] tests: timestamp example
Quoted 1 line · Pavel Begunkov
Signed-off-by Pavel Begunkov <[email protected]>
A bit of commit message might be nice? Ditto the other patch. I know they are pretty straight forward, but doesn't hurt to spell out a bit why the change is being made.
test/timestamp.c line 27
Quoted 3 lines
test/timestamp.c new file +3
-0+#ifndef SCM_TS_OPT_ID +#define SCM_TS_OPT_ID 0 +#endif
This one had me a bit puzzled, particularly with:
test/timestamp.c line 370
Quoted 4 lines
test/timestamp.c new file +4
-0+if (SCM_TS_OPT_ID ==0 ) { +fprintf (stderr,"no SCM_TS_OPT_ID, skip\n" ); +return T_EXIT_SKIP ; + }
as that'll just make the test skip on even my debian unstable/testing base as it's still not defined there. But I guess it's because it's arch specific? FWIW, looks like anything but sparc/parisc define it as 81, hence in terms of coverage might be better to simply define it for anything but those and actually have the test run?
Signature · 1 line
Jens Axboe
Re: [PATCH 2/2] tests: timestamp example
Quoted 6 lines · Jens Axboe
Quoted 1 line · Pavel Begunkov
Signed-off-by Pavel Begunkov <[email protected]>A bit of commit message might be nice? Ditto the other patch. I know they are pretty straight forward, but doesn't hurt to spell out a bit why the change is being made.
It's not like there is much to describe. The only bit I can add is the reference to the selftest as per the CV
Quoted 3 lines
test/timestamp.c line 27
Quoted 3 lines
test/timestamp.c new file +3
-0+#ifndef SCM_TS_OPT_ID +#define SCM_TS_OPT_ID 0 +#endif
Otherwise it needs to be
#ifdef SCM_TS_OPT_ID
All tests using SCM_TS_OPT_ID
#else
int main() {
return skip;
}#endif
which is even uglier
Quoted 12 lines
This one had me a bit puzzled, particularly with:
test/timestamp.c line 370
Quoted 4 lines
test/timestamp.c new file +4
-0+if (SCM_TS_OPT_ID ==0 ) { +fprintf (stderr,"no SCM_TS_OPT_ID, skip\n" ); +return T_EXIT_SKIP ; + }as that'll just make the test skip on even my debian unstable/testing base as it's still not defined there. But I guess it's because it's arch specific? FWIW, looks like anything but sparc/parisc define it as 81, hence in terms of coverage might be better to simply define it for anything but those and actually have the test run?
That only works until someone runs it on those arches and complain, i.e. delaying the problem. And I honesty don't want to parse the current architecture and figuring the value just for a test.
Signature · 1 line
Pavel Begunkov
Jens Axboe
maintainerRe: [PATCH 2/2] tests: timestamp example
Quoted 10 lines · Pavel Begunkov
Quoted 6 lines · Jens Axboe
Quoted 1 line · Pavel Begunkov
Signed-off-by Pavel Begunkov <[email protected]>A bit of commit message might be nice? Ditto the other patch. I know they are pretty straight forward, but doesn't hurt to spell out a bit why the change is being made.
It's not like there is much to describe. The only bit I can add is the reference to the selftest as per the CV
Agree, but even a link to the cover letter for the feature would be nice, then people can at least look it up rather than need to search for what it is.
Quoted 10 lines
Quoted 3 lines
test/timestamp.c line 27
Quoted 3 lines
test/timestamp.c new file +3
-0+#ifndef SCM_TS_OPT_ID +#define SCM_TS_OPT_ID 0 +#endif Otherwise it needs to be
#ifdef
SCM_TS_OPT_IDAll tests using
SCM_TS_OPT_ID
Quoted 7 lines
#else
int main() { return skip; }#endif
which is even uglier
That's not what I meant, as per below. It was about defining it to something valid, rather than gate the entire test on the define being available.
Quoted 13 lines
Quoted 7 lines
This one had me a bit puzzled, particularly with:
test/timestamp.c line 370
Quoted 4 lines
test/timestamp.c new file +4
-0+if (SCM_TS_OPT_ID ==0 ) { +fprintf (stderr,"no SCM_TS_OPT_ID, skip\n" ); +return T_EXIT_SKIP ; + }Quoted 5 lines
as that'll just make the test skip on even my debian unstable/testing base as it's still not defined there. But I guess it's because it's arch specific? FWIW, looks like anything but sparc/parisc define it as 81, hence in terms of coverage might be better to simply define it for anything but those and actually have the test run?
Quoted 3 lines
That only works until someone runs it on those arches and complain, i.e. delaying the problem. And I honesty don't want to parse the current architecture and figuring the value just for a test.
Since it's just those two obscure archs that nobody uses, I can just add it after the fact. I'd rather deal with that than not have the test run just because some arch relics use private defines. Not a big deal.
Signature · 1 line
Jens Axboe
Re: [PATCH 2/2] tests: timestamp example
In reply to Pavel BegunkovQuoted 42 lines · Pavel Begunkov
Quoted 6 lines · Jens Axboe
Quoted 1 line · Pavel Begunkov
Signed-off-by Pavel Begunkov <[email protected]>A bit of commit message might be nice? Ditto the other patch. I know they are pretty straight forward, but doesn't hurt to spell out a bit why the change is being made.
It's not like there is much to describe. The only bit I can add is the reference to the selftest as per the CV
Quoted 3 lines
test/timestamp.c line 27
Quoted 3 lines
test/timestamp.c new file +3
-0+#ifndef SCM_TS_OPT_ID +#define SCM_TS_OPT_ID 0 +#endif Otherwise it needs to be
#ifdef
SCM_TS_OPT_IDAll tests using
SCM_TS_OPT_ID#else
intmain(){
return skip;
}
#endifwhich is even uglier
Quoted 7 lines
This one had me a bit puzzled, particularly with:
Quoted 4 lines
+ if (
SCM_TS_OPT_ID== 0) {
+fprintf(stderr, "no SCM_TS_OPT_ID, skip\n"); + returnT_EXIT_SKIP;
+ }Quoted 5 lines
as that'll just make the test skip on even my debian unstable/testing base as it's still not defined there. But I guess it's because it's arch specific? FWIW, looks like anything but sparc/parisc define it as 81, hence in terms of coverage might be better to simply define it for anything but those and actually have the test run?
Quoted 3 lines
That only works until someone runs it on those arches and complain, i.e. delaying the problem. And I honesty don't want to parse the current architecture and figuring the value just for a test.
#include <asm/socket.h>
Is that even legit?
Signature · 1 line
Pavel Begunkov
Re: [PATCH 2/2] tests: timestamp example
Quoted 43 lines · Pavel Begunkov
Quoted 42 lines · Pavel Begunkov
Quoted 6 lines · Jens Axboe
Quoted 1 line · Pavel Begunkov
Signed-off-by Pavel Begunkov <[email protected]>A bit of commit message might be nice? Ditto the other patch. I know they are pretty straight forward, but doesn't hurt to spell out a bit why the change is being made.
It's not like there is much to describe. The only bit I can add is the reference to the selftest as per the CV
Quoted 3 lines
test/timestamp.c line 27
Quoted 3 lines
test/timestamp.c new file +3
-0+#ifndef SCM_TS_OPT_ID +#define SCM_TS_OPT_ID 0 +#endif Otherwise it needs to be
#ifdef
SCM_TS_OPT_IDAll tests using
SCM_TS_OPT_ID#else
intmain(){
return skip;
}
#endifwhich is even uglier
Quoted 12 lines
This one had me a bit puzzled, particularly with:
Quoted 4 lines
+ if (
SCM_TS_OPT_ID== 0) {
+fprintf(stderr, "no SCM_TS_OPT_ID, skip\n"); + returnT_EXIT_SKIP;
+ }as that'll just make the test skip on even my debian unstable/testing base as it's still not defined there. But I guess it's because it's arch specific? FWIW, looks like anything but sparc/parisc define it as 81, hence in terms of coverage might be better to simply define it for anything but those and actually have the test run?
Quoted 7 lines
Quoted 3 lines
That only works until someone runs it on those arches and complain, i.e. delaying the problem. And I honesty don't want to parse the current architecture and figuring the value just for a test.
#include <
asm/socket.h>Is that even legit?
Except that it doesn't work, nevermind
Signature · 1 line
Pavel Begunkov
Jens Axboe
maintainerRe: [PATCH 2/2] tests: timestamp example
In reply to Pavel BegunkovQuoted 43 lines · Pavel Begunkov
Quoted 42 lines · Pavel Begunkov
Quoted 6 lines · Jens Axboe
Quoted 1 line · Pavel Begunkov
Signed-off-by Pavel Begunkov <[email protected]>A bit of commit message might be nice? Ditto the other patch. I know they are pretty straight forward, but doesn't hurt to spell out a bit why the change is being made.
It's not like there is much to describe. The only bit I can add is the reference to the selftest as per the CV
Quoted 3 lines
test/timestamp.c line 27
Quoted 3 lines
test/timestamp.c new file +3
-0+#ifndef SCM_TS_OPT_ID +#define SCM_TS_OPT_ID 0 +#endif Otherwise it needs to be
#ifdef
SCM_TS_OPT_IDAll tests using
SCM_TS_OPT_ID#else
int main() { return skip; }#endif
which is even uglier
Quoted 12 lines
This one had me a bit puzzled, particularly with:
test/timestamp.c line 370
Quoted 4 lines
test/timestamp.c new file +4
-0+if (SCM_TS_OPT_ID ==0 ) { +fprintf (stderr,"no SCM_TS_OPT_ID, skip\n" ); +return T_EXIT_SKIP ; + }as that'll just make the test skip on even my debian unstable/testing base as it's still not defined there. But I guess it's because it's arch specific? FWIW, looks like anything but sparc/parisc define it as 81, hence in terms of coverage might be better to simply define it for anything but those and actually have the test run?
Quoted 7 lines
Quoted 3 lines
That only works until someone runs it on those arches and complain, i.e. delaying the problem. And I honesty don't want to parse the current architecture and figuring the value just for a test.
#include <
asm/socket.h>Is that even legit?
Good question... We can always try. Looking at debian, their newest package for testing/unstable is 6.12.33 which is why asm doesn't even have it. There is an 6.15 based package too, but still listed as experimental.
Signature · 1 line
Jens Axboe