Skip to content

Commit c3ba277

Browse files
fine tuning lwip stack and compiling it
1 parent 9734322 commit c3ba277

File tree

2 files changed

+69
-15
lines changed

2 files changed

+69
-15
lines changed

extras/net/lwipopts.h

Lines changed: 69 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@
9595
* ATTENTION: This is required when using lwIP from more than one context! If
9696
* you disable this, you must be sure what you are doing!
9797
*/
98-
#if !defined SYS_LIGHTWEIGHT_PROT
98+
#ifndef SYS_LIGHTWEIGHT_PROT
9999
#define SYS_LIGHTWEIGHT_PROT 0
100100
#endif
101101

@@ -277,7 +277,7 @@
277277
* (requires the LWIP_RAW option)
278278
*/
279279
#ifndef MEMP_NUM_RAW_PCB
280-
#define MEMP_NUM_RAW_PCB 0
280+
#define MEMP_NUM_RAW_PCB 4
281281
#endif
282282

283283
/**
@@ -318,7 +318,7 @@
318318
* reassembly (whole packets, not fragments!)
319319
*/
320320
#ifndef MEMP_NUM_REASSDATA
321-
#define MEMP_NUM_REASSDATA 0
321+
#define MEMP_NUM_REASSDATA 5
322322
#endif
323323

324324
/**
@@ -329,7 +329,7 @@
329329
* where the packet is not yet sent when netif->output returns.
330330
*/
331331
#ifndef MEMP_NUM_FRAG_PBUF
332-
#define MEMP_NUM_FRAG_PBUF 0
332+
#define MEMP_NUM_FRAG_PBUF 15
333333
#endif
334334

335335
/**
@@ -353,11 +353,18 @@
353353
#endif
354354

355355
/**
356-
* MEMP_NUM_SYS_TIMEOUT: the number of simulateously active timeouts.
357-
* (requires NO_SYS==0)
356+
* The number of sys timeouts used by the core stack (not apps)
357+
* The default number of timeouts is calculated here for all enabled modules.
358+
*/
359+
#define LWIP_NUM_SYS_TIMEOUT_INTERNAL (LWIP_TCP + IP_REASSEMBLY + LWIP_ARP + (2*LWIP_DHCP) + LWIP_ACD + LWIP_IGMP + LWIP_DNS + PPP_NUM_TIMEOUTS + (LWIP_IPV6 * (1 + LWIP_IPV6_REASS + LWIP_IPV6_MLD + LWIP_IPV6_DHCP6)))
360+
361+
/**
362+
* MEMP_NUM_SYS_TIMEOUT: the number of simultaneously active timeouts.
363+
* The default number of timeouts is calculated here for all enabled modules.
364+
* The formula expects settings to be either '0' or '1'.
358365
*/
359366
#ifndef MEMP_NUM_SYS_TIMEOUT
360-
#define MEMP_NUM_SYS_TIMEOUT 6
367+
#define MEMP_NUM_SYS_TIMEOUT LWIP_NUM_SYS_TIMEOUT_INTERNAL
361368
#endif
362369

363370
/**
@@ -416,7 +423,11 @@
416423
* PBUF_POOL_SIZE: the number of buffers in the pbuf pool.
417424
*/
418425
#ifndef PBUF_POOL_SIZE
419-
#define PBUF_POOL_SIZE 4
426+
#define PBUF_POOL_SIZE 16
427+
#endif
428+
429+
#ifndef LWIP_SUPPORT_CUSTOM_PBUF
430+
#define LWIP_SUPPORT_CUSTOM_PBUF 1
420431
#endif
421432

422433
/**
@@ -549,16 +560,27 @@
549560
* an upper limit on the MSS advertised by the remote host.
550561
*/
551562
#ifndef TCP_MSS
552-
#define TCP_MSS 536
563+
#define TCP_MSS 1420
553564
#endif
554565

566+
/**
567+
* TCP_CALCULATE_EFF_SEND_MSS: "The maximum size of a segment that TCP really
568+
* sends, the 'effective send MSS,' MUST be the smaller of the send MSS (which
569+
* reflects the available reassembly buffer size at the remote host) and the
570+
* largest size permitted by the IP layer" (RFC 1122)
571+
* Setting this to 1 enables code that checks TCP_MSS against the MTU of the
572+
* netif used for a connection and limits the MSS if it would be too big otherwise.
573+
*/
574+
#ifndef TCP_CALCULATE_EFF_SEND_MSS
575+
#define TCP_CALCULATE_EFF_SEND_MSS 1
576+
#endif
555577

556578
/**
557579
* TCP_SND_BUF: TCP sender buffer space (bytes).
558580
* To achieve good performance, this should be at least 2 * TCP_MSS.
559581
*/
560582
#ifndef TCP_SND_BUF
561-
#define TCP_SND_BUF 1500
583+
#define TCP_SND_BUF (4 * TCP_MSS)
562584
#endif
563585

564586
/**
@@ -596,7 +618,7 @@
596618
* Define to 0 if your device is low on memory.
597619
*/
598620
#ifndef TCP_QUEUE_OOSEQ
599-
#define TCP_QUEUE_OOSEQ 0
621+
#define TCP_QUEUE_OOSEQ (LWIP_TCP)
600622
#endif
601623

602624
/**
@@ -738,13 +760,45 @@
738760
/**
739761
* LWIP_DEBUG==1: Enable Debug.
740762
*/
763+
764+
#define LWIP_DBG_MIN_LEVEL LWIP_DBG_LEVEL_ALL
765+
741766
#define LWIP_DEBUG 0
767+
768+
#define ETHARP_DEBUG LWIP_DBG_OFF
742769
#define NETIF_DEBUG LWIP_DBG_OFF
743-
#define DHCP_DEBUG LWIP_DBG_OFF
744-
#define UDP_DEBUG LWIP_DBG_OFF
745-
#define MEMP_DEBUG LWIP_DBG_OFF
746-
#define MEM_DEBUG LWIP_DBG_OFF
770+
#define PBUF_DEBUG LWIP_DBG_OFF
771+
#define API_LIB_DEBUG LWIP_DBG_OFF
772+
#define API_MSG_DEBUG LWIP_DBG_OFF
773+
#define SOCKETS_DEBUG LWIP_DBG_OFF
747774
#define ICMP_DEBUG LWIP_DBG_OFF
775+
#define IGMP_DEBUG LWIP_DBG_OFF
776+
#define INET_DEBUG LWIP_DBG_OFF
777+
#define IP_DEBUG LWIP_DBG_OFF
778+
#define IP_REASS_DEBUG LWIP_DBG_OFF
779+
#define RAW_DEBUG LWIP_DBG_OFF
780+
#define MEM_DEBUG LWIP_DBG_OFF
781+
#define MEMP_DEBUG LWIP_DBG_OFF
782+
#define SYS_DEBUG LWIP_DBG_OFF
783+
#define TIMERS_DEBUG LWIP_DBG_OFF
784+
#define TCP_DEBUG LWIP_DBG_OFF
785+
#define TCP_INPUT_DEBUG LWIP_DBG_OFF
786+
#define TCP_FR_DEBUG LWIP_DBG_OFF
787+
#define TCP_RTO_DEBUG LWIP_DBG_OFF
788+
#define TCP_CWND_DEBUG LWIP_DBG_OFF
789+
#define TCP_WND_DEBUG LWIP_DBG_OFF
790+
#define TCP_OUTPUT_DEBUG LWIP_DBG_OFF
791+
#define TCP_RST_DEBUG LWIP_DBG_OFF
792+
#define TCP_QLEN_DEBUG LWIP_DBG_OFF
793+
#define UDP_DEBUG LWIP_DBG_OFF
794+
#define TCPIP_DEBUG LWIP_DBG_OFF
795+
#define SLIP_DEBUG LWIP_DBG_OFF
796+
#define DHCP_DEBUG LWIP_DBG_OFF
797+
#define AUTOIP_DEBUG LWIP_DBG_OFF
798+
#define ACD_DEBUG LWIP_DBG_OFF
799+
#define DNS_DEBUG LWIP_DBG_OFF
800+
#define IP6_DEBUG LWIP_DBG_OFF
801+
#define DHCP6_DEBUG LWIP_DBG_OFF
748802
#endif
749803

750804
//#define LWIP_USE_EXTERNAL_MBEDTLS 1
2.57 KB
Binary file not shown.

0 commit comments

Comments
 (0)