From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
To: netdev-bot+sashiko@kernel.org
Cc: netdev@vger.kernel.org, j-rameshbabu@ti.com,
andrew+netdev@lunn.ch, c-vankar@ti.com, danishanwar@ti.com,
d-qiu@ti.com, davem@davemloft.net, edumazet@google.com,
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
Subject: Re: [PATCH net-next v8 2/8] hsr: Use skb_clone() while adding the HSR header
Date: Mon, 12 Oct 2026 18:00:05 +0200 [thread overview]
Message-ID: <20261012160005.3Lcx_XLP@linutronix.de> (raw)
In-Reply-To: <179129707396.434549.16689509180703800541@kernel.org>
On 2026-10-06 14:31:13 [+0000], netdev-bot+sashiko@kernel.org wrote:
> [Severity: Low]
> Each per-slave skb now keeps SKBTX_HW_TSTAMP, SKBTX_SW_TSTAMP,
> SKBTX_SCHED_TSTAMP and tskey in its shinfo. However, __skb_clone() leaves
> it without an owning socket:
…
> Will a slave driver with hardware timestamping enabled now take a TX
> timestamp for this clone, only for __skb_tstamp_tx() to discard it?
Yes. There is a patch later in this series where a socket is assigned.
…
> Before this patch, __pskb_copy() did not carry these flags over on the
> software path, so the slaves never saw these requests. Some NICs have only
> a single in-flight TX timestamp slot. On those, a concurrent PTP request on
> the same slave might be skipped.
>
> The later patch "hsr: Assign a socket for cloned skbs" calls
> skb_set_owner_w() only when frame->req_tx_port != HSR_PT_NONE. Ordinary
> traffic sent over hsr0 by a socket with SOF_TIMESTAMPING_TX_HARDWARE would
> still reach this through:
>
> hsr_dev_xmit()->hsr_forward_do()->hsr_create_tagged_frame()->
> hsr_xmit()->dev_queue_xmit()
>
> The NETIF_F_HW_HSR_TAG_INS path already sent sk-less clones like this
> before the patch. Should the timestamp request flags be cleared on clones
> that have no socket attached?
No. If there is no socket, it gets dropped. If there the HW is capable
of concurrent PTP request then the user shouldn't ask for them. We
didn't have PTP timestamps before.
> > if (!skb)
> > return NULL;
> > - skb_reset_mac_header(skb);
> >
> > - if (skb->ip_summed == CHECKSUM_PARTIAL)
> > - skb->csum_start += HSR_HLEN;
> > + if (port->dev->features & NETIF_F_HW_HSR_TAG_INS)
> > + return skb;
> > +
> > + /* Ensure the cloned skb has enough headroom to fit the HSR tag */
> > + if (skb_cow_head(skb, HSR_HLEN))
> > + goto err;
> >
> > movelen = ETH_HLEN;
> > if (frame->is_vlan)
> > movelen += VLAN_HLEN;
> >
> > + /* The entire header area needs to be linear */
> > + if (!pskb_may_pull(skb, movelen))
> > + goto err;
> > +
> > src = skb_mac_header(skb);
> > dst = skb_push(skb, HSR_HLEN);
> > memmove(dst, src, movelen);
>
> [Severity: Medium]
> Can skb_shared_info.meta_len end up describing the wrong bytes here?
>
> skb_clone() shares the shinfo of frame->skb_std. pskb_expand_head() then
> copies both the shinfo and the head contents, so the XDP metadata length is
> kept. __pskb_copy() used a fresh shinfo, so meta_len used to be 0 on this
> path.
>
> skb_metadata_end() returns skb_mac_header(). This code pushes HSR_HLEN,
> moves only the ETH(+VLAN) header 6 bytes earlier and resets mac_header. As
> a result, the range [mac - meta_len, mac) begins with 6 bytes that are not
> metadata, followed by only the first meta_len - 6 bytes of the original
> metadata. The memmove() also overwrites the last 6 bytes of the original
> metadata with the start of the Ethernet header.
>
…
> Should this use skb_postpush_data_move(), or clear the metadata with
> skb_metadata_clear() after the clone?
puh. This is the only thing I found that could be improved. It looks
like the memmove() could be replace with
skb_postpush_data_move(skb, HSR_HLEN, movelen);
should I re-spin the whole series or send a follow-up for this change?
> > + skb_set_network_header(skb, HSR_HLEN + movelen);
> > skb_reset_mac_header(skb);
> > + skb_reset_mac_len(skb);
>
> [Severity: Low]
> The commit message only covers preserving skb_shared_info for timestamps:
>
> hsr_create_tagged_frame() creates a new skb where the HSR header can be
> prepended via __pskb_copy(). This does not copy the skb_shared_info part
> of the original skb so any timestamp request is lost.
>
> Could the changelog also mention the header layout changes made here?
>
> With the old code, __pskb_copy() only ran skb_copy_header(), so the
> head-relative offsets were copied unchanged into a buffer with HSR_HLEN
> more headroom. Only mac_header and csum_start were fixed up afterwards.
> That left network_header pointing at the HSR tag, transport_header
> HSR_HLEN bytes too early, and mac_len at 14 (18 with VLAN).
>
> With this patch:
>
> - skb_cow_head()->pskb_expand_head()->skb_headers_offset_update() moves
> all offsets, which replaces the manual csum_start adjustment.
> - network_header now points past the HSR tag.
> - mac_len becomes 20 (24 with VLAN).
> - A new pskb_may_pull() drop path is added.
>
> So the patch fixes the transport_header offset and changes what
> network_header and mac_len mean for these frames. Neither change is
> described in the changelog.
This sounds like a fix? I just followed the API and it is a side effect.
Sebastian
next prev parent reply other threads:[~2026-10-12 16:00 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-02 13:01 [PATCH net-next v8 0/8] hsr: Add additional info to send/ receive skbs Sebastian Andrzej Siewior
2026-10-02 13:01 ` [PATCH net-next v8 1/8] hsr: Add header_ops::parse_protocol Sebastian Andrzej Siewior
2026-10-06 14:31 ` netdev-bot+sashiko
2026-10-12 13:13 ` Sebastian Andrzej Siewior
2026-10-02 13:01 ` [PATCH net-next v8 2/8] hsr: Use skb_clone() while adding the HSR header Sebastian Andrzej Siewior
2026-10-06 14:31 ` netdev-bot+sashiko
2026-10-12 16:00 ` Sebastian Andrzej Siewior [this message]
2026-10-02 13:01 ` [PATCH net-next v8 3/8] hsr: Add a magic header for sending PTP packets Sebastian Andrzej Siewior
2026-10-06 14:31 ` netdev-bot+sashiko
2026-10-12 14:40 ` Sebastian Andrzej Siewior
2026-10-02 13:01 ` [PATCH net-next v8 4/8] hsr: Drop received " Sebastian Andrzej Siewior
2026-10-06 14:31 ` netdev-bot+sashiko
2026-10-12 14:49 ` Sebastian Andrzej Siewior
2026-10-02 13:01 ` [PATCH net-next v8 5/8] hsr: Use the port and header information in hsr_forward_skb() Sebastian Andrzej Siewior
2026-10-06 14:31 ` netdev-bot+sashiko
2026-10-12 15:03 ` Sebastian Andrzej Siewior
2026-10-02 13:01 ` [PATCH net-next v8 6/8] hsr: Assign a socket for cloned skbs Sebastian Andrzej Siewior
2026-10-06 14:31 ` netdev-bot+sashiko
2026-10-12 15:33 ` Sebastian Andrzej Siewior
2026-10-02 13:01 ` [PATCH net-next v8 7/8] hsr: Move struct hsr_ethhdr to a global header Sebastian Andrzej Siewior
2026-10-02 13:01 ` [PATCH net-next v8 8/8] selftests: hsr: Add test for the inline PTP header on HSR Sebastian Andrzej Siewior
2026-10-06 14:31 ` netdev-bot+sashiko
2026-10-12 15:56 ` Sebastian Andrzej Siewior
2026-10-05 12:16 ` [PATCH net-next v8 0/8] hsr: Add additional info to send/ receive skbs Daniel Machon
2026-10-12 12:52 ` Sebastian Andrzej Siewior
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261012160005.3Lcx_XLP@linutronix.de \
--to=bigeasy@linutronix.de \
--cc=andrew+netdev@lunn.ch \
--cc=c-vankar@ti.com \
--cc=d-qiu@ti.com \
--cc=danishanwar@ti.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=fmaurer@redhat.com \
--cc=horms@kernel.org \
--cc=j-rameshbabu@ti.com \
--cc=kuba@kernel.org \
--cc=neelima@ti.com \
--cc=netdev-bot+sashiko@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=praneeth@ti.com \
--cc=pratheesh@ti.com \
--cc=richardcochran@gmail.com \
--cc=vigneshr@ti.com \
--cc=willemdebruijn.kernel@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox