Linux Kernel Selftest development
 help / color / mirror / Atom feed
From: Martin KaFai Lau <martin.lau@linux.dev>
To: alexis.lothore@bootlin.com
Cc: ebpf@linuxfoundation.org, bastien.curutchet@bootlin.com,
	thomas.petazzoni@bootlin.com, bpf@vger.kernel.org,
	linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org,
	martin.lau@kernel.org, clm@meta.com, ihor.solodrai@linux.dev,
	bot+bpf-ci@kernel.org, ast@kernel.org, daniel@iogearbox.net,
	andrii@kernel.org, eddyz87@gmail.com, song@kernel.org,
	yonghong.song@linux.dev, john.fastabend@gmail.com,
	kpsingh@kernel.org, sdf@fomichev.me, haoluo@google.com,
	jolsa@kernel.org, shuah@kernel.org
Subject: Re: [PATCH bpf-next 2/4] selftests/bpf: integrate test_tc_edt into test_progs
Date: Fri, 31 Oct 2025 12:28:50 -0700	[thread overview]
Message-ID: <d886e631-851b-4e2f-aecb-ecdb541dfedc@linux.dev> (raw)
In-Reply-To: <09feef91b51f675195b5b1b9a854d844c9999c0cebb429d785fe60f6c787dc8b@mail.kernel.org>

On 10/31/25 9:20 AM, bot+bpf-ci@kernel.org wrote:
>> +static void run_test(void)
>> +{
>> +	__u64 rx_bytes_start, rx_bytes_end;
>> +	double rate_mbps, rate_error;
>> +	pthread_t server_thread = 0;
>> +	struct connection *conn;
>> +	__u64 ts_start, ts_end;
>> +	int ret;
>> +
>> +
>> +	conn = setup_connection();
>> +	if (!ASSERT_OK_PTR(conn, "setup client and server connection"))
>> +		return;
>> +
>> +	ret = pthread_create(&server_thread, NULL, run_server,
>> +			     (void *)(&conn->server_conn_fd));
>> +	if (!ASSERT_OK(ret, "start server rx thread"))
>> +		goto end_cleanup_conn;
>> +	if (!ASSERT_OK(read_rx_bytes(&rx_bytes_start), "read rx_bytes"))
>> +		goto end_kill_thread;
>> +	ts_start = get_time_ns();
>> +	while (true) {
>> +		send(conn->client_conn_fd, (void *)tx_buffer, BUFFER_LEN, 0);
>> +		ts_end = get_time_ns();
>> +		if ((ts_end - ts_start)/100000 >= TIMEOUT_MS) {
>                                           ^^^^^^
> 
> Does this time conversion use the correct divisor? The timeout check
> appears to divide nanoseconds by 100000, but TIMEOUT_MS is 2000
> milliseconds. Converting nanoseconds to milliseconds requires dividing
> by 1000000, not 100000. With the current calculation, the timeout would
> trigger after 200 milliseconds rather than 2000 milliseconds.

The report is correct, there is a typo in the denominator.

Use the send_recv_data() helper in network_helpers.c. It should simplify 
this test and no need to pthread_create, while loop, ....etc. 
send_recv_data limits by the number of bytes instead of the length of 
time. There is a target rate in this test, so it should be easy to 
convert from time limit to byte limit and reuse the send_recv_data.

pw-bot: cr


  reply	other threads:[~2025-10-31 19:29 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-31 15:55 [PATCH bpf-next 0/4] selftests/bpf: convert test_tc_edt.sh into test_progs Alexis Lothoré (eBPF Foundation)
2025-10-31 15:55 ` [PATCH bpf-next 1/4] selftests/bpf: rename test_tc_edt.bpf.c section to expose program type Alexis Lothoré (eBPF Foundation)
2025-10-31 15:55 ` [PATCH bpf-next 2/4] selftests/bpf: integrate test_tc_edt into test_progs Alexis Lothoré (eBPF Foundation)
2025-10-31 16:20   ` bot+bpf-ci
2025-10-31 19:28     ` Martin KaFai Lau [this message]
2025-11-03  9:39       ` Alexis Lothoré
2025-10-31 15:55 ` [PATCH bpf-next 3/4] selftests/bpf: remove test_tc_edt.sh Alexis Lothoré (eBPF Foundation)
2025-10-31 15:55 ` [PATCH bpf-next 4/4] selftests/bpf: do not hardcode target rate in test_tc_edt BPF program Alexis Lothoré (eBPF Foundation)

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=d886e631-851b-4e2f-aecb-ecdb541dfedc@linux.dev \
    --to=martin.lau@linux.dev \
    --cc=alexis.lothore@bootlin.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bastien.curutchet@bootlin.com \
    --cc=bot+bpf-ci@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=clm@meta.com \
    --cc=daniel@iogearbox.net \
    --cc=ebpf@linuxfoundation.org \
    --cc=eddyz87@gmail.com \
    --cc=haoluo@google.com \
    --cc=ihor.solodrai@linux.dev \
    --cc=john.fastabend@gmail.com \
    --cc=jolsa@kernel.org \
    --cc=kpsingh@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=martin.lau@kernel.org \
    --cc=sdf@fomichev.me \
    --cc=shuah@kernel.org \
    --cc=song@kernel.org \
    --cc=thomas.petazzoni@bootlin.com \
    --cc=yonghong.song@linux.dev \
    /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