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

tcp: add tcpi_min_rtt and tcpi_notsent_bytes to tcp_info

tcpi_min_rtt reports the minimal rtt observed by TCP stack for the flow,
in usec unit. Might be ~0U if not yet known.

tcpi_notsent_bytes reports the amount of bytes in the write queue that
were not yet sent.

This is done in a single patch to not add a temporary 32bit padding hole
in tcp_info.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Eric Dumazet and committed by
David S. Miller
cd9b2660 4cba259f

+9
+3
include/uapi/linux/tcp.h
··· 196 196 __u64 tcpi_bytes_received; /* RFC4898 tcpEStatsAppHCThruOctetsReceived */ 197 197 __u32 tcpi_segs_out; /* RFC4898 tcpEStatsPerfSegsOut */ 198 198 __u32 tcpi_segs_in; /* RFC4898 tcpEStatsPerfSegsIn */ 199 + 200 + __u32 tcpi_notsent_bytes; 201 + __u32 tcpi_min_rtt; 199 202 }; 200 203 201 204 /* for TCP_MD5SIG socket option */
+6
net/ipv4/tcp.c
··· 2642 2642 const struct inet_connection_sock *icsk = inet_csk(sk); 2643 2643 u32 now = tcp_time_stamp; 2644 2644 unsigned int start; 2645 + int notsent_bytes; 2645 2646 u64 rate64; 2646 2647 u32 rate; 2647 2648 ··· 2723 2722 } while (u64_stats_fetch_retry_irq(&tp->syncp, start)); 2724 2723 info->tcpi_segs_out = tp->segs_out; 2725 2724 info->tcpi_segs_in = tp->segs_in; 2725 + 2726 + notsent_bytes = READ_ONCE(tp->write_seq) - READ_ONCE(tp->snd_nxt); 2727 + info->tcpi_notsent_bytes = max(0, notsent_bytes); 2728 + 2729 + info->tcpi_min_rtt = tcp_min_rtt(tp); 2726 2730 } 2727 2731 EXPORT_SYMBOL_GPL(tcp_get_info); 2728 2732