Skip to content

Commit 8991849

Browse files
committed
Merge branch 'bufix/Backport_some_lwip_bugs_for_5.0_1215' into 'release/v5.0'
Bufix/backport some lwip bugs for 5.0 1215 See merge request espressif/esp-idf!27941
2 parents c74c15a + a60e0ad commit 8991849

File tree

3 files changed

+90
-4
lines changed

3 files changed

+90
-4
lines changed

components/lwip/Kconfig

+55-3
Original file line numberDiff line numberDiff line change
@@ -518,7 +518,7 @@ menu "LWIP"
518518

519519
Can be set lower to save RAM, the default value 1460(ipv4)/1440(ipv6) will give best throughput.
520520
IPv4 TCP_MSS Range: 576 <= TCP_MSS <= 1460
521-
IPv6 TCP_MSS Range: 1220<= TCP_mSS <= 1440
521+
IPv6 TCP_MSS Range: 1220<= TCP_MSS <= 1440
522522

523523
config LWIP_TCP_TMR_INTERVAL
524524
int "TCP timer interval(ms)"
@@ -543,7 +543,7 @@ menu "LWIP"
543543

544544
config LWIP_TCP_SND_BUF_DEFAULT
545545
int "Default send buffer size"
546-
default 5744 # 4 * default MSS
546+
default 5760 # 4 * default MSS
547547
range 2440 65535 if !LWIP_WND_SCALE
548548
range 2440 1024000 if LWIP_WND_SCALE
549549
help
@@ -560,7 +560,7 @@ menu "LWIP"
560560

561561
config LWIP_TCP_WND_DEFAULT
562562
int "Default receive window size"
563-
default 5744 # 4 * default MSS
563+
default 5760 # 4 * default MSS
564564
range 2440 65535 if !LWIP_WND_SCALE
565565
range 2440 1024000 if LWIP_WND_SCALE
566566
help
@@ -602,6 +602,41 @@ menu "LWIP"
602602
Disable this option to save some RAM during TCP sessions, at the expense
603603
of increased retransmissions if segments arrive out of order.
604604

605+
config LWIP_TCP_OOSEQ_TIMEOUT
606+
int "Timeout for each pbuf queued in TCP OOSEQ, in RTOs."
607+
depends on LWIP_TCP_QUEUE_OOSEQ
608+
range 1 30
609+
default 6
610+
help
611+
The timeout value is TCP_OOSEQ_TIMEOUT * RTO.
612+
613+
config LWIP_TCP_OOSEQ_MAX_PBUFS
614+
int "The maximum number of pbufs queued on OOSEQ per pcb"
615+
depends on LWIP_TCP_QUEUE_OOSEQ
616+
range 0 12
617+
default 4 if !SPIRAM_TRY_ALLOCATE_WIFI_LWIP
618+
default 0 if SPIRAM_TRY_ALLOCATE_WIFI_LWIP
619+
help
620+
If LWIP_TCP_OOSEQ_MAX_PBUFS = 0, TCP will not control the number of OOSEQ pbufs.
621+
622+
In a poor network environment, many out-of-order tcp pbufs will be received.
623+
These out-of-order pbufs will be cached in the TCP out-of-order queue which will
624+
cause Wi-Fi/Ethernet fail to release RX buffer in time.
625+
It is possible that all RX buffers for MAC layer are used by OOSEQ.
626+
627+
Control the number of out-of-order pbufs to ensure that the MAC layer
628+
has enough RX buffer to receive packets.
629+
630+
In the Wi-Fi scenario,recommended OOSEQ PBUFS Range:
631+
0 <= TCP_OOSEQ_MAX_PBUFS <= CONFIG_ESP_WIFI_DYNAMIC_RX_BUFFER_NUM/(MAX_TCP_NUMBER + 1)
632+
633+
In the Ethernet scenario,recommended Ethernet OOSEQ PBUFS Range:
634+
0 <= TCP_OOSEQ_MAX_PBUFS <= CONFIG_ETH_DMA_RX_BUFFER_NUM/(MAX_TCP_NUMBER + 1)
635+
636+
Within the recommended value range, the larger the value, the better the performance.
637+
638+
MAX_TCP_NUMBER represent Maximum number of TCP connections in Wi-Fi(STA+SoftAP) and Ethernet scenario.
639+
605640
config LWIP_TCP_SACK_OUT
606641
bool "Support sending selective acknowledgements"
607642
default n
@@ -783,6 +818,23 @@ menu "LWIP"
783818
help
784819
Config max number of entries in IPv6 neighbor cache
785820

821+
config LWIP_ND6
822+
bool "LWIP NDP6 Enable/Disable"
823+
default y
824+
depends on LWIP_IPV6
825+
help
826+
This option is used to disable the Network Discovery Protocol (NDP) if it is not required.
827+
Please use this option with caution, as the NDP is essential for IPv6 functionality within a local network.
828+
829+
config LWIP_FORCE_ROUTER_FORWARDING
830+
bool "LWIP Force Router Forwarding Enable/Disable"
831+
default n
832+
depends on LWIP_ND6
833+
help
834+
This option is used to set the the router flag for the NA packets.
835+
When enabled, the router flag in NA packet will always set to 1,
836+
otherwise, never set router flag for NA packets.
837+
786838
config LWIP_PPP_NOTIFY_PHASE_SUPPORT
787839
bool "Enable Notify Phase Callback"
788840
depends on LWIP_PPP_SUPPORT

components/lwip/port/esp32/include/lwipopts.h

+34
Original file line numberDiff line numberDiff line change
@@ -530,6 +530,21 @@ static inline uint32_t timeout_from_offered(uint32_t lease, uint32_t min)
530530
#define TCP_QUEUE_OOSEQ 0
531531
#endif
532532

533+
/**
534+
* TCP_OOSEQ_MAX_PBUFS: The maximum number of pbufs
535+
* queued on ooseq per pcb
536+
*/
537+
#if TCP_QUEUE_OOSEQ
538+
#define TCP_OOSEQ_MAX_PBUFS CONFIG_LWIP_TCP_OOSEQ_MAX_PBUFS
539+
#endif
540+
541+
/**
542+
* TCP_OOSEQ_TIMEOUT: Timeout for each pbuf queued in TCP OOSEQ, in RTOs.
543+
*/
544+
#if TCP_QUEUE_OOSEQ
545+
#define TCP_OOSEQ_TIMEOUT CONFIG_LWIP_TCP_OOSEQ_TIMEOUT
546+
#endif
547+
533548
/**
534549
* LWIP_TCP_SACK_OUT==1: TCP will support sending selective acknowledgements (SACKs).
535550
*/
@@ -1130,6 +1145,25 @@ static inline uint32_t timeout_from_offered(uint32_t lease, uint32_t min)
11301145
#define LWIP_IPV6 0
11311146
#endif
11321147

1148+
/**
1149+
* LWIP_ND6==1: Enable ND6 protocol in IPv6
1150+
*/
1151+
#ifdef CONFIG_LWIP_ND6
1152+
#define LWIP_ND6 1
1153+
#else
1154+
#define LWIP_ND6 0
1155+
#endif
1156+
1157+
/**
1158+
* LWIP_FORCE_ROUTER_FORWARDING==1: the router flag in NA packet will always set to 1,
1159+
* otherwise, never set router flag for NA packets.
1160+
*/
1161+
#ifdef CONFIG_LWIP_FORCE_ROUTER_FORWARDING
1162+
#define LWIP_FORCE_ROUTER_FORWARDING 1
1163+
#else
1164+
#define LWIP_FORCE_ROUTER_FORWARDING 0
1165+
#endif
1166+
11331167
/**
11341168
* LWIP_IPV6_NUM_ADDRESSES: Number of IPv6 addresses per netif.
11351169
*/

0 commit comments

Comments
 (0)