xref: /linux/include/trace/events/qdisc.h (revision 87c9c16317882dd6dbbc07e349bc3223e14f3244)
1 #undef TRACE_SYSTEM
2 #define TRACE_SYSTEM qdisc
3 
4 #if !defined(_TRACE_QDISC_H) || defined(TRACE_HEADER_MULTI_READ)
5 #define _TRACE_QDISC_H
6 
7 #include <linux/skbuff.h>
8 #include <linux/netdevice.h>
9 #include <linux/tracepoint.h>
10 #include <linux/ftrace.h>
11 #include <linux/pkt_sched.h>
12 #include <net/sch_generic.h>
13 
14 TRACE_EVENT(qdisc_dequeue,
15 
16 	TP_PROTO(struct Qdisc *qdisc, const struct netdev_queue *txq,
17 		 int packets, struct sk_buff *skb),
18 
19 	TP_ARGS(qdisc, txq, packets, skb),
20 
21 	TP_STRUCT__entry(
22 		__field(	struct Qdisc *,		qdisc	)
23 		__field(const	struct netdev_queue *,	txq	)
24 		__field(	int,			packets	)
25 		__field(	void *,			skbaddr	)
26 		__field(	int,			ifindex	)
27 		__field(	u32,			handle	)
28 		__field(	u32,			parent	)
29 		__field(	unsigned long,		txq_state)
30 	),
31 
32 	/* skb==NULL indicate packets dequeued was 0, even when packets==1 */
33 	TP_fast_assign(
34 		__entry->qdisc		= qdisc;
35 		__entry->txq		= txq;
36 		__entry->packets	= skb ? packets : 0;
37 		__entry->skbaddr	= skb;
38 		__entry->ifindex	= txq->dev ? txq->dev->ifindex : 0;
39 		__entry->handle		= qdisc->handle;
40 		__entry->parent		= qdisc->parent;
41 		__entry->txq_state	= txq->state;
42 	),
43 
44 	TP_printk("dequeue ifindex=%d qdisc handle=0x%X parent=0x%X txq_state=0x%lX packets=%d skbaddr=%p",
45 		  __entry->ifindex, __entry->handle, __entry->parent,
46 		  __entry->txq_state, __entry->packets, __entry->skbaddr )
47 );
48 
49 TRACE_EVENT(qdisc_reset,
50 
51 	TP_PROTO(struct Qdisc *q),
52 
53 	TP_ARGS(q),
54 
55 	TP_STRUCT__entry(
56 		__string(	dev,		qdisc_dev(q)	)
57 		__string(	kind,		q->ops->id	)
58 		__field(	u32,		parent		)
59 		__field(	u32,		handle		)
60 	),
61 
62 	TP_fast_assign(
63 		__assign_str(dev, qdisc_dev(q));
64 		__assign_str(kind, q->ops->id);
65 		__entry->parent = q->parent;
66 		__entry->handle = q->handle;
67 	),
68 
69 	TP_printk("dev=%s kind=%s parent=%x:%x handle=%x:%x", __get_str(dev),
70 		  __get_str(kind), TC_H_MAJ(__entry->parent) >> 16, TC_H_MIN(__entry->parent),
71 		  TC_H_MAJ(__entry->handle) >> 16, TC_H_MIN(__entry->handle))
72 );
73 
74 TRACE_EVENT(qdisc_destroy,
75 
76 	TP_PROTO(struct Qdisc *q),
77 
78 	TP_ARGS(q),
79 
80 	TP_STRUCT__entry(
81 		__string(	dev,		qdisc_dev(q)	)
82 		__string(	kind,		q->ops->id	)
83 		__field(	u32,		parent		)
84 		__field(	u32,		handle		)
85 	),
86 
87 	TP_fast_assign(
88 		__assign_str(dev, qdisc_dev(q));
89 		__assign_str(kind, q->ops->id);
90 		__entry->parent = q->parent;
91 		__entry->handle = q->handle;
92 	),
93 
94 	TP_printk("dev=%s kind=%s parent=%x:%x handle=%x:%x", __get_str(dev),
95 		  __get_str(kind), TC_H_MAJ(__entry->parent) >> 16, TC_H_MIN(__entry->parent),
96 		  TC_H_MAJ(__entry->handle) >> 16, TC_H_MIN(__entry->handle))
97 );
98 
99 TRACE_EVENT(qdisc_create,
100 
101 	TP_PROTO(const struct Qdisc_ops *ops, struct net_device *dev, u32 parent),
102 
103 	TP_ARGS(ops, dev, parent),
104 
105 	TP_STRUCT__entry(
106 		__string(	dev,		dev->name	)
107 		__string(	kind,		ops->id		)
108 		__field(	u32,		parent		)
109 	),
110 
111 	TP_fast_assign(
112 		__assign_str(dev, dev->name);
113 		__assign_str(kind, ops->id);
114 		__entry->parent = parent;
115 	),
116 
117 	TP_printk("dev=%s kind=%s parent=%x:%x",
118 		  __get_str(dev), __get_str(kind),
119 		  TC_H_MAJ(__entry->parent) >> 16, TC_H_MIN(__entry->parent))
120 );
121 
122 #endif /* _TRACE_QDISC_H */
123 
124 /* This part must be outside protection */
125 #include <trace/define_trace.h>
126