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

tcp: add ca_state stat in SCM_TIMESTAMPING_OPT_STATS

This patch adds TCP_NLA_CA_STATE stat into SCM_TIMESTAMPING_OPT_STATS.
It reports ca_state of socket, 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
be631892 87ecc95d

+3 -1
+1
include/uapi/linux/tcp.h
··· 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 244 TCP_NLA_SNDQ_SIZE, /* Data (bytes) pending in send queue */ 245 + TCP_NLA_CA_STATE, /* ca_state of socket */ 245 246 246 247 }; 247 248
+2 -1
net/ipv4/tcp.c
··· 3032 3032 3033 3033 stats = alloc_skb(7 * nla_total_size_64bit(sizeof(u64)) + 3034 3034 4 * nla_total_size(sizeof(u32)) + 3035 - 2 * nla_total_size(sizeof(u8)), GFP_ATOMIC); 3035 + 3 * nla_total_size(sizeof(u8)), GFP_ATOMIC); 3036 3036 if (!stats) 3037 3037 return NULL; 3038 3038 ··· 3063 3063 nla_put_u8(stats, TCP_NLA_DELIVERY_RATE_APP_LMT, !!tp->rate_app_limited); 3064 3064 3065 3065 nla_put_u32(stats, TCP_NLA_SNDQ_SIZE, tp->write_seq - tp->snd_una); 3066 + nla_put_u8(stats, TCP_NLA_CA_STATE, inet_csk(sk)->icsk_ca_state); 3066 3067 return stats; 3067 3068 } 3068 3069