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>
209 lines
4.9 KiB
C
209 lines
4.9 KiB
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
/* Copyright(c) 2013 - 2018 Intel Corporation. */
|
|
|
|
/* Modeled on trace-events-sample.h */
|
|
|
|
/* The trace subsystem name for iavf will be "iavf".
|
|
*
|
|
* This file is named iavf_trace.h.
|
|
*
|
|
* Since this include file's name is different from the trace
|
|
* subsystem name, we'll have to define TRACE_INCLUDE_FILE at the end
|
|
* of this file.
|
|
*/
|
|
#undef TRACE_SYSTEM
|
|
#define TRACE_SYSTEM iavf
|
|
|
|
/* See trace-events-sample.h for a detailed description of why this
|
|
* guard clause is different from most normal include files.
|
|
*/
|
|
#if !defined(_IAVF_TRACE_H_) || defined(TRACE_HEADER_MULTI_READ)
|
|
#define _IAVF_TRACE_H_
|
|
|
|
#include <linux/tracepoint.h>
|
|
|
|
/*
|
|
* iavf_trace() macro enables shared code to refer to trace points
|
|
* like:
|
|
*
|
|
* trace_iavf{,vf}_example(args...)
|
|
*
|
|
* ... as:
|
|
*
|
|
* iavf_trace(example, args...)
|
|
*
|
|
* ... to resolve to the PF or VF version of the tracepoint without
|
|
* ifdefs, and to allow tracepoints to be disabled entirely at build
|
|
* time.
|
|
*
|
|
* Trace point should always be referred to in the driver via this
|
|
* macro.
|
|
*
|
|
* Similarly, iavf_trace_enabled(trace_name) wraps references to
|
|
* trace_iavf{,vf}_<trace_name>_enabled() functions.
|
|
*/
|
|
#define _IAVF_TRACE_NAME(trace_name) (trace_ ## iavf ## _ ## trace_name)
|
|
#define IAVF_TRACE_NAME(trace_name) _IAVF_TRACE_NAME(trace_name)
|
|
|
|
#define iavf_trace(trace_name, args...) IAVF_TRACE_NAME(trace_name)(args)
|
|
|
|
#define iavf_trace_enabled(trace_name) IAVF_TRACE_NAME(trace_name##_enabled)()
|
|
|
|
/* Events common to PF and VF. Corresponding versions will be defined
|
|
* for both, named trace_iavf_* and trace_iavf_*. The iavf_trace()
|
|
* macro above will select the right trace point name for the driver
|
|
* being built from shared code.
|
|
*/
|
|
|
|
/* Events related to a vsi & ring */
|
|
DECLARE_EVENT_CLASS(
|
|
iavf_tx_template,
|
|
|
|
TP_PROTO(struct iavf_ring *ring,
|
|
struct iavf_tx_desc *desc,
|
|
struct iavf_tx_buffer *buf),
|
|
|
|
TP_ARGS(ring, desc, buf),
|
|
|
|
/* The convention here is to make the first fields in the
|
|
* TP_STRUCT match the TP_PROTO exactly. This enables the use
|
|
* of the args struct generated by the tplist tool (from the
|
|
* bcc-tools package) to be used for those fields. To access
|
|
* fields other than the tracepoint args will require the
|
|
* tplist output to be adjusted.
|
|
*/
|
|
TP_STRUCT__entry(
|
|
__field(void*, ring)
|
|
__field(void*, desc)
|
|
__field(void*, buf)
|
|
__string(devname, ring->netdev->name)
|
|
),
|
|
|
|
TP_fast_assign(
|
|
__entry->ring = ring;
|
|
__entry->desc = desc;
|
|
__entry->buf = buf;
|
|
__assign_str(devname);
|
|
),
|
|
|
|
TP_printk(
|
|
"netdev: %s ring: %p desc: %p buf %p",
|
|
__get_str(devname), __entry->ring,
|
|
__entry->desc, __entry->buf)
|
|
);
|
|
|
|
DEFINE_EVENT(
|
|
iavf_tx_template, iavf_clean_tx_irq,
|
|
TP_PROTO(struct iavf_ring *ring,
|
|
struct iavf_tx_desc *desc,
|
|
struct iavf_tx_buffer *buf),
|
|
|
|
TP_ARGS(ring, desc, buf));
|
|
|
|
DEFINE_EVENT(
|
|
iavf_tx_template, iavf_clean_tx_irq_unmap,
|
|
TP_PROTO(struct iavf_ring *ring,
|
|
struct iavf_tx_desc *desc,
|
|
struct iavf_tx_buffer *buf),
|
|
|
|
TP_ARGS(ring, desc, buf));
|
|
|
|
DECLARE_EVENT_CLASS(
|
|
iavf_rx_template,
|
|
|
|
TP_PROTO(struct iavf_ring *ring,
|
|
union iavf_32byte_rx_desc *desc,
|
|
struct sk_buff *skb),
|
|
|
|
TP_ARGS(ring, desc, skb),
|
|
|
|
TP_STRUCT__entry(
|
|
__field(void*, ring)
|
|
__field(void*, desc)
|
|
__field(void*, skb)
|
|
__string(devname, ring->netdev->name)
|
|
),
|
|
|
|
TP_fast_assign(
|
|
__entry->ring = ring;
|
|
__entry->desc = desc;
|
|
__entry->skb = skb;
|
|
__assign_str(devname);
|
|
),
|
|
|
|
TP_printk(
|
|
"netdev: %s ring: %p desc: %p skb %p",
|
|
__get_str(devname), __entry->ring,
|
|
__entry->desc, __entry->skb)
|
|
);
|
|
|
|
DEFINE_EVENT(
|
|
iavf_rx_template, iavf_clean_rx_irq,
|
|
TP_PROTO(struct iavf_ring *ring,
|
|
union iavf_32byte_rx_desc *desc,
|
|
struct sk_buff *skb),
|
|
|
|
TP_ARGS(ring, desc, skb));
|
|
|
|
DEFINE_EVENT(
|
|
iavf_rx_template, iavf_clean_rx_irq_rx,
|
|
TP_PROTO(struct iavf_ring *ring,
|
|
union iavf_32byte_rx_desc *desc,
|
|
struct sk_buff *skb),
|
|
|
|
TP_ARGS(ring, desc, skb));
|
|
|
|
DECLARE_EVENT_CLASS(
|
|
iavf_xmit_template,
|
|
|
|
TP_PROTO(struct sk_buff *skb,
|
|
struct iavf_ring *ring),
|
|
|
|
TP_ARGS(skb, ring),
|
|
|
|
TP_STRUCT__entry(
|
|
__field(void*, skb)
|
|
__field(void*, ring)
|
|
__string(devname, ring->netdev->name)
|
|
),
|
|
|
|
TP_fast_assign(
|
|
__entry->skb = skb;
|
|
__entry->ring = ring;
|
|
__assign_str(devname);
|
|
),
|
|
|
|
TP_printk(
|
|
"netdev: %s skb: %p ring: %p",
|
|
__get_str(devname), __entry->skb,
|
|
__entry->ring)
|
|
);
|
|
|
|
DEFINE_EVENT(
|
|
iavf_xmit_template, iavf_xmit_frame_ring,
|
|
TP_PROTO(struct sk_buff *skb,
|
|
struct iavf_ring *ring),
|
|
|
|
TP_ARGS(skb, ring));
|
|
|
|
DEFINE_EVENT(
|
|
iavf_xmit_template, iavf_xmit_frame_ring_drop,
|
|
TP_PROTO(struct sk_buff *skb,
|
|
struct iavf_ring *ring),
|
|
|
|
TP_ARGS(skb, ring));
|
|
|
|
/* Events unique to the VF. */
|
|
|
|
#endif /* _IAVF_TRACE_H_ */
|
|
/* This must be outside ifdef _IAVF_TRACE_H */
|
|
|
|
/* This trace include file is not located in the .../include/trace
|
|
* with the kernel tracepoint definitions, because we're a loadable
|
|
* module.
|
|
*/
|
|
#undef TRACE_INCLUDE_PATH
|
|
#define TRACE_INCLUDE_PATH .
|
|
#undef TRACE_INCLUDE_FILE
|
|
#define TRACE_INCLUDE_FILE iavf_trace
|
|
#include <trace/define_trace.h>
|