On Tue, 2019-01-01 at 09:53 -0800, David Miller wrote:
> From: Radu Rendec <radu.ren...@gmail.com
> Date: Sat, 29 Dec 2018 13:26:34 -0500
> 
> > I'm working on some application-specific NIC driver. On the TX path, it
> > must remove a custom tag that sits between the Ethernet type field and
> > the actual Ethernet payload; then it must add a different tag in front
> > of the Ethernet header (the MAC DA field) before it hands over the frame
> > to the hardware for delivery.
> 
> > I'm wondering if skb_cow_head() is enough to safely modify the skb as
> > described above, or I should use skb_cow() instead.
> 
> skb_cow_head() should be sufficient.  This is what the DSA layer tagging
> code uses, and it is doing something similar if not exactly like what you
> are doing.
> 
> See net/dsa/tag_dsa.c:dsa_xmit().

David, thank you - this is very helpful! Indeed, my use case is very
similar to DSA, but not identical, so unfortunately I can't use DSA.

However, my other question is still unanswered: what exactly is the
"header"? In the case of a fragmented skb, is it the entire "main" skb
(i.e. skb->data, without the fragments) or just a portion of it? Does
the "header" concept still apply to linear skb's?

Thanks,
Radu Rendec


Reply via email to