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

tcp: add send queue size stat in SCM_TIMESTAMPING_OPT_STATS

This patch adds TCP_NLA_SENDQ_SIZE stat into SCM_TIMESTAMPING_OPT_STATS.
It reports no. of bytes present in send queue, when timestamp is
generated.

Signed-off-by: Priyaranjan Jha <priyarjha@google.com>
Signed-off-by: Neal Cardwell <ncardwell@google.com>
Signed-off-by: Yuchung Cheng <ycheng@google.com>
Signed-off-by: Soheil Hassas Yeganeh <soheil@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Priyaranjan Jha and committed by
David S. Miller
87ecc95d 200066a5

+4 -1
+1
include/uapi/linux/tcp.h
··· 241 241 TCP_NLA_MIN_RTT, /* minimum RTT */ 242 242 TCP_NLA_RECUR_RETRANS, /* Recurring retransmits for the current pkt */ 243 243 TCP_NLA_DELIVERY_RATE_APP_LMT, /* delivery rate application limited ? */ 244 + TCP_NLA_SNDQ_SIZE, /* Data (bytes) pending in send queue */ 244 245 245 246 }; 246 247
+3 -1
net/ipv4/tcp.c
··· 3031 3031 u32 rate; 3032 3032 3033 3033 stats = alloc_skb(7 * nla_total_size_64bit(sizeof(u64)) + 3034 - 3 * nla_total_size(sizeof(u32)) + 3034 + 4 * nla_total_size(sizeof(u32)) + 3035 3035 2 * nla_total_size(sizeof(u8)), GFP_ATOMIC); 3036 3036 if (!stats) 3037 3037 return NULL; ··· 3061 3061 3062 3062 nla_put_u8(stats, TCP_NLA_RECUR_RETRANS, inet_csk(sk)->icsk_retransmits); 3063 3063 nla_put_u8(stats, TCP_NLA_DELIVERY_RATE_APP_LMT, !!tp->rate_app_limited); 3064 + 3065 + nla_put_u32(stats, TCP_NLA_SNDQ_SIZE, tp->write_seq - tp->snd_una); 3064 3066 return stats; 3065 3067 } 3066 3068