Greg Kroah-Hartman | b244131 | 2017-11-01 15:07:57 +0100 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
Satoru Moriya | 3847ce3 | 2011-06-17 12:00:03 +0000 | [diff] [blame] | 2 | #undef TRACE_SYSTEM |
| 3 | #define TRACE_SYSTEM sock |
| 4 | |
| 5 | #if !defined(_TRACE_SOCK_H) || defined(TRACE_HEADER_MULTI_READ) |
| 6 | #define _TRACE_SOCK_H |
| 7 | |
| 8 | #include <net/sock.h> |
| 9 | #include <linux/tracepoint.h> |
| 10 | |
| 11 | TRACE_EVENT(sock_rcvqueue_full, |
| 12 | |
| 13 | TP_PROTO(struct sock *sk, struct sk_buff *skb), |
| 14 | |
| 15 | TP_ARGS(sk, skb), |
| 16 | |
| 17 | TP_STRUCT__entry( |
| 18 | __field(int, rmem_alloc) |
| 19 | __field(unsigned int, truesize) |
| 20 | __field(int, sk_rcvbuf) |
| 21 | ), |
| 22 | |
| 23 | TP_fast_assign( |
| 24 | __entry->rmem_alloc = atomic_read(&sk->sk_rmem_alloc); |
| 25 | __entry->truesize = skb->truesize; |
| 26 | __entry->sk_rcvbuf = sk->sk_rcvbuf; |
| 27 | ), |
| 28 | |
| 29 | TP_printk("rmem_alloc=%d truesize=%u sk_rcvbuf=%d", |
| 30 | __entry->rmem_alloc, __entry->truesize, __entry->sk_rcvbuf) |
| 31 | ); |
| 32 | |
| 33 | TRACE_EVENT(sock_exceed_buf_limit, |
| 34 | |
| 35 | TP_PROTO(struct sock *sk, struct proto *prot, long allocated), |
| 36 | |
| 37 | TP_ARGS(sk, prot, allocated), |
| 38 | |
| 39 | TP_STRUCT__entry( |
| 40 | __array(char, name, 32) |
| 41 | __field(long *, sysctl_mem) |
| 42 | __field(long, allocated) |
| 43 | __field(int, sysctl_rmem) |
| 44 | __field(int, rmem_alloc) |
| 45 | ), |
| 46 | |
| 47 | TP_fast_assign( |
| 48 | strncpy(__entry->name, prot->name, 32); |
| 49 | __entry->sysctl_mem = prot->sysctl_mem; |
| 50 | __entry->allocated = allocated; |
| 51 | __entry->sysctl_rmem = prot->sysctl_rmem[0]; |
| 52 | __entry->rmem_alloc = atomic_read(&sk->sk_rmem_alloc); |
| 53 | ), |
| 54 | |
| 55 | TP_printk("proto:%s sysctl_mem=%ld,%ld,%ld allocated=%ld " |
| 56 | "sysctl_rmem=%d rmem_alloc=%d", |
| 57 | __entry->name, |
| 58 | __entry->sysctl_mem[0], |
| 59 | __entry->sysctl_mem[1], |
| 60 | __entry->sysctl_mem[2], |
| 61 | __entry->allocated, |
| 62 | __entry->sysctl_rmem, |
| 63 | __entry->rmem_alloc) |
| 64 | ); |
| 65 | |
| 66 | #endif /* _TRACE_SOCK_H */ |
| 67 | |
| 68 | /* This part must be outside protection */ |
| 69 | #include <trace/define_trace.h> |