From b4a37ebd9d8af762e65b790c69f9bf2eb4982414 Mon Sep 17 00:00:00 2001 From: Chen Yudong Date: Tue, 30 Dec 2025 10:55:57 +0800 Subject: [PATCH 1/4] fix(example): remove bt requires from wifi example --- examples/wifi/getting_started/station/main/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/wifi/getting_started/station/main/CMakeLists.txt b/examples/wifi/getting_started/station/main/CMakeLists.txt index 8ac6097df6..2fe97581a2 100644 --- a/examples/wifi/getting_started/station/main/CMakeLists.txt +++ b/examples/wifi/getting_started/station/main/CMakeLists.txt @@ -1,3 +1,3 @@ idf_component_register(SRCS "station_example_main.c" - PRIV_REQUIRES esp_wifi nvs_flash bt + PRIV_REQUIRES esp_wifi nvs_flash INCLUDE_DIRS ".") From 4e032bf3e13a2ee9ca2177e45fee3b528b872e53 Mon Sep 17 00:00:00 2001 From: Chen Yudong Date: Tue, 30 Dec 2025 18:13:30 +0800 Subject: [PATCH 2/4] feat(example): update iperf examples --- .../wifi_coexist/main/idf_component.yml | 2 +- .../ethernet/iperf/main/ethernet_iperf_main.c | 2 +- examples/ethernet/iperf/main/idf_component.yml | 4 ++-- .../ot_examples_common/idf_component.yml | 2 +- examples/wifi/iperf/main/idf_component.yml | 2 +- examples/wifi/iperf/main/iperf_example_main.c | 18 +++++++++--------- examples/wifi/iperf/sdkconfig.defaults | 3 +-- .../idf_iperf_test_util/IperfUtility.py | 8 ++++---- 8 files changed, 20 insertions(+), 21 deletions(-) diff --git a/examples/bluetooth/esp_ble_mesh/wifi_coexist/main/idf_component.yml b/examples/bluetooth/esp_ble_mesh/wifi_coexist/main/idf_component.yml index 9fe802f328..21aa055cda 100644 --- a/examples/bluetooth/esp_ble_mesh/wifi_coexist/main/idf_component.yml +++ b/examples/bluetooth/esp_ble_mesh/wifi_coexist/main/idf_component.yml @@ -4,4 +4,4 @@ dependencies: example_init: path: ${IDF_PATH}/examples/bluetooth/esp_ble_mesh/common_components/example_init espressif/iperf: - version: "~0.1.1" + version: "^1.0.2" diff --git a/examples/ethernet/iperf/main/ethernet_iperf_main.c b/examples/ethernet/iperf/main/ethernet_iperf_main.c index bd5b996ec1..71ddd7d15f 100644 --- a/examples/ethernet/iperf/main/ethernet_iperf_main.c +++ b/examples/ethernet/iperf/main/ethernet_iperf_main.c @@ -114,7 +114,7 @@ void app_main(void) /* Register commands */ register_system_common(); - app_register_iperf_commands(); + iperf_cmd_register_iperf(); register_ethernet_commands(); printf("\n =======================================================\n"); diff --git a/examples/ethernet/iperf/main/idf_component.yml b/examples/ethernet/iperf/main/idf_component.yml index 47e0d941b9..3afe76ea24 100644 --- a/examples/ethernet/iperf/main/idf_component.yml +++ b/examples/ethernet/iperf/main/idf_component.yml @@ -2,6 +2,6 @@ dependencies: cmd_system: path: ${IDF_PATH}/examples/system/console/advanced/components/cmd_system espressif/ethernet_init: - version: "~1.2.0" + version: "~1.3.0" espressif/iperf-cmd: - version: "~0.1.1" + version: "~1.0.2" diff --git a/examples/openthread/ot_common_components/ot_examples_common/idf_component.yml b/examples/openthread/ot_common_components/ot_examples_common/idf_component.yml index 64b8f724c2..ea03d0d861 100644 --- a/examples/openthread/ot_common_components/ot_examples_common/idf_component.yml +++ b/examples/openthread/ot_common_components/ot_examples_common/idf_component.yml @@ -1,5 +1,5 @@ ## IDF Component Manager Manifest File dependencies: - espressif/iperf-cmd: "^1.0.0" + espressif/iperf-cmd: "^1.0.2" cmd_system: path: ${IDF_PATH}/examples/system/console/advanced/components/cmd_system diff --git a/examples/wifi/iperf/main/idf_component.yml b/examples/wifi/iperf/main/idf_component.yml index 35dc881596..910a14dce7 100644 --- a/examples/wifi/iperf/main/idf_component.yml +++ b/examples/wifi/iperf/main/idf_component.yml @@ -2,7 +2,7 @@ dependencies: cmd_system: path: ${IDF_PATH}/examples/system/console/advanced/components/cmd_system espressif/iperf-cmd: - version: "~0.1.3" + version: "~1.0.2" esp-qa/wifi-cmd: version: "~0.2.7" esp-qa/ping-cmd: diff --git a/examples/wifi/iperf/main/iperf_example_main.c b/examples/wifi/iperf/main/iperf_example_main.c index a7fb3c3608..b9ec99bd1f 100644 --- a/examples/wifi/iperf/main/iperf_example_main.c +++ b/examples/wifi/iperf/main/iperf_example_main.c @@ -39,29 +39,29 @@ extern int wifi_cmd_clr_rx_statistics(int argc, char **argv); #include "esp_extconn.h" #endif -void iperf_hook_show_wifi_stats(iperf_traffic_type_t type, iperf_status_t status) +void iperf_hook_show_wifi_stats(iperf_id_t instance_id, iperf_state_data_t *data, void *priv) { - if (status == IPERF_STARTED) { + if (data->state == IPERF_STARTED) { #if CONFIG_ESP_WIFI_ENABLE_WIFI_TX_STATS - if (type != IPERF_UDP_SERVER) { + if (data->traffic_type != IPERF_UDP_SERVER) { wifi_cmd_clr_tx_statistics(0, NULL); } #endif #if CONFIG_ESP_WIFI_ENABLE_WIFI_RX_STATS - if (type != IPERF_UDP_CLIENT) { + if (data->traffic_type != IPERF_UDP_CLIENT) { wifi_cmd_clr_rx_statistics(0, NULL); } #endif } - if (status == IPERF_STOPPED) { + if (data->state == IPERF_STOPPED) { #if CONFIG_ESP_WIFI_ENABLE_WIFI_TX_STATS - if (type != IPERF_UDP_SERVER) { + if (data->traffic_type != IPERF_UDP_SERVER) { wifi_cmd_get_tx_statistics(0, NULL); } #endif #if CONFIG_ESP_WIFI_ENABLE_WIFI_RX_STATS - if (type != IPERF_UDP_CLIENT) { + if (data->traffic_type != IPERF_UDP_CLIENT) { wifi_cmd_get_rx_statistics(0, NULL); } #endif @@ -132,8 +132,8 @@ void app_main(void) /* From wifi-cmd */ wifi_cmd_register_all(); /* From iperf-cmd */ - app_register_iperf_commands(); - app_register_iperf_hook_func(iperf_hook_show_wifi_stats); + iperf_cmd_register_iperf(); + iperf_cmd_set_iperf_state_handler(iperf_hook_show_wifi_stats, NULL); /* From ping-cmd */ ping_cmd_register_ping(); diff --git a/examples/wifi/iperf/sdkconfig.defaults b/examples/wifi/iperf/sdkconfig.defaults index 3f9430a102..5911186722 100644 --- a/examples/wifi/iperf/sdkconfig.defaults +++ b/examples/wifi/iperf/sdkconfig.defaults @@ -7,10 +7,9 @@ CONFIG_ESP_INT_WDT=n CONFIG_ESP_TASK_WDT_EN=n CONFIG_LWIP_IRAM_OPTIMIZATION=y +CONFIG_LWIP_EXTRA_IRAM_OPTIMIZATION=y CONFIG_LWIP_TCPIP_TASK_PRIO=23 -CONFIG_IPERF_TRAFFIC_TASK_PRIORITY=23 -CONFIG_IPERF_REPORT_TASK_PRIORITY=24 CONFIG_COMPILER_OPTIMIZATION_PERF=y CONFIG_PARTITION_TABLE_SINGLE_APP_LARGE=y diff --git a/tools/ci/python_packages/idf_iperf_test_util/IperfUtility.py b/tools/ci/python_packages/idf_iperf_test_util/IperfUtility.py index 632da99dbc..5a40b32032 100644 --- a/tools/ci/python_packages/idf_iperf_test_util/IperfUtility.py +++ b/tools/ci/python_packages/idf_iperf_test_util/IperfUtility.py @@ -387,10 +387,10 @@ class IperfTestUtility(object): self.dut.write('iperf -s -u -i 1 -t {}'.format(TEST_TIME)) # wait until DUT TCP server created try: - self.dut.expect('Socket bound', timeout=5) + self.dut.expect('Socket created', timeout=5) except pexpect.TIMEOUT: # compatible with old iperf example binary - logging.info('create iperf udp server fail') + logging.info('No "Socket created" confirmation received after starting UDP server') process = subprocess.Popen( ['iperf', '-c', dut_ip, '-u', '-b', str(bw_limit) + 'm', '-t', str(TEST_TIME), '-f', 'm'], stdout=f, @@ -412,10 +412,10 @@ class IperfTestUtility(object): ) # 4 sec for each bw step instance start/stop # wait until DUT TCP server created try: - self.dut.expect('Socket bound', timeout=5) + self.dut.expect('Socket created', timeout=5) except pexpect.TIMEOUT: # compatible with old iperf example binary - logging.info('create iperf udp server fail') + logging.info('No "Socket created" confirmation received after starting UDP server') for bandwidth in range(start_bw, stop_bw, step): process = subprocess.Popen( [ From c5fc8e916e07b524ce11efa3717f19eaa33dc92d Mon Sep 17 00:00:00 2001 From: Chen Yudong Date: Wed, 4 Feb 2026 15:09:43 +0800 Subject: [PATCH 3/4] ci: add 'depends_components' to wifi test apps --- .../esp_wifi/test_apps/.build-test-rules.yml | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/components/esp_wifi/test_apps/.build-test-rules.yml b/components/esp_wifi/test_apps/.build-test-rules.yml index 5dca73c51e..a9972bba6c 100644 --- a/components/esp_wifi/test_apps/.build-test-rules.yml +++ b/components/esp_wifi/test_apps/.build-test-rules.yml @@ -3,7 +3,30 @@ components/esp_wifi/test_apps/: disable: - if: SOC_WIFI_SUPPORTED != 1 + depends_components: + - esp_hw_support + - esp_rom + - esp_system + - esp_timer + - freertos + - esp_event + - esp_wifi + - esp_phy + - esp_netif + - esp_coex + - wpa_supplicant + - mbedtls + - esp_pm components/esp_wifi/test_apps/wifi_nvs_config: disable: - if: SOC_WIFI_SUPPORTED != 1 + depends_components: + - esp_hw_support + - esp_rom + - esp_system + - esp_timer + - freertos + - esp_event + - nvs_flash + - esp_wifi From 9afec3c4f3eca9db2c2b0c1b2e2aa0539fcaa007 Mon Sep 17 00:00:00 2001 From: Chen Yudong Date: Fri, 6 Feb 2026 17:43:04 +0800 Subject: [PATCH 4/4] fix: use iperf-cmd for example esp_ble_mesh/wifi_coexist --- .../esp_ble_mesh/wifi_coexist/main/cmd_wifi.c | 155 +----------------- .../wifi_coexist/main/idf_component.yml | 2 +- .../esp_ble_mesh/wifi_coexist/main/main.c | 3 + ...E_Mesh_WiFi_Coexist_Example_Walkthrough.md | 2 +- examples/wifi/iperf/sdkconfig.ci.99 | 1 + examples/wifi/iperf/sdkconfig.defaults | 1 - .../idf_iperf_test_util/IperfUtility.py | 89 +++++----- 7 files changed, 45 insertions(+), 208 deletions(-) diff --git a/examples/bluetooth/esp_ble_mesh/wifi_coexist/main/cmd_wifi.c b/examples/bluetooth/esp_ble_mesh/wifi_coexist/main/cmd_wifi.c index 42da684a3a..ff2e4f2d2a 100644 --- a/examples/bluetooth/esp_ble_mesh/wifi_coexist/main/cmd_wifi.c +++ b/examples/bluetooth/esp_ble_mesh/wifi_coexist/main/cmd_wifi.c @@ -1,7 +1,7 @@ /* * Iperf example - wifi commands * - * SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2021-2026 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Unlicense OR CC0-1.0 */ @@ -18,21 +18,6 @@ #include "freertos/event_groups.h" #include "esp_wifi.h" #include "esp_netif.h" -#include "iperf.h" - -typedef struct { - struct arg_str *ip; - struct arg_lit *server; - struct arg_lit *udp; - struct arg_lit *version; - struct arg_int *port; - struct arg_int *length; - struct arg_int *interval; - struct arg_int *time; - struct arg_lit *abort; - struct arg_end *end; -} wifi_iperf_t; -static wifi_iperf_t iperf_args; typedef struct { struct arg_str *ssid; @@ -293,124 +278,6 @@ static int wifi_cmd_query(int argc, char **argv) return 0; } -static uint32_t wifi_get_local_ip(void) -{ - int bits = xEventGroupWaitBits(wifi_event_group, CONNECTED_BIT, 0, 1, 0); - esp_netif_t *ifx = ap_netif; - esp_netif_ip_info_t ip_info; - wifi_mode_t mode; - - esp_wifi_get_mode(&mode); - if (WIFI_MODE_STA == mode) { - bits = xEventGroupWaitBits(wifi_event_group, CONNECTED_BIT, 0, 1, 0); - if (bits & CONNECTED_BIT) { - ifx = sta_netif; - } else { - ESP_LOGE(TAG, "sta has no IP"); - return 0; - } - } - - esp_netif_get_ip_info(ifx, &ip_info); - return ip_info.ip.addr; -} - -static int wifi_cmd_iperf(int argc, char **argv) -{ - int nerrors = arg_parse(argc, argv, (void **) &iperf_args); - iperf_cfg_t cfg; - - if (nerrors != 0) { - arg_print_errors(stderr, iperf_args.end, argv[0]); - return 0; - } - - memset(&cfg, 0, sizeof(cfg)); - - // wifi iperf only support IPV4 address - cfg.type = IPERF_IP_TYPE_IPV4; - - if ( iperf_args.abort->count != 0) { - iperf_stop(); - return 0; - } - - if ( ((iperf_args.ip->count == 0) && (iperf_args.server->count == 0)) || - ((iperf_args.ip->count != 0) && (iperf_args.server->count != 0)) ) { - ESP_LOGE(TAG, "should specific client/server mode"); - return 0; - } - - if (iperf_args.ip->count == 0) { - cfg.flag |= IPERF_FLAG_SERVER; - } else { - cfg.destination_ip4 = esp_ip4addr_aton(iperf_args.ip->sval[0]); - cfg.flag |= IPERF_FLAG_CLIENT; - } - - cfg.source_ip4 = wifi_get_local_ip(); - if (cfg.source_ip4 == 0) { - return 0; - } - - if (iperf_args.length->count == 0) { - cfg.len_send_buf = 0; - } else { - cfg.len_send_buf = iperf_args.length->ival[0]; - } - - if (iperf_args.udp->count == 0) { - cfg.flag |= IPERF_FLAG_TCP; - } else { - cfg.flag |= IPERF_FLAG_UDP; - } - - if (iperf_args.port->count == 0) { - cfg.sport = IPERF_DEFAULT_PORT; - cfg.dport = IPERF_DEFAULT_PORT; - } else { - if (cfg.flag & IPERF_FLAG_SERVER) { - cfg.sport = iperf_args.port->ival[0]; - cfg.dport = IPERF_DEFAULT_PORT; - } else { - cfg.sport = IPERF_DEFAULT_PORT; - cfg.dport = iperf_args.port->ival[0]; - } - } - - if (iperf_args.interval->count == 0) { - cfg.interval = IPERF_DEFAULT_INTERVAL; - } else { - cfg.interval = iperf_args.interval->ival[0]; - if (cfg.interval <= 0) { - cfg.interval = IPERF_DEFAULT_INTERVAL; - } - } - - if (iperf_args.time->count == 0) { - cfg.time = IPERF_DEFAULT_TIME; - } else { - cfg.time = iperf_args.time->ival[0]; - if (cfg.time <= cfg.interval) { - cfg.time = cfg.interval; - } - } - - ESP_LOGI(TAG, "mode=%s-%s sip=%" PRIu32 ".%" PRIu32 ".%" PRIu32 ".%" PRIu32 ":%d, \ - dip=%" PRIu32 ".%" PRIu32 ".%" PRIu32 ".%" PRIu32 ":%d, interval=%" PRIu32 ", time=%" PRIu32, - cfg.flag & IPERF_FLAG_TCP ? "tcp" : "udp", - cfg.flag & IPERF_FLAG_SERVER ? "server" : "client", - cfg.source_ip4 & 0xFF, (cfg.source_ip4 >> 8) & 0xFF, (cfg.source_ip4 >> 16) & 0xFF, - (cfg.source_ip4 >> 24) & 0xFF, cfg.sport, - cfg.destination_ip4 & 0xFF, (cfg.destination_ip4 >> 8) & 0xFF, (cfg.destination_ip4 >> 16) & 0xFF, - (cfg.destination_ip4 >> 24) & 0xFF, cfg.dport, - cfg.interval, cfg.time); - - iperf_start(&cfg); - - return 0; -} - static int restart(int argc, char **argv) { ESP_LOGI(TAG, "Restarting"); @@ -484,26 +351,6 @@ void register_wifi(void) }; ESP_ERROR_CHECK( esp_console_cmd_register(&restart_cmd) ); - iperf_args.ip = arg_str0("c", "client", "", "run in client mode, connecting to "); - iperf_args.server = arg_lit0("s", "server", "run in server mode"); - iperf_args.udp = arg_lit0("u", "udp", "use UDP rather than TCP"); - iperf_args.version = arg_lit0("V", "ipv6_domain", "use IPV6 address rather than IPV4"); - iperf_args.port = arg_int0("p", "port", "", "server port to listen on/connect to"); - iperf_args.length = arg_int0("l", "len", "", "set read/write buffer size"); - iperf_args.interval = arg_int0("i", "interval", "", "seconds between periodic bandwidth reports"); - iperf_args.time = arg_int0("t", "time", "