[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <24740ec75a9cfd2a0ddaf53855d23ad9365eeee8.camel@gmail.com>
Date: Sun, 06 Jan 2019 09:22:05 -0500
From: Radu Rendec <radu.rendec@...il.com>
To: David Miller <davem@...hat.com>
Cc: netdev@...r.kernel.org
Subject: Re: skb_cow() vs skb_cow_head() - what exactly is "header"?
On Tue, 2019-01-01 at 09:53 -0800, David Miller wrote:
> From: Radu Rendec <radu.rendec@...il.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
Powered by blists - more mailing lists