This is an automated email from the ASF dual-hosted git repository.

xiaoxiang781216 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 1aa3425447e arch/arm/imxrt: hold RX frames while the ENET TX ring is 
full
1aa3425447e is described below

commit 1aa3425447e53b077a29d59e2005bb2e455bc0f3
Author: Royyan Zahir <[email protected]>
AuthorDate: Fri Oct 9 17:19:34 2026 +0400

    arch/arm/imxrt: hold RX frames while the ENET TX ring is full
    
    A reply built in the receive path (ICMP echo, ARP, TCP ACK) is dropped
    when imxrt_transmit() finds every TX descriptor busy. A board that
    streams UDP keeps the ring full often enough that about 0.5% of pings
    go unanswered.
    
    Stop taking frames off the RX ring and mask RX while the TX ring is
    full. When a TX completes, unmask RX and drain the ring before polling
    the stack for more output, so replies are not starved by bulk sends.
    
    Signed-off-by: Royyan Zahir <[email protected]>
---
 arch/arm/src/imxrt/imxrt_enet.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/arch/arm/src/imxrt/imxrt_enet.c b/arch/arm/src/imxrt/imxrt_enet.c
index 2f840b08709..0592257fbf3 100644
--- a/arch/arm/src/imxrt/imxrt_enet.c
+++ b/arch/arm/src/imxrt/imxrt_enet.c
@@ -990,6 +990,12 @@ static void imxrt_receive(struct imxrt_driver_s *priv)
 
   do
     {
+      if (imxrt_txringfull(priv))
+        {
+          priv->ints &= ~RX_INTERRUPTS;
+          break;
+        }
+
       /* Invalidate the Rx descriptor.  Since it has been modified via DMA,
        * we must assure that we must invalid any cached values and re-read
        * the descriptor from the memory.
@@ -1134,6 +1140,12 @@ static void imxrt_txdone(struct imxrt_driver_s *priv)
                              priv->ints);
     }
 
+  if ((priv->ints & RX_INTERRUPTS) == 0)
+    {
+      priv->ints |= RX_INTERRUPTS;
+      imxrt_receive(priv);
+    }
+
   /* There should be space for a new TX in any event.  Poll the network for
    * new XMIT data
    */

Reply via email to