aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/tcp_input.c
diff options
context:
space:
mode:
authorYuchung Cheng <ycheng@google.com>2018-04-18 02:18:49 -0400
committerDavid S. Miller <davem@davemloft.net>2018-04-19 13:05:16 -0400
commitfeb5f2ec646483fb66f9ad7218b1aad2a93a2a5c (patch)
treecc1b3d9495eeab4743e7086ff22a926854d79823 /net/ipv4/tcp_input.c
parente21db6f69a95b846ff04e31fe0a86004cbd000d7 (diff)
tcp: export packets delivery info
Export data delivered and delivered with CE marks to 1) SNMP TCPDelivered and TCPDeliveredCE 2) getsockopt(TCP_INFO) 3) Timestamping API SOF_TIMESTAMPING_OPT_STATS Note that for SCM_TSTAMP_ACK, the delivery info in SOF_TIMESTAMPING_OPT_STATS is reported before the info was fully updated on the ACK. These stats help application monitor TCP delivery and ECN status on per host, per connection, even per message level. Signed-off-by: Yuchung Cheng <ycheng@google.com> Reviewed-by: Neal Cardwell <ncardwell@google.com> Reviewed-by: Soheil Hassas Yeganeh <soheil@google.com> Reviewed-by: Eric Dumazet <edumazet@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/tcp_input.c')
-rw-r--r--net/ipv4/tcp_input.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index b3bff9c20606..0396fb919b5d 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -3499,12 +3499,16 @@ static void tcp_xmit_recovery(struct sock *sk, int rexmit)
3499/* Returns the number of packets newly acked or sacked by the current ACK */ 3499/* Returns the number of packets newly acked or sacked by the current ACK */
3500static u32 tcp_newly_delivered(struct sock *sk, u32 prior_delivered, int flag) 3500static u32 tcp_newly_delivered(struct sock *sk, u32 prior_delivered, int flag)
3501{ 3501{
3502 const struct net *net = sock_net(sk);
3502 struct tcp_sock *tp = tcp_sk(sk); 3503 struct tcp_sock *tp = tcp_sk(sk);
3503 u32 delivered; 3504 u32 delivered;
3504 3505
3505 delivered = tp->delivered - prior_delivered; 3506 delivered = tp->delivered - prior_delivered;
3506 if (flag & FLAG_ECE) 3507 NET_ADD_STATS(net, LINUX_MIB_TCPDELIVERED, delivered);
3508 if (flag & FLAG_ECE) {
3507 tp->delivered_ce += delivered; 3509 tp->delivered_ce += delivered;
3510 NET_ADD_STATS(net, LINUX_MIB_TCPDELIVEREDCE, delivered);
3511 }
3508 return delivered; 3512 return delivered;
3509} 3513}
3510 3514