root/net/mac802154/trace.h

/* [<][>][^][v][top][bottom][index][help] */

INCLUDED FROM


   1 /* SPDX-License-Identifier: GPL-2.0 */
   2 /* Based on net/mac80211/trace.h */
   3 
   4 #undef TRACE_SYSTEM
   5 #define TRACE_SYSTEM mac802154
   6 
   7 #if !defined(__MAC802154_DRIVER_TRACE) || defined(TRACE_HEADER_MULTI_READ)
   8 #define __MAC802154_DRIVER_TRACE
   9 
  10 #include <linux/tracepoint.h>
  11 
  12 #include <net/mac802154.h>
  13 #include "ieee802154_i.h"
  14 
  15 #define MAXNAME         32
  16 #define LOCAL_ENTRY     __array(char, wpan_phy_name, MAXNAME)
  17 #define LOCAL_ASSIGN    strlcpy(__entry->wpan_phy_name, \
  18                                 wpan_phy_name(local->hw.phy), MAXNAME)
  19 #define LOCAL_PR_FMT    "%s"
  20 #define LOCAL_PR_ARG    __entry->wpan_phy_name
  21 
  22 #define CCA_ENTRY __field(enum nl802154_cca_modes, cca_mode) \
  23                   __field(enum nl802154_cca_opts, cca_opt)
  24 #define CCA_ASSIGN \
  25         do {                                     \
  26                 (__entry->cca_mode) = cca->mode; \
  27                 (__entry->cca_opt) = cca->opt;   \
  28         } while (0)
  29 #define CCA_PR_FMT "cca_mode: %d, cca_opt: %d"
  30 #define CCA_PR_ARG __entry->cca_mode, __entry->cca_opt
  31 
  32 #define BOOL_TO_STR(bo) (bo) ? "true" : "false"
  33 
  34 /* Tracing for driver callbacks */
  35 
  36 DECLARE_EVENT_CLASS(local_only_evt4,
  37         TP_PROTO(struct ieee802154_local *local),
  38         TP_ARGS(local),
  39         TP_STRUCT__entry(
  40                 LOCAL_ENTRY
  41         ),
  42         TP_fast_assign(
  43                 LOCAL_ASSIGN;
  44         ),
  45         TP_printk(LOCAL_PR_FMT, LOCAL_PR_ARG)
  46 );
  47 
  48 DEFINE_EVENT(local_only_evt4, 802154_drv_return_void,
  49         TP_PROTO(struct ieee802154_local *local),
  50         TP_ARGS(local)
  51 );
  52 
  53 TRACE_EVENT(802154_drv_return_int,
  54         TP_PROTO(struct ieee802154_local *local, int ret),
  55         TP_ARGS(local, ret),
  56         TP_STRUCT__entry(
  57                 LOCAL_ENTRY
  58                 __field(int, ret)
  59         ),
  60         TP_fast_assign(
  61                 LOCAL_ASSIGN;
  62                 __entry->ret = ret;
  63         ),
  64         TP_printk(LOCAL_PR_FMT ", returned: %d", LOCAL_PR_ARG,
  65                   __entry->ret)
  66 );
  67 
  68 DEFINE_EVENT(local_only_evt4, 802154_drv_start,
  69         TP_PROTO(struct ieee802154_local *local),
  70         TP_ARGS(local)
  71 );
  72 
  73 DEFINE_EVENT(local_only_evt4, 802154_drv_stop,
  74         TP_PROTO(struct ieee802154_local *local),
  75         TP_ARGS(local)
  76 );
  77 
  78 TRACE_EVENT(802154_drv_set_channel,
  79         TP_PROTO(struct ieee802154_local *local, u8 page, u8 channel),
  80         TP_ARGS(local, page, channel),
  81         TP_STRUCT__entry(
  82                 LOCAL_ENTRY
  83                 __field(u8, page)
  84                 __field(u8, channel)
  85         ),
  86         TP_fast_assign(
  87                 LOCAL_ASSIGN;
  88                 __entry->page = page;
  89                 __entry->channel = channel;
  90         ),
  91         TP_printk(LOCAL_PR_FMT ", page: %d, channel: %d", LOCAL_PR_ARG,
  92                   __entry->page, __entry->channel)
  93 );
  94 
  95 TRACE_EVENT(802154_drv_set_cca_mode,
  96         TP_PROTO(struct ieee802154_local *local,
  97                  const struct wpan_phy_cca *cca),
  98         TP_ARGS(local, cca),
  99         TP_STRUCT__entry(
 100                 LOCAL_ENTRY
 101                 CCA_ENTRY
 102         ),
 103         TP_fast_assign(
 104                 LOCAL_ASSIGN;
 105                 CCA_ASSIGN;
 106         ),
 107         TP_printk(LOCAL_PR_FMT ", " CCA_PR_FMT, LOCAL_PR_ARG,
 108                   CCA_PR_ARG)
 109 );
 110 
 111 TRACE_EVENT(802154_drv_set_cca_ed_level,
 112         TP_PROTO(struct ieee802154_local *local, s32 mbm),
 113         TP_ARGS(local, mbm),
 114         TP_STRUCT__entry(
 115                 LOCAL_ENTRY
 116                 __field(s32, mbm)
 117         ),
 118         TP_fast_assign(
 119                 LOCAL_ASSIGN;
 120                 __entry->mbm = mbm;
 121         ),
 122         TP_printk(LOCAL_PR_FMT ", ed level: %d", LOCAL_PR_ARG,
 123                   __entry->mbm)
 124 );
 125 
 126 TRACE_EVENT(802154_drv_set_tx_power,
 127         TP_PROTO(struct ieee802154_local *local, s32 power),
 128         TP_ARGS(local, power),
 129         TP_STRUCT__entry(
 130                 LOCAL_ENTRY
 131                 __field(s32, power)
 132         ),
 133         TP_fast_assign(
 134                 LOCAL_ASSIGN;
 135                 __entry->power = power;
 136         ),
 137         TP_printk(LOCAL_PR_FMT ", mbm: %d", LOCAL_PR_ARG,
 138                  __entry->power)
 139 );
 140 
 141 TRACE_EVENT(802154_drv_set_lbt_mode,
 142         TP_PROTO(struct ieee802154_local *local, bool mode),
 143         TP_ARGS(local, mode),
 144         TP_STRUCT__entry(
 145                 LOCAL_ENTRY
 146                 __field(bool, mode)
 147         ),
 148         TP_fast_assign(
 149                 LOCAL_ASSIGN;
 150                 __entry->mode = mode;
 151         ),
 152         TP_printk(LOCAL_PR_FMT ", lbt mode: %s", LOCAL_PR_ARG,
 153                   BOOL_TO_STR(__entry->mode))
 154 );
 155 
 156 TRACE_EVENT(802154_drv_set_short_addr,
 157         TP_PROTO(struct ieee802154_local *local, __le16 short_addr),
 158         TP_ARGS(local, short_addr),
 159         TP_STRUCT__entry(
 160                 LOCAL_ENTRY
 161                 __field(__le16, short_addr)
 162         ),
 163         TP_fast_assign(
 164                 LOCAL_ASSIGN;
 165                 __entry->short_addr = short_addr;
 166         ),
 167         TP_printk(LOCAL_PR_FMT ", short addr: 0x%04x", LOCAL_PR_ARG,
 168                   le16_to_cpu(__entry->short_addr))
 169 );
 170 
 171 TRACE_EVENT(802154_drv_set_pan_id,
 172         TP_PROTO(struct ieee802154_local *local, __le16 pan_id),
 173         TP_ARGS(local, pan_id),
 174         TP_STRUCT__entry(
 175                 LOCAL_ENTRY
 176                 __field(__le16, pan_id)
 177         ),
 178         TP_fast_assign(
 179                 LOCAL_ASSIGN;
 180                 __entry->pan_id = pan_id;
 181         ),
 182         TP_printk(LOCAL_PR_FMT ", pan id: 0x%04x", LOCAL_PR_ARG,
 183                   le16_to_cpu(__entry->pan_id))
 184 );
 185 
 186 TRACE_EVENT(802154_drv_set_extended_addr,
 187         TP_PROTO(struct ieee802154_local *local, __le64 extended_addr),
 188         TP_ARGS(local, extended_addr),
 189         TP_STRUCT__entry(
 190                 LOCAL_ENTRY
 191                 __field(__le64, extended_addr)
 192         ),
 193         TP_fast_assign(
 194                 LOCAL_ASSIGN;
 195                 __entry->extended_addr = extended_addr;
 196         ),
 197         TP_printk(LOCAL_PR_FMT ", extended addr: 0x%llx", LOCAL_PR_ARG,
 198                   le64_to_cpu(__entry->extended_addr))
 199 );
 200 
 201 TRACE_EVENT(802154_drv_set_pan_coord,
 202         TP_PROTO(struct ieee802154_local *local, bool is_coord),
 203         TP_ARGS(local, is_coord),
 204         TP_STRUCT__entry(
 205                 LOCAL_ENTRY
 206                 __field(bool, is_coord)
 207         ),
 208         TP_fast_assign(
 209                 LOCAL_ASSIGN;
 210                 __entry->is_coord = is_coord;
 211         ),
 212         TP_printk(LOCAL_PR_FMT ", is_coord: %s", LOCAL_PR_ARG,
 213                   BOOL_TO_STR(__entry->is_coord))
 214 );
 215 
 216 TRACE_EVENT(802154_drv_set_csma_params,
 217         TP_PROTO(struct ieee802154_local *local, u8 min_be, u8 max_be,
 218                  u8 max_csma_backoffs),
 219         TP_ARGS(local, min_be, max_be, max_csma_backoffs),
 220         TP_STRUCT__entry(
 221                 LOCAL_ENTRY
 222                 __field(u8, min_be)
 223                 __field(u8, max_be)
 224                 __field(u8, max_csma_backoffs)
 225         ),
 226         TP_fast_assign(
 227                 LOCAL_ASSIGN,
 228                 __entry->min_be = min_be;
 229                 __entry->max_be = max_be;
 230                 __entry->max_csma_backoffs = max_csma_backoffs;
 231         ),
 232         TP_printk(LOCAL_PR_FMT ", min be: %d, max be: %d, max csma backoffs: %d",
 233                   LOCAL_PR_ARG, __entry->min_be, __entry->max_be,
 234                   __entry->max_csma_backoffs)
 235 );
 236 
 237 TRACE_EVENT(802154_drv_set_max_frame_retries,
 238         TP_PROTO(struct ieee802154_local *local, s8 max_frame_retries),
 239         TP_ARGS(local, max_frame_retries),
 240         TP_STRUCT__entry(
 241                 LOCAL_ENTRY
 242                 __field(s8, max_frame_retries)
 243         ),
 244         TP_fast_assign(
 245                 LOCAL_ASSIGN;
 246                 __entry->max_frame_retries = max_frame_retries;
 247         ),
 248         TP_printk(LOCAL_PR_FMT ", max frame retries: %d", LOCAL_PR_ARG,
 249                   __entry->max_frame_retries)
 250 );
 251 
 252 TRACE_EVENT(802154_drv_set_promiscuous_mode,
 253         TP_PROTO(struct ieee802154_local *local, bool on),
 254         TP_ARGS(local, on),
 255         TP_STRUCT__entry(
 256                 LOCAL_ENTRY
 257                 __field(bool, on)
 258         ),
 259         TP_fast_assign(
 260                 LOCAL_ASSIGN;
 261                 __entry->on = on;
 262         ),
 263         TP_printk(LOCAL_PR_FMT ", promiscuous mode: %s", LOCAL_PR_ARG,
 264                   BOOL_TO_STR(__entry->on))
 265 );
 266 
 267 #endif /* !__MAC802154_DRIVER_TRACE || TRACE_HEADER_MULTI_READ */
 268 
 269 #undef TRACE_INCLUDE_PATH
 270 #define TRACE_INCLUDE_PATH .
 271 #undef TRACE_INCLUDE_FILE
 272 #define TRACE_INCLUDE_FILE trace
 273 #include <trace/define_trace.h>

/* [<][>][^][v][top][bottom][index][help] */