On Mon, Apr 20, 2026 at 11:00:37PM +0000, Werner Kasselman wrote:
> Add a tcpbpf sock_ops selftest that forces a same-register ctx->rtt_min read 
> on request_sock-backed callbacks and verifies the observed value is zero.
> 
> This covers the dst_reg == src_reg path that the previous ctx_rewrite-only 
> test did not exercise.

Same formatting issue.

> 
> Signed-off-by: Werner Kasselman <[email protected]>
> ---
>  .../testing/selftests/bpf/prog_tests/tcpbpf_user.c |  4 ++++
>  .../testing/selftests/bpf/progs/test_tcpbpf_kern.c | 14 ++++++++++++++
>  tools/testing/selftests/bpf/test_tcpbpf.h          |  2 ++
>  3 files changed, 20 insertions(+)
> 
> diff --git a/tools/testing/selftests/bpf/prog_tests/tcpbpf_user.c 
> b/tools/testing/selftests/bpf/prog_tests/tcpbpf_user.c
> index 7e8fe1bad03f..1b08e49327d0 100644
> --- a/tools/testing/selftests/bpf/prog_tests/tcpbpf_user.c
> +++ b/tools/testing/selftests/bpf/prog_tests/tcpbpf_user.c
> @@ -42,6 +42,10 @@ static void verify_result(struct tcpbpf_globals *result)
>       /* check getsockopt for window_clamp */
>       ASSERT_EQ(result->window_clamp_client, 9216, "window_clamp_client");
>       ASSERT_EQ(result->window_clamp_server, 9216, "window_clamp_server");
> +
> +     /* check same-reg rtt_min read on request_sock-backed callbacks */
> +     ASSERT_NEQ(result->rtt_min_req_seen, 0, "rtt_min_req_seen");
> +     ASSERT_EQ(result->rtt_min_req_nonzero, 0, "rtt_min_req_nonzero");
>  }
>  
>  static void run_test(struct tcpbpf_globals *result)
> diff --git a/tools/testing/selftests/bpf/progs/test_tcpbpf_kern.c 
> b/tools/testing/selftests/bpf/progs/test_tcpbpf_kern.c
> index 6935f32eeb8f..a488b282b5dd 100644
> --- a/tools/testing/selftests/bpf/progs/test_tcpbpf_kern.c
> +++ b/tools/testing/selftests/bpf/progs/test_tcpbpf_kern.c
> @@ -33,6 +33,7 @@ int bpf_testcb(struct bpf_sock_ops *skops)
>  {
>       char header[sizeof(struct ipv6hdr) + sizeof(struct tcphdr)];
>       struct bpf_sock_ops *reuse = skops;
> +     long rtt_min = (long)skops;

It is overly smart to test the same dst_reg == src_reg.
A new test has just been added to test it in a cleaner way.

pw-bot: cr

You haven't spent time to take a look of the patches first.
Please don't post again. I will stop reviewing your patches from now.

Reply via email to