diff mbox series

[net-next,2/3] net-timestamp: add OPT_ID_TCP test in selftests

Message ID 20240930092416.80830-3-kerneljasonxing@gmail.com (mailing list archive)
State Changes Requested
Delegated to: Netdev Maintainers
Headers show
Series net-timestamp: add some trivial | expand

Checks

Context Check Description
netdev/series_format success Posting correctly formatted
netdev/tree_selection success Clearly marked for net-next, async
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 9 this patch: 9
netdev/build_tools success Errors and warnings before: 0 this patch: 0
netdev/cc_maintainers success CCed 6 of 6 maintainers
netdev/build_clang success Errors and warnings before: 9 this patch: 9
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn fail Errors and warnings before: 12 this patch: 12
netdev/checkpatch warning WARNING: line length of 83 exceeds 80 columns
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Jason Xing Sept. 30, 2024, 9:24 a.m. UTC
From: Jason Xing <kernelxing@tencent.com>

Introduce a test for SOF_TIMESTAMPING_OPT_ID_TCP for TCP proto so
that we can get aware of whether using write_seq as an initial key
value works as expected.

Signed-off-by: Jason Xing <kernelxing@tencent.com>
---
 tools/testing/selftests/net/txtimestamp.c | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

Willem de Bruijn Sept. 30, 2024, 10:42 a.m. UTC | #1
Jason Xing wrote:
> From: Jason Xing <kernelxing@tencent.com>
> 
> Introduce a test for SOF_TIMESTAMPING_OPT_ID_TCP for TCP proto so
> that we can get aware of whether using write_seq as an initial key
> value works as expected.

Does the test behave different with this flag set?

> 
> Signed-off-by: Jason Xing <kernelxing@tencent.com>
> ---
>  tools/testing/selftests/net/txtimestamp.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/tools/testing/selftests/net/txtimestamp.c b/tools/testing/selftests/net/txtimestamp.c
> index d626f22f9550..5f5de79d0e51 100644
> --- a/tools/testing/selftests/net/txtimestamp.c
> +++ b/tools/testing/selftests/net/txtimestamp.c
> @@ -893,6 +893,12 @@ static void do_main(int family)
>  		do_test(family, SOF_TIMESTAMPING_TX_SCHED |
>  				SOF_TIMESTAMPING_TX_SOFTWARE |
>  				SOF_TIMESTAMPING_TX_ACK);
> +
> +		fprintf(stderr, "\ntest ENQ + SND + ACK with tcp tskey setting\n");
> +		do_test(family, SOF_TIMESTAMPING_TX_SCHED |
> +				SOF_TIMESTAMPING_TX_SOFTWARE |
> +				SOF_TIMESTAMPING_TX_ACK |
> +				SOF_TIMESTAMPING_OPT_ID_TCP);
>  	}
>  }
>  
> -- 
> 2.37.3
>
Jason Xing Sept. 30, 2024, 11:49 a.m. UTC | #2
On Mon, Sep 30, 2024 at 6:42 PM Willem de Bruijn
<willemdebruijn.kernel@gmail.com> wrote:
>
> Jason Xing wrote:
> > From: Jason Xing <kernelxing@tencent.com>
> >
> > Introduce a test for SOF_TIMESTAMPING_OPT_ID_TCP for TCP proto so
> > that we can get aware of whether using write_seq as an initial key
> > value works as expected.
>
> Does the test behave different with this flag set?
>

Sorry, my mistake, the last email is not open to the mailing list. So
I copy that here.

Not that much, only at the very beginning, this new test will use
write_seq directly.

I once thought and wondered if I need to setsockopt() when one or two
sendmsg() are already done, then we check the behaviour of subsequent
sendmsg() calls. Then I changed my mind because it's a bit complex. Do
you think it's a good way to test?

Thanks,
Jason
Willem de Bruijn Sept. 30, 2024, 11:54 a.m. UTC | #3
Jason Xing wrote:
> On Mon, Sep 30, 2024 at 6:42 PM Willem de Bruijn
> <willemdebruijn.kernel@gmail.com> wrote:
> >
> > Jason Xing wrote:
> > > From: Jason Xing <kernelxing@tencent.com>
> > >
> > > Introduce a test for SOF_TIMESTAMPING_OPT_ID_TCP for TCP proto so
> > > that we can get aware of whether using write_seq as an initial key
> > > value works as expected.
> >
> > Does the test behave different with this flag set?
> >
> 
> Sorry, my mistake, the last email is not open to the mailing list. So
> I copy that here.
> 
> Not that much, only at the very beginning, this new test will use
> write_seq directly.

The kernel will act differently. But the test does not detect this.
 
> I once thought and wondered if I need to setsockopt() when one or two
> sendmsg() are already done, then we check the behaviour of subsequent
> sendmsg() calls. Then I changed my mind because it's a bit complex. Do
> you think it's a good way to test?

Packetdrill is more suitable for deterministically testing such subtle
differences.

I have a packetdrill test for OPT_ID with and without OPT_ID_TCP. It
is not public yet. As part of upstreaming our packetdrill tests, this
will eventually also be available.
Jason Xing Sept. 30, 2024, 12:17 p.m. UTC | #4
On Mon, Sep 30, 2024 at 7:54 PM Willem de Bruijn
<willemdebruijn.kernel@gmail.com> wrote:
>
> Jason Xing wrote:
> > On Mon, Sep 30, 2024 at 6:42 PM Willem de Bruijn
> > <willemdebruijn.kernel@gmail.com> wrote:
> > >
> > > Jason Xing wrote:
> > > > From: Jason Xing <kernelxing@tencent.com>
> > > >
> > > > Introduce a test for SOF_TIMESTAMPING_OPT_ID_TCP for TCP proto so
> > > > that we can get aware of whether using write_seq as an initial key
> > > > value works as expected.
> > >
> > > Does the test behave different with this flag set?
> > >
> >
> > Sorry, my mistake, the last email is not open to the mailing list. So
> > I copy that here.
> >
> > Not that much, only at the very beginning, this new test will use
> > write_seq directly.
>
> The kernel will act differently. But the test does not detect this.

No, it will not cover this.

>
> > I once thought and wondered if I need to setsockopt() when one or two
> > sendmsg() are already done, then we check the behaviour of subsequent
> > sendmsg() calls. Then I changed my mind because it's a bit complex. Do
> > you think it's a good way to test?
>
> Packetdrill is more suitable for deterministically testing such subtle
> differences.
>
> I have a packetdrill test for OPT_ID with and without OPT_ID_TCP. It
> is not public yet. As part of upstreaming our packetdrill tests, this
> will eventually also be available.

Good to hear that. Now I think I will drop this patch.

Thanks,
Jason
diff mbox series

Patch

diff --git a/tools/testing/selftests/net/txtimestamp.c b/tools/testing/selftests/net/txtimestamp.c
index d626f22f9550..5f5de79d0e51 100644
--- a/tools/testing/selftests/net/txtimestamp.c
+++ b/tools/testing/selftests/net/txtimestamp.c
@@ -893,6 +893,12 @@  static void do_main(int family)
 		do_test(family, SOF_TIMESTAMPING_TX_SCHED |
 				SOF_TIMESTAMPING_TX_SOFTWARE |
 				SOF_TIMESTAMPING_TX_ACK);
+
+		fprintf(stderr, "\ntest ENQ + SND + ACK with tcp tskey setting\n");
+		do_test(family, SOF_TIMESTAMPING_TX_SCHED |
+				SOF_TIMESTAMPING_TX_SOFTWARE |
+				SOF_TIMESTAMPING_TX_ACK |
+				SOF_TIMESTAMPING_OPT_ID_TCP);
 	}
 }