Skip to content

Commit 5615f88

Browse files
francisyyandavem330
authored andcommitted
tcp: instrument how long TCP is limited by receive window
This patch measures the total time when the TCP stops sending because the receiver's advertised window is not large enough. Note that once the limit is lifted we are likely in the busy status if we have data pending. Signed-off-by: Francis Yan <francisyyan@gmail.com> Signed-off-by: Yuchung Cheng <ycheng@google.com> Signed-off-by: Soheil Hassas Yeganeh <soheil@google.com> Acked-by: Neal Cardwell <ncardwell@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 0f87230 commit 5615f88

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

net/ipv4/tcp_output.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2144,7 +2144,7 @@ static bool tcp_write_xmit(struct sock *sk, unsigned int mss_now, int nonagle,
21442144
unsigned int tso_segs, sent_pkts;
21452145
int cwnd_quota;
21462146
int result;
2147-
bool is_cwnd_limited = false;
2147+
bool is_cwnd_limited = false, is_rwnd_limited = false;
21482148
u32 max_segs;
21492149

21502150
sent_pkts = 0;
@@ -2181,8 +2181,10 @@ static bool tcp_write_xmit(struct sock *sk, unsigned int mss_now, int nonagle,
21812181
break;
21822182
}
21832183

2184-
if (unlikely(!tcp_snd_wnd_test(tp, skb, mss_now)))
2184+
if (unlikely(!tcp_snd_wnd_test(tp, skb, mss_now))) {
2185+
is_rwnd_limited = true;
21852186
break;
2187+
}
21862188

21872189
if (tso_segs == 1) {
21882190
if (unlikely(!tcp_nagle_test(tp, skb, mss_now,
@@ -2227,6 +2229,11 @@ static bool tcp_write_xmit(struct sock *sk, unsigned int mss_now, int nonagle,
22272229
break;
22282230
}
22292231

2232+
if (is_rwnd_limited)
2233+
tcp_chrono_start(sk, TCP_CHRONO_RWND_LIMITED);
2234+
else
2235+
tcp_chrono_stop(sk, TCP_CHRONO_RWND_LIMITED);
2236+
22302237
if (likely(sent_pkts)) {
22312238
if (tcp_in_cwnd_reduction(sk))
22322239
tp->prr_out += sent_pkts;

0 commit comments

Comments
 (0)