On Fri, Dec 02, 2011 at 08:59:55PM -0500, David Miller wrote:
From: Antonio Quartulli ordex@autistici.org Date: Sat, 3 Dec 2011 02:55:29 +0100
We first call pskb_may_pull() to pull the header only and then, under certain conditions, we linearise the whole skb to access it all. Should I use pskb_may_pull() even in this case?
Why would you need to access the whole thing?
It contains only information for the routing/pathfinding to client nodes (nodes which do not directly participate in this mesh).
There are only two types of possible accesses:
Header parsing --> use pskb_may_pull() as needed.
Copying the data to some other location, such as a user buffer. Use skb_copy_datagram_iovec or similar which handle fragmented SKBs just fine.
I think a "copy" using skb_header_pointer/skb_copy_bits would be the right thing to do. batman-adv needs the data for kernel data structures and don't send it to a userspace program (at least not as primary functionality). I don't have benchmarks which compare both solutions (with a heavily fragmented skb) when accessing small, packed structures in a skb.
Thanks, Sven