Skip to content

Commit

Permalink
change(lwip): Added macro to configure TCP accept mailbox size
Browse files Browse the repository at this point in the history
  • Loading branch information
espressif-abhikroy committed Dec 15, 2023
1 parent 336c094 commit 0c41c4e
Show file tree
Hide file tree
Showing 6 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion components/esp_wifi/src/wifi_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ static void esp_wifi_config_info(void)
#endif

#ifdef CONFIG_ESP_NETIF_TCPIP_LWIP
ESP_LOGI(TAG, "accept mbox: %d", CONFIG_LWIP_ACCEPTMBOX_SIZE);
ESP_LOGI(TAG, "accept mbox: %d", CONFIG_LWIP_TCP_ACCEPTMBOX_SIZE);
ESP_LOGI(TAG, "tcpip mbox: %d", CONFIG_LWIP_TCPIP_RECVMBOX_SIZE);
ESP_LOGI(TAG, "udp mbox: %d", CONFIG_LWIP_UDP_RECVMBOX_SIZE);
ESP_LOGI(TAG, "tcp mbox: %d", CONFIG_LWIP_TCP_RECVMBOX_SIZE);
Expand Down
2 changes: 1 addition & 1 deletion components/lwip/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -665,7 +665,7 @@ menu "LWIP"
mail box is full, the LWIP drops the packets. So generally we need to make sure the TCP
receive mail box is big enough to avoid packet drop between LWIP core and application.

config LWIP_ACCEPTMBOX_SIZE
config LWIP_TCP_ACCEPTMBOX_SIZE
int "Default TCP accept mail box size"
default 6
range 1 64 if !LWIP_WND_SCALE
Expand Down
2 changes: 1 addition & 1 deletion components/lwip/port/include/lwipopts.h
Original file line number Diff line number Diff line change
Expand Up @@ -849,7 +849,7 @@ static inline uint32_t timeout_from_offered(uint32_t lease, uint32_t min)
* The queue size value itself is platform-dependent, but is passed to
* sys_mbox_new() when the acceptmbox is created.
*/
#define DEFAULT_ACCEPTMBOX_SIZE CONFIG_LWIP_ACCEPTMBOX_SIZE
#define DEFAULT_ACCEPTMBOX_SIZE CONFIG_LWIP_TCP_ACCEPTMBOX_SIZE

/**
* DEFAULT_THREAD_STACKSIZE: The stack size used by any other lwIP thread.
Expand Down
1 change: 1 addition & 0 deletions docs/en/api-guides/coexist.rst
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,7 @@ Setting Coexistence Compile-time Options
#) :ref:`CONFIG_LWIP_TCP_SND_BUF_DEFAULT`: reduce the default TX buffer size for TCP sockets.
#) :ref:`CONFIG_LWIP_TCP_WND_DEFAULT`: reduce the default size of the RX window for TCP sockets.
#) :ref:`CONFIG_LWIP_TCP_RECVMBOX_SIZE`: reduce the size of the TCP receive mailbox.
#) :ref:`CONFIG_LWIP_TCP_ACCEPTMBOX_SIZE`: reduce the size of the TCP accept mailbox.
#) :ref:`CONFIG_LWIP_UDP_RECVMBOX_SIZE`: reduce the size of the UDP receive mailbox.
#) :ref:`CONFIG_LWIP_TCPIP_RECVMBOX_SIZE`: reduce the size of TCPIP task receive mailbox.

Expand Down
1 change: 1 addition & 0 deletions docs/en/api-guides/lwip.rst
Original file line number Diff line number Diff line change
Expand Up @@ -505,6 +505,7 @@ Most lwIP RAM usage is on-demand, as RAM is allocated from the heap as needed. T

- Reducing :ref:`CONFIG_LWIP_MAX_SOCKETS` reduces the maximum number of sockets in the system. This also causes TCP sockets in the ``WAIT_CLOSE`` state to be closed and recycled more rapidly when needed to open a new socket, further reducing peak RAM usage.
- Reducing :ref:`CONFIG_LWIP_TCPIP_RECVMBOX_SIZE`, :ref:`CONFIG_LWIP_TCP_RECVMBOX_SIZE` and :ref:`CONFIG_LWIP_UDP_RECVMBOX_SIZE` reduce RAM usage at the expense of throughput, depending on usage.
- Reducing :ref:`CONFIG_LWIP_TCP_ACCEPTMBOX_SIZE` reduce RAM usage by limiting concurrent accepted connections.
- Reducing :ref:`CONFIG_LWIP_TCP_MSL` and :ref:`CONFIG_LWIP_TCP_FIN_WAIT_TIMEOUT` reduces the maximum segment lifetime in the system. This also causes TCP sockets in the ``TIME_WAIT`` and ``FIN_WAIT_2`` states to be closed and recycled more rapidly.
- Disabling :ref:`CONFIG_LWIP_IPV6` can save about 39 KB for firmware size and 2 KB RAM when the system is powered up and 7 KB RAM when the TCP/IP stack is running. If there is no requirement for supporting IPV6, it can be disabled to save flash and RAM footprint.
- Disabling :ref:`CONFIG_LWIP_IPV4` can save about 26 KB of firmware size and 600 B RAM on power up and 6 KB RAM when the TCP/IP stack is running. If the local network supports IPv6-only configuration, IPv4 can be disabled to save flash and RAM footprint.
Expand Down
1 change: 0 additions & 1 deletion tools/ldgen/samples/sdkconfig
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,6 @@ CONFIG_LWIP_TCP_MSL=60000
CONFIG_LWIP_TCP_SND_BUF_DEFAULT=5744
CONFIG_LWIP_TCP_WND_DEFAULT=5744
CONFIG_LWIP_TCP_RECVMBOX_SIZE=6
CONFIG_LWIP_ACCEPTMBOX_SIZE=6
CONFIG_LWIP_TCP_QUEUE_OOSEQ=y
CONFIG_LWIP_TCP_OVERSIZE_MSS=y
CONFIG_LWIP_TCP_OVERSIZE_QUARTER_MSS=
Expand Down

0 comments on commit 0c41c4e

Please sign in to comment.