blob: 59c945b66f9c7469bc071e2a27efb8bfa9eb19f7 [file] [log] [blame]
Jesper Dangaard Brouere5430022017-08-15 21:11:03 +02001#undef TRACE_SYSTEM
2#define TRACE_SYSTEM qdisc
3
4#if !defined(_TRACE_QDISC_H) || defined(TRACE_HEADER_MULTI_READ)
Masahiro Yamadab1d45c22019-07-20 19:39:43 +09005#define _TRACE_QDISC_H
Jesper Dangaard Brouere5430022017-08-15 21:11:03 +02006
7#include <linux/skbuff.h>
8#include <linux/netdevice.h>
9#include <linux/tracepoint.h>
10#include <linux/ftrace.h>
Cong Wanga34dac02020-05-26 21:35:24 -070011#include <linux/pkt_sched.h>
12#include <net/sch_generic.h>
Jesper Dangaard Brouere5430022017-08-15 21:11:03 +020013
14TRACE_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
Qitao Xu851f36e2021-07-14 23:00:21 -070044 TP_printk("dequeue ifindex=%d qdisc handle=0x%X parent=0x%X txq_state=0x%lX packets=%d skbaddr=%px",
Jesper Dangaard Brouere5430022017-08-15 21:11:03 +020045 __entry->ifindex, __entry->handle, __entry->parent,
46 __entry->txq_state, __entry->packets, __entry->skbaddr )
47);
48
Qitao Xu70713dd2021-07-14 23:03:24 -070049TRACE_EVENT(qdisc_enqueue,
50
51 TP_PROTO(struct Qdisc *qdisc, const struct netdev_queue *txq, struct sk_buff *skb),
52
53 TP_ARGS(qdisc, txq, skb),
54
55 TP_STRUCT__entry(
56 __field(struct Qdisc *, qdisc)
Tonghao Zhang409f3862021-07-27 21:14:13 +080057 __field(const struct netdev_queue *, txq)
Qitao Xu70713dd2021-07-14 23:03:24 -070058 __field(void *, skbaddr)
59 __field(int, ifindex)
60 __field(u32, handle)
61 __field(u32, parent)
62 ),
63
64 TP_fast_assign(
65 __entry->qdisc = qdisc;
Tonghao Zhang409f3862021-07-27 21:14:13 +080066 __entry->txq = txq;
Qitao Xu70713dd2021-07-14 23:03:24 -070067 __entry->skbaddr = skb;
68 __entry->ifindex = txq->dev ? txq->dev->ifindex : 0;
69 __entry->handle = qdisc->handle;
70 __entry->parent = qdisc->parent;
71 ),
72
73 TP_printk("enqueue ifindex=%d qdisc handle=0x%X parent=0x%X skbaddr=%px",
74 __entry->ifindex, __entry->handle, __entry->parent, __entry->skbaddr)
75);
76
Cong Wanga34dac02020-05-26 21:35:24 -070077TRACE_EVENT(qdisc_reset,
78
79 TP_PROTO(struct Qdisc *q),
80
81 TP_ARGS(q),
82
83 TP_STRUCT__entry(
84 __string( dev, qdisc_dev(q) )
85 __string( kind, q->ops->id )
86 __field( u32, parent )
87 __field( u32, handle )
88 ),
89
90 TP_fast_assign(
91 __assign_str(dev, qdisc_dev(q));
92 __assign_str(kind, q->ops->id);
93 __entry->parent = q->parent;
94 __entry->handle = q->handle;
95 ),
96
97 TP_printk("dev=%s kind=%s parent=%x:%x handle=%x:%x", __get_str(dev),
98 __get_str(kind), TC_H_MAJ(__entry->parent) >> 16, TC_H_MIN(__entry->parent),
99 TC_H_MAJ(__entry->handle) >> 16, TC_H_MIN(__entry->handle))
100);
101
102TRACE_EVENT(qdisc_destroy,
103
104 TP_PROTO(struct Qdisc *q),
105
106 TP_ARGS(q),
107
108 TP_STRUCT__entry(
109 __string( dev, qdisc_dev(q) )
110 __string( kind, q->ops->id )
111 __field( u32, parent )
112 __field( u32, handle )
113 ),
114
115 TP_fast_assign(
116 __assign_str(dev, qdisc_dev(q));
117 __assign_str(kind, q->ops->id);
118 __entry->parent = q->parent;
119 __entry->handle = q->handle;
120 ),
121
122 TP_printk("dev=%s kind=%s parent=%x:%x handle=%x:%x", __get_str(dev),
123 __get_str(kind), TC_H_MAJ(__entry->parent) >> 16, TC_H_MIN(__entry->parent),
124 TC_H_MAJ(__entry->handle) >> 16, TC_H_MIN(__entry->handle))
125);
126
Cong Wangf5a78332020-05-26 21:35:25 -0700127TRACE_EVENT(qdisc_create,
128
129 TP_PROTO(const struct Qdisc_ops *ops, struct net_device *dev, u32 parent),
130
131 TP_ARGS(ops, dev, parent),
132
133 TP_STRUCT__entry(
134 __string( dev, dev->name )
135 __string( kind, ops->id )
136 __field( u32, parent )
137 ),
138
139 TP_fast_assign(
140 __assign_str(dev, dev->name);
141 __assign_str(kind, ops->id);
142 __entry->parent = parent;
143 ),
144
145 TP_printk("dev=%s kind=%s parent=%x:%x",
146 __get_str(dev), __get_str(kind),
147 TC_H_MAJ(__entry->parent) >> 16, TC_H_MIN(__entry->parent))
148);
149
Masahiro Yamadab1d45c22019-07-20 19:39:43 +0900150#endif /* _TRACE_QDISC_H */
Jesper Dangaard Brouere5430022017-08-15 21:11:03 +0200151
152/* This part must be outside protection */
153#include <trace/define_trace.h>