From: frank_6014@yahoo.com on

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.

(I tried to send it large packet > than the Ethernet frame size, but
that didn't
seem to work.)

Please post or email, I'll summarize any responses received:

frank_6014 @ yahoo dot com.

Thanks!
-Frank H.

From: Spoon on
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.
From: frank_6014@yahoo.com on

Spoon,

Thanks for your reply. My question probably wasn't clear in the
original post.

Basically, I've gotten past the setting of those flags and would like
to receive
some fragmented skbs from the kernel to test my code. (I wrote a
network
device driver and during tests, which composed mainly of running
several
network programs using my driver (e.g. Apache web server, telnet
server,
ssh servers, etc.), but I don't see fragmeted skbs going thru my
driver.)

How can I get some of those skbs coming fro mthe kernel?
(I'm using Linux kernel 2.6.13)

Thanks,
Ching

 | 
Pages: 1
Prev: Bluetooth network
Next: Dial-Up Modem Questions