frank wrote:
> I'm writing a small kernel module that is similar to a Ethernet
> device driver and it receives skbs from the kernel. I'd like to
> generate some skbs with fragments (i.e. skb_shinfo(skb)->nr_frag > 0)
> to test my module, but I don't know how.
>
> If you can help, I'd highly appreciate it. Basically, I'd like to
> know under what circumstances my driver can get fragmented skbs in
> its hard_start_xmit() function.
Linux Device Drivers, Third Edition
http://lwn.net/Kernel/LDD3/
Chapter 17 might provide some insight.
<quote>
NETIF_F_SG
NETIF_F_FRAGLIST
Both of these flags control the use of scatter/gather I/O. If your
interface can transmit a packet that has been split into several
distinct memory segments, you should set NETIF_F_SG. Of course, you have
to actually implement the scatter/gather I/O (we describe how that is
done in the section "Scatter/Gather I/O"). NETIF_F_FRAGLIST states that
your interface can cope with packets that have been fragmented; only the
loopback driver does this in 2.6.
[...]
The kernel does not pass scattered packets to your hard_start_xmit
method unless the NETIF_F_SG bit has been set in the features field of
your device structure. If you have set that flag, you need to look at a
special "shared info" field within the skb to see whether the packet is
made up of a single fragment or many and to find the scattered fragments
if need be.
</quote>
Regards.