From: devnetfs (
Date: Sat Feb 01 2003 - 13:22:35 EST


I have a skb whose data I want to fragment into fixed size
chunks with each fragment having its own (fixed size) header.

What is the fastest way to do this, with minimal copying of data
around? The easiest approach looks to be:

1. allocated a *new* skb of size=header_size+fragement_size
2. *copy* part of data from my original skb into this new pkt
3. setup the header in the fragmented-packet
4. xmit this sk_buff (dev_queue_xmit)

What I dont like is the *new* and (extra) *copy* part. As my original
skb in in the kernel itself an additional copy (of fragment-size)
before xmit seems wasteful to me.

Is it possible to allocate buffer-space for just the header and then
have pointers into the original skb for the fragement data, avoiding
the extra *copy* of the fragment-data.

So the question(s) are:

[1] can I submit a packet (a sk_buff)to low level device (using
    dev_queue_xmit()) that has its buffer/data in discontinuous
    blocks in the kernel -- some kind of iovec.
    And if the network device supports DMA gather -- this would
    make the xmit path very fast. right?
[2] can I submit a chain of sk_buff's that need to be xmited as ONE
    ether frame to dev_queue_xmit()?
[2] such a chaining is not very useful and the above approach
    (steps 1-4) is ok.

[btw this data is being generated in the kernel and sent over ether]

Any insights or possible solutions would be helpful.


ps: I've just subscribed to netdev, so not sure if I will get the reply
to this mail. So please Cc: me the reply -- thanks.

Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
To unsubscribe from this list: send the line "unsubscribe linux-net" in
the body of a message to
More majordomo info at

This archive was generated by hypermail 2b29 : Fri Feb 07 2003 - 22:00:00 EST