Article View: linux.kernel.netdev
Article #22564[PATCH net-next v12 6/8] hsr: Assign a socket for cloned skbs
From: Sebastian Andrzej Siewior
Date: Wed, 25 Nov 2026 14:31
Date: Wed, 25 Nov 2026 14:31
58 lines
11652 bytes
11652 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:
<20261125-hsr_ptp-v12-6-9ddd2a73cb90@linutronix.de>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-371403-linux-kernel-netdev=dewy.ruReferences:
<20261125-hsr_ptp-v12-0-9ddd2a73cb90@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-371403-linux-kernel-netdev=dewy.ru From: bigeasy@linutronix.de (Sebastian Andrzej Siewior) Newsgroups: linux.kernel.netdev Subject: [PATCH net-next v12 6/8] hsr: Assign a socket for cloned skbs Date: Wed, 25 Nov 2026 15:31:49 +0100 Organization: Usenet Network Message-ID: <20261125-hsr_ptp-v12-6-9ddd2a73cb90@linutronix.de> References: <20261125-hsr_ptp-v12-0-9ddd2a73cb90@linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Injection-Info: usenet.network; logging-data="229402"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:OtPj2HJ18fBbSO5PZR79o4ybNNA= sha256:3l79CtG/lRM4K6PqAzS/OhCBoEn732ZmGBXk4NWuGb0= sha1:9d0yaGbRnTcN/bQZljqDBzQQ4pg= sha256:E5aEvOxhI2YfkQTEt/xzVHsF0nvRbQScgzH3WM5L5oc= 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 41E71125E72; Wed, 25 Nov 2026 17:33:53 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.15 X-Spam-Status: No, score=-3.15 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, URIBL_BLOCKED=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=1377YgjL; dkim=neutral reason="invalid (unsupported algorithm ed25519-sha256)" header.d=linutronix.de header.b=iZlcU8jv 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 HMMGqDnL6lKl; Wed, 25 Nov 2026 17:33:50 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-371403-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 tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114]) by mail.dewy.ru (Postfix) with ESMTPS id 657E9125E6B; Wed, 25 Nov 2026 17:33:37 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by tor.lore.kernel.org (Postfix) with ESMTP id 4C9A23E552; Wed, 25 Nov 2026 14:32:58 +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=1795617171; b=YAUxI+icmeb63F2efesjpO8RL2aY+mXCYfVJVr5YCH7TmAyfib8cXW4PzUyqcAKw/lza AAYLtCJ690/olJ+FV34P39lS+MpH+jEKb+0K4P8QafnLERON23tEhPWOCSD3+q19nQJcl 4O8DZXKe6JOcMQJI7fy4tkhzV35IeDQ8Tww0TcqoBvPFbQvOYBeg8d+jvnT3a674PQCgX HqfSOWNNohDZzV/mFunNxffd20qAhVSgf35t/giefpLwl8sljpY4diiwP+MShRrJPS+pt /gqVKbe9eJn+GqiUYtPckfU+xA2saFMN0hibY7+rbIS1ZDSygk/HaikNev+IBIlpaTw== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795617171; 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=NPfQLEmkSZgocIYSafVGM1DjwjfDVbJdOtPRQkuF1LXtOjnziv7b1VPUtrWHEFdeknuv IAfqHXQSDR+XwLJ1cOY0O9MWOlQQbHKslsSZlKxx8z5lkhK4YSYjun6VrTw2EzKNB80Kb QAwBrvgBKl4CLnYla0BxMZ1SwPgA/FMwqKH6/K8Xm/tTEFS3kJhOyBGhW16IDZQRA6xEq 3Whokg5kUdAhjbAQjUkGYL1fNh17Pib8WYU7b8ns5bL8/L4nzeDsQ664u8XVqpA5/MBA+ oKJr78K3jsQYKF8QLAsqjA5FUTtLUbZxQY9gKGHHxIe2XitwFScKEMaGGUouGj+miXw== 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=1377YgjL; dkim=pass header.d=linutronix.de header.i=@linutronix.de header.a=ed25519-sha256 header.s=2020e header.b=iZlcU8jv; 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 CBA60606A683; Wed, 25 Nov 2026 14:32:51 +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=1377YgjL; dkim=pass header.d=linutronix.de header.i=@linutronix.de header.a=ed25519-sha256 header.s=2020e header.b=iZlcU8jv 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=1795617171; b=vOZL8w3mVb1LVXVaalpcRCOSRnDV5vVjEnoEEdPmXEKv1i4gsGFhs3kKIhzOwrO+9Mjw n3Rqub7tyKtdXZOFuJGH8eMGYk8NavF5a7ves++Foo4h4CJ3TV0Q7vX8DWnH2YUf7Bk6M prXOQBJPkeVUHYlGaJB/NDAbdXg/UowZLfnrRo3VpCu5CIp5kn0Ynv1NzBi3Ntcuf1c91 qESlv8S1A3Uef2Nzj3CDXB67KXGUvsm9XcHJ7JQ5qnjAB0Hf3xN004Mz9/+qEoxS64Sgt iX2+xUKhOeSATFR8OpWDuNKxaNXLmXWtmwDsQco+uJrYNWNxyfYy0IvTCuCEEl338mg== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795617171; 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=I9WRJJ4eC6GXvFoBa7Kmnuh8Y6bKtxpRqiT4z9kWyw1VXQPu3kDcCzyfhirnN4ilwfuo JBipN46z/paM0DbZeR+AfQso2W6Q2HMRTiTSXC3oVFCaWaD4rWWLs+ivSskRpmrIcvMfF YZNOPb2N2AcZ1J6Wzjhb1L33DL3tI1slIS5FmN4UcaSJjRtIaXKX3JgJ64z5oOtObVJ5A c/SMeiTdrjhh6jSq2YHB1MQKoe7EZGc+438xvwHfMntByGb+KwjNupt1UtUfiR9B4XG1U 4t8W9+QK/EjRy4/YYOhfPLVZMDMTU6lAyNaFX1D6Cmib/YeWchRtNuj6/FIKNqzezXQ== 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=1377YgjL; dkim=pass header.d=linutronix.de header.i=@linutronix.de header.a=ed25519-sha256 header.s=2020e header.b=iZlcU8jv; 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 7EF82606A337 for <netdev@vger.kernel.org>; Wed, 25 Nov 2026 14:32:50 +0000 (UTC) X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 7EF82606A337 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=1795617168; 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=1377YgjLQSv3v66JKhTkp4HTkaCIl4QAoRTzZ91pSL5ZpOQAMokqfmOcJPRy2w6lg2EDTA 5hoggxibKSe8XM6SnT3DZs14sj5TO9tqYLayCNk6Rn4SRoORaxKX6L9V1IKJjbmIByW3jo YAtZcgT5ang6cm6axSYPbIahkA48e34GoVZ6a89l4db2LuIVSyPcrQfP4byzwC/WTPRGY/ gze5bPQ4+NPPPI0A+IGzcVc5WBLxw4nwXK1b2Y88xpgTsKRDKfiL+xprqBSwxXxxuy14vz zQVmm0R5K8Fyw8qYFFCdueeP0zReqqDAFtGypok4eYQLONPEqAqrEGPMRrHwWg== X-DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1795617168; 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=iZlcU8jv1SZTSInfYa6Afj4bsOVHeTrC/t7MQMXweVYPtPgLe9w/N7n1ciiA3AbcMpCSWH w5B+vrSpygydQECg== 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: <20261125-hsr_ptp-v12-0-9ddd2a73cb90@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