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] The commit message is broader than the code.
--
hsr: Assign a socket for cloned skbs
skb_clone() clears skb->sk, and the original skb is freed in
hsr_forward_skb(), so a TX timestamp requested by the sender is lost.
This patch gives the clones created in hsr_create_tagged_frame() and
in the has_hsr_header branch of hsr_forward_do() the socket of the
original skb, by calling skb_set_owner_w(). That lets skb_tstamp_tx()
pass the timestamp back to user space.
> hsr: Assign a socket for cloned skbs
[ ... ]
> Assign the socket of the original skb to the clone so the timestamp is
> forwarded to the user.
> 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
[ ... ]
> @@ -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);
> +
[Severity: Low]
This isn't a bug, but the commit message reads more broadly than the
code. Should it say which frames are covered?
The subject and the line "Assign the socket of the original skb to the
clone so the timestamp is forwarded to the user" suggest that every HSR
TX clone gets the sender's socket. Here, though, skb_set_owner_w() only
runs when frame->req_tx_port != HSR_PT_NONE.
req_tx_port (and has_hsr_header, which gates the second hunk below) is
only set from the inline header, in hsr_dev_xmit():
net/hsr/hsr_device.c:hsr_dev_xmit() {
...
if (skb->protocol == htons(ETH_P_1588) &&
hsr_ptp_parse_header(skb, &has_hsr_header, &req_tx_port))
goto drop;
...
}
Every other frame sent through the HSR master is duplicated to both
slaves with req_tx_port == HSR_PT_NONE. That includes ordinary frames
from a socket with SO_TIMESTAMPING. For those frames the clones still
have no socket, so the timestamp is still dropped.
Skipping the duplicated case is probably intentional, for example to
avoid two timestamps and charging sk_wmem_alloc twice for the two
clones. Could the commit message, or a comment on this check, say that
only the single-port, inline-header PTP path is handled, and why?
> 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;
> }
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/2026…%40linutronix.de