| 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
| 2 | #undef TRACE_SYSTEM |
| 3 | #define TRACE_SYSTEM sock |
| 4 | |
| 5 | #if !defined(LTTNG_TRACE_SOCK_H) || defined(TRACE_HEADER_MULTI_READ) |
| 6 | #define LTTNG_TRACE_SOCK_H |
| 7 | |
| 8 | #include <probes/lttng-tracepoint-event.h> |
| 9 | #include <linux/version.h> |
| 10 | #include <net/sock.h> |
| 11 | |
| 12 | LTTNG_TRACEPOINT_EVENT(sock_rcvqueue_full, |
| 13 | |
| 14 | TP_PROTO(struct sock *sk, struct sk_buff *skb), |
| 15 | |
| 16 | TP_ARGS(sk, skb), |
| 17 | |
| 18 | TP_FIELDS( |
| 19 | ctf_integer(int, rmem_alloc, atomic_read(&sk->sk_rmem_alloc)) |
| 20 | ctf_integer(unsigned int, truesize, skb->truesize) |
| 21 | ctf_integer(int, sk_rcvbuf, sk->sk_rcvbuf) |
| 22 | ) |
| 23 | ) |
| 24 | |
| 25 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,19,0)) |
| 26 | |
| 27 | LTTNG_TRACEPOINT_EVENT(sock_exceed_buf_limit, |
| 28 | |
| 29 | TP_PROTO(struct sock *sk, struct proto *prot, long allocated, int kind), |
| 30 | |
| 31 | TP_ARGS(sk, prot, allocated, kind), |
| 32 | |
| 33 | TP_FIELDS( |
| 34 | ctf_string(name, prot->name) |
| 35 | ctf_array(long, sysctl_mem, prot->sysctl_mem, 3) |
| 36 | ctf_integer(long, allocated, allocated) |
| 37 | ctf_integer(int, sysctl_rmem, sk_get_rmem0(sk, prot)) |
| 38 | ctf_integer(int, rmem_alloc, atomic_read(&sk->sk_rmem_alloc)) |
| 39 | ctf_integer(int, sysctl_wmem, sk_get_wmem0(sk, prot)) |
| 40 | ctf_integer(int, wmem_alloc, refcount_read(&sk->sk_wmem_alloc)) |
| 41 | ctf_integer(int, wmem_queued, sk->sk_wmem_queued) |
| 42 | ctf_integer(int, kind, kind) |
| 43 | ) |
| 44 | ) |
| 45 | |
| 46 | #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4,15,0)) |
| 47 | |
| 48 | LTTNG_TRACEPOINT_EVENT(sock_exceed_buf_limit, |
| 49 | |
| 50 | TP_PROTO(struct sock *sk, struct proto *prot, long allocated), |
| 51 | |
| 52 | TP_ARGS(sk, prot, allocated), |
| 53 | |
| 54 | TP_FIELDS( |
| 55 | ctf_string(name, prot->name) |
| 56 | ctf_array(long, sysctl_mem, prot->sysctl_mem, 3) |
| 57 | ctf_integer(long, allocated, allocated) |
| 58 | ctf_integer(int, sysctl_rmem, sk_get_rmem0(sk, prot)) |
| 59 | ctf_integer(int, rmem_alloc, atomic_read(&sk->sk_rmem_alloc)) |
| 60 | ) |
| 61 | ) |
| 62 | |
| 63 | #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,15,0)) */ |
| 64 | |
| 65 | LTTNG_TRACEPOINT_EVENT(sock_exceed_buf_limit, |
| 66 | |
| 67 | TP_PROTO(struct sock *sk, struct proto *prot, long allocated), |
| 68 | |
| 69 | TP_ARGS(sk, prot, allocated), |
| 70 | |
| 71 | TP_FIELDS( |
| 72 | ctf_string(name, prot->name) |
| 73 | ctf_array(long, sysctl_mem, prot->sysctl_mem, 3) |
| 74 | ctf_integer(long, allocated, allocated) |
| 75 | ctf_integer(int, sysctl_rmem, prot->sysctl_rmem[0]) |
| 76 | ctf_integer(int, rmem_alloc, atomic_read(&sk->sk_rmem_alloc)) |
| 77 | ) |
| 78 | ) |
| 79 | |
| 80 | #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,15,0)) */ |
| 81 | |
| 82 | #endif /* LTTNG_TRACE_SOCK_H */ |
| 83 | |
| 84 | /* This part must be outside protection */ |
| 85 | #include <probes/define_trace.h> |