Skip to content

Commit 6ce5199

Browse files
JordanYateskartben
authored andcommitted
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>
1 parent 82d7675 commit 6ce5199

File tree

2 files changed

+11
-9
lines changed

2 files changed

+11
-9
lines changed

subsys/net/lib/zperf/CMakeLists.txt

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,14 @@
22

33
zephyr_library_named(zperf)
44

5-
zephyr_library_sources(
6-
zperf_common.c
7-
zperf_udp_uploader.c
8-
zperf_tcp_uploader.c
9-
)
5+
zephyr_library_sources(zperf_common.c)
6+
zephyr_library_sources_ifdef(CONFIG_NET_UDP zperf_udp_uploader.c)
7+
zephyr_library_sources_ifdef(CONFIG_NET_TCP zperf_tcp_uploader.c)
108

119
if(CONFIG_NET_ZPERF_SERVER)
1210
zephyr_library_sources(zperf_session.c)
13-
zephyr_library_sources(zperf_udp_receiver.c)
14-
zephyr_library_sources(zperf_tcp_receiver.c)
11+
zephyr_library_sources_ifdef(CONFIG_NET_UDP zperf_udp_receiver.c)
12+
zephyr_library_sources_ifdef(CONFIG_NET_TCP zperf_tcp_receiver.c)
1513
endif()
1614

1715
zephyr_library_sources_ifdef(CONFIG_NET_SHELL

subsys/net/lib/zperf/zperf_common.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -234,8 +234,12 @@ static int zperf_init(void)
234234
NULL);
235235
k_thread_name_set(&zperf_work_q.thread, "zperf_work_q");
236236

237-
zperf_udp_uploader_init();
238-
zperf_tcp_uploader_init();
237+
if (IS_ENABLED(CONFIG_NET_UDP)) {
238+
zperf_udp_uploader_init();
239+
}
240+
if (IS_ENABLED(CONFIG_NET_TCP)) {
241+
zperf_tcp_uploader_init();
242+
}
239243

240244
if (IS_ENABLED(CONFIG_NET_ZPERF_SERVER)) {
241245
zperf_session_init();

0 commit comments

Comments
 (0)