questions on tcp_send

From: Steven Mickovski (
Date: Wed Aug 13 2003 - 16:51:40 EST

i have some problems understanding the tcp_send routine in net/ipv4/tcp.c:

1) In the following code:

if (skb_tailroom(skb) > 0) {
/* We have some space in skb head. Superb! */
else {
int merge = 0;
int i = skb_shinfo(skb)->nr_frags;
struct page *page = TCP_PAGE(sk);
int off = TCP_OFF(sk);
if (can_coalesce(skb, i, page, off) && off != PAGE_SIZE) {merge=1;}

My understanding of the skb_tailroom condition is that it's for the case when the previous sk_buff can accomodate the new buffer to be sent, and it checks if this can be done in the space allocated to
it, or if it should stuff it into the page where the space is allocated.

Is this correct?

2) If so, then why does "can_coalesce" check if:
(page == frag->page && off == frag->page_offset+frag->size) to decide if the data can be merged with that in the previous sk_buff?

Thanks in advance!

Meet your old school or college friends from
1 Million + database...
Click here to reunite

To unsubscribe from this list: send the line "unsubscribe linux-net" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at