xref: /openbmc/linux/net/dccp/trace.h (revision e65e175b)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #undef TRACE_SYSTEM
3 #define TRACE_SYSTEM dccp
4 
5 #if !defined(_TRACE_DCCP_H) || defined(TRACE_HEADER_MULTI_READ)
6 #define _TRACE_DCCP_H
7 
8 #include <net/sock.h>
9 #include "dccp.h"
10 #include "ccids/ccid3.h"
11 #include <linux/tracepoint.h>
12 #include <trace/events/net_probe_common.h>
13 
14 TRACE_EVENT(dccp_probe,
15 
16 	TP_PROTO(struct sock *sk, size_t size),
17 
18 	TP_ARGS(sk, size),
19 
20 	TP_STRUCT__entry(
21 		/* sockaddr_in6 is always bigger than sockaddr_in */
22 		__array(__u8, saddr, sizeof(struct sockaddr_in6))
23 		__array(__u8, daddr, sizeof(struct sockaddr_in6))
24 		__field(__u16, sport)
25 		__field(__u16, dport)
26 		__field(__u16, size)
27 		__field(__u16, tx_s)
28 		__field(__u32, tx_rtt)
29 		__field(__u32, tx_p)
30 		__field(__u32, tx_x_calc)
31 		__field(__u64, tx_x_recv)
32 		__field(__u64, tx_x)
33 		__field(__u32, tx_t_ipi)
34 	),
35 
36 	TP_fast_assign(
37 		const struct inet_sock *inet = inet_sk(sk);
38 		struct ccid3_hc_tx_sock *hc = NULL;
39 
40 		if (ccid_get_current_tx_ccid(dccp_sk(sk)) == DCCPC_CCID3)
41 			hc = ccid3_hc_tx_sk(sk);
42 
43 		memset(__entry->saddr, 0, sizeof(struct sockaddr_in6));
44 		memset(__entry->daddr, 0, sizeof(struct sockaddr_in6));
45 
46 		TP_STORE_ADDR_PORTS(__entry, inet, sk);
47 
48 		/* For filtering use */
49 		__entry->sport = ntohs(inet->inet_sport);
50 		__entry->dport = ntohs(inet->inet_dport);
51 
52 		__entry->size = size;
53 		if (hc) {
54 			__entry->tx_s = hc->tx_s;
55 			__entry->tx_rtt = hc->tx_rtt;
56 			__entry->tx_p = hc->tx_p;
57 			__entry->tx_x_calc = hc->tx_x_calc;
58 			__entry->tx_x_recv = hc->tx_x_recv >> 6;
59 			__entry->tx_x = hc->tx_x >> 6;
60 			__entry->tx_t_ipi = hc->tx_t_ipi;
61 		} else {
62 			__entry->tx_s = 0;
63 			memset_startat(__entry, 0, tx_rtt);
64 		}
65 	),
66 
67 	TP_printk("src=%pISpc dest=%pISpc size=%d tx_s=%d tx_rtt=%d "
68 		  "tx_p=%d tx_x_calc=%u tx_x_recv=%llu tx_x=%llu tx_t_ipi=%d",
69 		  __entry->saddr, __entry->daddr, __entry->size,
70 		  __entry->tx_s, __entry->tx_rtt, __entry->tx_p,
71 		  __entry->tx_x_calc, __entry->tx_x_recv, __entry->tx_x,
72 		  __entry->tx_t_ipi)
73 );
74 
75 #endif /* _TRACE_TCP_H */
76 
77 /* This part must be outside protection */
78 #undef TRACE_INCLUDE_PATH
79 #define TRACE_INCLUDE_PATH .
80 #undef TRACE_INCLUDE_FILE
81 #define TRACE_INCLUDE_FILE trace
82 #include <trace/define_trace.h>
83