From a4c608c591d09f996a79ba2bc164716da4187fb7 Mon Sep 17 00:00:00 2001 From: "Daniel P. Carvalho" Date: Mon, 21 Sep 2026 19:29:52 -0300 Subject: [PATCH] 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 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 1c88e21ad98..db001b991ca 100644 --- a/arch/arm/src/stm32h7/stm32_ethernet.c +++ b/arch/arm/src/stm32h7/stm32_ethernet.c @@ -40,6 +40,7 @@ #include #include +#include #include #include @@ -2392,7 +2393,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