Merge branch 'bugfix/lwipopts_cleanup' into 'master'

lw-IP: Cleanup of config options and flags

Closes IDF-3594

See merge request espressif/esp-idf!15248
pull/8262/head
David Čermák 2022-01-17 06:46:27 +00:00
commit c45d34aea2
9 zmienionych plików z 569 dodań i 334 usunięć

Wyświetl plik

@ -85,14 +85,7 @@ menu "LWIP"
bool "Support LWIP socket select() only (DEPRECATED)"
default n
help
This option is deprecated. Use VFS_SUPPORT_SELECT instead, which is
the inverse of this option.
The virtual filesystem layer of select() redirects sockets to
lwip_select() and non-socket file descriptors to their respective driver
implementations. If this option is enabled then all calls of select()
will be redirected to lwip_select(), therefore, select can be used
for sockets only.
This option is deprecated. Do not use this option, use VFS_SUPPORT_SELECT instead.
config LWIP_SO_LINGER
bool "Enable SO_LINGER processing"
@ -190,32 +183,6 @@ menu "LWIP"
help
Enabling this option allows LWIP statistics
config LWIP_ETHARP_TRUST_IP_MAC
bool "Enable LWIP ARP trust"
default n
help
Enabling this option allows ARP table to be updated.
If this option is enabled, the incoming IP packets cause the ARP table to be
updated with the source MAC and IP addresses supplied in the packet.
You may want to disable this if you do not trust LAN peers to have the
correct addresses, or as a limited approach to attempt to handle
spoofing. If disabled, lwIP will need to make a new ARP request if
the peer is not already in the ARP table, adding a little latency.
The peer *is* in the ARP table if it requested our address before.
Also notice that this slows down input processing of every IP packet!
There are two known issues in real application if this feature is enabled:
- The LAN peer may have bug to update the ARP table after the ARP entry is aged out.
If the ARP entry on the LAN peer is aged out but failed to be updated, all IP packets
sent from LWIP to the LAN peer will be dropped by LAN peer.
- The LAN peer may not be trustful, the LAN peer may send IP packets to LWIP with
two different MACs, but the same IP address. If this happens, the LWIP has problem
to receive IP packets from LAN peer.
So the recommendation is to disable this option.
Here the LAN peer means the other side to which the ESP station or soft-AP is connected.
config LWIP_ESP_GRATUITOUS_ARP
bool "Send gratuitous ARP periodically"
default y
@ -420,6 +387,7 @@ menu "LWIP"
Enabling this option means that if a packet is sent with a destination
address equal to the interface's own IP address, it will "loop back" and
be received by this interface.
Disabling this option disables support of loopback interface in lwIP
config LWIP_LOOPBACK_MAX_PBUFS
int "Max queued loopback packets per interface"
@ -572,18 +540,10 @@ menu "LWIP"
config LWIP_TCP_SACK_OUT
bool "Support sending selective acknowledgements"
default n
depends on LWIP_TCP_QUEUE_OOSEQ
help
TCP will support sending selective acknowledgements (SACKs).
config LWIP_TCP_KEEP_CONNECTION_WHEN_IP_CHANGES
bool "Keep TCP connections when IP changed"
default n
help
This option is enabled when the following scenario happen:
network dropped and reconnected, IP changes is like: 192.168.0.2->0.0.0.0->192.168.0.2
Disable this option to keep consistent with the original LWIP code behavior.
choice LWIP_TCP_OVERSIZE
prompt "Pre-allocate transmit PBUF size"

Wyświetl plik

@ -54,7 +54,7 @@
#include "esp_netif_net_stack.h"
#include "esp_compiler.h"
#if !ESP_L2_TO_L3_COPY
#ifndef CONFIG_LWIP_L2_TO_L3_COPY
/**
* @brief Free resources allocated in L2 layer
*
@ -102,7 +102,7 @@ low_level_init(struct netif *netif)
#endif
#endif
#if !ESP_L2_TO_L3_COPY
#ifndef CONFIG_LWIP_L2_TO_L3_COPY
netif->l2_buffer_free_notify = lwip_netif_wifi_free_rx_buffer;
#endif
}
@ -122,7 +122,7 @@ low_level_init(struct netif *netif)
* to become availale since the stack doesn't retry to send a packet
* dropped because of memory failure (except for the TCP timers).
*/
static err_t ESP_IRAM_ATTR
static err_t
low_level_output(struct netif *netif, struct pbuf *p)
{
esp_netif_t *esp_netif = esp_netif_get_handle_from_netif_impl(netif);
@ -170,7 +170,7 @@ low_level_output(struct netif *netif, struct pbuf *p)
*
* @param netif the lwip network interface structure for this ethernetif
*/
void ESP_IRAM_ATTR
void
wlanif_input(void *h, void *buffer, size_t len, void* eb)
{
struct netif * netif = h;
@ -184,7 +184,7 @@ wlanif_input(void *h, void *buffer, size_t len, void* eb)
return;
}
#if (ESP_L2_TO_L3_COPY == 1)
#ifdef CONFIG_LWIP_L2_TO_L3_COPY
p = pbuf_alloc(PBUF_RAW, len, PBUF_RAM);
if (p == NULL) {
esp_netif_free_rx_buffer(esp_netif, eb);
@ -202,7 +202,7 @@ wlanif_input(void *h, void *buffer, size_t len, void* eb)
p->payload = buffer;
p->l2_owner = netif;
p->l2_buf = eb;
#endif
#endif /* CONFIG_LWIP_L2_TO_L3_COPY */
/* full packet send to tcpip_thread to process */
if (unlikely(netif->input(p, netif) != ERR_OK)) {

Wyświetl plik

@ -2,7 +2,6 @@
# CONFIG_DEPRECATED_OPTION CONFIG_NEW_OPTION
CONFIG_L2_TO_L3_COPY CONFIG_LWIP_L2_TO_L3_COPY
CONFIG_USE_ONLY_LWIP_SELECT CONFIG_LWIP_USE_ONLY_LWIP_SELECT
CONFIG_ESP_GRATUITOUS_ARP CONFIG_LWIP_ESP_GRATUITOUS_ARP
CONFIG_GARP_TMR_INTERVAL CONFIG_LWIP_GARP_TMR_INTERVAL
CONFIG_TCPIP_RECVMBOX_SIZE CONFIG_LWIP_TCPIP_RECVMBOX_SIZE
@ -16,7 +15,6 @@ CONFIG_TCP_SND_BUF_DEFAULT CONFIG_LWIP_TCP_SND_BUF_DEFAULT
CONFIG_TCP_WND_DEFAULT CONFIG_LWIP_TCP_WND_DEFAULT
CONFIG_TCP_RECVMBOX_SIZE CONFIG_LWIP_TCP_RECVMBOX_SIZE
CONFIG_TCP_QUEUE_OOSEQ CONFIG_LWIP_TCP_QUEUE_OOSEQ
CONFIG_ESP_TCP_KEEP_CONNECTION_WHEN_IP_CHANGES CONFIG_LWIP_TCP_KEEP_CONNECTION_WHEN_IP_CHANGES
CONFIG_TCP_OVERSIZE CONFIG_LWIP_TCP_OVERSIZE
CONFIG_TCP_OVERSIZE_MSS CONFIG_LWIP_TCP_OVERSIZE_MSS
CONFIG_TCP_OVERSIZE_QUARTER_MSS CONFIG_LWIP_TCP_OVERSIZE_QUARTER_MSS

Wyświetl plik

@ -21,6 +21,11 @@
#include "esp_vfs_private.h"
#include "sdkconfig.h"
// Warn about using deprecated option
#ifdef CONFIG_LWIP_USE_ONLY_LWIP_SELECT
#warning CONFIG_LWIP_USE_ONLY_LWIP_SELECT is deprecated: Please use CONFIG_VFS_SUPPORT_SELECT instead
#endif
#ifdef CONFIG_VFS_SUPPRESS_SELECT_DEBUG_OUTPUT
#define LOG_LOCAL_LEVEL ESP_LOG_NONE
#endif //CONFIG_VFS_SUPPRESS_SELECT_DEBUG_OUTPUT

Wyświetl plik

@ -368,11 +368,6 @@ The following API functions are supported. For full details see :component_file:
- ``sys_timeouts_init()``
- ``sys_timeouts_deinit()``
Abort TCP connections when IP changes
+++++++++++++++++++++++++++++++++++++
:ref:`CONFIG_LWIP_TCP_KEEP_CONNECTION_WHEN_IP_CHANGES` is disabled by default. This disables the default lwIP behaviour of keeping TCP connections open if an interface IP changes, in case the interface IP changes back (for example, if an interface connection goes down and comes back up). Enable this option to keep TCP connections open in this case, until they time out normally. This may increase the number of sockets in use if a network interface goes down temporarily.
Additional Socket Options
+++++++++++++++++++++++++
@ -417,7 +412,7 @@ The :example_file:`wifi/iperf/sdkconfig.defaults` file for the iperf example con
- If a lot of tasks are competing for CPU time on the system, consider that the lwIP task has configurable CPU affinity (:ref:`CONFIG_LWIP_TCPIP_TASK_AFFINITY`) and runs at fixed priority ``ESP_TASK_TCPIP_PRIO`` (18). Configure competing tasks to be pinned to a different core, or to run at a lower priority. See also :ref:`built-in-task-priorities`.
- If using ``select()`` function with socket arguments only, setting :ref:`CONFIG_LWIP_USE_ONLY_LWIP_SELECT` will make ``select()`` calls faster.
- If using ``select()`` function with socket arguments only, disabling :ref:`CONFIG_VFS_SUPPORT_SELECT` will make ``select()`` calls faster.
- If there is enough free IRAM, select :ref:`CONFIG_LWIP_IRAM_OPTIMIZATION` to improve TX/RX throughput

Wyświetl plik

@ -140,7 +140,7 @@ A socket VFS driver needs to be registered with the following functions defined:
Please see :component_file:`lwip/port/esp32/vfs_lwip.c` for a reference socket driver implementation using LWIP.
.. note::
If :cpp:func:`select` is only used on socket file descriptors, you can enable the :envvar:`CONFIG_LWIP_USE_ONLY_LWIP_SELECT` option to reduce the code size and improve performance.
If you use :cpp:func:`select` for socket file descriptors only then you can disable the :envvar:`CONFIG_VFS_SUPPORT_SELECT` option to reduce the code size and improve performance.
You should not change the socket driver during an active :cpp:func:`select` call or you might experience some undefined behavior.
Paths

Wyświetl plik

@ -140,7 +140,7 @@ VFS 组件支持通过 :cpp:func:`select` 进行同步输入/输出多路复用
请参考 :component_file:`lwip/port/esp32/vfs_lwip.c` 以了解使用 LWIP 的套接字驱动参考实现。
.. note::
如果 :cpp:func:`select` 只用于套接字文件描述符,您可以启用 :envvar:`CONFIG_LWIP_USE_ONLY_LWIP_SELECT` 选项来减少代码量,提高性能。
如果 :cpp:func:`select` 用于套接字文件描述符,您可以禁用 :envvar:`CONFIG_VFS_SUPPORT_SELECT` 选项来减少代码量,提高性能。
不要在 :cpp:func:`select` 调用过程中更改套接字驱动,否则会出现一些未定义行为。
路径

Wyświetl plik

@ -65,6 +65,14 @@ freemodbus_component:
- BSD-3-Clause
license_for_new_files: Apache-2.0
lwip_component:
include:
- 'components/lwip/**'
allowed_licenses:
- Apache-2.0
- BSD-3-Clause
license_for_new_files: Apache-2.0
# files matching this section do not perform the check
# file patterns starting with ! are negated, meaning files matching them won't match the section.
ignore: