diff options
author | Florian Westphal <fw@strlen.de> | 2014-02-25 08:34:32 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-02-26 15:23:30 -0500 |
commit | 8e165e20348b53583f6c6cb45865b89209f4aa13 (patch) | |
tree | 26eab521fe1c2ac3aca539d832d747f2c42bc930 /net/ipv4 | |
parent | 2ebe21fdde1c92ef1654f23d29194145be0e1ddc (diff) |
net: tcp: add mib counters to track zero window transitions
Three counters are added:
- one to track when we went from non-zero to zero window
- one to track the reverse
- one counter incremented when we want to announce zero window,
but can't because we would shrink current window.
Suggested-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: Florian Westphal <fw@strlen.de>
Acked-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4')
-rw-r--r-- | net/ipv4/proc.c | 3 | ||||
-rw-r--r-- | net/ipv4/tcp_output.c | 12 |
2 files changed, 14 insertions, 1 deletions
diff --git a/net/ipv4/proc.c b/net/ipv4/proc.c index a6c8a80ec9d6..99d2e9b6fac9 100644 --- a/net/ipv4/proc.c +++ b/net/ipv4/proc.c | |||
@@ -280,6 +280,9 @@ static const struct snmp_mib snmp4_net_list[] = { | |||
280 | SNMP_MIB_ITEM("TCPSpuriousRtxHostQueues", LINUX_MIB_TCPSPURIOUS_RTX_HOSTQUEUES), | 280 | SNMP_MIB_ITEM("TCPSpuriousRtxHostQueues", LINUX_MIB_TCPSPURIOUS_RTX_HOSTQUEUES), |
281 | SNMP_MIB_ITEM("BusyPollRxPackets", LINUX_MIB_BUSYPOLLRXPACKETS), | 281 | SNMP_MIB_ITEM("BusyPollRxPackets", LINUX_MIB_BUSYPOLLRXPACKETS), |
282 | SNMP_MIB_ITEM("TCPAutoCorking", LINUX_MIB_TCPAUTOCORKING), | 282 | SNMP_MIB_ITEM("TCPAutoCorking", LINUX_MIB_TCPAUTOCORKING), |
283 | SNMP_MIB_ITEM("TCPFromZeroWindowAdv", LINUX_MIB_TCPFROMZEROWINDOWADV), | ||
284 | SNMP_MIB_ITEM("TCPToZeroWindowAdv", LINUX_MIB_TCPTOZEROWINDOWADV), | ||
285 | SNMP_MIB_ITEM("TCPWantZeroWindowAdv", LINUX_MIB_TCPWANTZEROWINDOWADV), | ||
283 | SNMP_MIB_SENTINEL | 286 | SNMP_MIB_SENTINEL |
284 | }; | 287 | }; |
285 | 288 | ||
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c index 21e8a9f33287..c5eadec001c1 100644 --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c | |||
@@ -269,6 +269,7 @@ EXPORT_SYMBOL(tcp_select_initial_window); | |||
269 | static u16 tcp_select_window(struct sock *sk) | 269 | static u16 tcp_select_window(struct sock *sk) |
270 | { | 270 | { |
271 | struct tcp_sock *tp = tcp_sk(sk); | 271 | struct tcp_sock *tp = tcp_sk(sk); |
272 | u32 old_win = tp->rcv_wnd; | ||
272 | u32 cur_win = tcp_receive_window(tp); | 273 | u32 cur_win = tcp_receive_window(tp); |
273 | u32 new_win = __tcp_select_window(sk); | 274 | u32 new_win = __tcp_select_window(sk); |
274 | 275 | ||
@@ -281,6 +282,9 @@ static u16 tcp_select_window(struct sock *sk) | |||
281 | * | 282 | * |
282 | * Relax Will Robinson. | 283 | * Relax Will Robinson. |
283 | */ | 284 | */ |
285 | if (new_win == 0) | ||
286 | NET_INC_STATS(sock_net(sk), | ||
287 | LINUX_MIB_TCPWANTZEROWINDOWADV); | ||
284 | new_win = ALIGN(cur_win, 1 << tp->rx_opt.rcv_wscale); | 288 | new_win = ALIGN(cur_win, 1 << tp->rx_opt.rcv_wscale); |
285 | } | 289 | } |
286 | tp->rcv_wnd = new_win; | 290 | tp->rcv_wnd = new_win; |
@@ -298,8 +302,14 @@ static u16 tcp_select_window(struct sock *sk) | |||
298 | new_win >>= tp->rx_opt.rcv_wscale; | 302 | new_win >>= tp->rx_opt.rcv_wscale; |
299 | 303 | ||
300 | /* If we advertise zero window, disable fast path. */ | 304 | /* If we advertise zero window, disable fast path. */ |
301 | if (new_win == 0) | 305 | if (new_win == 0) { |
302 | tp->pred_flags = 0; | 306 | tp->pred_flags = 0; |
307 | if (old_win) | ||
308 | NET_INC_STATS(sock_net(sk), | ||
309 | LINUX_MIB_TCPTOZEROWINDOWADV); | ||
310 | } else if (old_win == 0) { | ||
311 | NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPFROMZEROWINDOWADV); | ||
312 | } | ||
303 | 313 | ||
304 | return new_win; | 314 | return new_win; |
305 | } | 315 | } |