From: Martin KaFai Lau <martin.lau@linux.dev>
To: Kui-Feng Lee <sinquersw@gmail.com>, Kui-Feng Lee <thinker.li@gmail.com>
Cc: bpf@vger.kernel.org, ast@kernel.org, song@kernel.org,
kernel-team@meta.com, andrii@kernel.org, sdf@fomichev.me,
geliang@kernel.org, kuifeng@meta.com
Subject: Re: [PATCH bpf-next v4 1/6] selftests/bpf: Add traffic monitor functions.
Date: Fri, 2 Aug 2024 14:12:04 -0700 [thread overview]
Message-ID: <dfd374ec-0b7c-4238-8e2f-42a331635261@linux.dev> (raw)
In-Reply-To: <f183b180-3bb1-4650-89f9-704db529281b@gmail.com>
On 8/2/24 1:37 PM, Kui-Feng Lee wrote:
>> One way could be putting them in a new traffic_monitor.c such that the non
>> test_progs binaries won't link to it. and exports the test name and shmod_tmon
>> in test_progs.h (e.g. through function).
>>
>> Another way (better and my preference if it works out) is to ask the
>> traffic_monitor_start() to take the the pcap file name args and makeup a
>> reasonable default if no filename is given. Not that I am promoting non
>> test_progs tests, traffic_monitor_start() can then be reused by others for
>> legit reason. The test_progs's tests usually should not use
>> traffic_monitor_start() directly and they should stay with the netns_{new,
>> free}. I think only netns_new needs the env to figure out the should_tmon and
>> the pcap filename. May be netns_new() can stay in test_progs.c, or rename it
>> to test__netns_new().
>>
>> wdyt?
>
> How about put two ideas together?
> Have traffic_monitor.c and macros in test_progs.h to collect
> data from env, and pass the data to netns_new() in traffic_monitor.c.
>
> For example,
>
> #define test__netns_new(ns) netns_new(ns, env.test->should_tmon || \
> (env.subtest_state && env.subtest_state->should_tmon), \
> env.test->test_name, \
> env.subtest_state ? env.subtest_state->name: NULL)
>
The macro looks ok. I am not sure if it is easier as a macro in .h or just a
func in test_progs.c. A quick look is the struct of env.test is not defined in
.h. Just a thought.
If we have this macro/func, a quick thought is there is not much upside to
create a new traffic_monitor.c instead of putting everything in
network_helpers.c. I am fine either way. The other non test_progs binaries just
need to link another traffic_monitor.o in the future if it wants to do
traffic_monitor_start().
next prev parent reply other threads:[~2024-08-02 21:12 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-31 19:31 [PATCH bpf-next v4 0/6] monitor network traffic for flaky test cases Kui-Feng Lee
2024-07-31 19:31 ` [PATCH bpf-next v4 1/6] selftests/bpf: Add traffic monitor functions Kui-Feng Lee
2024-07-31 21:07 ` Stanislav Fomichev
2024-08-02 3:54 ` Kui-Feng Lee
2024-08-02 3:29 ` Martin KaFai Lau
2024-08-02 4:31 ` Kui-Feng Lee
2024-08-02 18:58 ` Martin KaFai Lau
2024-08-02 20:37 ` Kui-Feng Lee
2024-08-02 21:12 ` Martin KaFai Lau [this message]
2024-08-02 3:43 ` Martin KaFai Lau
2024-08-02 4:35 ` Kui-Feng Lee
2024-08-06 22:07 ` Kui-Feng Lee
2024-08-06 22:22 ` Martin KaFai Lau
2024-08-06 23:18 ` Kui-Feng Lee
2024-08-06 23:41 ` Martin KaFai Lau
2024-08-07 0:17 ` Kui-Feng Lee
2024-07-31 19:31 ` [PATCH bpf-next v4 2/6] selftests/bpf: Add the traffic monitor option to test_progs Kui-Feng Lee
2024-07-31 19:31 ` [PATCH bpf-next v4 3/6] selftests/bpf: netns_new() and netns_free() helpers Kui-Feng Lee
2024-07-31 21:02 ` Stanislav Fomichev
2024-08-02 4:42 ` Kui-Feng Lee
2024-07-31 19:31 ` [PATCH bpf-next v4 4/6] selftests/bpf: Monitor traffic for tc_redirect Kui-Feng Lee
2024-07-31 19:31 ` [PATCH bpf-next v4 5/6] selftests/bpf: Monitor traffic for sockmap_listen Kui-Feng Lee
2024-07-31 21:09 ` Stanislav Fomichev
2024-08-02 4:42 ` Kui-Feng Lee
2024-07-31 19:31 ` [PATCH bpf-next v4 6/6] selftests/bpf: Monitor traffic for select_reuseport Kui-Feng Lee
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=dfd374ec-0b7c-4238-8e2f-42a331635261@linux.dev \
--to=martin.lau@linux.dev \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=geliang@kernel.org \
--cc=kernel-team@meta.com \
--cc=kuifeng@meta.com \
--cc=sdf@fomichev.me \
--cc=sinquersw@gmail.com \
--cc=song@kernel.org \
--cc=thinker.li@gmail.com \
/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