mirror of
https://github.com/torvalds/linux.git
synced 2024-11-14 16:12:02 +00:00
2c92ca849f
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>
419 lines
11 KiB
C
419 lines
11 KiB
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
/* Based on net/wireless/trace.h */
|
|
|
|
#undef TRACE_SYSTEM
|
|
#define TRACE_SYSTEM cfg802154
|
|
|
|
#if !defined(__RDEV_CFG802154_OPS_TRACE) || defined(TRACE_HEADER_MULTI_READ)
|
|
#define __RDEV_CFG802154_OPS_TRACE
|
|
|
|
#include <linux/tracepoint.h>
|
|
|
|
#include <net/cfg802154.h>
|
|
|
|
#define MAXNAME 32
|
|
#define WPAN_PHY_ENTRY __array(char, wpan_phy_name, MAXNAME)
|
|
#define WPAN_PHY_ASSIGN strscpy(__entry->wpan_phy_name, \
|
|
wpan_phy_name(wpan_phy), \
|
|
MAXNAME)
|
|
#define WPAN_PHY_PR_FMT "%s"
|
|
#define WPAN_PHY_PR_ARG __entry->wpan_phy_name
|
|
|
|
#define WPAN_DEV_ENTRY __field(u32, identifier)
|
|
#define WPAN_DEV_ASSIGN (__entry->identifier) = (!IS_ERR_OR_NULL(wpan_dev) \
|
|
? wpan_dev->identifier : 0)
|
|
#define WPAN_DEV_PR_FMT "wpan_dev(%u)"
|
|
#define WPAN_DEV_PR_ARG (__entry->identifier)
|
|
|
|
#define WPAN_CCA_ENTRY __field(enum nl802154_cca_modes, cca_mode) \
|
|
__field(enum nl802154_cca_opts, cca_opt)
|
|
#define WPAN_CCA_ASSIGN \
|
|
do { \
|
|
(__entry->cca_mode) = cca->mode; \
|
|
(__entry->cca_opt) = cca->opt; \
|
|
} while (0)
|
|
#define WPAN_CCA_PR_FMT "cca_mode: %d, cca_opt: %d"
|
|
#define WPAN_CCA_PR_ARG __entry->cca_mode, __entry->cca_opt
|
|
|
|
#define BOOL_TO_STR(bo) (bo) ? "true" : "false"
|
|
|
|
/*************************************************************
|
|
* rdev->ops traces *
|
|
*************************************************************/
|
|
|
|
DECLARE_EVENT_CLASS(wpan_phy_only_evt,
|
|
TP_PROTO(struct wpan_phy *wpan_phy),
|
|
TP_ARGS(wpan_phy),
|
|
TP_STRUCT__entry(
|
|
WPAN_PHY_ENTRY
|
|
),
|
|
TP_fast_assign(
|
|
WPAN_PHY_ASSIGN;
|
|
),
|
|
TP_printk(WPAN_PHY_PR_FMT, WPAN_PHY_PR_ARG)
|
|
);
|
|
|
|
DEFINE_EVENT(wpan_phy_only_evt, 802154_rdev_suspend,
|
|
TP_PROTO(struct wpan_phy *wpan_phy),
|
|
TP_ARGS(wpan_phy)
|
|
);
|
|
|
|
DEFINE_EVENT(wpan_phy_only_evt, 802154_rdev_resume,
|
|
TP_PROTO(struct wpan_phy *wpan_phy),
|
|
TP_ARGS(wpan_phy)
|
|
);
|
|
|
|
TRACE_EVENT(802154_rdev_add_virtual_intf,
|
|
TP_PROTO(struct wpan_phy *wpan_phy, char *name,
|
|
enum nl802154_iftype type, __le64 extended_addr),
|
|
TP_ARGS(wpan_phy, name, type, extended_addr),
|
|
TP_STRUCT__entry(
|
|
WPAN_PHY_ENTRY
|
|
__string(vir_intf_name, name ? name : "<noname>")
|
|
__field(enum nl802154_iftype, type)
|
|
__field(__le64, extended_addr)
|
|
),
|
|
TP_fast_assign(
|
|
WPAN_PHY_ASSIGN;
|
|
__assign_str(vir_intf_name);
|
|
__entry->type = type;
|
|
__entry->extended_addr = extended_addr;
|
|
),
|
|
TP_printk(WPAN_PHY_PR_FMT ", virtual intf name: %s, type: %d, extended addr: 0x%llx",
|
|
WPAN_PHY_PR_ARG, __get_str(vir_intf_name), __entry->type,
|
|
__le64_to_cpu(__entry->extended_addr))
|
|
);
|
|
|
|
TRACE_EVENT(802154_rdev_del_virtual_intf,
|
|
TP_PROTO(struct wpan_phy *wpan_phy, struct wpan_dev *wpan_dev),
|
|
TP_ARGS(wpan_phy, wpan_dev),
|
|
TP_STRUCT__entry(
|
|
WPAN_PHY_ENTRY
|
|
WPAN_DEV_ENTRY
|
|
),
|
|
TP_fast_assign(
|
|
WPAN_PHY_ASSIGN;
|
|
WPAN_DEV_ASSIGN;
|
|
),
|
|
TP_printk(WPAN_PHY_PR_FMT ", " WPAN_DEV_PR_FMT, WPAN_PHY_PR_ARG,
|
|
WPAN_DEV_PR_ARG)
|
|
);
|
|
|
|
TRACE_EVENT(802154_rdev_set_channel,
|
|
TP_PROTO(struct wpan_phy *wpan_phy, u8 page, u8 channel),
|
|
TP_ARGS(wpan_phy, page, channel),
|
|
TP_STRUCT__entry(
|
|
WPAN_PHY_ENTRY
|
|
__field(u8, page)
|
|
__field(u8, channel)
|
|
),
|
|
TP_fast_assign(
|
|
WPAN_PHY_ASSIGN;
|
|
__entry->page = page;
|
|
__entry->channel = channel;
|
|
),
|
|
TP_printk(WPAN_PHY_PR_FMT ", page: %d, channel: %d", WPAN_PHY_PR_ARG,
|
|
__entry->page, __entry->channel)
|
|
);
|
|
|
|
TRACE_EVENT(802154_rdev_set_tx_power,
|
|
TP_PROTO(struct wpan_phy *wpan_phy, s32 power),
|
|
TP_ARGS(wpan_phy, power),
|
|
TP_STRUCT__entry(
|
|
WPAN_PHY_ENTRY
|
|
__field(s32, power)
|
|
),
|
|
TP_fast_assign(
|
|
WPAN_PHY_ASSIGN;
|
|
__entry->power = power;
|
|
),
|
|
TP_printk(WPAN_PHY_PR_FMT ", mbm: %d", WPAN_PHY_PR_ARG,
|
|
__entry->power)
|
|
);
|
|
|
|
TRACE_EVENT(802154_rdev_set_cca_mode,
|
|
TP_PROTO(struct wpan_phy *wpan_phy, const struct wpan_phy_cca *cca),
|
|
TP_ARGS(wpan_phy, cca),
|
|
TP_STRUCT__entry(
|
|
WPAN_PHY_ENTRY
|
|
WPAN_CCA_ENTRY
|
|
),
|
|
TP_fast_assign(
|
|
WPAN_PHY_ASSIGN;
|
|
WPAN_CCA_ASSIGN;
|
|
),
|
|
TP_printk(WPAN_PHY_PR_FMT ", " WPAN_CCA_PR_FMT, WPAN_PHY_PR_ARG,
|
|
WPAN_CCA_PR_ARG)
|
|
);
|
|
|
|
TRACE_EVENT(802154_rdev_set_cca_ed_level,
|
|
TP_PROTO(struct wpan_phy *wpan_phy, s32 ed_level),
|
|
TP_ARGS(wpan_phy, ed_level),
|
|
TP_STRUCT__entry(
|
|
WPAN_PHY_ENTRY
|
|
__field(s32, ed_level)
|
|
),
|
|
TP_fast_assign(
|
|
WPAN_PHY_ASSIGN;
|
|
__entry->ed_level = ed_level;
|
|
),
|
|
TP_printk(WPAN_PHY_PR_FMT ", ed level: %d", WPAN_PHY_PR_ARG,
|
|
__entry->ed_level)
|
|
);
|
|
|
|
DECLARE_EVENT_CLASS(802154_le16_template,
|
|
TP_PROTO(struct wpan_phy *wpan_phy, struct wpan_dev *wpan_dev,
|
|
__le16 le16arg),
|
|
TP_ARGS(wpan_phy, wpan_dev, le16arg),
|
|
TP_STRUCT__entry(
|
|
WPAN_PHY_ENTRY
|
|
WPAN_DEV_ENTRY
|
|
__field(__le16, le16arg)
|
|
),
|
|
TP_fast_assign(
|
|
WPAN_PHY_ASSIGN;
|
|
WPAN_DEV_ASSIGN;
|
|
__entry->le16arg = le16arg;
|
|
),
|
|
TP_printk(WPAN_PHY_PR_FMT ", " WPAN_DEV_PR_FMT ", pan id: 0x%04x",
|
|
WPAN_PHY_PR_ARG, WPAN_DEV_PR_ARG,
|
|
__le16_to_cpu(__entry->le16arg))
|
|
);
|
|
|
|
DEFINE_EVENT(802154_le16_template, 802154_rdev_set_pan_id,
|
|
TP_PROTO(struct wpan_phy *wpan_phy, struct wpan_dev *wpan_dev,
|
|
__le16 le16arg),
|
|
TP_ARGS(wpan_phy, wpan_dev, le16arg)
|
|
);
|
|
|
|
DEFINE_EVENT_PRINT(802154_le16_template, 802154_rdev_set_short_addr,
|
|
TP_PROTO(struct wpan_phy *wpan_phy, struct wpan_dev *wpan_dev,
|
|
__le16 le16arg),
|
|
TP_ARGS(wpan_phy, wpan_dev, le16arg),
|
|
TP_printk(WPAN_PHY_PR_FMT ", " WPAN_DEV_PR_FMT ", short addr: 0x%04x",
|
|
WPAN_PHY_PR_ARG, WPAN_DEV_PR_ARG,
|
|
__le16_to_cpu(__entry->le16arg))
|
|
);
|
|
|
|
TRACE_EVENT(802154_rdev_set_backoff_exponent,
|
|
TP_PROTO(struct wpan_phy *wpan_phy, struct wpan_dev *wpan_dev,
|
|
u8 min_be, u8 max_be),
|
|
TP_ARGS(wpan_phy, wpan_dev, min_be, max_be),
|
|
TP_STRUCT__entry(
|
|
WPAN_PHY_ENTRY
|
|
WPAN_DEV_ENTRY
|
|
__field(u8, min_be)
|
|
__field(u8, max_be)
|
|
),
|
|
TP_fast_assign(
|
|
WPAN_PHY_ASSIGN;
|
|
WPAN_DEV_ASSIGN;
|
|
__entry->min_be = min_be;
|
|
__entry->max_be = max_be;
|
|
),
|
|
|
|
TP_printk(WPAN_PHY_PR_FMT ", " WPAN_DEV_PR_FMT
|
|
", min be: %d, max be: %d", WPAN_PHY_PR_ARG,
|
|
WPAN_DEV_PR_ARG, __entry->min_be, __entry->max_be)
|
|
);
|
|
|
|
TRACE_EVENT(802154_rdev_set_csma_backoffs,
|
|
TP_PROTO(struct wpan_phy *wpan_phy, struct wpan_dev *wpan_dev,
|
|
u8 max_csma_backoffs),
|
|
TP_ARGS(wpan_phy, wpan_dev, max_csma_backoffs),
|
|
TP_STRUCT__entry(
|
|
WPAN_PHY_ENTRY
|
|
WPAN_DEV_ENTRY
|
|
__field(u8, max_csma_backoffs)
|
|
),
|
|
TP_fast_assign(
|
|
WPAN_PHY_ASSIGN;
|
|
WPAN_DEV_ASSIGN;
|
|
__entry->max_csma_backoffs = max_csma_backoffs;
|
|
),
|
|
|
|
TP_printk(WPAN_PHY_PR_FMT ", " WPAN_DEV_PR_FMT
|
|
", max csma backoffs: %d", WPAN_PHY_PR_ARG,
|
|
WPAN_DEV_PR_ARG, __entry->max_csma_backoffs)
|
|
);
|
|
|
|
TRACE_EVENT(802154_rdev_set_max_frame_retries,
|
|
TP_PROTO(struct wpan_phy *wpan_phy, struct wpan_dev *wpan_dev,
|
|
s8 max_frame_retries),
|
|
TP_ARGS(wpan_phy, wpan_dev, max_frame_retries),
|
|
TP_STRUCT__entry(
|
|
WPAN_PHY_ENTRY
|
|
WPAN_DEV_ENTRY
|
|
__field(s8, max_frame_retries)
|
|
),
|
|
TP_fast_assign(
|
|
WPAN_PHY_ASSIGN;
|
|
WPAN_DEV_ASSIGN;
|
|
__entry->max_frame_retries = max_frame_retries;
|
|
),
|
|
|
|
TP_printk(WPAN_PHY_PR_FMT ", " WPAN_DEV_PR_FMT
|
|
", max frame retries: %d", WPAN_PHY_PR_ARG,
|
|
WPAN_DEV_PR_ARG, __entry->max_frame_retries)
|
|
);
|
|
|
|
TRACE_EVENT(802154_rdev_set_lbt_mode,
|
|
TP_PROTO(struct wpan_phy *wpan_phy, struct wpan_dev *wpan_dev,
|
|
bool mode),
|
|
TP_ARGS(wpan_phy, wpan_dev, mode),
|
|
TP_STRUCT__entry(
|
|
WPAN_PHY_ENTRY
|
|
WPAN_DEV_ENTRY
|
|
__field(bool, mode)
|
|
),
|
|
TP_fast_assign(
|
|
WPAN_PHY_ASSIGN;
|
|
WPAN_DEV_ASSIGN;
|
|
__entry->mode = mode;
|
|
),
|
|
TP_printk(WPAN_PHY_PR_FMT ", " WPAN_DEV_PR_FMT
|
|
", lbt mode: %s", WPAN_PHY_PR_ARG,
|
|
WPAN_DEV_PR_ARG, BOOL_TO_STR(__entry->mode))
|
|
);
|
|
|
|
TRACE_EVENT(802154_rdev_set_ackreq_default,
|
|
TP_PROTO(struct wpan_phy *wpan_phy, struct wpan_dev *wpan_dev,
|
|
bool ackreq),
|
|
TP_ARGS(wpan_phy, wpan_dev, ackreq),
|
|
TP_STRUCT__entry(
|
|
WPAN_PHY_ENTRY
|
|
WPAN_DEV_ENTRY
|
|
__field(bool, ackreq)
|
|
),
|
|
TP_fast_assign(
|
|
WPAN_PHY_ASSIGN;
|
|
WPAN_DEV_ASSIGN;
|
|
__entry->ackreq = ackreq;
|
|
),
|
|
TP_printk(WPAN_PHY_PR_FMT ", " WPAN_DEV_PR_FMT
|
|
", ackreq default: %s", WPAN_PHY_PR_ARG,
|
|
WPAN_DEV_PR_ARG, BOOL_TO_STR(__entry->ackreq))
|
|
);
|
|
|
|
TRACE_EVENT(802154_rdev_trigger_scan,
|
|
TP_PROTO(struct wpan_phy *wpan_phy,
|
|
struct cfg802154_scan_request *request),
|
|
TP_ARGS(wpan_phy, request),
|
|
TP_STRUCT__entry(
|
|
WPAN_PHY_ENTRY
|
|
__field(u8, page)
|
|
__field(u32, channels)
|
|
__field(u8, duration)
|
|
),
|
|
TP_fast_assign(
|
|
WPAN_PHY_ASSIGN;
|
|
__entry->page = request->page;
|
|
__entry->channels = request->channels;
|
|
__entry->duration = request->duration;
|
|
),
|
|
TP_printk(WPAN_PHY_PR_FMT ", scan, page: %d, channels: %x, duration %d",
|
|
WPAN_PHY_PR_ARG, __entry->page, __entry->channels, __entry->duration)
|
|
);
|
|
|
|
TRACE_EVENT(802154_rdev_send_beacons,
|
|
TP_PROTO(struct wpan_phy *wpan_phy,
|
|
struct cfg802154_beacon_request *request),
|
|
TP_ARGS(wpan_phy, request),
|
|
TP_STRUCT__entry(
|
|
WPAN_PHY_ENTRY
|
|
__field(u8, interval)
|
|
),
|
|
TP_fast_assign(
|
|
WPAN_PHY_ASSIGN;
|
|
__entry->interval = request->interval;
|
|
),
|
|
TP_printk(WPAN_PHY_PR_FMT ", sending beacons (interval order: %d)",
|
|
WPAN_PHY_PR_ARG, __entry->interval)
|
|
);
|
|
|
|
DECLARE_EVENT_CLASS(802154_wdev_template,
|
|
TP_PROTO(struct wpan_phy *wpan_phy, struct wpan_dev *wpan_dev),
|
|
TP_ARGS(wpan_phy, wpan_dev),
|
|
TP_STRUCT__entry(
|
|
WPAN_PHY_ENTRY
|
|
WPAN_DEV_ENTRY
|
|
),
|
|
TP_fast_assign(
|
|
WPAN_PHY_ASSIGN;
|
|
WPAN_DEV_ASSIGN;
|
|
),
|
|
TP_printk(WPAN_PHY_PR_FMT ", " WPAN_DEV_PR_FMT,
|
|
WPAN_PHY_PR_ARG, WPAN_DEV_PR_ARG)
|
|
);
|
|
|
|
DEFINE_EVENT(802154_wdev_template, 802154_rdev_abort_scan,
|
|
TP_PROTO(struct wpan_phy *wpan_phy, struct wpan_dev *wpan_dev),
|
|
TP_ARGS(wpan_phy, wpan_dev)
|
|
);
|
|
|
|
DEFINE_EVENT(802154_wdev_template, 802154_rdev_stop_beacons,
|
|
TP_PROTO(struct wpan_phy *wpan_phy, struct wpan_dev *wpan_dev),
|
|
TP_ARGS(wpan_phy, wpan_dev)
|
|
);
|
|
|
|
TRACE_EVENT(802154_rdev_associate,
|
|
TP_PROTO(struct wpan_phy *wpan_phy,
|
|
struct wpan_dev *wpan_dev,
|
|
struct ieee802154_addr *coord),
|
|
TP_ARGS(wpan_phy, wpan_dev, coord),
|
|
TP_STRUCT__entry(
|
|
WPAN_PHY_ENTRY
|
|
WPAN_DEV_ENTRY
|
|
__field(__le64, addr)
|
|
),
|
|
TP_fast_assign(
|
|
WPAN_PHY_ASSIGN;
|
|
WPAN_DEV_ASSIGN;
|
|
__entry->addr = coord->extended_addr;
|
|
),
|
|
TP_printk(WPAN_PHY_PR_FMT ", " WPAN_DEV_PR_FMT ", associating with: 0x%llx",
|
|
WPAN_PHY_PR_ARG, WPAN_DEV_PR_ARG, __entry->addr)
|
|
);
|
|
|
|
TRACE_EVENT(802154_rdev_disassociate,
|
|
TP_PROTO(struct wpan_phy *wpan_phy,
|
|
struct wpan_dev *wpan_dev,
|
|
struct ieee802154_addr *target),
|
|
TP_ARGS(wpan_phy, wpan_dev, target),
|
|
TP_STRUCT__entry(
|
|
WPAN_PHY_ENTRY
|
|
WPAN_DEV_ENTRY
|
|
__field(__le64, addr)
|
|
),
|
|
TP_fast_assign(
|
|
WPAN_PHY_ASSIGN;
|
|
WPAN_DEV_ASSIGN;
|
|
__entry->addr = target->extended_addr;
|
|
),
|
|
TP_printk(WPAN_PHY_PR_FMT ", " WPAN_DEV_PR_FMT ", disassociating with: 0x%llx",
|
|
WPAN_PHY_PR_ARG, WPAN_DEV_PR_ARG, __entry->addr)
|
|
);
|
|
|
|
TRACE_EVENT(802154_rdev_return_int,
|
|
TP_PROTO(struct wpan_phy *wpan_phy, int ret),
|
|
TP_ARGS(wpan_phy, ret),
|
|
TP_STRUCT__entry(
|
|
WPAN_PHY_ENTRY
|
|
__field(int, ret)
|
|
),
|
|
TP_fast_assign(
|
|
WPAN_PHY_ASSIGN;
|
|
__entry->ret = ret;
|
|
),
|
|
TP_printk(WPAN_PHY_PR_FMT ", returned: %d", WPAN_PHY_PR_ARG,
|
|
__entry->ret)
|
|
);
|
|
|
|
#endif /* !__RDEV_CFG802154_OPS_TRACE || TRACE_HEADER_MULTI_READ */
|
|
|
|
#undef TRACE_INCLUDE_PATH
|
|
#define TRACE_INCLUDE_PATH .
|
|
#undef TRACE_INCLUDE_FILE
|
|
#define TRACE_INCLUDE_FILE trace
|
|
#include <trace/define_trace.h>
|