Subject: Re: [PATCH RFC net-next 1/2] hsr: Allow to send a specific port and with HSR header

From: Willem de Bruijn <[email-masked]>
Date: Wed, 04 Feb 2026 12:30:47 -0500

Sebastian Andrzej Siewior wrote:
> HSR forwards all packets it received on slave port A to slave port B and
> one of the possible two copies to the user (master) interface.
> In terms of PTP this is not good because the latency introduced by
> forwarding makes the timestamp in the PTP packet inaccurate.
> 
> Introduce a hsr_ptp field to struct skb_shared_info which can be used to
> store HSR specific information for sending and receiving skbs.
> 
> Receive (slave ports):
> - HSR_PT_SLAVE_A/ HSR_PT_SLAVE_B to denote the port which received the
>   packet. This information is only added to PTP packets.
> 
> Send (master port):
> - HSR_PT_SLAVE_A/ HSR_PT_SLAVE_B to denote the port on which the packet
>   has to be sent.
> - HSR_SKB_INCLUDES_HEADER to denote that the packet already contains a
>   HSR header and the stack must not add the system's header to it.
> 
> HSR_SKB_INCLUDES_HEADER is used to allow forwarding a PTP packet and
> preserving the HSR header by the sender.
> Cloning skbs requires to preserve the socket information so that a PTP
> timestamp can be associated with the socket.
> 
> Signed-off-by: Sebastian Andrzej Siewior <[email-masked]>
> ---
>  include/linux/if_hsr.h |   2 +
>  include/linux/skbuff.h |   1 +
>  net/hsr/hsr_device.c   |   7 +++
>  net/hsr/hsr_forward.c  | 114 ++++++++++++++++++++++++++++++++++++++++++++++---
>  net/hsr/hsr_slave.c    |  16 +++++++
>  5 files changed, 133 insertions(+), 7 deletions(-)
> 
> diff --git a/include/linux/if_hsr.h b/include/linux/if_hsr.h
> index f4cf2dd36d193..1463ddbc8cddf 100644
> --- a/include/linux/if_hsr.h
> +++ b/include/linux/if_hsr.h
> @@ -22,6 +22,8 @@ enum hsr_port_type {
>  	HSR_PT_PORTS,	/* This must be the last item in the enum */
>  };
>  
> +#define HSR_SKB_INCLUDES_HEADER		(1 << 4)
> +
>  /* HSR Tag.
>   * As defined in IEC-62439-3:2010, the HSR tag is really { ethertype = 0x88FB,
>   * path, LSDU_size, sequence Nr }. But we let eth_header() create { h_dest,
> diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
> index 86737076101d4..52c847e490ee8 100644
> --- a/include/linux/skbuff.h
> +++ b/include/linux/skbuff.h
> @@ -605,6 +605,7 @@ struct skb_shared_info {
>  	};
>  	unsigned int	gso_type;
>  	u32		tskey;
> +	u32		hsr_ptp;

skb_shared_info cannot easily be expanded.

This is too specific a use-case to warrant fields in every packet.

I'm not super familiar with High-availability Seamless Redundancy
(HSR). Perhaps you can use either an skb_extension. Or the skb->cb[]
field if this data is only needed within the HSR protocol logic, so
can be assured to not be overwritten by other users of the control
block.