lwip/0137-reduce-pbuf-pool-size.patch
yinbin6 b827de2e31 reduce pbuf poll size
(cherry picked from commit 31d2ac9cf3e6e42de830d4276cab3c64deee0851)
2024-06-20 15:56:21 +08:00

45 lines
1.9 KiB
Diff

From 98e846b1bc4f4c304bd08dbce0d92467f01a4196 Mon Sep 17 00:00:00 2001
From: jiangheng <jiangheng14@huawei.com>
Date: Thu, 13 Jun 2024 08:57:50 +0800
Subject: [PATCH] reduce pbuf pool size
---
src/core/init.c | 4 ++++
src/include/lwipopts.h | 2 +-
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/src/core/init.c b/src/core/init.c
index c0aaf45..821c6c7 100644
--- a/src/core/init.c
+++ b/src/core/init.c
@@ -321,9 +321,13 @@ PACK_STRUCT_END
#if !MEMP_MEM_MALLOC && PBUF_POOL_SIZE && (PBUF_POOL_BUFSIZE <= (PBUF_LINK_ENCAPSULATION_HLEN + PBUF_LINK_HLEN + PBUF_IP_HLEN + PBUF_TRANSPORT_HLEN))
#error "lwip_sanity_check: WARNING: PBUF_POOL_BUFSIZE does not provide enough space for protocol headers. If you know what you are doing, define LWIP_DISABLE_TCP_SANITY_CHECKS to 1 to disable this error."
#endif
+
+#if !GAZELLE_ENABLE
#if !MEMP_MEM_MALLOC && PBUF_POOL_SIZE && (TCP_WND > (PBUF_POOL_SIZE * (PBUF_POOL_BUFSIZE - (PBUF_LINK_ENCAPSULATION_HLEN + PBUF_LINK_HLEN + PBUF_IP_HLEN + PBUF_TRANSPORT_HLEN))))
#error "lwip_sanity_check: WARNING: TCP_WND is larger than space provided by PBUF_POOL_SIZE * (PBUF_POOL_BUFSIZE - protocol headers). If you know what you are doing, define LWIP_DISABLE_TCP_SANITY_CHECKS to 1 to disable this error."
#endif
+#endif
+
#if TCP_WND < TCP_MSS
#error "lwip_sanity_check: WARNING: TCP_WND is smaller than MSS. If you know what you are doing, define LWIP_DISABLE_TCP_SANITY_CHECKS to 1 to disable this error."
#endif
diff --git a/src/include/lwipopts.h b/src/include/lwipopts.h
index 4655388..cb3154a 100644
--- a/src/include/lwipopts.h
+++ b/src/include/lwipopts.h
@@ -134,7 +134,7 @@
#define MEMP_NUM_SYS_MBOX (GAZELLE_MAX_CLIENTS + GAZELLE_RESERVED_CLIENTS)
-#define PBUF_POOL_SIZE (GAZELLE_MAX_CLIENTS * 2)
+#define PBUF_POOL_SIZE (1024)
/* we use PBUF_POOL instead of PBUF_RAM in tcp_write, so reduce PBUF_RAM size,
* and do NOT let PBUF_POOL_BUFSIZE less then TCP_MSS
--
2.33.0