Skip to content

Commit 87ecc95

Browse files
Prj2223davem330
authored andcommitted
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 <[email protected]> Signed-off-by: Neal Cardwell <[email protected]> Signed-off-by: Yuchung Cheng <[email protected]> Signed-off-by: Soheil Hassas Yeganeh <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 200066a commit 87ecc95

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

include/uapi/linux/tcp.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,7 @@ enum {
241241
TCP_NLA_MIN_RTT, /* minimum RTT */
242242
TCP_NLA_RECUR_RETRANS, /* Recurring retransmits for the current pkt */
243243
TCP_NLA_DELIVERY_RATE_APP_LMT, /* delivery rate application limited ? */
244+
TCP_NLA_SNDQ_SIZE, /* Data (bytes) pending in send queue */
244245

245246
};
246247

net/ipv4/tcp.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3031,7 +3031,7 @@ struct sk_buff *tcp_get_timestamping_opt_stats(const struct sock *sk)
30313031
u32 rate;
30323032

30333033
stats = alloc_skb(7 * nla_total_size_64bit(sizeof(u64)) +
3034-
3 * nla_total_size(sizeof(u32)) +
3034+
4 * nla_total_size(sizeof(u32)) +
30353035
2 * nla_total_size(sizeof(u8)), GFP_ATOMIC);
30363036
if (!stats)
30373037
return NULL;
@@ -3061,6 +3061,8 @@ struct sk_buff *tcp_get_timestamping_opt_stats(const struct sock *sk)
30613061

30623062
nla_put_u8(stats, TCP_NLA_RECUR_RETRANS, inet_csk(sk)->icsk_retransmits);
30633063
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);
30643066
return stats;
30653067
}
30663068

0 commit comments

Comments
 (0)