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

commit 25f35ca8a794d22c7b848919ece717fe52d3972a
Author: raiden00pl <[email protected]>
AuthorDate: Tue Nov 17 14:40:53 2026 +0100

    arch/arm/stm32: Keep received Ethernet frames with a dribble bit error.
    
    A dribble bit error sets the RX error summary although the CRC of the
    frame is good.  The LAN8742A RMII link of the Nucleo-N657X0-Q shows it
    on a few percent of the frames, which were all dropped.  Drop only
    frames with a CRC, receive, overflow, watchdog or giant packet error.
    
    Assisted-by: Claude:claude-opus-5-5
    Signed-off-by: raiden00pl <[email protected]>
---
 arch/arm/src/common/stm32/stm32_eth_v2.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/arch/arm/src/common/stm32/stm32_eth_v2.c 
b/arch/arm/src/common/stm32/stm32_eth_v2.c
index d12c37736fe..17cd817445a 100644
--- a/arch/arm/src/common/stm32/stm32_eth_v2.c
+++ b/arch/arm/src/common/stm32/stm32_eth_v2.c
@@ -376,6 +376,12 @@
 #define DMA_ALIGN_UP(n)    (((n) + DMA_BUFFER_MASK) & ~DMA_BUFFER_MASK)
 #define DMA_ALIGN_DOWN(n)  ((n) & ~DMA_BUFFER_MASK)
 
+/* The RX descriptor errors that make a received frame unusable */
+
+#define RDES3_FATAL_ERRORS (ETH_RDES3_WB_RE | ETH_RDES3_WB_OE |   \
+                            ETH_RDES3_WB_RWT | ETH_RDES3_WB_GP |  \
+                            ETH_RDES3_WB_CE)
+
 #define DESC_SIZE       16
 #define DESC_PADSIZE        DMA_ALIGN_UP(DESC_SIZE)
 #define ALIGNED_BUFSIZE     DMA_ALIGN_UP(ETH_BUFSIZE)
@@ -2131,7 +2137,12 @@ static int stm32_recvframe(struct stm32_ethmac_s *priv)
 
           else
             {
-              bool err = ((rxdesc->des3 & ETH_RDES3_WB_ES) != 0);
+              /* A dribble bit error alone also sets the error summary,
+               * but the CRC of the frame is good: keep such frames.
+               */
+
+              bool err = ((rxdesc->des3 & ETH_RDES3_WB_ES) != 0 &&
+                          (rxdesc->des3 & RDES3_FATAL_ERRORS) != 0);
 
               priv->segments++;
 

Reply via email to