Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

zperf: Add support for nRF7002DK #83455

Merged
merged 4 commits into from
Jan 3, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion include/zephyr/net/wifi_mgmt.h
Original file line number Diff line number Diff line change
Expand Up @@ -696,7 +696,7 @@ struct wifi_iface_status {
unsigned short beacon_interval;
/** is TWT capable? */
bool twt_capable;
/** The current 802.11 PHY TX data rate (in Kbps) */
/** The current 802.11 PHY TX data rate (in Mbps) */
int current_phy_tx_rate;
};

Expand Down
6 changes: 6 additions & 0 deletions samples/net/zperf/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,9 @@ endif()
if (CONFIG_USB_DEVICE_STACK_NEXT)
include(${ZEPHYR_BASE}/samples/subsys/usb/common/common.cmake)
endif()

if (CONFIG_SOC_NRF5340_CPUAPP)
target_sources(app PRIVATE
src/nrf5340_cpu_boost.c
)
endif()
6 changes: 6 additions & 0 deletions samples/net/zperf/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,9 @@ Usage

See :ref:`zperf library documentation <zperf>` for more information about
the library usage.

Wi-Fi
=====

The IPv4 Wi-Fi support can be enabled in the sample with
:ref:`Wi-Fi snippet <snippet-wifi-ipv4>`.
25 changes: 25 additions & 0 deletions samples/net/zperf/boards/nrf7002dk_nrf5340_cpuapp.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Optimized networking settings for performance
CONFIG_NET_PKT_RX_COUNT=28
CONFIG_NET_PKT_TX_COUNT=27
CONFIG_NET_BUF_RX_COUNT=28
CONFIG_NET_BUF_TX_COUNT=54
CONFIG_NET_BUF_DATA_SIZE=1100
CONFIG_HEAP_MEM_POOL_SIZE=260000
CONFIG_NRF70_MAX_TX_AGGREGATION=4
CONFIG_NRF70_QSPI_LOW_POWER=n

# For speed optimizations
CONFIG_PICOLIBC_USE_MODULE=y

# Consumes more memory
CONFIG_WIFI_CREDENTIALS=n
CONFIG_FLASH=n
CONFIG_NVS=n
CONFIG_SETTINGS=n

# Debugging
CONFIG_NRF70_UTIL=y
CONFIG_SYS_HEAP_RUNTIME_STATS=y
CONFIG_NET_STATISTICS=y
CONFIG_NET_STATISTICS_WIFI=y
CONFIG_NET_STATISTICS_USER_API=y
5 changes: 5 additions & 0 deletions samples/net/zperf/sample.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -123,3 +123,8 @@ tests:
sample.net.zperf.802154.subg:
extra_args: EXTRA_CONF_FILE="overlay-802154-subg.conf"
platform_allow: beagleconnect_freedom
sample.net.zperf.nrf7002dk:
extra_args: SNIPPET=wifi-ipv4
extra_configs:
- CONFIG_BUILD_ONLY_NO_BLOBS=y
platform_allow: nrf7002dk/nrf5340/cpuapp
2 changes: 2 additions & 0 deletions samples/net/zperf/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
#include <zephyr/usb/usbd.h>
#include <zephyr/net/net_config.h>

LOG_MODULE_REGISTER(zperf, CONFIG_NET_ZPERF_LOG_LEVEL);

#ifdef CONFIG_NET_LOOPBACK_SIMULATE_PACKET_DROP
#include <zephyr/net/loopback.h>
#endif
Expand Down
35 changes: 35 additions & 0 deletions samples/net/zperf/src/nrf5340_cpu_boost.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/*
* Copyright (c) 2025 Nordic Semiconductor ASA
*
* SPDX-License-Identifier: Apache-2.0
*/

/**
* @file
* @brief CPU frequency boost for nRF53 series
*/

#include <zephyr/kernel.h>
#include <zephyr/logging/log.h>

#include <nrfx_clock.h>

LOG_MODULE_DECLARE(zperf, CONFIG_NET_ZPERF_LOG_LEVEL);

static int nrf53_cpu_boost(void)
{
int err;

/* For optimal performance, the CPU frequency should be set to 128 MHz */
err = nrfx_clock_divider_set(NRF_CLOCK_DOMAIN_HFCLK, NRF_CLOCK_HFCLK_DIV_1);
err -= NRFX_ERROR_BASE_NUM;
if (err != 0) {
LOG_WRN("Failed to set 128 MHz: %d", err);
}

LOG_INF("Starting %s with CPU frequency: %d MHz", CONFIG_BOARD, SystemCoreClock/MHZ(1));

return err;
}

SYS_INIT(nrf53_cpu_boost, POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT);
2 changes: 1 addition & 1 deletion snippets/wifi-ipv4/wifi-ipv4.conf
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ CONFIG_WIFI_NM_WPA_SUPPLICANT=y
CONFIG_MAIN_STACK_SIZE=2048
CONFIG_ZVFS_OPEN_MAX=24
CONFIG_NET_MAX_CONN=10
CONFIG_NET_SOCKETS_POLL_MAX=9
CONFIG_ZVFS_POLL_MAX=10

# IPv4 only for now
CONFIG_NET_IPV6=n
Expand Down
4 changes: 1 addition & 3 deletions subsys/net/l2/wifi/wifi_shell.c
Original file line number Diff line number Diff line change
Expand Up @@ -1154,9 +1154,7 @@ static int cmd_wifi_status(const struct shell *sh, size_t argc, char *argv[])
PR("DTIM: %d\n", status.dtim_period);
PR("TWT: %s\n",
status.twt_capable ? "Supported" : "Not supported");
PR("Current PHY TX rate (Mbps) : %d.%03d\n",
status.current_phy_tx_rate / 1000,
status.current_phy_tx_rate % 1000);
PR("Current PHY TX rate (Mbps) : %d\n", status.current_phy_tx_rate);
}

return 0;
Expand Down
Loading