This is an automated email from the ASF dual-hosted git repository.
kasjer pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git
The following commit(s) were added to refs/heads/master by this push:
new 88eb87b8e drivers/stm32_eth: Read all received frames in RX interrupt
88eb87b8e is described below
commit 88eb87b8e6f48f5f7dd0d1525bb6b6ae84dc21df
Author: Jerzy Kasenberg <[email protected]>
AuthorDate: Wed Oct 14 11:38:46 2026 +0200
drivers/stm32_eth: Read all received frames in RX interrupt
HAL_ETH_RxCpltCallback() handled only one frame. When more frames
were received before interrupt was serviced the rest stayed in DMA
descriptors until next frame arrived, adding latency and causing
packet loss when traffic stopped.
Read frames until HAL reports no more data or RX buffer allocation
fails.
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Jerzy Kasenberg <[email protected]>
---
hw/drivers/lwip/stm32_eth/src/stm32_eth.c | 21 +++++++++++++--------
1 file changed, 13 insertions(+), 8 deletions(-)
diff --git a/hw/drivers/lwip/stm32_eth/src/stm32_eth.c
b/hw/drivers/lwip/stm32_eth/src/stm32_eth.c
index c71dde793..30a5a3a85 100644
--- a/hw/drivers/lwip/stm32_eth/src/stm32_eth.c
+++ b/hw/drivers/lwip/stm32_eth/src/stm32_eth.c
@@ -125,20 +125,25 @@ LWIP_MEMPOOL_DECLARE(RX_POOL, STM32_ETH_RX_BUFFER_CNT,
sizeof(struct rx_buff), "
static void
stm32_eth_input(struct stm32_eth_state *ses)
{
- struct pbuf *p = NULL;
+ struct pbuf *p;
int sr;
- if (rx_alloc_failed) {
- return;
- }
+ /*
+ * One RX interrupt can be reported for several received frames,
+ * take all of them, otherwise they wait for next frame to arrive.
+ */
+ while (!rx_alloc_failed) {
+ p = NULL;
- OS_ENTER_CRITICAL(sr);
+ OS_ENTER_CRITICAL(sr);
- HAL_ETH_ReadData(&ses->st_eth, (void **)&p);
+ HAL_ETH_ReadData(&ses->st_eth, (void **)&p);
- OS_EXIT_CRITICAL(sr);
+ OS_EXIT_CRITICAL(sr);
- if (p != NULL) {
+ if (p == NULL) {
+ break;
+ }
if (ses->st_nif.input(p, &ses->st_nif) != ERR_OK) {
pbuf_free(p);
}