Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

tcp: do not scale TSO segment size with reordering degree

Since 2005 (c1b4a7e69576d65efc31a8cea0714173c2841244)
tcp_tso_should_defer has been using tcp_max_burst() as a target limit
for deciding how large to make outgoing TSO packets when not using
sysctl_tcp_tso_win_divisor. But since 2008
(dd9e0dda66ba38a2ddd1405ac279894260dc5c36) tcp_max_burst() returns the
reordering degree. We should not have tcp_tso_should_defer attempt to
build larger segments just because there is more reordering. This
commit splits the notion of deferral size used in TSO from the notion
of burst size used in cwnd moderation, and returns the TSO deferral
limit to its original value.

Signed-off-by: Neal Cardwell <ncardwell@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Neal Cardwell and committed by
David S. Miller
6b5a5c0d befc93fe

+10 -2
+8
include/net/tcp.h
··· 834 834 extern void tcp_enter_cwr(struct sock *sk, const int set_ssthresh); 835 835 extern __u32 tcp_init_cwnd(const struct tcp_sock *tp, const struct dst_entry *dst); 836 836 837 + /* The maximum number of MSS of available cwnd for which TSO defers 838 + * sending if not using sysctl_tcp_tso_win_divisor. 839 + */ 840 + static inline __u32 tcp_max_tso_deferred_mss(const struct tcp_sock *tp) 841 + { 842 + return 3; 843 + } 844 + 837 845 /* Slow start with delack produces 3 packets of burst, so that 838 846 * it is safe "de facto". This will be the default - same as 839 847 * the default reordering threshold - but if reordering increases,
+1 -1
net/ipv4/tcp_cong.c
··· 292 292 left * sysctl_tcp_tso_win_divisor < tp->snd_cwnd && 293 293 left * tp->mss_cache < sk->sk_gso_max_size) 294 294 return 1; 295 - return left <= tcp_max_burst(tp); 295 + return left <= tcp_max_tso_deferred_mss(tp); 296 296 } 297 297 EXPORT_SYMBOL_GPL(tcp_is_cwnd_limited); 298 298
+1 -1
net/ipv4/tcp_output.c
··· 1581 1581 * frame, so if we have space for more than 3 frames 1582 1582 * then send now. 1583 1583 */ 1584 - if (limit > tcp_max_burst(tp) * tp->mss_cache) 1584 + if (limit > tcp_max_tso_deferred_mss(tp) * tp->mss_cache) 1585 1585 goto send_now; 1586 1586 } 1587 1587