This is an automated email from the ASF dual-hosted git repository.
fdcavalcanti pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git
The following commit(s) were added to refs/heads/master by this push:
new 88c8623cedb xtensa/espressif: enable openeth RX interrupt, fix
ifdown()'s TX/RX disable
88c8623cedb is described below
commit 88c8623cedbdc5a2d7cee82cec33fa265271b8e1
Author: Felipe Moura <[email protected]>
AuthorDate: Tue Sep 15 15:26:02 2026 -0300
xtensa/espressif: enable openeth RX interrupt, fix ifdown()'s TX/RX disable
esp_openeth_initialize() (arch/xtensa/src/common/espressif/esp_openeth.c)
attaches the MAC interrupt with esp_setup_irq() but never calls
up_enable_irq(OPENETH_IRQ_MAC), unlike every other Espressif driver in
this tree. Left masked, openeth_isr_handler() never runs and received
frames are only picked up when the netdev work thread happens to run
for some other reason (a transmit). A guest can therefore send but
effectively not receive: ping still works because each request is
itself a transmit, while a socket blocked in recvfrom() waits on a
wake-up that never comes.
Confirmed with a GDB breakpoint counter on openeth_isr_handler():
zero hits before the fix, dozens after, under QEMU's esp32s3 machine
(the open_eth NIC it emulates). With the interrupt enabled, TCP
retransmits over a fixed test window dropped from 86 to 4.
Separately, openeth_ifdown() calls openeth_enable() right under a
comment that says "Disable TX and RX" -- it should call
openeth_disable(), which is what actually disables the two DMA
descriptor rings. Fixed alongside since it's the same function and
the same class of mistake.
Board-independent (arch/xtensa/src/common/espressif), not specific
to any one esp32s3 board; open_eth itself only exists as a QEMU
peripheral, so there's no real-hardware regression risk from either
change.
Signed-off-by: Felipe Moura <[email protected]>
Assisted-by: Claude:claude-sonnet-5
---
arch/xtensa/src/common/espressif/esp_openeth.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/arch/xtensa/src/common/espressif/esp_openeth.c
b/arch/xtensa/src/common/espressif/esp_openeth.c
index 1376ede0993..ed58e7ed357 100644
--- a/arch/xtensa/src/common/espressif/esp_openeth.c
+++ b/arch/xtensa/src/common/espressif/esp_openeth.c
@@ -366,7 +366,7 @@ static int openeth_ifdown(struct netdev_lowerhalf_s *dev)
/* Disable TX and RX */
- openeth_enable();
+ openeth_disable();
leave_critical_section(flags);
@@ -424,6 +424,7 @@ static int openeth_set_addr(uint8_t *addr)
uint32_t mac0_u32;
uint32_t mac1_u32;
+
memcpy(&mac0_u32, &mac0, 4);
memcpy(&mac1_u32, &mac1, 4);
REG_WRITE(OPENETH_MAC_ADDR0_REG, mac0_u32);
@@ -524,6 +525,12 @@ int esp_openeth_initialize(void)
goto err;
}
+ /* The interrupt is attached but still masked at the CPU; without this
+ * call it never fires, so received frames are only picked up on a TX.
+ */
+
+ up_enable_irq(OPENETH_IRQ_MAC);
+
/* Initialize the MAC */
openeth_reset();