Limit the PSRAM input path to dual wifi + ethernet builds

An ethernet-only build has internal RAM to spare (135 KB free idle on a
CAST-1 built without wifi), so keep stock behaviour there.
This commit is contained in:
J. Nick Koston
2026-09-17 12:10:32 -05:00
parent 3529eed08a
commit 1ae337e82d
3 changed files with 20 additions and 9 deletions
@@ -74,9 +74,11 @@ static const char *const TAG = "ethernet";
// PHY register size for hex logging
static constexpr size_t PHY_REG_SIZE = 2;
// SPI MACs only: the bus is the bottleneck there, the extra copy is unmeasured on the 100 Mbit EMAC.
// Replacing the glue's input path would bypass its L2 TAP filter, so leave it alone when that is on.
#if defined(USE_PSRAM) && defined(USE_ETHERNET_SPI) && !CONFIG_ESP_NETIF_L2_TAP
// Dual wifi + ethernet builds only: wifi's fixed costs leave little internal RAM and its buffers are
// already in PSRAM, while an ethernet-only build has room to spare. SPI MACs only: the bus is the
// bottleneck there, the extra copy is unmeasured on the 100 Mbit EMAC. Not with L2 TAP, whose filter
// lives in the glue's input path.
#if defined(USE_PSRAM) && defined(USE_ETHERNET_SPI) && defined(USE_WIFI) && !CONFIG_ESP_NETIF_L2_TAP
#define USE_ETHERNET_RX_PSRAM
// ESP-IDF ethernet drivers malloc() every received frame in internal RAM, where it stays until lwIP
// hands it to the application. Move it to PSRAM; if that fails the frame is passed on where it is.
@@ -1,6 +0,0 @@
# W5500 with PSRAM: compiles the input path that moves received frames to PSRAM
packages:
ethernet: !include common-w5500.yaml
psram:
mode: quad
@@ -0,0 +1,15 @@
# W5500 next to wifi with PSRAM: compiles the input path that moves received frames to PSRAM
packages:
ethernet: !include common-w5500.yaml
psram:
mode: quad
wifi:
ssid: MySSID
password: password1
network:
priority:
- ethernet
- wifi