net: tcp_drop adds `reason` v5
Subsystems (4)
PATCH 1/1 net: tcp_drop adds `reason` v5
Description information in the reason field of tcp_drop, "Tcp" is changed to "TCP" Feel free to suggest changes
Signed-off-by Zhongya Yan <[email protected]>
--- include/trace/events/tcp.h | 62 ++++++++++++++++++ net/ipv4/tcp_input.c | 126 +++++++++++++++++++++++-------------- 2 files changed, 142 insertions(+), 46 deletions(-)
include/trace/events/tcp.h +62 -0
@@ -371,6 +371,68 @@ DEFINE_EVENT(tcp_event_skb, tcp_bad_csum,TP_ARGS (skb) ); +TRACE_EVENT (tcp_drop, + TP_PROTO(struct sock *sk, struct sk_buff *skb, int field, const char *reason), + +TP_ARGS (sk, skb, field, reason), + +TP_STRUCT__entry ( + __array(__u8, saddr, sizeof(struct sockaddr_in6)) + __array(__u8, daddr, sizeof(struct sockaddr_in6)) + __field(__u16, sport) + __field(__u16, dport) + __field(__u32, mark) + __field(__u16, data_len) + __field(__u32, snd_nxt) + __field(__u32, snd_una) + __field(__u32, snd_cwnd) + __field(__u32, ssthresh) + __field(__u32, snd_wnd) + __field(__u32, srtt) + __field(__u32, rcv_wnd) + __field(__u64, sock_cookie) + __field(int, field) +__string (reason, reason) + ), + +TP_fast_assign ( + const struct tcphdr *th = (const struct tcphdr *)skb->data; + const struct inet_sock *inet = inet_sk(sk); + const struct tcp_sock *tp = tcp_sk(sk); + + memset(__entry->saddr, 0, sizeof(struct sockaddr_in6)); + memset(__entry->daddr, 0, sizeof(struct sockaddr_in6)); + + TP_STORE_ADDR_PORTS(__entry, inet, sk); + + __entry->sport = ntohs(inet->inet_sport); + __entry->dport = ntohs(inet->inet_dport); + __entry->mark = skb->mark; + + __entry->data_len = skb->len - __tcp_hdrlen(th); + __entry->snd_nxt = tp->snd_nxt; + __entry->snd_una = tp->snd_una; + __entry->snd_cwnd = tp->snd_cwnd; + __entry->snd_wnd = tp->snd_wnd; + __entry->rcv_wnd = tp->rcv_wnd; + __entry->ssthresh = tcp_current_ssthresh(sk); + __entry->srtt = tp->srtt_us >> 3; + __entry->sock_cookie = sock_gen_cookie(sk); + __entry->field = field; + + __assign_str(reason, reason); + ), + +TP_printk ("src=%pISpc dest=%pISpc mark=%#x data_len=%d snd_nxt=%#x snd_una=%#x \ +snd_cwnd=%u ssthresh=%u snd_wnd=%u srtt=%u rcv_wnd=%u \ +sock_cookie=%llx field=%d reason=%s" , + __entry->saddr, __entry->daddr, __entry->mark, + __entry->data_len, __entry->snd_nxt, __entry->snd_una, + __entry->snd_cwnd, __entry->ssthresh, __entry->snd_wnd, + __entry->srtt, __entry->rcv_wnd, __entry->sock_cookie, + __entry->field,__get_str (reason)) +); +#endif /* _TRACE_TCP_H */ /* This part must be outside protection */
net/ipv4/tcp_input.c +80 -46
325 lines not on this page · raw message
Signature · 1 line
2.25.1
Quoted 4 lines · Zhongya Yan
Description information in the reason field of
tcp_drop, "Tcp" is changed to "TCP" Feel free to suggest changes
This is a cryptic changelog.
Have you forgotten to copy/paste important information ?
We would like something that explains what the patch is about, and eventually how to use the new functionality.
Do not assume future readers of linux TCP stack will have instant access to all your prior versions
Also patch is about tcp, net: prefix in patch title should be tcp:
Thanks.