From: "Ilpo_Järvinen" <[EMAIL PROTECTED]> Date: Wed, 19 Dec 2007 23:46:33 +0200 (EET)
> I'm not fully sure what's purpose of this code in tcp_write_xmit: > > if (skb->len < limit) { > unsigned int trim = skb->len % mss_now; > > if (trim) > limit = skb->len - trim; > } > > Is it used to make sure we send only multiples of mss_now here and leave > the left-over into another skb? Or does it try to make sure that > tso_fragment result honors multiple of mss_now boundaries when snd_wnd > is the limitting factor? For latter IMHO this would be necessary: > > if (skb->len > limit) > limit -= limit % mss_now; The purpose of the test is to make sure we process tail sub-mss chunks correctly wrt. Nagle, which most closely matches the first purpose you've listed. So I think the calculation really does belong where it is. Because of the way that the sendmsg() super-skb formation logic works, we always will tack on more data and grow the tail SKB before creating a new one. So any sub-mss chunk at the end of a TSO frame really is at the end of the write queue and really should get nagle processing. Actually, there is an exception, which is when we run out of skb_frag_list slots. In that case we'll potentially have breaks at odd boundaries in the middle of the queue. But this can only happen in exceptional cases (user does tons of 1-byte sendfile()'s over random non-consequetive locations of a file) or outright bugs (MAX_SKB_FRAGS is defined incorrectly, for example) and thus this situation is not worth coding for. sendmsg()'s goal, when TSO is enabled, is to append to the write queue tail SKB, and it does so until the MAX_SKB_FRAGS limit is reached. -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html