Re: Non-linear SKBs

From: David Miller
Date: Thu Oct 11 2007 - 20:00:26 EST


From: Kristian Evensen <kristrev@xxxxxxxxxx>
Date: Fri, 12 Oct 2007 00:54:37 +0200

> I have developed a small patch for the TCP code in 2.6.19 and it works
> flawlessly. A couple of days ago I decided to make it compatible with
> 2.6.22.5 and have stumbled upon a problem I cannot solve.
>
> In 2.6.19 it seems that all packets (at least the ones my patch work
> with) are linear, while they are non-linear in 2.6.22.5. I have searched
> through the code (focusing on tcp_sendmsg) to try to figure out what
> happens, but can't find any differences that would explain this. Does
> anyone know what might be the cause and if there is an easy way to
> return to linear skbs (unless that is totally stupid)? I would also like
> the benefits offered by the collapsing when retransmitting (which
> requires number of fragments to be 0).

If the underlying device can do scatter-gather and checksumming,
the TCP code builds outgoing packets by copying user date into
full system pages, and then attaching those pages into the SKB.
The protocol headers sit under the skb->data linear area, and
the user data mostly sits in the user pages under
skb_shinfo(skb)->frags[]

This increases the density of data packed into the memory allocated
compared to using skb->data for it. It also enormously simplifies
the logic necessary to support TSO.
-
To unsubscribe from this list: send the line "unsubscribe linux-net" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html