1
0
Fork 0
mirror of synced 2025-03-06 20:59:54 +01:00
linux/include/trace/events/qdisc.h
Steven Rostedt (Google) 2c92ca849f tracing/treewide: Remove second parameter of __assign_str()
With the rework of how the __string() handles dynamic strings where it
saves off the source string in field in the helper structure[1], the
assignment of that value to the trace event field is stored in the helper
value and does not need to be passed in again.

This means that with:

  __string(field, mystring)

Which use to be assigned with __assign_str(field, mystring), no longer
needs the second parameter and it is unused. With this, __assign_str()
will now only get a single parameter.

There's over 700 users of __assign_str() and because coccinelle does not
handle the TRACE_EVENT() macro I ended up using the following sed script:

  git grep -l __assign_str | while read a ; do
      sed -e 's/\(__assign_str([^,]*[^ ,]\) *,[^;]*/\1)/' $a > /tmp/test-file;
      mv /tmp/test-file $a;
  done

I then searched for __assign_str() that did not end with ';' as those
were multi line assignments that the sed script above would fail to catch.

Note, the same updates will need to be done for:

  __assign_str_len()
  __assign_rel_str()
  __assign_rel_str_len()

I tested this with both an allmodconfig and an allyesconfig (build only for both).

[1] https://lore.kernel.org/linux-trace-kernel/20240222211442.634192653@goodmis.org/

Link: https://lore.kernel.org/linux-trace-kernel/20240516133454.681ba6a0@rorschach.local.home

Cc: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Julia Lawall <Julia.Lawall@inria.fr>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
Acked-by: Jani Nikula <jani.nikula@intel.com>
Acked-by: Christian König <christian.koenig@amd.com> for the amdgpu parts.
Acked-by: Thomas Hellström <thomas.hellstrom@linux.intel.com> #for
Acked-by: Rafael J. Wysocki <rafael@kernel.org> # for thermal
Acked-by: Takashi Iwai <tiwai@suse.de>
Acked-by: Darrick J. Wong <djwong@kernel.org>	# xfs
Tested-by: Guenter Roeck <linux@roeck-us.net>
2024-05-22 20:14:47 -04:00

153 lines
3.7 KiB
C

#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);
__assign_str(kind);
__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);
__assign_str(kind);
__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);
__assign_str(kind);
__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>