aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/tcp.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.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.c')
-rw-r--r--net/ipv4/tcp.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index 5a5ce6da4792..4022073b0aee 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -3167,6 +3167,8 @@ void tcp_get_info(struct sock *sk, struct tcp_info *info)
3167 rate64 = tcp_compute_delivery_rate(tp); 3167 rate64 = tcp_compute_delivery_rate(tp);
3168 if (rate64) 3168 if (rate64)
3169 info->tcpi_delivery_rate = rate64; 3169 info->tcpi_delivery_rate = rate64;
3170 info->tcpi_delivered = tp->delivered;
3171 info->tcpi_delivered_ce = tp->delivered_ce;
3170 unlock_sock_fast(sk, slow); 3172 unlock_sock_fast(sk, slow);
3171} 3173}
3172EXPORT_SYMBOL_GPL(tcp_get_info); 3174EXPORT_SYMBOL_GPL(tcp_get_info);
@@ -3180,7 +3182,7 @@ struct sk_buff *tcp_get_timestamping_opt_stats(const struct sock *sk)
3180 u32 rate; 3182 u32 rate;
3181 3183
3182 stats = alloc_skb(7 * nla_total_size_64bit(sizeof(u64)) + 3184 stats = alloc_skb(7 * nla_total_size_64bit(sizeof(u64)) +
3183 5 * nla_total_size(sizeof(u32)) + 3185 7 * nla_total_size(sizeof(u32)) +
3184 3 * nla_total_size(sizeof(u8)), GFP_ATOMIC); 3186 3 * nla_total_size(sizeof(u8)), GFP_ATOMIC);
3185 if (!stats) 3187 if (!stats)
3186 return NULL; 3188 return NULL;
@@ -3211,9 +3213,12 @@ struct sk_buff *tcp_get_timestamping_opt_stats(const struct sock *sk)
3211 nla_put_u8(stats, TCP_NLA_RECUR_RETRANS, inet_csk(sk)->icsk_retransmits); 3213 nla_put_u8(stats, TCP_NLA_RECUR_RETRANS, inet_csk(sk)->icsk_retransmits);
3212 nla_put_u8(stats, TCP_NLA_DELIVERY_RATE_APP_LMT, !!tp->rate_app_limited); 3214 nla_put_u8(stats, TCP_NLA_DELIVERY_RATE_APP_LMT, !!tp->rate_app_limited);
3213 nla_put_u32(stats, TCP_NLA_SND_SSTHRESH, tp->snd_ssthresh); 3215 nla_put_u32(stats, TCP_NLA_SND_SSTHRESH, tp->snd_ssthresh);
3216 nla_put_u32(stats, TCP_NLA_DELIVERED, tp->delivered);
3217 nla_put_u32(stats, TCP_NLA_DELIVERED_CE, tp->delivered_ce);
3214 3218
3215 nla_put_u32(stats, TCP_NLA_SNDQ_SIZE, tp->write_seq - tp->snd_una); 3219 nla_put_u32(stats, TCP_NLA_SNDQ_SIZE, tp->write_seq - tp->snd_una);
3216 nla_put_u8(stats, TCP_NLA_CA_STATE, inet_csk(sk)->icsk_ca_state); 3220 nla_put_u8(stats, TCP_NLA_CA_STATE, inet_csk(sk)->icsk_ca_state);
3221
3217 return stats; 3222 return stats;
3218} 3223}
3219 3224