Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 /* Based on net/mac80211/trace.h */
0003 
0004 #undef TRACE_SYSTEM
0005 #define TRACE_SYSTEM mac802154
0006 
0007 #if !defined(__MAC802154_DRIVER_TRACE) || defined(TRACE_HEADER_MULTI_READ)
0008 #define __MAC802154_DRIVER_TRACE
0009 
0010 #include <linux/tracepoint.h>
0011 
0012 #include <net/mac802154.h>
0013 #include "ieee802154_i.h"
0014 
0015 #define MAXNAME     32
0016 #define LOCAL_ENTRY __array(char, wpan_phy_name, MAXNAME)
0017 #define LOCAL_ASSIGN    strlcpy(__entry->wpan_phy_name, \
0018                 wpan_phy_name(local->hw.phy), MAXNAME)
0019 #define LOCAL_PR_FMT    "%s"
0020 #define LOCAL_PR_ARG    __entry->wpan_phy_name
0021 
0022 #define CCA_ENTRY __field(enum nl802154_cca_modes, cca_mode) \
0023           __field(enum nl802154_cca_opts, cca_opt)
0024 #define CCA_ASSIGN \
0025     do {                                     \
0026         (__entry->cca_mode) = cca->mode; \
0027         (__entry->cca_opt) = cca->opt;   \
0028     } while (0)
0029 #define CCA_PR_FMT "cca_mode: %d, cca_opt: %d"
0030 #define CCA_PR_ARG __entry->cca_mode, __entry->cca_opt
0031 
0032 #define BOOL_TO_STR(bo) (bo) ? "true" : "false"
0033 
0034 /* Tracing for driver callbacks */
0035 
0036 DECLARE_EVENT_CLASS(local_only_evt4,
0037     TP_PROTO(struct ieee802154_local *local),
0038     TP_ARGS(local),
0039     TP_STRUCT__entry(
0040         LOCAL_ENTRY
0041     ),
0042     TP_fast_assign(
0043         LOCAL_ASSIGN;
0044     ),
0045     TP_printk(LOCAL_PR_FMT, LOCAL_PR_ARG)
0046 );
0047 
0048 DEFINE_EVENT(local_only_evt4, 802154_drv_return_void,
0049     TP_PROTO(struct ieee802154_local *local),
0050     TP_ARGS(local)
0051 );
0052 
0053 TRACE_EVENT(802154_drv_return_int,
0054     TP_PROTO(struct ieee802154_local *local, int ret),
0055     TP_ARGS(local, ret),
0056     TP_STRUCT__entry(
0057         LOCAL_ENTRY
0058         __field(int, ret)
0059     ),
0060     TP_fast_assign(
0061         LOCAL_ASSIGN;
0062         __entry->ret = ret;
0063     ),
0064     TP_printk(LOCAL_PR_FMT ", returned: %d", LOCAL_PR_ARG,
0065           __entry->ret)
0066 );
0067 
0068 DEFINE_EVENT(local_only_evt4, 802154_drv_start,
0069     TP_PROTO(struct ieee802154_local *local),
0070     TP_ARGS(local)
0071 );
0072 
0073 DEFINE_EVENT(local_only_evt4, 802154_drv_stop,
0074     TP_PROTO(struct ieee802154_local *local),
0075     TP_ARGS(local)
0076 );
0077 
0078 TRACE_EVENT(802154_drv_set_channel,
0079     TP_PROTO(struct ieee802154_local *local, u8 page, u8 channel),
0080     TP_ARGS(local, page, channel),
0081     TP_STRUCT__entry(
0082         LOCAL_ENTRY
0083         __field(u8, page)
0084         __field(u8, channel)
0085     ),
0086     TP_fast_assign(
0087         LOCAL_ASSIGN;
0088         __entry->page = page;
0089         __entry->channel = channel;
0090     ),
0091     TP_printk(LOCAL_PR_FMT ", page: %d, channel: %d", LOCAL_PR_ARG,
0092           __entry->page, __entry->channel)
0093 );
0094 
0095 TRACE_EVENT(802154_drv_set_cca_mode,
0096     TP_PROTO(struct ieee802154_local *local,
0097          const struct wpan_phy_cca *cca),
0098     TP_ARGS(local, cca),
0099     TP_STRUCT__entry(
0100         LOCAL_ENTRY
0101         CCA_ENTRY
0102     ),
0103     TP_fast_assign(
0104         LOCAL_ASSIGN;
0105         CCA_ASSIGN;
0106     ),
0107     TP_printk(LOCAL_PR_FMT ", " CCA_PR_FMT, LOCAL_PR_ARG,
0108           CCA_PR_ARG)
0109 );
0110 
0111 TRACE_EVENT(802154_drv_set_cca_ed_level,
0112     TP_PROTO(struct ieee802154_local *local, s32 mbm),
0113     TP_ARGS(local, mbm),
0114     TP_STRUCT__entry(
0115         LOCAL_ENTRY
0116         __field(s32, mbm)
0117     ),
0118     TP_fast_assign(
0119         LOCAL_ASSIGN;
0120         __entry->mbm = mbm;
0121     ),
0122     TP_printk(LOCAL_PR_FMT ", ed level: %d", LOCAL_PR_ARG,
0123           __entry->mbm)
0124 );
0125 
0126 TRACE_EVENT(802154_drv_set_tx_power,
0127     TP_PROTO(struct ieee802154_local *local, s32 power),
0128     TP_ARGS(local, power),
0129     TP_STRUCT__entry(
0130         LOCAL_ENTRY
0131         __field(s32, power)
0132     ),
0133     TP_fast_assign(
0134         LOCAL_ASSIGN;
0135         __entry->power = power;
0136     ),
0137     TP_printk(LOCAL_PR_FMT ", mbm: %d", LOCAL_PR_ARG,
0138          __entry->power)
0139 );
0140 
0141 TRACE_EVENT(802154_drv_set_lbt_mode,
0142     TP_PROTO(struct ieee802154_local *local, bool mode),
0143     TP_ARGS(local, mode),
0144     TP_STRUCT__entry(
0145         LOCAL_ENTRY
0146         __field(bool, mode)
0147     ),
0148     TP_fast_assign(
0149         LOCAL_ASSIGN;
0150         __entry->mode = mode;
0151     ),
0152     TP_printk(LOCAL_PR_FMT ", lbt mode: %s", LOCAL_PR_ARG,
0153           BOOL_TO_STR(__entry->mode))
0154 );
0155 
0156 TRACE_EVENT(802154_drv_set_short_addr,
0157     TP_PROTO(struct ieee802154_local *local, __le16 short_addr),
0158     TP_ARGS(local, short_addr),
0159     TP_STRUCT__entry(
0160         LOCAL_ENTRY
0161         __field(__le16, short_addr)
0162     ),
0163     TP_fast_assign(
0164         LOCAL_ASSIGN;
0165         __entry->short_addr = short_addr;
0166     ),
0167     TP_printk(LOCAL_PR_FMT ", short addr: 0x%04x", LOCAL_PR_ARG,
0168           le16_to_cpu(__entry->short_addr))
0169 );
0170 
0171 TRACE_EVENT(802154_drv_set_pan_id,
0172     TP_PROTO(struct ieee802154_local *local, __le16 pan_id),
0173     TP_ARGS(local, pan_id),
0174     TP_STRUCT__entry(
0175         LOCAL_ENTRY
0176         __field(__le16, pan_id)
0177     ),
0178     TP_fast_assign(
0179         LOCAL_ASSIGN;
0180         __entry->pan_id = pan_id;
0181     ),
0182     TP_printk(LOCAL_PR_FMT ", pan id: 0x%04x", LOCAL_PR_ARG,
0183           le16_to_cpu(__entry->pan_id))
0184 );
0185 
0186 TRACE_EVENT(802154_drv_set_extended_addr,
0187     TP_PROTO(struct ieee802154_local *local, __le64 extended_addr),
0188     TP_ARGS(local, extended_addr),
0189     TP_STRUCT__entry(
0190         LOCAL_ENTRY
0191         __field(__le64, extended_addr)
0192     ),
0193     TP_fast_assign(
0194         LOCAL_ASSIGN;
0195         __entry->extended_addr = extended_addr;
0196     ),
0197     TP_printk(LOCAL_PR_FMT ", extended addr: 0x%llx", LOCAL_PR_ARG,
0198           le64_to_cpu(__entry->extended_addr))
0199 );
0200 
0201 TRACE_EVENT(802154_drv_set_pan_coord,
0202     TP_PROTO(struct ieee802154_local *local, bool is_coord),
0203     TP_ARGS(local, is_coord),
0204     TP_STRUCT__entry(
0205         LOCAL_ENTRY
0206         __field(bool, is_coord)
0207     ),
0208     TP_fast_assign(
0209         LOCAL_ASSIGN;
0210         __entry->is_coord = is_coord;
0211     ),
0212     TP_printk(LOCAL_PR_FMT ", is_coord: %s", LOCAL_PR_ARG,
0213           BOOL_TO_STR(__entry->is_coord))
0214 );
0215 
0216 TRACE_EVENT(802154_drv_set_csma_params,
0217     TP_PROTO(struct ieee802154_local *local, u8 min_be, u8 max_be,
0218          u8 max_csma_backoffs),
0219     TP_ARGS(local, min_be, max_be, max_csma_backoffs),
0220     TP_STRUCT__entry(
0221         LOCAL_ENTRY
0222         __field(u8, min_be)
0223         __field(u8, max_be)
0224         __field(u8, max_csma_backoffs)
0225     ),
0226     TP_fast_assign(
0227         LOCAL_ASSIGN,
0228         __entry->min_be = min_be;
0229         __entry->max_be = max_be;
0230         __entry->max_csma_backoffs = max_csma_backoffs;
0231     ),
0232     TP_printk(LOCAL_PR_FMT ", min be: %d, max be: %d, max csma backoffs: %d",
0233           LOCAL_PR_ARG, __entry->min_be, __entry->max_be,
0234           __entry->max_csma_backoffs)
0235 );
0236 
0237 TRACE_EVENT(802154_drv_set_max_frame_retries,
0238     TP_PROTO(struct ieee802154_local *local, s8 max_frame_retries),
0239     TP_ARGS(local, max_frame_retries),
0240     TP_STRUCT__entry(
0241         LOCAL_ENTRY
0242         __field(s8, max_frame_retries)
0243     ),
0244     TP_fast_assign(
0245         LOCAL_ASSIGN;
0246         __entry->max_frame_retries = max_frame_retries;
0247     ),
0248     TP_printk(LOCAL_PR_FMT ", max frame retries: %d", LOCAL_PR_ARG,
0249           __entry->max_frame_retries)
0250 );
0251 
0252 TRACE_EVENT(802154_drv_set_promiscuous_mode,
0253     TP_PROTO(struct ieee802154_local *local, bool on),
0254     TP_ARGS(local, on),
0255     TP_STRUCT__entry(
0256         LOCAL_ENTRY
0257         __field(bool, on)
0258     ),
0259     TP_fast_assign(
0260         LOCAL_ASSIGN;
0261         __entry->on = on;
0262     ),
0263     TP_printk(LOCAL_PR_FMT ", promiscuous mode: %s", LOCAL_PR_ARG,
0264           BOOL_TO_STR(__entry->on))
0265 );
0266 
0267 #endif /* !__MAC802154_DRIVER_TRACE || TRACE_HEADER_MULTI_READ */
0268 
0269 #undef TRACE_INCLUDE_PATH
0270 #define TRACE_INCLUDE_PATH .
0271 #undef TRACE_INCLUDE_FILE
0272 #define TRACE_INCLUDE_FILE trace
0273 #include <trace/define_trace.h>