[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Tue, 01 Jan 2019 09:53:49 -0800 (PST)
From: David Miller <davem@...hat.com>
To: radu.rendec@...il.com
Cc: netdev@...r.kernel.org
Subject: Re: skb_cow() vs skb_cow_head() - what exactly is "header"?
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().
Powered by blists - more mailing lists