Skip to content

Commit 52ddc6e

Browse files
Krishna Tcarlescufi
authored andcommitted
samples: net: zperf: Add loopback overlay
This is useful to profile networking stack using loopback interface, a TX only option is also added but disabled by default. Signed-off-by: Krishna T <[email protected]>
1 parent 3cc1a6e commit 52ddc6e

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
CONFIG_NET_DRIVERS=y
2+
CONFIG_NET_LOOPBACK=y
3+
CONFIG_NET_LOOPBACK_MTU=1100
4+
# Enable for testing TX only
5+
CONFIG_NET_LOOPBACK_SIMULATE_PACKET_DROP=y
6+
7+
CONFIG_NET_BUF_DATA_SIZE=1100
8+
# Optimized networking settings for performance
9+
CONFIG_NET_PKT_RX_COUNT=32
10+
CONFIG_NET_PKT_TX_COUNT=48
11+
CONFIG_NET_BUF_RX_COUNT=32
12+
CONFIG_NET_BUF_TX_COUNT=96

samples/net/zperf/src/main.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111
#include <zephyr/usb/usb_device.h>
1212
#include <zephyr/net/net_config.h>
1313

14+
#ifdef CONFIG_NET_LOOPBACK_SIMULATE_PACKET_DROP
15+
#include <zephyr/net/loopback.h>
16+
#endif
1417
void main(void)
1518
{
1619
#if defined(CONFIG_USB_DEVICE_STACK)
@@ -23,4 +26,7 @@ void main(void)
2326

2427
(void)net_config_init_app(NULL, "Initializing network");
2528
#endif /* CONFIG_USB_DEVICE_STACK */
29+
#ifdef CONFIG_NET_LOOPBACK_SIMULATE_PACKET_DROP
30+
loopback_set_packet_drop_ratio(1);
31+
#endif
2632
}

0 commit comments

Comments
 (0)