[PATCH] net: lwip: scale buffer pool size with TFTP block size
Pranav Tilak
pranav.vinaytilak at amd.com
Thu Mar 5 07:40:11 CET 2026
TFTP transfers fail when tftpblocksize is set to 8192 or larger due to
insufficient buffer resources for IP fragment reassembly.
Adjust PBUF_POOL_SIZE and IP_REASS_MAX_PBUFS based on
CONFIG_TFTP_BLOCKSIZE to support larger TFTP transfers
while keeping memory usage efficient.
- CONFIG_TFTP_BLOCKSIZE >= 12288:PBUF_POOL_SIZE=18, IP_REASS_MAX_PBUFS=12
- CONFIG_TFTP_BLOCKSIZE >= 8192:PBUF_POOL_SIZE=12, IP_REASS_MAX_PBUFS=6
- CONFIG_TFTP_BLOCKSIZE undefined: PBUF_POOL_SIZE=8, IP_REASS_MAX_PBUFS=4
Signed-off-by: Pranav Tilak <pranav.vinaytilak at amd.com>
---
lib/lwip/u-boot/lwipopts.h | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/lib/lwip/u-boot/lwipopts.h b/lib/lwip/u-boot/lwipopts.h
index e8a2c9d7a0a..b4ff31096fe 100644
--- a/lib/lwip/u-boot/lwipopts.h
+++ b/lib/lwip/u-boot/lwipopts.h
@@ -65,7 +65,14 @@
#define MEM_ALIGNMENT 8
#define MEMP_NUM_TCP_SEG 16
+
+#if defined(CONFIG_TFTP_BLOCKSIZE) && CONFIG_TFTP_BLOCKSIZE >= 12288
+#define PBUF_POOL_SIZE 18
+#elif defined(CONFIG_TFTP_BLOCKSIZE) && CONFIG_TFTP_BLOCKSIZE >= 8192
+#define PBUF_POOL_SIZE 12
+#else
#define PBUF_POOL_SIZE 8
+#endif
#define LWIP_ARP 1
#define ARP_TABLE_SIZE 4
@@ -76,7 +83,15 @@
#define IP_REASSEMBLY 1
#define IP_FRAG 1
#define IP_REASS_MAXAGE 3
+
+#if defined(CONFIG_TFTP_BLOCKSIZE) && CONFIG_TFTP_BLOCKSIZE >= 12288
+#define IP_REASS_MAX_PBUFS 12
+#elif defined(CONFIG_TFTP_BLOCKSIZE) && CONFIG_TFTP_BLOCKSIZE >= 8192
+#define IP_REASS_MAX_PBUFS 6
+#else
#define IP_REASS_MAX_PBUFS 4
+#endif
+
#define IP_FRAG_USES_STATIC_BUF 0
#define IP_DEFAULT_TTL 255
--
2.34.1
More information about the U-Boot
mailing list