🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #19745

[PATCH net-next v11 6/8] hsr: Assign a socket for cloned skbs

#19745
From: Sebastian Andrzej Siewior
Date: Fri, 20 Nov 2026 10:17
58 lines
11660 bytes
The cloned skb does not have the socket recorded of the original skb
because skb_clone() clears sk_buff::sk. The original skb is never
submitted but freed in hsr_forward_skb(). skb_tstamp_tx() will only
submit timestamp information to the sender if the socket is recorded and
the TS flags are available.

As of the recent changes everything is available except the socket and
the requested timestamp gets lost.

This does not consider PRP part of the stack. The specification says
that PTP-PRP packets do not have the RCT therefore these packets can be
sent directly from userland skipping the stack.

Assign the socket of the original skb to the clone so the timestamp is
forwarded to the user.

Reviewed-by: Daniel Machon <daniel.machon@microchip.com>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
 net/hsr/hsr_forward.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/net/hsr/hsr_forward.c b/net/hsr/hsr_forward.c
index 1d1d75ed8cd06..9cb3297a8640a 100644
--- a/net/hsr/hsr_forward.c
+++ b/net/hsr/hsr_forward.c
@@ -12,6 +12,7 @@
 #include <linux/skbuff.h>
 #include <linux/etherdevice.h>
 #include <linux/if_vlan.h>
+#include <net/sock.h>
 #include "hsr_main.h"
 #include "hsr_framereg.h"
 
@@ -347,6 +348,9 @@ struct sk_buff *hsr_create_tagged_frame(struct hsr_frame_info *frame,
 	if (!skb)
 		return NULL;
 
+	if (frame->req_tx_port != HSR_PT_NONE && frame->skb_std->sk)
+		skb_set_owner_w(skb, frame->skb_std->sk);
+
 	if (port->dev->features & NETIF_F_HW_HSR_TAG_INS)
 		return skb;
 
@@ -582,6 +586,8 @@ static void hsr_forward_do(struct hsr_frame_info *frame)
 		 */
 		if (frame->has_hsr_header && frame->skb_std) {
 			skb = skb_clone(frame->skb_std, GFP_ATOMIC);
+			if (skb && frame->skb_std->sk)
+				skb_set_owner_w(skb, frame->skb_std->sk);
 			goto inject_into_stack;
 		}
 

-- 
2.55.0
Technical Details
Message-ID: <20261120-hsr_ptp-v11-6-264c88f4f1d0@linutronix.de>
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-367850-linux-kernel-netdev=dewy.ru
References: <20261120-hsr_ptp-v11-0-264c88f4f1d0@linutronix.de>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-367850-linux-kernel-netdev=dewy.ru
From: bigeasy@linutronix.de (Sebastian Andrzej Siewior)
Newsgroups: linux.kernel.netdev
Subject: [PATCH net-next v11 6/8] hsr: Assign a socket for cloned skbs
Date: Fri, 20 Nov 2026 11:17:02 +0100
Organization: Usenet Network
Message-ID: <20261120-hsr_ptp-v11-6-264c88f4f1d0@linutronix.de>
References: <20261120-hsr_ptp-v11-0-264c88f4f1d0@linutronix.de>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: quoted-printable
Injection-Info: usenet.network;
	logging-data="3131262"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:BwiI5utP3iRTY9fcn6EtCSER74g= sha256:5vQxQAdRo2PUQtlbHqMMUP127V34z9Q+zJRudcSQbI4=
	sha1:4M/3jg+3ey/iikWXAI725e/0xPo= sha256:gGlrSN/NllALjxASOjI6iR/fukHlfpMgcvPIe97Ain8=
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 A6BE1115946; Fri, 20 Nov 2026 13:17:40 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.151
X-Spam-Status: No, score=-3.151 tagged_above=-9999 required=6.31
	tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,
	HEADER_FROM_DIFFERENT_DOMAINS=0.249, 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=linutronix.de header.b=DRE+CP5F; dkim=neutral
	reason="invalid (unsupported algorithm ed25519-sha256)"
	header.d=linutronix.de header.b=NpDNIrVq
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 FYI44xqXoe72;
	Fri, 20 Nov 2026 13:17:37 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.232.135.74; helo=sto.lore.kernel.org; envelope-from=netdev+bounces-367850-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=linutronix.de
X-Received: from sto.lore.kernel.org (sto.lore.kernel.org [172.232.135.74])
	by mail.dewy.ru (Postfix) with ESMTPS id AF99E115948; Fri, 20 Nov 2026 13:17:24 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sto.lore.kernel.org (Postfix) with ESMTP id EF177624776; Fri, 20 Nov 2026 10:17:23 +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=1795169834;
	b=UiGB2BbKJ0L48Z6TZnxpfzFTKYxkLV6VW62pSndtTQDnZTyPiLAMuw0cX5YIWxdfufql
	 mqT5tDDceynGua4nKuQNDMYRdh8QGuyOOAk7lHOhJXpHnVy7/eONqghkoDHuodTfY5JQT
	 iAa5yNOA+lbzhXgVdRjRcJTjL+uqiRxZgqOsxeZ3EBgbxaRuWJStVmdiObE8dwnZvZQw/
	 PVatw7qpO42iG4BZ4rwkCHA5fiIdD8oWDc3iEONe64G8kKB39frZuCZ1XuogmgElpw8tC
	 fQlU48mMhWGtDxXMC95XS6upkKceWXb/uU+6aE6TAxSh/CWnnKP69IcYHgNbxfhCczQ==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795169834;
	h=X-Original-To:Received:DMARC-Filter:From:DKIM-Signature:
	 DKIM-Signature:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:
	 X-Mailing-List:List-Id:List-Post:List-Help:List-Subscribe:
	 List-Unsubscribe:List-Owner:Precedence:MIME-Version:Content-Type:
	 Content-Transfer-Encoding;
	bh=FwpG6VmvKDfDxRWSRFyRgDQSZNtSM0ZoDrxOLJ+NYuM=;
	b=NmiczGiYD+vxAIxnqWxUg31cyHxmkS1fKnMRBXJgnmdm3bqO3P3RuIfR07P5Q2JouyCv
	 RtpLV8OtXmSFhyUWQl6KFdGvXIP3uuKv2NiYW5M5QyUx/hu7NNwS+Mn5/SjV56oLWpf3R
	 LRfMQoA+Wk5G4ZRPUy+iPHyn5OmSLG3/NDFmkTDQFdZf7r6+UW/LB4W/t/LQ3+DsX8rQD
	 mGTnMZsumGEigRwr4bDm5bdwh8TYSITImxg2YPCKEnLlsowYVG9c5OaAJ+u3m2t7wPsCP
	 ZYMwfSSfW+ytyWxsCq+zSaIT34uiuhMO7SWuSOXewTQUJyPZgAS14vDpoGHcf63ELGg==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=linutronix.de header.i=@linutronix.de header.a=rsa-sha256 header.s=2020 header.b=DRE+CP5F;
	dkim=pass header.d=linutronix.de header.i=@linutronix.de header.a=ed25519-sha256 header.s=2020e header.b=NpDNIrVq;
	dmarc=pass header.from=linutronix.de;
	spf=pass smtp.mailfrom=linutronix.de;
	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 6B0FA60A262A;
	Fri, 20 Nov 2026 10:17:14 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.a=rsa-sha256 header.s=2020 header.b=DRE+CP5F;
	dkim=pass header.d=linutronix.de header.i=@linutronix.de header.a=ed25519-sha256 header.s=2020e header.b=NpDNIrVq
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=193.142.43.55
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1795169833;
	b=R86RhuCU/cKPZsm7INohEkph5AVb1OJ0Bs9Uis9oX1293QN8DXOlPzTodO903i/2HPJW
	 7VlJs2vgZFv871zZepjeETlx6kxCat/KcRNSWu+viPVzGC2/EKcUttzUSSzuqaT0swhEB
	 7kdZiG8qf4x8/ixFaMePiE+NU3Cwb46sENpWXsBIIVQP3l6VQLgOMq2GZj+EloHtkDADW
	 8K9Kf/oCWN3yuvO4I5uW6pmOmv1dar5jkzk9CxhdO+5Rggt5KOfgBkquGEEHO8HIUZsRB
	 Ip53rDn/8NCyqw7ugVansZQ3GizwdVCLO7vx5tf2r7gjLE8ERGt2Zjpsf5Hktetv8rQ==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795169833;
	h=DMARC-Filter:From:DKIM-Signature:DKIM-Signature:To:Cc:Subject:Date:
	 Message-ID:In-Reply-To:References:MIME-Version:Content-Type:
	 Content-Transfer-Encoding;
	bh=FwpG6VmvKDfDxRWSRFyRgDQSZNtSM0ZoDrxOLJ+NYuM=;
	b=MgStLKYMwedMucpNS/Nb51bIWFzbxU9eqONrm886hcPXEccvB8cYuMU00B8jojd+LnI6
	 WDXfgBzjOvLjHpWmgz1NVdyfpu9zHF4hpzO8gypOFs+SzWIRDeQzEAceJlwTsjeRGND1x
	 /0U6KiIX1mJEbgGEQvSk5N/vAkZHzThBNdAshUyC++m569Y5ENA6gvpvLu13otsbSgW4T
	 xPlNito6McW9Ln3oX0zJGzRqHYM6Ly8SMxeLDdh2EtrftiGZW/QuZ5MTEbmafK5FIRdla
	 A2GdjPXf5IaV0bUqzlQjdL333ouJATLCbodS4TbF8kzLVwAUx1xKdBtjWIGFDZxGJJQ==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dmarc=pass header.from=linutronix.de;
	spf=pass smtp.mailfrom=linutronix.de;
	dkim=pass header.d=linutronix.de header.i=@linutronix.de header.a=rsa-sha256 header.s=2020 header.b=DRE+CP5F;
	dkim=pass header.d=linutronix.de header.i=@linutronix.de header.a=ed25519-sha256 header.s=2020e header.b=NpDNIrVq;
	arc=none smtp.remote-ip=193.142.43.55
X-Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256)
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id 23B6560A260E
	for <netdev@vger.kernel.org>; Fri, 20 Nov 2026 10:17:12 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 23B6560A260E
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de;
	s=2020; t=1795169831;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding:
	 in-reply-to:in-reply-to:references:references;
	bh=FwpG6VmvKDfDxRWSRFyRgDQSZNtSM0ZoDrxOLJ+NYuM=;
	b=DRE+CP5FdMNZdpyukmWj15D2z3rtH1gVNn8fVtXj7Gx5GyRUyWjNgbQi1xjM7o7N/LW57S
	mK6kUPXqSHaHMrPB+zX9DLv1x7YCdMx0OdAwMEzQ7QQunGZnA3MkjQ1kd4P56G0BKaZUtS
	d0wr5q7d/UM41YCuifhd6aeDR910tbF2pLze+XLG1Q9vJAnJWaIjrfGlx/ekKcCCWL3XKa
	tl3xpdaYK3eKvKkifqs8EPhG53vh3Abw/olQOmEJPF0tcmydCrDL2mQVQW0ChsJ5kdE+wL
	6tsGf8KwBvR0zMy8alaDsi0MMtZkah4JctOFCI+l5OQWhgzF66S1ESKvoLX6hQ==
X-DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de;
	s=2020e; t=1795169831;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding:
	 in-reply-to:in-reply-to:references:references;
	bh=FwpG6VmvKDfDxRWSRFyRgDQSZNtSM0ZoDrxOLJ+NYuM=;
	b=NpDNIrVqIVOT7Y4kWdaeLDF9U4qtp5e9KKKXS5M7xP2ON2SgiE15VLD4LQcVI/cY4a2n/6
	+aLKBdft759Bz9DA==
X-Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
	"(JC), Jayachandran" <j-rameshbabu@ti.com>,
	Andrew Lunn <andrew+netdev@lunn.ch>,
	Danish Anwar <danishanwar@ti.com>,
	Daolin Qiu <d-qiu@ti.com>,
	"David S. Miller" <davem@davemloft.net>,
	Felix Maurer <fmaurer@redhat.com>,
	Jakub Kicinski <kuba@kernel.org>,
	Neelima Muralidharan <neelima@ti.com>,
	Paolo Abeni <pabeni@redhat.com>,
	Praneeth Bajjuri <praneeth@ti.com>,
	Pratheesh Gangadhar TK <pratheesh@ti.com>,
	Richard Cochran <richardcochran@gmail.com>,
	Simon Horman <horms@kernel.org>,
	Vignesh Raghavendra <vigneshr@ti.com>,
	Willem de Bruijn <willemdebruijn.kernel@gmail.com>,
	Daniel Machon <daniel.machon@microchip.com>,
	Eric Dumazet <edumazet@kernel.org>
X-In-Reply-To: <20261120-hsr_ptp-v11-0-264c88f4f1d0@linutronix.de>
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