1e543002fSJesper Dangaard Brouer #undef TRACE_SYSTEM 2e543002fSJesper Dangaard Brouer #define TRACE_SYSTEM qdisc 3e543002fSJesper Dangaard Brouer 4e543002fSJesper Dangaard Brouer #if !defined(_TRACE_QDISC_H) || defined(TRACE_HEADER_MULTI_READ) 5b1d45c23SMasahiro Yamada #define _TRACE_QDISC_H 6e543002fSJesper Dangaard Brouer 7e543002fSJesper Dangaard Brouer #include <linux/skbuff.h> 8e543002fSJesper Dangaard Brouer #include <linux/netdevice.h> 9e543002fSJesper Dangaard Brouer #include <linux/tracepoint.h> 10e543002fSJesper Dangaard Brouer #include <linux/ftrace.h> 11a34dac0bSCong Wang #include <linux/pkt_sched.h> 12a34dac0bSCong Wang #include <net/sch_generic.h> 13e543002fSJesper Dangaard Brouer 14e543002fSJesper Dangaard Brouer TRACE_EVENT(qdisc_dequeue, 15e543002fSJesper Dangaard Brouer 16e543002fSJesper Dangaard Brouer TP_PROTO(struct Qdisc *qdisc, const struct netdev_queue *txq, 17e543002fSJesper Dangaard Brouer int packets, struct sk_buff *skb), 18e543002fSJesper Dangaard Brouer 19e543002fSJesper Dangaard Brouer TP_ARGS(qdisc, txq, packets, skb), 20e543002fSJesper Dangaard Brouer 21e543002fSJesper Dangaard Brouer TP_STRUCT__entry( 22e543002fSJesper Dangaard Brouer __field( struct Qdisc *, qdisc ) 23e543002fSJesper Dangaard Brouer __field(const struct netdev_queue *, txq ) 24e543002fSJesper Dangaard Brouer __field( int, packets ) 25e543002fSJesper Dangaard Brouer __field( void *, skbaddr ) 26e543002fSJesper Dangaard Brouer __field( int, ifindex ) 27e543002fSJesper Dangaard Brouer __field( u32, handle ) 28e543002fSJesper Dangaard Brouer __field( u32, parent ) 29e543002fSJesper Dangaard Brouer __field( unsigned long, txq_state) 30e543002fSJesper Dangaard Brouer ), 31e543002fSJesper Dangaard Brouer 32e543002fSJesper Dangaard Brouer /* skb==NULL indicate packets dequeued was 0, even when packets==1 */ 33e543002fSJesper Dangaard Brouer TP_fast_assign( 34e543002fSJesper Dangaard Brouer __entry->qdisc = qdisc; 35e543002fSJesper Dangaard Brouer __entry->txq = txq; 36e543002fSJesper Dangaard Brouer __entry->packets = skb ? packets : 0; 37e543002fSJesper Dangaard Brouer __entry->skbaddr = skb; 38e543002fSJesper Dangaard Brouer __entry->ifindex = txq->dev ? txq->dev->ifindex : 0; 39e543002fSJesper Dangaard Brouer __entry->handle = qdisc->handle; 40e543002fSJesper Dangaard Brouer __entry->parent = qdisc->parent; 41e543002fSJesper Dangaard Brouer __entry->txq_state = txq->state; 42e543002fSJesper Dangaard Brouer ), 43e543002fSJesper Dangaard Brouer 446deb209dSSubash Abhinov Kasiviswanathan TP_printk("dequeue ifindex=%d qdisc handle=0x%X parent=0x%X txq_state=0x%lX packets=%d skbaddr=%p", 45e543002fSJesper Dangaard Brouer __entry->ifindex, __entry->handle, __entry->parent, 46e543002fSJesper Dangaard Brouer __entry->txq_state, __entry->packets, __entry->skbaddr ) 47e543002fSJesper Dangaard Brouer ); 48e543002fSJesper Dangaard Brouer 4970713dddSQitao Xu TRACE_EVENT(qdisc_enqueue, 5070713dddSQitao Xu 5170713dddSQitao Xu TP_PROTO(struct Qdisc *qdisc, const struct netdev_queue *txq, struct sk_buff *skb), 5270713dddSQitao Xu 5370713dddSQitao Xu TP_ARGS(qdisc, txq, skb), 5470713dddSQitao Xu 5570713dddSQitao Xu TP_STRUCT__entry( 5670713dddSQitao Xu __field(struct Qdisc *, qdisc) 57409f386bSTonghao Zhang __field(const struct netdev_queue *, txq) 5870713dddSQitao Xu __field(void *, skbaddr) 5970713dddSQitao Xu __field(int, ifindex) 6070713dddSQitao Xu __field(u32, handle) 6170713dddSQitao Xu __field(u32, parent) 6270713dddSQitao Xu ), 6370713dddSQitao Xu 6470713dddSQitao Xu TP_fast_assign( 6570713dddSQitao Xu __entry->qdisc = qdisc; 66409f386bSTonghao Zhang __entry->txq = txq; 6770713dddSQitao Xu __entry->skbaddr = skb; 6870713dddSQitao Xu __entry->ifindex = txq->dev ? txq->dev->ifindex : 0; 6970713dddSQitao Xu __entry->handle = qdisc->handle; 7070713dddSQitao Xu __entry->parent = qdisc->parent; 7170713dddSQitao Xu ), 7270713dddSQitao Xu 736deb209dSSubash Abhinov Kasiviswanathan TP_printk("enqueue ifindex=%d qdisc handle=0x%X parent=0x%X skbaddr=%p", 7470713dddSQitao Xu __entry->ifindex, __entry->handle, __entry->parent, __entry->skbaddr) 7570713dddSQitao Xu ); 7670713dddSQitao Xu 77a34dac0bSCong Wang TRACE_EVENT(qdisc_reset, 78a34dac0bSCong Wang 79a34dac0bSCong Wang TP_PROTO(struct Qdisc *q), 80a34dac0bSCong Wang 81a34dac0bSCong Wang TP_ARGS(q), 82a34dac0bSCong Wang 83a34dac0bSCong Wang TP_STRUCT__entry( 84*bab49231SYunseong Kim __string( dev, qdisc_dev(q) ? qdisc_dev(q)->name : "(null)" ) 85a34dac0bSCong Wang __string( kind, q->ops->id ) 86a34dac0bSCong Wang __field( u32, parent ) 87a34dac0bSCong Wang __field( u32, handle ) 88a34dac0bSCong Wang ), 89a34dac0bSCong Wang 90a34dac0bSCong Wang TP_fast_assign( 912c92ca84SSteven Rostedt (Google) __assign_str(dev); 922c92ca84SSteven Rostedt (Google) __assign_str(kind); 93a34dac0bSCong Wang __entry->parent = q->parent; 94a34dac0bSCong Wang __entry->handle = q->handle; 95a34dac0bSCong Wang ), 96a34dac0bSCong Wang 97a34dac0bSCong Wang TP_printk("dev=%s kind=%s parent=%x:%x handle=%x:%x", __get_str(dev), 98a34dac0bSCong Wang __get_str(kind), TC_H_MAJ(__entry->parent) >> 16, TC_H_MIN(__entry->parent), 99a34dac0bSCong Wang TC_H_MAJ(__entry->handle) >> 16, TC_H_MIN(__entry->handle)) 100a34dac0bSCong Wang ); 101a34dac0bSCong Wang 102a34dac0bSCong Wang TRACE_EVENT(qdisc_destroy, 103a34dac0bSCong Wang 104a34dac0bSCong Wang TP_PROTO(struct Qdisc *q), 105a34dac0bSCong Wang 106a34dac0bSCong Wang TP_ARGS(q), 107a34dac0bSCong Wang 108a34dac0bSCong Wang TP_STRUCT__entry( 10951270d57SSteven Rostedt (Google) __string( dev, qdisc_dev(q)->name ) 110a34dac0bSCong Wang __string( kind, q->ops->id ) 111a34dac0bSCong Wang __field( u32, parent ) 112a34dac0bSCong Wang __field( u32, handle ) 113a34dac0bSCong Wang ), 114a34dac0bSCong Wang 115a34dac0bSCong Wang TP_fast_assign( 1162c92ca84SSteven Rostedt (Google) __assign_str(dev); 1172c92ca84SSteven Rostedt (Google) __assign_str(kind); 118a34dac0bSCong Wang __entry->parent = q->parent; 119a34dac0bSCong Wang __entry->handle = q->handle; 120a34dac0bSCong Wang ), 121a34dac0bSCong Wang 122a34dac0bSCong Wang TP_printk("dev=%s kind=%s parent=%x:%x handle=%x:%x", __get_str(dev), 123a34dac0bSCong Wang __get_str(kind), TC_H_MAJ(__entry->parent) >> 16, TC_H_MIN(__entry->parent), 124a34dac0bSCong Wang TC_H_MAJ(__entry->handle) >> 16, TC_H_MIN(__entry->handle)) 125a34dac0bSCong Wang ); 126a34dac0bSCong Wang 127f5a7833eSCong Wang TRACE_EVENT(qdisc_create, 128f5a7833eSCong Wang 129f5a7833eSCong Wang TP_PROTO(const struct Qdisc_ops *ops, struct net_device *dev, u32 parent), 130f5a7833eSCong Wang 131f5a7833eSCong Wang TP_ARGS(ops, dev, parent), 132f5a7833eSCong Wang 133f5a7833eSCong Wang TP_STRUCT__entry( 134f5a7833eSCong Wang __string( dev, dev->name ) 135f5a7833eSCong Wang __string( kind, ops->id ) 136f5a7833eSCong Wang __field( u32, parent ) 137f5a7833eSCong Wang ), 138f5a7833eSCong Wang 139f5a7833eSCong Wang TP_fast_assign( 1402c92ca84SSteven Rostedt (Google) __assign_str(dev); 1412c92ca84SSteven Rostedt (Google) __assign_str(kind); 142f5a7833eSCong Wang __entry->parent = parent; 143f5a7833eSCong Wang ), 144f5a7833eSCong Wang 145f5a7833eSCong Wang TP_printk("dev=%s kind=%s parent=%x:%x", 146f5a7833eSCong Wang __get_str(dev), __get_str(kind), 147f5a7833eSCong Wang TC_H_MAJ(__entry->parent) >> 16, TC_H_MIN(__entry->parent)) 148f5a7833eSCong Wang ); 149f5a7833eSCong Wang 150b1d45c23SMasahiro Yamada #endif /* _TRACE_QDISC_H */ 151e543002fSJesper Dangaard Brouer 152e543002fSJesper Dangaard Brouer /* This part must be outside protection */ 153e543002fSJesper Dangaard Brouer #include <trace/define_trace.h> 154