Tony Lu | 4826260 | 2021-11-01 15:39:12 +0800 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
| 2 | |
| 3 | #undef TRACE_SYSTEM |
| 4 | #define TRACE_SYSTEM smc |
| 5 | |
| 6 | #if !defined(_TRACE_SMC_H) || defined(TRACE_HEADER_MULTI_READ) |
| 7 | #define _TRACE_SMC_H |
| 8 | |
| 9 | #include <linux/ipv6.h> |
| 10 | #include <linux/tcp.h> |
| 11 | #include <linux/tracepoint.h> |
| 12 | #include <net/ipv6.h> |
| 13 | #include "smc.h" |
| 14 | #include "smc_core.h" |
| 15 | |
| 16 | TRACE_EVENT(smc_switch_to_fallback, |
| 17 | |
| 18 | TP_PROTO(const struct smc_sock *smc, int fallback_rsn), |
| 19 | |
| 20 | TP_ARGS(smc, fallback_rsn), |
| 21 | |
| 22 | TP_STRUCT__entry( |
| 23 | __field(const void *, sk) |
| 24 | __field(const void *, clcsk) |
Tony Lu | a838f50 | 2021-12-28 21:06:12 +0800 | [diff] [blame] | 25 | __field(u64, net_cookie) |
Tony Lu | 4826260 | 2021-11-01 15:39:12 +0800 | [diff] [blame] | 26 | __field(int, fallback_rsn) |
| 27 | ), |
| 28 | |
| 29 | TP_fast_assign( |
| 30 | const struct sock *sk = &smc->sk; |
| 31 | const struct sock *clcsk = smc->clcsock->sk; |
| 32 | |
| 33 | __entry->sk = sk; |
| 34 | __entry->clcsk = clcsk; |
Tony Lu | a838f50 | 2021-12-28 21:06:12 +0800 | [diff] [blame] | 35 | __entry->net_cookie = sock_net(sk)->net_cookie; |
Tony Lu | 4826260 | 2021-11-01 15:39:12 +0800 | [diff] [blame] | 36 | __entry->fallback_rsn = fallback_rsn; |
| 37 | ), |
| 38 | |
Tony Lu | a838f50 | 2021-12-28 21:06:12 +0800 | [diff] [blame] | 39 | TP_printk("sk=%p clcsk=%p net=%llu fallback_rsn=%d", |
| 40 | __entry->sk, __entry->clcsk, |
| 41 | __entry->net_cookie, __entry->fallback_rsn) |
Tony Lu | 4826260 | 2021-11-01 15:39:12 +0800 | [diff] [blame] | 42 | ); |
| 43 | |
Tony Lu | aff3083 | 2021-11-01 15:39:14 +0800 | [diff] [blame] | 44 | DECLARE_EVENT_CLASS(smc_msg_event, |
| 45 | |
| 46 | TP_PROTO(const struct smc_sock *smc, size_t len), |
| 47 | |
| 48 | TP_ARGS(smc, len), |
| 49 | |
| 50 | TP_STRUCT__entry( |
| 51 | __field(const void *, smc) |
Tony Lu | a838f50 | 2021-12-28 21:06:12 +0800 | [diff] [blame] | 52 | __field(u64, net_cookie) |
Tony Lu | aff3083 | 2021-11-01 15:39:14 +0800 | [diff] [blame] | 53 | __field(size_t, len) |
| 54 | __string(name, smc->conn.lnk->ibname) |
| 55 | ), |
| 56 | |
| 57 | TP_fast_assign( |
Tony Lu | a838f50 | 2021-12-28 21:06:12 +0800 | [diff] [blame] | 58 | const struct sock *sk = &smc->sk; |
| 59 | |
Tony Lu | aff3083 | 2021-11-01 15:39:14 +0800 | [diff] [blame] | 60 | __entry->smc = smc; |
Tony Lu | a838f50 | 2021-12-28 21:06:12 +0800 | [diff] [blame] | 61 | __entry->net_cookie = sock_net(sk)->net_cookie; |
Tony Lu | aff3083 | 2021-11-01 15:39:14 +0800 | [diff] [blame] | 62 | __entry->len = len; |
| 63 | __assign_str(name, smc->conn.lnk->ibname); |
| 64 | ), |
| 65 | |
Tony Lu | a838f50 | 2021-12-28 21:06:12 +0800 | [diff] [blame] | 66 | TP_printk("smc=%p net=%llu len=%zu dev=%s", |
| 67 | __entry->smc, __entry->net_cookie, |
| 68 | __entry->len, __get_str(name)) |
Tony Lu | aff3083 | 2021-11-01 15:39:14 +0800 | [diff] [blame] | 69 | ); |
| 70 | |
| 71 | DEFINE_EVENT(smc_msg_event, smc_tx_sendmsg, |
| 72 | |
| 73 | TP_PROTO(const struct smc_sock *smc, size_t len), |
| 74 | |
| 75 | TP_ARGS(smc, len) |
| 76 | ); |
| 77 | |
| 78 | DEFINE_EVENT(smc_msg_event, smc_rx_recvmsg, |
| 79 | |
| 80 | TP_PROTO(const struct smc_sock *smc, size_t len), |
| 81 | |
| 82 | TP_ARGS(smc, len) |
| 83 | ); |
| 84 | |
Tony Lu | a3a0e81 | 2021-11-01 15:39:16 +0800 | [diff] [blame] | 85 | TRACE_EVENT(smcr_link_down, |
| 86 | |
| 87 | TP_PROTO(const struct smc_link *lnk, void *location), |
| 88 | |
| 89 | TP_ARGS(lnk, location), |
| 90 | |
| 91 | TP_STRUCT__entry( |
| 92 | __field(const void *, lnk) |
| 93 | __field(const void *, lgr) |
Tony Lu | a838f50 | 2021-12-28 21:06:12 +0800 | [diff] [blame] | 94 | __field(u64, net_cookie) |
Tony Lu | a3a0e81 | 2021-11-01 15:39:16 +0800 | [diff] [blame] | 95 | __field(int, state) |
| 96 | __string(name, lnk->ibname) |
| 97 | __field(void *, location) |
| 98 | ), |
| 99 | |
| 100 | TP_fast_assign( |
| 101 | const struct smc_link_group *lgr = lnk->lgr; |
| 102 | |
| 103 | __entry->lnk = lnk; |
| 104 | __entry->lgr = lgr; |
Tony Lu | a838f50 | 2021-12-28 21:06:12 +0800 | [diff] [blame] | 105 | __entry->net_cookie = lgr->net->net_cookie; |
Tony Lu | a3a0e81 | 2021-11-01 15:39:16 +0800 | [diff] [blame] | 106 | __entry->state = lnk->state; |
| 107 | __assign_str(name, lnk->ibname); |
| 108 | __entry->location = location; |
| 109 | ), |
| 110 | |
Tony Lu | a838f50 | 2021-12-28 21:06:12 +0800 | [diff] [blame] | 111 | TP_printk("lnk=%p lgr=%p net=%llu state=%d dev=%s location=%pS", |
| 112 | __entry->lnk, __entry->lgr, __entry->net_cookie, |
Tony Lu | a3a0e81 | 2021-11-01 15:39:16 +0800 | [diff] [blame] | 113 | __entry->state, __get_str(name), |
| 114 | __entry->location) |
| 115 | ); |
| 116 | |
Tony Lu | 4826260 | 2021-11-01 15:39:12 +0800 | [diff] [blame] | 117 | #endif /* _TRACE_SMC_H */ |
| 118 | |
| 119 | #undef TRACE_INCLUDE_PATH |
| 120 | #define TRACE_INCLUDE_PATH . |
| 121 | |
| 122 | #undef TRACE_INCLUDE_FILE |
| 123 | #define TRACE_INCLUDE_FILE smc_tracepoint |
| 124 | |
| 125 | #include <trace/define_trace.h> |