aboutsummaryrefslogtreecommitdiff
path: root/include/trace/events/qdisc.h
blob: 1f4258308b967a9ca8e17bbf61ba4ef07b6d786b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
#undef TRACE_SYSTEM
#define TRACE_SYSTEM qdisc

#if !defined(_TRACE_QDISC_H) || defined(TRACE_HEADER_MULTI_READ)
#define _TRACE_QDISC_H

#include <linux/skbuff.h>
#include <linux/netdevice.h>
#include <linux/tracepoint.h>
#include <linux/ftrace.h>
#include <linux/pkt_sched.h>
#include <net/sch_generic.h>

TRACE_EVENT(qdisc_dequeue,

	TP_PROTO(struct Qdisc *qdisc, const struct netdev_queue *txq,
		 int packets, struct sk_buff *skb),

	TP_ARGS(qdisc, txq, packets, skb),

	TP_STRUCT__entry(
		__field(	struct Qdisc *,		qdisc	)
		__field(const	struct netdev_queue *,	txq	)
		__field(	int,			packets	)
		__field(	void *,			skbaddr	)
		__field(	int,			ifindex	)
		__field(	u32,			handle	)
		__field(	u32,			parent	)
		__field(	unsigned long,		txq_state)
	),

	/* skb==NULL indicate packets dequeued was 0, even when packets==1 */
	TP_fast_assign(
		__entry->qdisc		= qdisc;
		__entry->txq		= txq;
		__entry->packets	= skb ? packets : 0;
		__entry->skbaddr	= skb;
		__entry->ifindex	= txq->dev ? txq->dev->ifindex : 0;
		__entry->handle		= qdisc->handle;
		__entry->parent		= qdisc->parent;
		__entry->txq_state	= txq->state;
	),

	TP_printk("dequeue ifindex=%d qdisc handle=0x%X parent=0x%X txq_state=0x%lX packets=%d skbaddr=%p",
		  __entry->ifindex, __entry->handle, __entry->parent,
		  __entry->txq_state, __entry->packets, __entry->skbaddr )
);

TRACE_EVENT(qdisc_enqueue,

	TP_PROTO(struct Qdisc *qdisc, const struct netdev_queue *txq, struct sk_buff *skb),

	TP_ARGS(qdisc, txq, skb),

	TP_STRUCT__entry(
		__field(struct Qdisc *, qdisc)
		__field(const struct netdev_queue *, txq)
		__field(void *,	skbaddr)
		__field(int, ifindex)
		__field(u32, handle)
		__field(u32, parent)
	),

	TP_fast_assign(
		__entry->qdisc = qdisc;
		__entry->txq	 = txq;
		__entry->skbaddr = skb;
		__entry->ifindex = txq->dev ? txq->dev->ifindex : 0;
		__entry->handle	 = qdisc->handle;
		__entry->parent	 = qdisc->parent;
	),

	TP_printk("enqueue ifindex=%d qdisc handle=0x%X parent=0x%X skbaddr=%p",
		  __entry->ifindex, __entry->handle, __entry->parent, __entry->skbaddr)
);

TRACE_EVENT(qdisc_reset,

	TP_PROTO(struct Qdisc *q),

	TP_ARGS(q),

	TP_STRUCT__entry(
		__string(	dev,		qdisc_dev(q)->name	)
		__string(	kind,		q->ops->id		)
		__field(	u32,		parent			)
		__field(	u32,		handle			)
	),

	TP_fast_assign(
		__assign_str(dev, qdisc_dev(q)->name);
		__assign_str(kind, q->ops->id);
		__entry->parent = q->parent;
		__entry->handle = q->handle;
	),

	TP_printk("dev=%s kind=%s parent=%x:%x handle=%x:%x", __get_str(dev),
		  __get_str(kind), TC_H_MAJ(__entry->parent) >> 16, TC_H_MIN(__entry->parent),
		  TC_H_MAJ(__entry->handle) >> 16, TC_H_MIN(__entry->handle))
);

TRACE_EVENT(qdisc_destroy,

	TP_PROTO(struct Qdisc *q),

	TP_ARGS(q),

	TP_STRUCT__entry(
		__string(	dev,		qdisc_dev(q)->name	)
		__string(	kind,		q->ops->id		)
		__field(	u32,		parent			)
		__field(	u32,		handle			)
	),

	TP_fast_assign(
		__assign_str(dev, qdisc_dev(q)->name);
		__assign_str(kind, q->ops->id);
		__entry->parent = q->parent;
		__entry->handle = q->handle;
	),

	TP_printk("dev=%s kind=%s parent=%x:%x handle=%x:%x", __get_str(dev),
		  __get_str(kind), TC_H_MAJ(__entry->parent) >> 16, TC_H_MIN(__entry->parent),
		  TC_H_MAJ(__entry->handle) >> 16, TC_H_MIN(__entry->handle))
);

TRACE_EVENT(qdisc_create,

	TP_PROTO(const struct Qdisc_ops *ops, struct net_device *dev, u32 parent),

	TP_ARGS(ops, dev, parent),

	TP_STRUCT__entry(
		__string(	dev,		dev->name	)
		__string(	kind,		ops->id		)
		__field(	u32,		parent		)
	),

	TP_fast_assign(
		__assign_str(dev, dev->name);
		__assign_str(kind, ops->id);
		__entry->parent = parent;
	),

	TP_printk("dev=%s kind=%s parent=%x:%x",
		  __get_str(dev), __get_str(kind),
		  TC_H_MAJ(__entry->parent) >> 16, TC_H_MIN(__entry->parent))
);

#endif /* _TRACE_QDISC_H */

/* This part must be outside protection */
#include <trace/define_trace.h>