mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
Merge branch 'feature/tw8155_optimize_tx_flow_control' into 'master'
Feature/tw8155 optimize tx flow control 1. Remove TX flow control in LWIP 2. Make the return value of esp_wifi_internal_tx consistent with LWIP error code See merge request !164
This commit is contained in:
commit
fe64ea95b4
@ -1 +1 @@
|
|||||||
Subproject commit 9d18fd1a8f7610130e69f8be74ec68f6399221b1
|
Subproject commit b3090d885413fb78c86e7b88116cdb5c8c5e9e68
|
@ -382,31 +382,6 @@ static void lwip_socket_unregister_membership(int s, const ip4_addr_t *if_addr,
|
|||||||
static void lwip_socket_drop_registered_memberships(int s);
|
static void lwip_socket_drop_registered_memberships(int s);
|
||||||
#endif /* LWIP_IGMP */
|
#endif /* LWIP_IGMP */
|
||||||
|
|
||||||
#if ESP_LWIP
|
|
||||||
#include "esp_wifi_internal.h"
|
|
||||||
#include "esp_system.h"
|
|
||||||
|
|
||||||
/* Please be notified that this flow control is just a workaround for fixing wifi Q full issue.
|
|
||||||
* Under UDP/TCP pressure test, we found that the sockets may cause wifi tx queue full if the socket
|
|
||||||
* sending speed is faster than the wifi sending speed, it will finally cause the packet to be dropped
|
|
||||||
* in wifi layer, it's not acceptable in some application. That's why we introdue the tx flow control here.
|
|
||||||
* However, current solution is just a workaround, we need to consider the return value of wifi tx interface,
|
|
||||||
* and feedback the return value to lwip and let lwip do the flow control itself.
|
|
||||||
*/
|
|
||||||
static inline void esp32_tx_flow_ctrl(void)
|
|
||||||
{
|
|
||||||
uint8_t _wait_delay = 1;
|
|
||||||
|
|
||||||
while ((system_get_free_heap_size() < HEAP_HIGHWAT) || esp_wifi_internal_tx_is_stop()){
|
|
||||||
vTaskDelay(_wait_delay/portTICK_RATE_MS);
|
|
||||||
if (_wait_delay < 64) _wait_delay *= 2;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#else
|
|
||||||
#define esp32_tx_flow_ctrl()
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/** The global array of available sockets */
|
/** The global array of available sockets */
|
||||||
static struct lwip_sock sockets[NUM_SOCKETS];
|
static struct lwip_sock sockets[NUM_SOCKETS];
|
||||||
#if ESP_THREAD_SAFE
|
#if ESP_THREAD_SAFE
|
||||||
@ -1208,8 +1183,6 @@ lwip_send(int s, const void *data, size_t size, int flags)
|
|||||||
#endif /* (LWIP_UDP || LWIP_RAW) */
|
#endif /* (LWIP_UDP || LWIP_RAW) */
|
||||||
}
|
}
|
||||||
|
|
||||||
esp32_tx_flow_ctrl();
|
|
||||||
|
|
||||||
write_flags = NETCONN_COPY |
|
write_flags = NETCONN_COPY |
|
||||||
((flags & MSG_MORE) ? NETCONN_MORE : 0) |
|
((flags & MSG_MORE) ? NETCONN_MORE : 0) |
|
||||||
((flags & MSG_DONTWAIT) ? NETCONN_DONTBLOCK : 0);
|
((flags & MSG_DONTWAIT) ? NETCONN_DONTBLOCK : 0);
|
||||||
@ -1391,8 +1364,6 @@ lwip_sendto(int s, const void *data, size_t size, int flags,
|
|||||||
#endif /* LWIP_TCP */
|
#endif /* LWIP_TCP */
|
||||||
}
|
}
|
||||||
|
|
||||||
esp32_tx_flow_ctrl();
|
|
||||||
|
|
||||||
if ((to != NULL) && !SOCK_ADDR_TYPE_MATCH(to, sock)) {
|
if ((to != NULL) && !SOCK_ADDR_TYPE_MATCH(to, sock)) {
|
||||||
/* sockaddr does not match socket type (IPv4/IPv6) */
|
/* sockaddr does not match socket type (IPv4/IPv6) */
|
||||||
sock_set_errno(sock, err_to_errno(ERR_VAL));
|
sock_set_errno(sock, err_to_errno(ERR_VAL));
|
||||||
|
@ -523,7 +523,6 @@ extern unsigned long os_random(void);
|
|||||||
#define ESP_IP4_ATON 1
|
#define ESP_IP4_ATON 1
|
||||||
#define ESP_LIGHT_SLEEP 1
|
#define ESP_LIGHT_SLEEP 1
|
||||||
|
|
||||||
|
|
||||||
#define TCP_WND_DEFAULT (4*TCP_MSS)
|
#define TCP_WND_DEFAULT (4*TCP_MSS)
|
||||||
#define TCP_SND_BUF_DEFAULT (2*TCP_MSS)
|
#define TCP_SND_BUF_DEFAULT (2*TCP_MSS)
|
||||||
|
|
||||||
@ -550,8 +549,6 @@ extern unsigned char misc_prof_get_tcp_snd_buf(void);
|
|||||||
#define CHECKSUM_CHECK_UDP 0
|
#define CHECKSUM_CHECK_UDP 0
|
||||||
#define CHECKSUM_CHECK_IP 0
|
#define CHECKSUM_CHECK_IP 0
|
||||||
|
|
||||||
#define HEAP_HIGHWAT 20*1024
|
|
||||||
|
|
||||||
#define LWIP_NETCONN_FULLDUPLEX 1
|
#define LWIP_NETCONN_FULLDUPLEX 1
|
||||||
#define LWIP_NETCONN_SEM_PER_THREAD 1
|
#define LWIP_NETCONN_SEM_PER_THREAD 1
|
||||||
|
|
||||||
|
@ -142,16 +142,13 @@ low_level_output(struct netif *netif, struct pbuf *p)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
esp_wifi_internal_tx(wifi_if, q->payload, pbuf_x_len);
|
return esp_wifi_internal_tx(wifi_if, q->payload, pbuf_x_len);
|
||||||
return ERR_OK;
|
|
||||||
|
|
||||||
#else
|
#else
|
||||||
for(q = p; q != NULL; q = q->next) {
|
for(q = p; q != NULL; q = q->next) {
|
||||||
esp_wifi_internal_tx(wifi_if, q->payload, q->len);
|
esp_wifi_internal_tx(wifi_if, q->payload, q->len);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
return ERR_OK;
|
return ERR_OK;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user