History

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.

Eric Dumazet committed 10 years ago

Commit cd9b2661 parent 4cba2592 files · +9 −0Browse files

Unified · Split

2 files
  1. include/uapi/linux/tcp.h +3 −0
  2. net/ipv4/tcp.c +6 −0
include/uapi/linux/tcp.h+3−0
@@ -196,6 +196,9 @@ struct tcp_info { · 195 unmodified lines
196196 __u64 tcpi_bytes_received; /* RFC4898 tcpEStatsAppHCThruOctetsReceived */
197197 __u32 tcpi_segs_out; /* RFC4898 tcpEStatsPerfSegsOut */
198198 __u32 tcpi_segs_in; /* RFC4898 tcpEStatsPerfSegsIn */
199+
200+ __u32 tcpi_notsent_bytes;
201+ __u32 tcpi_min_rtt;
199202 };
200203
201204 /* for TCP_MD5SIG socket option */
net/ipv4/tcp.c+6−0
@@ -2642,6 +2642,7 @@ void tcp_get_info(struct sock *sk, struct tcp_info *info) · 2641 unmodified lines
26422642 const struct inet_connection_sock *icsk = inet_csk(sk);
26432643 u32 now = tcp_time_stamp;
26442644 unsigned int start;
2645+ int notsent_bytes;
26452646 u64 rate64;
26462647 u32 rate;
26472648
@@ -2722,6 +2723,11 @@ void tcp_get_info(struct sock *sk, struct tcp_info *info) · 74 unmodified lines
27222723 } while (u64_stats_fetch_retry_irq(&tp->syncp, start));
27232724 info->tcpi_segs_out = tp->segs_out;
27242725 info->tcpi_segs_in = tp->segs_in;
2726+
2727+ notsent_bytes = READ_ONCE(tp->write_seq) - READ_ONCE(tp->snd_nxt);
2728+ info->tcpi_notsent_bytes = max(0, notsent_bytes);
2729+
2730+ info->tcpi_min_rtt = tcp_min_rtt(tp);
27252731 }
27262732 EXPORT_SYMBOL_GPL(tcp_get_info);
27272733

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t