Subject: Re: [PATCH] qdisc: add tracepoint qdisc:qdisc_dequeue for dequeued SKBs

From: Jesper Dangaard Brouer <[email-masked]>
Date: Wed, 16 Aug 2017 07:15:15 +0200

On Tue, 15 Aug 2017 20:31:44 -0600
David Ahern <[email-masked]> wrote:

> On 8/15/17 1:11 PM, Jesper Dangaard Brouer wrote:
> > diff --git a/include/trace/events/qdisc.h b/include/trace/events/qdisc.h
> > new file mode 100644
> > index 000000000000..60d0d8bd336d
> > --- /dev/null
> > +++ b/include/trace/events/qdisc.h
> > @@ -0,0 +1,50 @@
> > +#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>
> > +
> > +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	)  
> 
> Why save qdisc and txq pointers in the tracepoint data?

I wanted to attach a BPF program, and allow it to dereference these
pointers.  Which is done via bpf_probe_read like:

 unsigned int qdisc_flags; 
 bpf_probe_read(&qdisc_flags, sizeof(qdisc_flags), &ctx->qdisc->flags);

-- 
Best regards,
  Jesper Dangaard Brouer
  MSc.CS, Principal Kernel Engineer at Red Hat
  LinkedIn: http://www.linkedin.com/in/brouer