9
I'm currently trying to debug an ATM encapsulation layer that runs on-top of Ethernet. Basically the ATM cells are stored in order after the ethernet header. However I suspect the drivers naive approach to the sk_buffs is broken.
The driver blindly assumes that skb->data can be iterated through but looking at the kernel code for virtio_net.c:page_to_skb I see the following behaviour:
memcpy(hdr, p, hdr_len);
len -= hdr_len;
p += offset;
copy = len;
if (copy > skb_tailroom(skb))
copy = skb_tailroom(skb);
memcpy(skb_put(skb, copy), p, copy);
Then further on:
while (len) {
set_skb_frag(skb, page, offset, &len);
page = (struct page *)page->private;
offset = 0;
}
Which seems to show the buffer is fragmented with only the first portion being directly accessible from skb->data.
What should I be using to get at the underlying data. Ideally I want to peek a few bytes at arbitrary offsets into the ethernet packet before memcpy'ing chunks into a reassembly buffer I maintain. What should I be using to do this?