Re: [PATCH net-next v9 2/8] hsr: Use skb_clone() while adding the HSR header
flat view
From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Date: 2026-10-19 13:33:51
On 2026-10-16 11:41:20 [+0200], To Daniel Machon wrote:
If this is important, I could add to the patch description. The removed skb_reset_mac_header() should be obvious. The csum_start() removal and so on was mostly sashiko complaining about one thing at at time and memove() got replaced with skb_postpush_data_move() in the last iteration which I just learned about myself ;) That looks like a nice clean up.
Updated as: | 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. | | An alternative is to use skb_clone() where the skb_shared_info part is | shared and then skb_cow_head() to make the header part writeable. This | avoids touching manually the tx_flags and tskey members. | Using skb_clone() allows also return early (after the clone) in the | offloaded case so this can be unified a bit. | The clone case does not need manual adjustment of sk_buff::csum_start | because by using skb_cow_head() the head does not move relative to the | payload. Should the head need expansion then pskb_expand_head() will | move it and update sk_buff::csum_start accordingly. The clone also | preserves metadata (if available) so skb_postpush_data_move() is used | instead of memmove() to move both. Finally skb_reset_mac_len() is added | to set the new length of the header after expansion. | | This is a preparation for PTP handling where timestamps are requested. Is this better?
quoted
/Daniel
Sebastian