Geliang Tang | e10a989 | 2021-04-16 15:38:04 -0700 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
| 2 | #undef TRACE_SYSTEM |
| 3 | #define TRACE_SYSTEM mptcp |
| 4 | |
| 5 | #if !defined(_TRACE_MPTCP_H) || defined(TRACE_HEADER_MULTI_READ) |
| 6 | #define _TRACE_MPTCP_H |
| 7 | |
| 8 | #include <linux/tracepoint.h> |
| 9 | |
Geliang Tang | d96a838 | 2021-04-16 15:38:07 -0700 | [diff] [blame] | 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" }) |
| 17 | |
Geliang Tang | e10a989 | 2021-04-16 15:38:04 -0700 | [diff] [blame] | 18 | TRACE_EVENT(mptcp_subflow_get_send, |
| 19 | |
| 20 | TP_PROTO(struct mptcp_subflow_context *subflow), |
| 21 | |
| 22 | TP_ARGS(subflow), |
| 23 | |
| 24 | TP_STRUCT__entry( |
| 25 | __field(bool, active) |
| 26 | __field(bool, free) |
| 27 | __field(u32, snd_wnd) |
| 28 | __field(u32, pace) |
| 29 | __field(u8, backup) |
| 30 | __field(u64, ratio) |
| 31 | ), |
| 32 | |
| 33 | TP_fast_assign( |
| 34 | struct sock *ssk; |
| 35 | |
| 36 | __entry->active = mptcp_subflow_active(subflow); |
| 37 | __entry->backup = subflow->backup; |
| 38 | |
| 39 | if (subflow->tcp_sock && sk_fullsock(subflow->tcp_sock)) |
| 40 | __entry->free = sk_stream_memory_free(subflow->tcp_sock); |
| 41 | else |
| 42 | __entry->free = 0; |
| 43 | |
| 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 = ssk->sk_pacing_rate; |
| 48 | } else { |
| 49 | __entry->snd_wnd = 0; |
| 50 | __entry->pace = 0; |
| 51 | } |
| 52 | |
| 53 | if (ssk && sk_fullsock(ssk) && __entry->pace) |
| 54 | __entry->ratio = div_u64((u64)ssk->sk_wmem_queued << 32, __entry->pace); |
| 55 | else |
| 56 | __entry->ratio = 0; |
| 57 | ), |
| 58 | |
| 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) |
| 63 | ); |
| 64 | |
Geliang Tang | 0918e34 | 2021-04-16 15:38:05 -0700 | [diff] [blame] | 65 | DECLARE_EVENT_CLASS(mptcp_dump_mpext, |
| 66 | |
| 67 | TP_PROTO(struct mptcp_ext *mpext), |
| 68 | |
| 69 | TP_ARGS(mpext), |
| 70 | |
| 71 | TP_STRUCT__entry( |
| 72 | __field(u64, data_ack) |
| 73 | __field(u64, data_seq) |
| 74 | __field(u32, subflow_seq) |
| 75 | __field(u16, data_len) |
Geliang Tang | 401e303 | 2021-06-17 16:46:20 -0700 | [diff] [blame] | 76 | __field(u16, csum) |
Geliang Tang | 0918e34 | 2021-04-16 15:38:05 -0700 | [diff] [blame] | 77 | __field(u8, use_map) |
| 78 | __field(u8, dsn64) |
| 79 | __field(u8, data_fin) |
| 80 | __field(u8, use_ack) |
| 81 | __field(u8, ack64) |
| 82 | __field(u8, mpc_map) |
| 83 | __field(u8, frozen) |
| 84 | __field(u8, reset_transient) |
| 85 | __field(u8, reset_reason) |
Geliang Tang | 401e303 | 2021-06-17 16:46:20 -0700 | [diff] [blame] | 86 | __field(u8, csum_reqd) |
Geliang Tang | 0918e34 | 2021-04-16 15:38:05 -0700 | [diff] [blame] | 87 | ), |
| 88 | |
| 89 | TP_fast_assign( |
| 90 | __entry->data_ack = mpext->ack64 ? mpext->data_ack : mpext->data_ack32; |
| 91 | __entry->data_seq = mpext->data_seq; |
| 92 | __entry->subflow_seq = mpext->subflow_seq; |
| 93 | __entry->data_len = mpext->data_len; |
Geliang Tang | 401e303 | 2021-06-17 16:46:20 -0700 | [diff] [blame] | 94 | __entry->csum = (__force u16)mpext->csum; |
Geliang Tang | 0918e34 | 2021-04-16 15:38:05 -0700 | [diff] [blame] | 95 | __entry->use_map = mpext->use_map; |
| 96 | __entry->dsn64 = mpext->dsn64; |
| 97 | __entry->data_fin = mpext->data_fin; |
| 98 | __entry->use_ack = mpext->use_ack; |
| 99 | __entry->ack64 = mpext->ack64; |
| 100 | __entry->mpc_map = mpext->mpc_map; |
| 101 | __entry->frozen = mpext->frozen; |
| 102 | __entry->reset_transient = mpext->reset_transient; |
| 103 | __entry->reset_reason = mpext->reset_reason; |
Geliang Tang | 401e303 | 2021-06-17 16:46:20 -0700 | [diff] [blame] | 104 | __entry->csum_reqd = mpext->csum_reqd; |
Geliang Tang | 0918e34 | 2021-04-16 15:38:05 -0700 | [diff] [blame] | 105 | ), |
| 106 | |
Geliang Tang | 401e303 | 2021-06-17 16:46:20 -0700 | [diff] [blame] | 107 | 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", |
Geliang Tang | 0918e34 | 2021-04-16 15:38:05 -0700 | [diff] [blame] | 108 | __entry->data_ack, __entry->data_seq, |
| 109 | __entry->subflow_seq, __entry->data_len, |
Geliang Tang | 401e303 | 2021-06-17 16:46:20 -0700 | [diff] [blame] | 110 | __entry->csum, __entry->use_map, |
| 111 | __entry->dsn64, __entry->data_fin, |
| 112 | __entry->use_ack, __entry->ack64, |
| 113 | __entry->mpc_map, __entry->frozen, |
| 114 | __entry->reset_transient, __entry->reset_reason, |
| 115 | __entry->csum_reqd) |
Geliang Tang | 0918e34 | 2021-04-16 15:38:05 -0700 | [diff] [blame] | 116 | ); |
| 117 | |
| 118 | DEFINE_EVENT(mptcp_dump_mpext, get_mapping_status, |
| 119 | TP_PROTO(struct mptcp_ext *mpext), |
| 120 | TP_ARGS(mpext)); |
| 121 | |
Geliang Tang | ed66bfb | 2021-04-16 15:38:06 -0700 | [diff] [blame] | 122 | TRACE_EVENT(ack_update_msk, |
| 123 | |
| 124 | TP_PROTO(u64 data_ack, u64 old_snd_una, |
| 125 | u64 new_snd_una, u64 new_wnd_end, |
| 126 | u64 msk_wnd_end), |
| 127 | |
| 128 | TP_ARGS(data_ack, old_snd_una, |
| 129 | new_snd_una, new_wnd_end, |
| 130 | msk_wnd_end), |
| 131 | |
| 132 | TP_STRUCT__entry( |
| 133 | __field(u64, data_ack) |
| 134 | __field(u64, old_snd_una) |
| 135 | __field(u64, new_snd_una) |
| 136 | __field(u64, new_wnd_end) |
| 137 | __field(u64, msk_wnd_end) |
| 138 | ), |
| 139 | |
| 140 | TP_fast_assign( |
| 141 | __entry->data_ack = data_ack; |
| 142 | __entry->old_snd_una = old_snd_una; |
| 143 | __entry->new_snd_una = new_snd_una; |
| 144 | __entry->new_wnd_end = new_wnd_end; |
| 145 | __entry->msk_wnd_end = msk_wnd_end; |
| 146 | ), |
| 147 | |
| 148 | TP_printk("data_ack=%llu old_snd_una=%llu new_snd_una=%llu new_wnd_end=%llu msk_wnd_end=%llu", |
| 149 | __entry->data_ack, __entry->old_snd_una, |
| 150 | __entry->new_snd_una, __entry->new_wnd_end, |
| 151 | __entry->msk_wnd_end) |
| 152 | ); |
| 153 | |
Geliang Tang | d96a838 | 2021-04-16 15:38:07 -0700 | [diff] [blame] | 154 | TRACE_EVENT(subflow_check_data_avail, |
| 155 | |
| 156 | TP_PROTO(__u8 status, struct sk_buff *skb), |
| 157 | |
| 158 | TP_ARGS(status, skb), |
| 159 | |
| 160 | TP_STRUCT__entry( |
| 161 | __field(u8, status) |
| 162 | __field(const void *, skb) |
| 163 | ), |
| 164 | |
| 165 | TP_fast_assign( |
| 166 | __entry->status = status; |
| 167 | __entry->skb = skb; |
| 168 | ), |
| 169 | |
| 170 | TP_printk("mapping_status=%s, skb=%p", |
| 171 | show_mapping_status(__entry->status), |
| 172 | __entry->skb) |
| 173 | ); |
| 174 | |
Geliang Tang | e10a989 | 2021-04-16 15:38:04 -0700 | [diff] [blame] | 175 | #endif /* _TRACE_MPTCP_H */ |
| 176 | |
| 177 | /* This part must be outside protection */ |
| 178 | #include <trace/define_trace.h> |