mirror of
https://github.com/hathach/tinyusb.git
synced 2026-08-18 11:02:16 +00:00
gate lwIP throughput tuning + iperf on MCU SRAM tier
The bigger TCP_WND/PBUF_POOL/MEMP_NUM_TCP_SEG and the always-on iperf overflowed SRAM on stm32c0/f1/wb, lpc11/13, samd11. Add LWIP_HIGH_THROUGHPUT gate (defined in tusb_config.h, consumed by lwipopts.h) so RAM-tight MCUs keep the original modest buffers and skip iperf, while RAM-rich targets (max32*/stm32f2/f4/f7/h5/h7/h7rs/u5/n6, rp2040, mimxrt1xxx, nrf5x) keep the throughput tuning needed for the iperf HIL test. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@ -32,6 +32,14 @@
|
||||
#ifndef LWIPOPTS_H__
|
||||
#define LWIPOPTS_H__
|
||||
|
||||
// Pulls in tusb_option.h → tusb_config.h, which defines LWIP_HIGH_THROUGHPUT
|
||||
// based on the target MCU's SRAM tier.
|
||||
#include "tusb_option.h"
|
||||
|
||||
#ifndef LWIP_HIGH_THROUGHPUT
|
||||
#define LWIP_HIGH_THROUGHPUT 0
|
||||
#endif
|
||||
|
||||
/* Prevent having to link sys_arch.c (we don't test the API layers in unit tests) */
|
||||
#define NO_SYS 1
|
||||
#define MEM_ALIGNMENT 4
|
||||
@ -49,7 +57,15 @@
|
||||
|
||||
#define TCP_MSS (1500 /*mtu*/ - 20 /*iphdr*/ - 20 /*tcphhr*/)
|
||||
#define TCP_SND_BUF (4 * TCP_MSS)
|
||||
#define TCP_WND (8 * TCP_MSS)
|
||||
#if LWIP_HIGH_THROUGHPUT
|
||||
#define TCP_WND (8 * TCP_MSS)
|
||||
#define PBUF_POOL_SIZE 8
|
||||
// Must grow in step with TCP_SND_BUF (default MEMP_NUM_TCP_SEG=16 caps TCP_SND_BUF at 4*MSS).
|
||||
#define MEMP_NUM_TCP_SEG 16
|
||||
#else
|
||||
#define TCP_WND (4 * TCP_MSS)
|
||||
#define PBUF_POOL_SIZE 4
|
||||
#endif
|
||||
|
||||
#define ETHARP_SUPPORT_STATIC_ENTRIES 1
|
||||
|
||||
@ -60,10 +76,6 @@
|
||||
#define LWIP_SINGLE_NETIF 1
|
||||
#define LWIP_NETIF_LINK_CALLBACK 1
|
||||
|
||||
#define PBUF_POOL_SIZE 8
|
||||
// Must grow in step with TCP_SND_BUF (default MEMP_NUM_TCP_SEG=16 caps TCP_SND_BUF at 4*MSS).
|
||||
#define MEMP_NUM_TCP_SEG 16
|
||||
|
||||
#define HTTPD_USE_CUSTOM_FSDATA 0
|
||||
|
||||
#define LWIP_MULTICAST_PING 1
|
||||
|
||||
@ -97,7 +97,24 @@ extern "C" {
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef INCLUDE_IPERF
|
||||
// MCU SRAM tier — drives the bigger lwIP buffers in lwipopts.h, the larger
|
||||
// NCM OUT NTB size below, and whether iperf is built. Small-RAM MCUs
|
||||
// (stm32c0/f1/wb, lpc11/13, samd11) keep modest defaults to fit.
|
||||
#ifndef LWIP_HIGH_THROUGHPUT
|
||||
#if TU_CHECK_MCU(OPT_MCU_MAX32650, OPT_MCU_MAX32666, OPT_MCU_MAX32690, OPT_MCU_MAX78002) || \
|
||||
TU_CHECK_MCU(OPT_MCU_STM32F2, OPT_MCU_STM32F4, OPT_MCU_STM32F7) || \
|
||||
TU_CHECK_MCU(OPT_MCU_STM32H5, OPT_MCU_STM32H7, OPT_MCU_STM32H7RS) || \
|
||||
TU_CHECK_MCU(OPT_MCU_STM32U5, OPT_MCU_STM32N6) || \
|
||||
TU_CHECK_MCU(OPT_MCU_RP2040) || \
|
||||
TU_CHECK_MCU(OPT_MCU_MIMXRT1XXX) || \
|
||||
TU_CHECK_MCU(OPT_MCU_NRF5X)
|
||||
#define LWIP_HIGH_THROUGHPUT 1
|
||||
#else
|
||||
#define LWIP_HIGH_THROUGHPUT 0
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if LWIP_HIGH_THROUGHPUT && !defined(INCLUDE_IPERF)
|
||||
#define INCLUDE_IPERF
|
||||
#endif
|
||||
|
||||
@ -111,7 +128,11 @@ extern "C" {
|
||||
|
||||
// Must be >> MTU
|
||||
// Can be set to smaller values if wNtbOutMaxDatagrams==1
|
||||
#define CFG_TUD_NCM_OUT_NTB_MAX_SIZE (3 * TCP_MSS + 100)
|
||||
#if LWIP_HIGH_THROUGHPUT
|
||||
#define CFG_TUD_NCM_OUT_NTB_MAX_SIZE (3 * TCP_MSS + 100)
|
||||
#else
|
||||
#define CFG_TUD_NCM_OUT_NTB_MAX_SIZE (2 * TCP_MSS + 100)
|
||||
#endif
|
||||
|
||||
// Number of NCM transfer blocks for reception side
|
||||
#ifndef CFG_TUD_NCM_OUT_NTB_N
|
||||
|
||||
Reference in New Issue
Block a user