[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <d886e631-851b-4e2f-aecb-ecdb541dfedc@linux.dev>
Date: Fri, 31 Oct 2025 12:28:50 -0700
From: Martin KaFai Lau <martin.lau@...ux.dev>
To: alexis.lothore@...tlin.com
Cc: ebpf@...uxfoundation.org, bastien.curutchet@...tlin.com,
thomas.petazzoni@...tlin.com, bpf@...r.kernel.org,
linux-kselftest@...r.kernel.org, linux-kernel@...r.kernel.org,
martin.lau@...nel.org, clm@...a.com, ihor.solodrai@...ux.dev,
bot+bpf-ci@...nel.org, ast@...nel.org, daniel@...earbox.net,
andrii@...nel.org, eddyz87@...il.com, song@...nel.org,
yonghong.song@...ux.dev, john.fastabend@...il.com, kpsingh@...nel.org,
sdf@...ichev.me, haoluo@...gle.com, jolsa@...nel.org, shuah@...nel.org
Subject: Re: [PATCH bpf-next 2/4] selftests/bpf: integrate test_tc_edt into
test_progs
On 10/31/25 9:20 AM, bot+bpf-ci@...nel.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
Powered by blists - more mailing lists