net: lib: zperf: conditional UDP/TCP compilation

Only compile in the UDP/TCP variants of the zperf functions if the
underlying support is present.

Signed-off-by: Jordan Yates <jordan@embeint.com>
This commit is contained in:
Jordan Yates 2025-04-17 16:10:34 +10:00 committed by Benjamin Cabé
commit 6ce51997e7
2 changed files with 11 additions and 9 deletions

View file

@ -2,16 +2,14 @@
zephyr_library_named(zperf) zephyr_library_named(zperf)
zephyr_library_sources( zephyr_library_sources(zperf_common.c)
zperf_common.c zephyr_library_sources_ifdef(CONFIG_NET_UDP zperf_udp_uploader.c)
zperf_udp_uploader.c zephyr_library_sources_ifdef(CONFIG_NET_TCP zperf_tcp_uploader.c)
zperf_tcp_uploader.c
)
if(CONFIG_NET_ZPERF_SERVER) if(CONFIG_NET_ZPERF_SERVER)
zephyr_library_sources(zperf_session.c) zephyr_library_sources(zperf_session.c)
zephyr_library_sources(zperf_udp_receiver.c) zephyr_library_sources_ifdef(CONFIG_NET_UDP zperf_udp_receiver.c)
zephyr_library_sources(zperf_tcp_receiver.c) zephyr_library_sources_ifdef(CONFIG_NET_TCP zperf_tcp_receiver.c)
endif() endif()
zephyr_library_sources_ifdef(CONFIG_NET_SHELL zephyr_library_sources_ifdef(CONFIG_NET_SHELL

View file

@ -234,8 +234,12 @@ static int zperf_init(void)
NULL); NULL);
k_thread_name_set(&zperf_work_q.thread, "zperf_work_q"); k_thread_name_set(&zperf_work_q.thread, "zperf_work_q");
zperf_udp_uploader_init(); if (IS_ENABLED(CONFIG_NET_UDP)) {
zperf_tcp_uploader_init(); zperf_udp_uploader_init();
}
if (IS_ENABLED(CONFIG_NET_TCP)) {
zperf_tcp_uploader_init();
}
if (IS_ENABLED(CONFIG_NET_ZPERF_SERVER)) { if (IS_ENABLED(CONFIG_NET_ZPERF_SERVER)) {
zperf_session_init(); zperf_session_init();