Article View: linux.kernel.netdev
Article #25098Re: [PATCH net-next v13 4/8] hsr: Drop received PTP packets
From: netdev-bot+sashiko
Date: Tue, 01 Dec 2026 08:55
Date: Tue, 01 Dec 2026 08:55
95 lines
11264 bytes
11264 bytes
Thank you for your contribution! Sashiko AI review found more severe
issue(s) in other patches of this series. This mail is only an FYI, in case
you want to address the nit picks below when you respin.
Low priority / nit picks for your consideration:
- [Low] In net/hsr/hsr_slave.c, hsr_handle_frame() now drops every
received PTP frame on purpose (HSR-tagged frames whoseโฆ
--
hsr: Drop received PTP packets
With this change hsr_handle_frame() drops every PTP frame it receives
instead of forwarding it through the HSR stack. For HSR/PRP tagged frames
it checks the encapsulated protocol, and for other frames it checks the
ether type. The existing kfree_skb() + return paths are also merged into a
common finish_free_consume label.
> diff --git a/net/hsr/hsr_slave.c b/net/hsr/hsr_slave.c
> index 84d8a40bba0a6..86a05f3fc1cc5 100644
> --- a/net/hsr/hsr_slave.c
> +++ b/net/hsr/hsr_slave.c
[ ... ]
> @@ -64,15 +64,28 @@ static rx_handler_result_t hsr_handle_frame(struct sk_buff **pskb)
> skb_reset_mac_header(skb);
> if ((!hsr->prot_version && protocol == htons(ETH_P_PRP)) ||
> protocol == htons(ETH_P_HSR)) {
> - if (!pskb_may_pull(skb, ETH_HLEN + HSR_HLEN)) {
> - kfree_skb(skb);
> - goto finish_consume;
> - }
> + if (!pskb_may_pull(skb, ETH_HLEN + HSR_HLEN))
> + goto finish_free_consume;
>
> skb_set_network_header(skb, ETH_HLEN + HSR_HLEN);
> }
> skb_reset_mac_len(skb);
>
> + /* PTP packets are not supposed to be forwarded via HSR as-is. The
> + * latency introduced by forwarding renders the time information
> + * useless. Userland needs to capture the packet on the original
> + * interface instead of hsr.
> + */
> + if ((!hsr->prot_version && protocol == htons(ETH_P_PRP)) ||
> + protocol == htons(ETH_P_HSR)) {
> + hsr_ethhdr = (struct hsr_ethhdr *)skb_mac_header(skb);
> + if (hsr_ethhdr->hsr_tag.encap_proto == htons(ETH_P_1588))
> + goto finish_free_consume;
> + } else {
> + if (protocol == htons(ETH_P_1588))
> + goto finish_free_consume;
> + }
> +
[ ... ]
> -finish_consume:
> + return RX_HANDLER_CONSUMED;
> +
> +finish_free_consume:
> + kfree_skb(skb);
> return RX_HANDLER_CONSUMED;
[Severity: Low]
Should these intentional PTP drops use a dedicated drop reason?
Both new PTP checks in hsr_handle_frame() jump to finish_free_consume.
That label calls kfree_skb(), which is
kfree_skb_reason(skb, SKB_DROP_REASON_NOT_SPECIFIED).
The same label also handles the real error drops, which are the
pskb_may_pull() failure and frames sent by ourselves. As a result, every
PTP frame received on an HSR/PRP slave or interlink port shows up in the
skb:kfree_skb tracepoint and in drop_monitor as an unexplained
NOT_SPECIFIED drop in hsr_handle_frame().
On a linuxptp-over-HSR setup this produces a steady stream of such drops
at the PTP message rate. They cannot be told apart from drops of
malformed frames.
The kernel-doc for consume_skb() in net/core/skbuff.c says kfree_skb()
assumes the frame is being dropped after a failure.
Would it be better to use kfree_skb_reason() with a specific reason here,
or consume_skb() if this discard is not meant to count as a drop?
>
> finish_pass:
--
Sashiko AI review ยท https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261130-hsr_ptp-v13-0-598326208fc5%40linutronix.de
Technical Details
Message-ID:
<179611532822.3146.5345968167708047240@kernel.org>Path:
mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-374865-linux-kernel-netdev=dewy.ruReferences:
<20261130-hsr_ptp-v13-4-598326208fc5@linutronix.de>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-374865-linux-kernel-netdev=dewy.ru From: netdev-bot+sashiko@kernel.org Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net-next v13 4/8] hsr: Drop received PTP packets Date: Tue, 01 Dec 2026 08:55:28 +0000 Organization: Usenet Network Message-ID: <179611532822.3146.5345968167708047240@kernel.org> References: <20261130-hsr_ptp-v13-4-598326208fc5@linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="1665931"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:FIqRLKDlIFOp6JDaNys3EwxKw3k= sha256:Srze1JvA6+CtaBkB9sGRHi4CSE9qfiICgZrlebx1VIA= sha1:JvC5TS94PtBfkZ5h538CFOXgFr0= sha256:1fMt0D7YodIGjUxir3ZnECTIX/qIFNH2NMVFNVFmLbc= List-ID: <netdev.vger.kernel.org> X-Mailpost-Empty-Hdrs: X-Spam-Level X-Received: from localhost (localhost [127.0.0.1]) by mail.dewy.ru (Postfix) with ESMTP id 2516B1172DD; Tue, 1 Dec 2026 11:55:47 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.401 X-Spam-Status: No, score=-3.401 tagged_above=-9999 required=6.31 tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001] autolearn=ham autolearn_force=no X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key) header.d=kernel.org X-Received: from mail.dewy.ru ([127.0.0.1]) by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 3iK0oZU0Sv-f; Tue, 1 Dec 2026 11:55:43 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-374865-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10]) by mail.dewy.ru (Postfix) with ESMTPS id 60F9F1172DE; Tue, 1 Dec 2026 11:55:34 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by sea.lore.kernel.org (Postfix) with ESMTP id 9A0392EFCA; Tue, 1 Dec 2026 08:55:31 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1796115331; b=uvKdJhzc0yRl2LVpB4bRZ306GTfnctjnR4m+TA9uvYYMd8mtVY5p9iT1fBdBLgleghu7 dU97stzbrNbzo56wQeEHD5GheoifbFO4MMKDroDSwzkZ0jcXdXuXgQXSObPfocVieY74N 77v4qYV1F2XTN7czuUPyhS2COYQ2sFl+6kqUlnT3TcqsG10/+y65UicqN40ILxIfHKUJ4 sdVVUhT5YjJaX/1oTGoGa6biVZZXITRD8ub7NCUdxLmdry5GelK0khkEzgP2Sbrqc+vkz 02p3jloSUbXnVf+6RKblGa9COQdCzDM3WLX9oj4h/Vr/wmszYp4OtnzX7AGy/ivwbKA== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796115331; h=X-Original-To:Received:Received:DKIM-Signature:Subject:From:To:Cc: Date:Message-ID:In-Reply-To:References:X-sashiko-severity: Content-Type:Content-Transfer-Encoding:X-Mailing-List:List-Id: List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner: Precedence:MIME-Version; bh=ntdDu58cNNjJ/FgBjzDa2PEF537n5XCu1Rv7NVNW3rQ=; b=oPHgsWNXX0Hb89H63REaYEVpHIKJSGMrhPKXvuHNdxajeNUjzG7zkWSf2Eh3Rhaq5R6Y e/mZ17ZpsIcxu9hhLcipp75ZxMZclmuvS2AGWc+qMLwtjqjQttNFA6m5eDvDhdgyZiHwT OFEvOyykw65mcM00eKvHsg8hoeCxLyBB8jxEHwfclRolacRp6jxF+q8gVUhBSMDSB69Ip 8acNEhYBOs9n/s6US5g+vEsKhOFOp6UEiNnYnZsCsTLeNPkekRqfORXUwoDObJvItwMpS eTpygY6EF7nb82TSxxaJ5byYVota12PxkjXI19l+JQH0dyt73nUZYE8idp+1YhjhvPA== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=dCO3sggA; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0563C606A32F; Tue, 1 Dec 2026 08:55:31 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=dCO3sggA X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796115330; b=e414AIuZsg9MAezhKQsONFk3vTWCaxDbnMwoGNxL8G6BU8RfnOW2ZGSqhXYe/OAHhdh8 4iqGWk96uvx9cx324w1oaNde9RPk4CojotCW0L3DIffdADkP90leRf2us6lCUPnT3sX8n LZgaDEdLiE0P9b0w1Wj9Cyepjr0ClqhaZkR5zMB+AMPHuJfJUTb3hzY5vVrf0/DtErt9H LIHHZWll3/5gN6RvE2vrC17lQtCwxBasIgBPTXgOqEcpAOaZAsjZhNOMoaJpGb+BdeYvS SfS9Dd4TXXsvb84sJUsf6wkKmAa+17oWE8Gs5FZW2IxS9i3auq35A/dcF0XlTPbUF/A== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796115330; h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID: In-Reply-To:References:X-sashiko-severity:Content-Type: Content-Transfer-Encoding:MIME-Version; bh=ntdDu58cNNjJ/FgBjzDa2PEF537n5XCu1Rv7NVNW3rQ=; b=l2xnuHyNB2NZVVUH/Wm3HMAY+esj6pCzBzqpPrBHmp7YF5mluUDHKoMgrmCpqiamcgha TJ/aQfZlfrLv3wqi/PrKiVp43/jnUsrLrcULVVTyicn5jobTXj13pDJ4Tx6URDiZma2bT rxx9c6MMSMsRcuiQ4H1WrRHtRu9n5RmPESc/KT7jlZEomTfRgCjoudvl572uHpHQRI1yU 4tYQE5F2XIjIRJA+fKmzsKpu1psDnDp7U7kBaDfHOZxlqn8ikmSUL+T2lDaop+7wUUqcp Z424wqwc0oAQBh/DULSp5NFfRT66M97JXsAfDvPDL3jdPN2RjFNeIKOx3p80A5WHqdg== X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=dCO3sggA; arc=none smtp.remote-ip=100.103.45.18 X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1F9E2606A31A for <netdev@vger.kernel.org>; Tue, 1 Dec 2026 08:55:29 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id AC85F1F000C1; Tue, 1 Dec 2026 08:55:28 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796115329; bh=ntdDu58cNNjJ/FgBjzDa2PEF537n5XCu1Rv7NVNW3rQ=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=dCO3sggAaVh8PJznJWfBjQHWLvKJEtEsX1DGR8O6z3P6zDSf/Qe7Ro2n9LXjsr6W3 pWNOyYjgj0fV3ZBRHHOSqReahmSKzr3FNUdpzJUi+SjXJY8FLeYk75JFcBoqWPRpxy FQgnac2bu5/jC+Q1Q8QA2S3Co3P/SDt1wGedebcBfPjXfnZS06r60foDU4P5xKIgge eBNz8sri/TdDtSLFgU+AmSa7XJFVuNaRTavB/1r8alF4XyC0jhoZSo1JI1w522hnCm 5UId8WTUtFWDkxTh276vUw/rsWluihwm//1DZkamM8hPuCqKH9KRcfMgyb7l+U2oIT r+TPhwS17ONUw== X-Cc: netdev@vger.kernel.org, j-rameshbabu@ti.com, andrew+netdev@lunn.ch, danishanwar@ti.com, d-qiu@ti.com, davem@davemloft.net, fmaurer@redhat.com, kuba@kernel.org, neelima@ti.com, pabeni@redhat.com, praneeth@ti.com, pratheesh@ti.com, richardcochran@gmail.com, horms@kernel.org, vigneshr@ti.com, willemdebruijn.kernel@gmail.com, daniel.machon@microchip.com, edumazet@kernel.org X-In-Reply-To: <20261130-hsr_ptp-v13-4-598326208fc5@linutronix.de> X-sashiko-severity: Low X-Mailing-List: netdev@vger.kernel.org X-List-Post: <mailto:netdev@vger.kernel.org> X-List-Help: <mailto:netdev+help@vger.kernel.org> X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org> X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org> X-List-Owner: <mailto:netdev+owner@vger.kernel.org> X-Precedence: list