1 /* SPDX-License-Identifier: GPL-2.0 */
3 #define TRACE_SYSTEM mptcp
5 #if !defined(_TRACE_MPTCP_H) || defined(TRACE_HEADER_MULTI_READ)
8 #include <linux/tracepoint.h>
10 #define show_mapping_status(status) \
11 __print_symbolic(status, \
12 { 0, "MAPPING_OK" }, \
13 { 1, "MAPPING_INVALID" }, \
14 { 2, "MAPPING_EMPTY" }, \
15 { 3, "MAPPING_DATA_FIN" }, \
16 { 4, "MAPPING_DUMMY" })
18 TRACE_EVENT(mptcp_subflow_get_send
,
20 TP_PROTO(struct mptcp_subflow_context
*subflow
),
36 __entry
->active
= mptcp_subflow_active(subflow
);
37 __entry
->backup
= subflow
->backup
|| subflow
->request_bkup
;
39 if (subflow
->tcp_sock
&& sk_fullsock(subflow
->tcp_sock
))
40 __entry
->free
= sk_stream_memory_free(subflow
->tcp_sock
);
44 ssk
= mptcp_subflow_tcp_sock(subflow
);
45 if (ssk
&& sk_fullsock(ssk
)) {
46 __entry
->snd_wnd
= tcp_sk(ssk
)->snd_wnd
;
47 __entry
->pace
= READ_ONCE(ssk
->sk_pacing_rate
);
53 if (ssk
&& sk_fullsock(ssk
) && __entry
->pace
)
54 __entry
->ratio
= div_u64((u64
)ssk
->sk_wmem_queued
<< 32, __entry
->pace
);
59 TP_printk("active=%d free=%d snd_wnd=%u pace=%u backup=%u ratio=%llu",
60 __entry
->active
, __entry
->free
,
61 __entry
->snd_wnd
, __entry
->pace
,
62 __entry
->backup
, __entry
->ratio
)
65 DECLARE_EVENT_CLASS(mptcp_dump_mpext
,
67 TP_PROTO(struct mptcp_ext
*mpext
),
72 __field(u64
, data_ack
)
73 __field(u64
, data_seq
)
74 __field(u32
, subflow_seq
)
75 __field(u16
, data_len
)
84 __field(u8
, reset_transient
)
85 __field(u8
, reset_reason
)
86 __field(u8
, csum_reqd
)
87 __field(u8
, infinite_map
)
91 __entry
->data_ack
= mpext
->ack64
? mpext
->data_ack
: mpext
->data_ack32
;
92 __entry
->data_seq
= mpext
->data_seq
;
93 __entry
->subflow_seq
= mpext
->subflow_seq
;
94 __entry
->data_len
= mpext
->data_len
;
95 __entry
->csum
= (__force u16
)mpext
->csum
;
96 __entry
->use_map
= mpext
->use_map
;
97 __entry
->dsn64
= mpext
->dsn64
;
98 __entry
->data_fin
= mpext
->data_fin
;
99 __entry
->use_ack
= mpext
->use_ack
;
100 __entry
->ack64
= mpext
->ack64
;
101 __entry
->mpc_map
= mpext
->mpc_map
;
102 __entry
->frozen
= mpext
->frozen
;
103 __entry
->reset_transient
= mpext
->reset_transient
;
104 __entry
->reset_reason
= mpext
->reset_reason
;
105 __entry
->csum_reqd
= mpext
->csum_reqd
;
106 __entry
->infinite_map
= mpext
->infinite_map
;
109 TP_printk("data_ack=%llu data_seq=%llu subflow_seq=%u data_len=%u csum=%x use_map=%u dsn64=%u data_fin=%u use_ack=%u ack64=%u mpc_map=%u frozen=%u reset_transient=%u reset_reason=%u csum_reqd=%u infinite_map=%u",
110 __entry
->data_ack
, __entry
->data_seq
,
111 __entry
->subflow_seq
, __entry
->data_len
,
112 __entry
->csum
, __entry
->use_map
,
113 __entry
->dsn64
, __entry
->data_fin
,
114 __entry
->use_ack
, __entry
->ack64
,
115 __entry
->mpc_map
, __entry
->frozen
,
116 __entry
->reset_transient
, __entry
->reset_reason
,
117 __entry
->csum_reqd
, __entry
->infinite_map
)
120 DEFINE_EVENT(mptcp_dump_mpext
, mptcp_sendmsg_frag
,
121 TP_PROTO(struct mptcp_ext
*mpext
),
124 DEFINE_EVENT(mptcp_dump_mpext
, get_mapping_status
,
125 TP_PROTO(struct mptcp_ext
*mpext
),
128 TRACE_EVENT(ack_update_msk
,
130 TP_PROTO(u64 data_ack
, u64 old_snd_una
,
131 u64 new_snd_una
, u64 new_wnd_end
,
134 TP_ARGS(data_ack
, old_snd_una
,
135 new_snd_una
, new_wnd_end
,
139 __field(u64
, data_ack
)
140 __field(u64
, old_snd_una
)
141 __field(u64
, new_snd_una
)
142 __field(u64
, new_wnd_end
)
143 __field(u64
, msk_wnd_end
)
147 __entry
->data_ack
= data_ack
;
148 __entry
->old_snd_una
= old_snd_una
;
149 __entry
->new_snd_una
= new_snd_una
;
150 __entry
->new_wnd_end
= new_wnd_end
;
151 __entry
->msk_wnd_end
= msk_wnd_end
;
154 TP_printk("data_ack=%llu old_snd_una=%llu new_snd_una=%llu new_wnd_end=%llu msk_wnd_end=%llu",
155 __entry
->data_ack
, __entry
->old_snd_una
,
156 __entry
->new_snd_una
, __entry
->new_wnd_end
,
157 __entry
->msk_wnd_end
)
160 TRACE_EVENT(subflow_check_data_avail
,
162 TP_PROTO(__u8 status
, struct sk_buff
*skb
),
164 TP_ARGS(status
, skb
),
168 __field(const void *, skb
)
172 __entry
->status
= status
;
176 TP_printk("mapping_status=%s, skb=%p",
177 show_mapping_status(__entry
->status
),
181 #endif /* _TRACE_MPTCP_H */
183 /* This part must be outside protection */
184 #include <trace/define_trace.h>