feat(example): update iperf examples

This commit is contained in:
Chen Yudong
2025-12-30 18:13:30 +08:00
committed by Chen Yu Dong
parent 30a3150702
commit 56065ee399
8 changed files with 20 additions and 21 deletions
@@ -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"
@@ -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");
@@ -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"
@@ -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
+1 -1
View File
@@ -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:
@@ -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();
+1 -2
View File
@@ -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
@@ -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(
[