From 45a43dc7e8383d6fbcc84114b80028fadb6c048d Mon Sep 17 00:00:00 2001 From: Stefano Ugolini Date: Tue, 17 Mar 2026 12:42:14 +0100 Subject: [PATCH] STM32H legacy driver fix: request usable RX size in legacy zero-copy path The STM32H legacy zero-copy RX path still requested ETH_RX_BUF_SIZE for replacement RX buffers even though BufferAllocation_1 now limits allocations to the interface-reported usable size. For this driver the usable size is ETH_RX_BUF_SIZE - ipBUFFER_PADDING. Requesting the full hardware buffer size caused every replacement allocation to fail, left pxReceivedBuffer as NULL, and dropped all received frames before they reached the IP task. Request ETH_RX_BUF_SIZE - ipBUFFER_PADDING in the RX fast path so the receive path matches the enforced allocation limit. --- .../STM32/Legacy/STM32Hxx/NetworkInterface.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/source/portable/NetworkInterface/STM32/Legacy/STM32Hxx/NetworkInterface.c b/source/portable/NetworkInterface/STM32/Legacy/STM32Hxx/NetworkInterface.c index f78224a609..725fa0481e 100644 --- a/source/portable/NetworkInterface/STM32/Legacy/STM32Hxx/NetworkInterface.c +++ b/source/portable/NetworkInterface/STM32/Legacy/STM32Hxx/NetworkInterface.c @@ -780,8 +780,9 @@ static BaseType_t prvNetworkInterfaceInput( void ) #if ( ipconfigZERO_COPY_RX_DRIVER != 0 ) { - /* Reserve the maximum length for the next reception. */ - uxLength = ETH_RX_BUF_SIZE; + /* Request the usable Ethernet payload area, excluding the descriptor + * metadata stored in front of pucEthernetBuffer. */ + uxLength = ETH_RX_BUF_SIZE - ipBUFFER_PADDING; if( data_buffer.buffer != NULL ) {