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

linguini1 pushed a commit to branch releases/13.1
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit fb555ffad04855ccd98f510cf01238695b1e6f84
Author: Daniel P. Carvalho <[email protected]>
AuthorDate: Mon Sep 21 19:29:52 2026 -0300

    arch/arm/stm32h7: do not log the frames of packet sockets as unknown.
    
    A frame that a packet socket consumes was given to pkt_input() and then
    logged as "Dropped, Unknown type" because it is neither IP nor ARP. With
    a PTP grandmaster on the network that is one warning for each frame, and
    the log of RAM fills in seconds, so it hides the messages of the start of
    the system.
    
    Do not log the frames of the type of PTP or of IPv6 when packet sockets
    are enabled, as the driver of the legacy STM32 does.
    
    Signed-off-by: Daniel P. Carvalho <[email protected]>
    Assisted-by: Claude:claude-sonnet-5
---
 arch/arm/src/stm32h7/stm32_ethernet.c | 14 +++++++++++++-
 include/netinet/if_ether.h            |  1 +
 2 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/arch/arm/src/stm32h7/stm32_ethernet.c 
b/arch/arm/src/stm32h7/stm32_ethernet.c
index 79a20a1931e..a0d12523050 100644
--- a/arch/arm/src/stm32h7/stm32_ethernet.c
+++ b/arch/arm/src/stm32h7/stm32_ethernet.c
@@ -40,6 +40,7 @@
 
 #include <arch/barriers.h>
 #include <arpa/inet.h>
+#include <netinet/if_ether.h>
 
 #include <nuttx/arch.h>
 #include <nuttx/irq.h>
@@ -2090,7 +2091,18 @@ static void stm32_receive(struct stm32_ethmac_s *priv)
       else
 #endif
         {
-          nwarn("WARNING: DROPPED Unknown type: %04x\n", BUF->type);
+#ifdef CONFIG_NET_PKT
+          /* Frames that packet sockets consume (PTP over Ethernet and
+           * IPv6) were already given to pkt_input() above, so they are not
+           * unknown and must not be logged as dropped.
+           */
+
+          if (BUF->type != HTONS(ETH_P_1588) &&
+              BUF->type != HTONS(ETHTYPE_IP6))
+#endif
+            {
+              nwarn("WARNING: DROPPED Unknown type: %04x\n", BUF->type);
+            }
         }
 
       /* We are finished with the RX buffer.  NOTE:  If the buffer is
diff --git a/include/netinet/if_ether.h b/include/netinet/if_ether.h
index db35a1c43a9..97fed0e4e11 100644
--- a/include/netinet/if_ether.h
+++ b/include/netinet/if_ether.h
@@ -51,6 +51,7 @@
 #define ETH_P_IPV6  ETHERTYPE_IPV6
 #define ETH_P_ARP   ETHERTYPE_ARP
 #define ETH_P_TSN   0x22F0  /* TSN (IEEE 1722) packet */
+#define ETH_P_1588  0x88F7  /* PTP (IEEE 1588) over Ethernet packet */
 
 /****************************************************************************
  * Public Type Definitions

Reply via email to