]> bbs.cooldavid.org Git - net-next-2.6.git/commit - net/ipv4/tcp_output.c
[TCP]: Force TSO splits to MSS boundaries
authorIlpo Järvinen <ilpo.jarvinen@helsinki.fi>
Tue, 25 Dec 2007 05:33:45 +0000 (21:33 -0800)
committerDavid S. Miller <davem@davemloft.net>
Mon, 28 Jan 2008 23:00:06 +0000 (15:00 -0800)
commit0e3a4803aa06cd7bc2cfc1d04289df4f6027640a
treec3af99ceea81cd14e14c96fe0c85f39236de933b
parent7ffc49a6ee92b7138c2ee28073a8e10e58335d62
[TCP]: Force TSO splits to MSS boundaries

If snd_wnd - snd_nxt wasn't multiple of MSS, skb was split on
odd boundary by the callers of tcp_window_allows.

We try really hard to avoid unnecessary modulos. Therefore the
old caller side check "if (skb->len < limit)" was too wide as
well because limit is not bound in any way to skb->len and can
cause spurious testing for trimming in the middle of the queue
while we only wanted that to happen at the tail of the queue.
A simple additional caller side check for tcp_write_queue_tail
would likely have resulted 2 x modulos because the limit would
have to be first calculated from window, however, doing that
unnecessary modulo is not mandatory. After a minor change to
the algorithm, simply determine first if the modulo is needed
at all and at that point immediately decide also from which
value it should be calculated from.

This approach also kills some duplicated code.

Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@helsinki.fi>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv4/tcp_output.c