mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
Merge branch 'bugfix/iperf_improvements_v5.1' into 'release/v5.1'
fix(examples/iperf): Update and rename default TCP/UDP buffer sizes (Backport v5.1) See merge request espressif/esp-idf!26680
This commit is contained in:
commit
0f61bd25a2
@ -42,10 +42,11 @@ extern "C" {
|
|||||||
#define IPERF_REPORT_TASK_PRIORITY CONFIG_IPERF_REPORT_TASK_PRIORITY
|
#define IPERF_REPORT_TASK_PRIORITY CONFIG_IPERF_REPORT_TASK_PRIORITY
|
||||||
#define IPERF_REPORT_TASK_STACK 4096
|
#define IPERF_REPORT_TASK_STACK 4096
|
||||||
|
|
||||||
#define IPERF_UDP_TX_LEN (1470)
|
#define IPERF_DEFAULT_IPV4_UDP_TX_LEN (1470)
|
||||||
#define IPERF_UDP_RX_LEN (16 << 10)
|
#define IPERF_DEFAULT_IPV6_UDP_TX_LEN (1450)
|
||||||
#define IPERF_TCP_TX_LEN (16 << 10)
|
#define IPERF_DEFAULT_UDP_RX_LEN (16 << 10)
|
||||||
#define IPERF_TCP_RX_LEN (16 << 10)
|
#define IPERF_DEFAULT_TCP_TX_LEN (16 << 10)
|
||||||
|
#define IPERF_DEFAULT_TCP_RX_LEN (16 << 10)
|
||||||
|
|
||||||
#define IPERF_MAX_DELAY 64
|
#define IPERF_MAX_DELAY 64
|
||||||
|
|
||||||
|
@ -152,8 +152,8 @@ static void IRAM_ATTR socket_recv(int recv_socket, struct sockaddr_storage liste
|
|||||||
static void IRAM_ATTR socket_send(int send_socket, struct sockaddr_storage dest_addr, uint8_t type, int bw_lim)
|
static void IRAM_ATTR socket_send(int send_socket, struct sockaddr_storage dest_addr, uint8_t type, int bw_lim)
|
||||||
{
|
{
|
||||||
uint8_t *buffer;
|
uint8_t *buffer;
|
||||||
int32_t *pkt_id_p;
|
uint32_t *pkt_id_p;
|
||||||
int32_t pkt_cnt = 0;
|
uint32_t pkt_cnt = 0;
|
||||||
int actual_send = 0;
|
int actual_send = 0;
|
||||||
int want_send = 0;
|
int want_send = 0;
|
||||||
int period_us = -1;
|
int period_us = -1;
|
||||||
@ -169,7 +169,7 @@ static void IRAM_ATTR socket_send(int send_socket, struct sockaddr_storage dest_
|
|||||||
const char *error_log = (type == IPERF_TRANS_TYPE_TCP) ? "tcp client send" : "udp client send";
|
const char *error_log = (type == IPERF_TRANS_TYPE_TCP) ? "tcp client send" : "udp client send";
|
||||||
|
|
||||||
buffer = s_iperf_ctrl.buffer;
|
buffer = s_iperf_ctrl.buffer;
|
||||||
pkt_id_p = (int32_t *)s_iperf_ctrl.buffer;
|
pkt_id_p = (uint32_t *)s_iperf_ctrl.buffer;
|
||||||
want_send = s_iperf_ctrl.buffer_len;
|
want_send = s_iperf_ctrl.buffer_len;
|
||||||
iperf_start_report();
|
iperf_start_report();
|
||||||
|
|
||||||
@ -193,13 +193,7 @@ static void IRAM_ATTR socket_send(int send_socket, struct sockaddr_storage dest_
|
|||||||
}
|
}
|
||||||
prev_time = send_time;
|
prev_time = send_time;
|
||||||
}
|
}
|
||||||
*pkt_id_p = htonl(pkt_cnt); // datagrams need to be sequentially numbered
|
*pkt_id_p = htonl(pkt_cnt++); // datagrams need to be sequentially numbered
|
||||||
if (pkt_cnt >= INT32_MAX) {
|
|
||||||
pkt_cnt = 0;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
pkt_cnt++;
|
|
||||||
}
|
|
||||||
actual_send = sendto(send_socket, buffer, want_send, 0, (struct sockaddr *)&dest_addr, socklen);
|
actual_send = sendto(send_socket, buffer, want_send, 0, (struct sockaddr *)&dest_addr, socklen);
|
||||||
if (actual_send != want_send) {
|
if (actual_send != want_send) {
|
||||||
if (type == IPERF_TRANS_TYPE_UDP) {
|
if (type == IPERF_TRANS_TYPE_UDP) {
|
||||||
@ -545,13 +539,23 @@ static void iperf_task_traffic(void *arg)
|
|||||||
static uint32_t iperf_get_buffer_len(void)
|
static uint32_t iperf_get_buffer_len(void)
|
||||||
{
|
{
|
||||||
if (iperf_is_udp_client()) {
|
if (iperf_is_udp_client()) {
|
||||||
return (s_iperf_ctrl.cfg.len_send_buf == 0 ? IPERF_UDP_TX_LEN : s_iperf_ctrl.cfg.len_send_buf);
|
#ifdef CONFIG_LWIP_IPV6
|
||||||
} else if (iperf_is_udp_server()) {
|
if (s_iperf_ctrl.cfg.len_send_buf) {
|
||||||
return IPERF_UDP_RX_LEN;
|
return s_iperf_ctrl.cfg.len_send_buf;
|
||||||
} else if (iperf_is_tcp_client()) {
|
} else if (s_iperf_ctrl.cfg.type == IPERF_IP_TYPE_IPV6) {
|
||||||
return (s_iperf_ctrl.cfg.len_send_buf == 0 ? IPERF_TCP_TX_LEN : s_iperf_ctrl.cfg.len_send_buf);
|
return IPERF_DEFAULT_IPV6_UDP_TX_LEN;
|
||||||
} else {
|
} else {
|
||||||
return IPERF_TCP_RX_LEN;
|
return IPERF_DEFAULT_IPV4_UDP_TX_LEN;
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
return (s_iperf_ctrl.cfg.len_send_buf == 0 ? IPERF_DEFAULT_IPV4_UDP_TX_LEN : s_iperf_ctrl.cfg.len_send_buf);
|
||||||
|
#endif
|
||||||
|
} else if (iperf_is_udp_server()) {
|
||||||
|
return IPERF_DEFAULT_UDP_RX_LEN;
|
||||||
|
} else if (iperf_is_tcp_client()) {
|
||||||
|
return (s_iperf_ctrl.cfg.len_send_buf == 0 ? IPERF_DEFAULT_TCP_TX_LEN : s_iperf_ctrl.cfg.len_send_buf);
|
||||||
|
} else {
|
||||||
|
return IPERF_DEFAULT_TCP_RX_LEN;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user