1 /* 1 2 * net/tipc/trace.h: TIPC tracepoints 3 * 4 * Copyright (c) 2018, Ericsson AB 5 * All rights reserved. 6 * 7 * Redistribution and use in source and binary 8 * modification, are permitted provided that t 9 * 10 * 1. Redistributions of source code must reta 11 * notice, this list of conditions and the 12 * 2. Redistributions in binary form must repr 13 * notice, this list of conditions and the 14 * documentation and/or other materials pro 15 * 3. Neither the names of the copyright holde 16 * contributors may be used to endorse or p 17 * this software without specific prior wri 18 * 19 * Alternatively, this software may be distrib 20 * GNU General Public License ("GPL") version 21 * Software Foundation. 22 * 23 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT 24 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCL 25 * IMPLIED WARRANTIES OF MERCHANTABILITY AND F 26 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYR 27 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL 28 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT L 29 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 30 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THE 31 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUD 32 * ARISING IN ANY WAY OUT OF THE USE OF THIS S 33 * POSSIBILITY OF SUCH DAMAGE. 34 */ 35 36 #undef TRACE_SYSTEM 37 #define TRACE_SYSTEM tipc 38 39 #if !defined(_TIPC_TRACE_H) || defined(TRACE_H 40 #define _TIPC_TRACE_H 41 42 #include <linux/tracepoint.h> 43 #include "core.h" 44 #include "link.h" 45 #include "socket.h" 46 #include "node.h" 47 48 #define SKB_LMIN (100) 49 #define SKB_LMAX (SKB_LMIN * 2) 50 #define LIST_LMIN (SKB_LMIN * 3) 51 #define LIST_LMAX (SKB_LMIN * 11) 52 #define SK_LMIN (SKB_LMIN * 2) 53 #define SK_LMAX (SKB_LMIN * 11) 54 #define LINK_LMIN (SKB_LMIN) 55 #define LINK_LMAX (SKB_LMIN * 16) 56 #define NODE_LMIN (SKB_LMIN) 57 #define NODE_LMAX (SKB_LMIN * 11) 58 59 #ifndef __TIPC_TRACE_ENUM 60 #define __TIPC_TRACE_ENUM 61 enum { 62 TIPC_DUMP_NONE = 0, 63 64 TIPC_DUMP_TRANSMQ = 1, 65 TIPC_DUMP_BACKLOGQ = (1 << 1), 66 TIPC_DUMP_DEFERDQ = (1 << 2), 67 TIPC_DUMP_INPUTQ = (1 << 3), 68 TIPC_DUMP_WAKEUP = (1 << 4), 69 70 TIPC_DUMP_SK_SNDQ = (1 << 8), 71 TIPC_DUMP_SK_RCVQ = (1 << 9), 72 TIPC_DUMP_SK_BKLGQ = (1 << 10), 73 TIPC_DUMP_ALL = 0xffffu 74 }; 75 #endif 76 77 /* Link & Node FSM states: */ 78 #define state_sym(val) 79 __print_symbolic(val, 80 {(0xe), "ESTAB 81 {(0xe << 4), "ESTAB 82 {(0x1 << 8), "RESET 83 {(0x2 << 12), "RESET 84 {(0xd << 16), "PEER_ 85 {(0xf << 20), "FAILI 86 {(0xc << 24), "SYNCH 87 {(0xdd), "SELF_ 88 {(0xaa), "SELF_ 89 {(0xd1), "SELF_ 90 {(0xac), "SELF_ 91 {(0xca), "SELF_ 92 {(0x1d), "SELF_ 93 {(0xf0), "FAILI 94 {(0xcc), "SYNCH 95 96 /* Link & Node FSM events: */ 97 #define evt_sym(val) 98 __print_symbolic(val, 99 {(0xec1ab1e), "ESTAB 100 {(0x9eed0e), "PEER_ 101 {(0xfa110e), "FAILU 102 {(0x10ca1d0e), "RESET 103 {(0xfa110bee), "FAILO 104 {(0xfa110ede), "FAILO 105 {(0xc1ccbee), "SYNCH 106 {(0xc1ccede), "SYNCH 107 {(0xece), "SELF_ 108 {(0x1ce), "SELF_ 109 {(0x9ece), "PEER_ 110 {(0x91ce), "PEER_ 111 {(0xfbe), "FAILO 112 {(0xfee), "FAILO 113 {(0xcbe), "SYNCH 114 {(0xcee), "SYNCH 115 116 /* Bearer, net device events: */ 117 #define dev_evt_sym(val) 118 __print_symbolic(val, 119 {(NETDEV_CHANGE), 120 {(NETDEV_GOING_DOWN), 121 {(NETDEV_UP), 122 {(NETDEV_CHANGEMTU), 123 {(NETDEV_CHANGEADDR), 124 {(NETDEV_UNREGISTER), 125 {(NETDEV_CHANGENAME), 126 127 extern unsigned long sysctl_tipc_sk_filter[5] 128 129 int tipc_skb_dump(struct sk_buff *skb, bool mo 130 int tipc_list_dump(struct sk_buff_head *list, 131 int tipc_sk_dump(struct sock *sk, u16 dqueues, 132 int tipc_link_dump(struct tipc_link *l, u16 dq 133 int tipc_node_dump(struct tipc_node *n, bool m 134 bool tipc_sk_filtering(struct sock *sk); 135 136 DECLARE_EVENT_CLASS(tipc_skb_class, 137 138 TP_PROTO(struct sk_buff *skb, bool mor 139 140 TP_ARGS(skb, more, header), 141 142 TP_STRUCT__entry( 143 __string(header, header) 144 __dynamic_array(char, buf, (mo 145 ), 146 147 TP_fast_assign( 148 __assign_str(header); 149 tipc_skb_dump(skb, more, __get 150 ), 151 152 TP_printk("%s\n%s", __get_str(header), 153 ) 154 155 #define DEFINE_SKB_EVENT(name) \ 156 DEFINE_EVENT(tipc_skb_class, name, \ 157 TP_PROTO(struct sk_buff *skb, bool mor 158 TP_ARGS(skb, more, header)) 159 DEFINE_SKB_EVENT(tipc_skb_dump); 160 DEFINE_SKB_EVENT(tipc_proto_build); 161 DEFINE_SKB_EVENT(tipc_proto_rcv); 162 163 DECLARE_EVENT_CLASS(tipc_list_class, 164 165 TP_PROTO(struct sk_buff_head *list, bo 166 167 TP_ARGS(list, more, header), 168 169 TP_STRUCT__entry( 170 __string(header, header) 171 __dynamic_array(char, buf, (mo 172 ), 173 174 TP_fast_assign( 175 __assign_str(header); 176 tipc_list_dump(list, more, __g 177 ), 178 179 TP_printk("%s\n%s", __get_str(header), 180 ); 181 182 #define DEFINE_LIST_EVENT(name) \ 183 DEFINE_EVENT(tipc_list_class, name, \ 184 TP_PROTO(struct sk_buff_head *list, bo 185 TP_ARGS(list, more, header)) 186 DEFINE_LIST_EVENT(tipc_list_dump); 187 188 DECLARE_EVENT_CLASS(tipc_sk_class, 189 190 TP_PROTO(struct sock *sk, struct sk_bu 191 const char *header), 192 193 TP_ARGS(sk, skb, dqueues, header), 194 195 TP_STRUCT__entry( 196 __string(header, header) 197 __field(u32, portid) 198 __dynamic_array(char, buf, (dq 199 __dynamic_array(char, skb_buf, 200 ), 201 202 TP_fast_assign( 203 __assign_str(header); 204 __entry->portid = tipc_sock_ge 205 tipc_sk_dump(sk, dqueues, __ge 206 if (skb) 207 tipc_skb_dump(skb, fal 208 else 209 *(__get_str(skb_buf)) 210 ), 211 212 TP_printk("<%u> %s\n%s%s", __entry->po 213 __get_str(skb_buf), __get_st 214 ); 215 216 #define DEFINE_SK_EVENT_FILTER(name) \ 217 DEFINE_EVENT_CONDITION(tipc_sk_class, name, \ 218 TP_PROTO(struct sock *sk, struct sk_bu 219 const char *header), \ 220 TP_ARGS(sk, skb, dqueues, header), \ 221 TP_CONDITION(tipc_sk_filtering(sk))) 222 DEFINE_SK_EVENT_FILTER(tipc_sk_dump); 223 DEFINE_SK_EVENT_FILTER(tipc_sk_create); 224 DEFINE_SK_EVENT_FILTER(tipc_sk_sendmcast); 225 DEFINE_SK_EVENT_FILTER(tipc_sk_sendmsg); 226 DEFINE_SK_EVENT_FILTER(tipc_sk_sendstream); 227 DEFINE_SK_EVENT_FILTER(tipc_sk_poll); 228 DEFINE_SK_EVENT_FILTER(tipc_sk_filter_rcv); 229 DEFINE_SK_EVENT_FILTER(tipc_sk_advance_rx); 230 DEFINE_SK_EVENT_FILTER(tipc_sk_rej_msg); 231 DEFINE_SK_EVENT_FILTER(tipc_sk_drop_msg); 232 DEFINE_SK_EVENT_FILTER(tipc_sk_release); 233 DEFINE_SK_EVENT_FILTER(tipc_sk_shutdown); 234 235 #define DEFINE_SK_EVENT_FILTER_COND(name, cond 236 DEFINE_EVENT_CONDITION(tipc_sk_class, name, \ 237 TP_PROTO(struct sock *sk, struct sk_bu 238 const char *header), \ 239 TP_ARGS(sk, skb, dqueues, header), \ 240 TP_CONDITION(tipc_sk_filtering(sk) && 241 DEFINE_SK_EVENT_FILTER_COND(tipc_sk_overlimit1 242 DEFINE_SK_EVENT_FILTER_COND(tipc_sk_overlimit2 243 244 DECLARE_EVENT_CLASS(tipc_link_class, 245 246 TP_PROTO(struct tipc_link *l, u16 dque 247 248 TP_ARGS(l, dqueues, header), 249 250 TP_STRUCT__entry( 251 __string(header, header) 252 __array(char, name, TIPC_MAX_L 253 __dynamic_array(char, buf, (dq 254 ), 255 256 TP_fast_assign( 257 __assign_str(header); 258 memcpy(__entry->name, tipc_lin 259 tipc_link_dump(l, dqueues, __g 260 ), 261 262 TP_printk("<%s> %s\n%s", __entry->name 263 __get_str(buf)) 264 ); 265 266 #define DEFINE_LINK_EVENT(name) \ 267 DEFINE_EVENT(tipc_link_class, name, \ 268 TP_PROTO(struct tipc_link *l, u16 dque 269 TP_ARGS(l, dqueues, header)) 270 DEFINE_LINK_EVENT(tipc_link_dump); 271 DEFINE_LINK_EVENT(tipc_link_conges); 272 DEFINE_LINK_EVENT(tipc_link_timeout); 273 DEFINE_LINK_EVENT(tipc_link_reset); 274 275 #define DEFINE_LINK_EVENT_COND(name, cond) \ 276 DEFINE_EVENT_CONDITION(tipc_link_class, name, 277 TP_PROTO(struct tipc_link *l, u16 dque 278 TP_ARGS(l, dqueues, header), \ 279 TP_CONDITION(cond)) 280 DEFINE_LINK_EVENT_COND(tipc_link_too_silent, t 281 282 DECLARE_EVENT_CLASS(tipc_link_transmq_class, 283 284 TP_PROTO(struct tipc_link *r, u16 f, u 285 286 TP_ARGS(r, f, t, tq), 287 288 TP_STRUCT__entry( 289 __array(char, name, TIPC_MAX_L 290 __field(u16, from) 291 __field(u16, to) 292 __field(u32, len) 293 __field(u16, fseqno) 294 __field(u16, lseqno) 295 ), 296 297 TP_fast_assign( 298 memcpy(__entry->name, tipc_lin 299 __entry->from = f; 300 __entry->to = t; 301 __entry->len = skb_queue_len(t 302 __entry->fseqno = __entry->len 303 msg_seqno(bu 304 __entry->lseqno = __entry->len 305 msg_seqno(bu 306 ), 307 308 TP_printk("<%s> retrans req: [%u-%u] t 309 __entry->name, __entry->from 310 __entry->len, __entry->fseqn 311 ); 312 313 DEFINE_EVENT_CONDITION(tipc_link_transmq_class 314 TP_PROTO(struct tipc_link *r, u16 f, u 315 TP_ARGS(r, f, t, tq), 316 TP_CONDITION(less_eq(f, t)) 317 ); 318 319 DEFINE_EVENT_PRINT(tipc_link_transmq_class, ti 320 TP_PROTO(struct tipc_link *r, u16 f, u 321 TP_ARGS(r, f, t, tq), 322 TP_printk("<%s> acked: %u gap: %u tran 323 __entry->name, __entry->from 324 __entry->len, __entry->fseqn 325 ); 326 327 DECLARE_EVENT_CLASS(tipc_node_class, 328 329 TP_PROTO(struct tipc_node *n, bool mor 330 331 TP_ARGS(n, more, header), 332 333 TP_STRUCT__entry( 334 __string(header, header) 335 __field(u32, addr) 336 __dynamic_array(char, buf, (mo 337 ), 338 339 TP_fast_assign( 340 __assign_str(header); 341 __entry->addr = tipc_node_get_ 342 tipc_node_dump(n, more, __get_ 343 ), 344 345 TP_printk("<%x> %s\n%s", __entry->addr 346 __get_str(buf)) 347 ); 348 349 #define DEFINE_NODE_EVENT(name) \ 350 DEFINE_EVENT(tipc_node_class, name, \ 351 TP_PROTO(struct tipc_node *n, bool mor 352 TP_ARGS(n, more, header)) 353 DEFINE_NODE_EVENT(tipc_node_dump); 354 DEFINE_NODE_EVENT(tipc_node_create); 355 DEFINE_NODE_EVENT(tipc_node_delete); 356 DEFINE_NODE_EVENT(tipc_node_lost_contact); 357 DEFINE_NODE_EVENT(tipc_node_timeout); 358 DEFINE_NODE_EVENT(tipc_node_link_up); 359 DEFINE_NODE_EVENT(tipc_node_link_down); 360 DEFINE_NODE_EVENT(tipc_node_reset_links); 361 DEFINE_NODE_EVENT(tipc_node_check_state); 362 363 DECLARE_EVENT_CLASS(tipc_fsm_class, 364 365 TP_PROTO(const char *name, u32 os, u32 366 367 TP_ARGS(name, os, ns, evt), 368 369 TP_STRUCT__entry( 370 __string(name, name) 371 __field(u32, os) 372 __field(u32, ns) 373 __field(u32, evt) 374 ), 375 376 TP_fast_assign( 377 __assign_str(name); 378 __entry->os = os; 379 __entry->ns = ns; 380 __entry->evt = evt; 381 ), 382 383 TP_printk("<%s> %s--(%s)->%s\n", __get 384 state_sym(__entry->os), evt_ 385 state_sym(__entry->ns)) 386 ); 387 388 #define DEFINE_FSM_EVENT(fsm_name) \ 389 DEFINE_EVENT(tipc_fsm_class, fsm_name, \ 390 TP_PROTO(const char *name, u32 os, u32 391 TP_ARGS(name, os, ns, evt)) 392 DEFINE_FSM_EVENT(tipc_link_fsm); 393 DEFINE_FSM_EVENT(tipc_node_fsm); 394 395 TRACE_EVENT(tipc_l2_device_event, 396 397 TP_PROTO(struct net_device *dev, struc 398 unsigned long evt), 399 400 TP_ARGS(dev, b, evt), 401 402 TP_STRUCT__entry( 403 __string(dev_name, dev->name) 404 __string(b_name, b->name) 405 __field(unsigned long, evt) 406 __field(u8, b_up) 407 __field(u8, carrier) 408 __field(u8, oper) 409 ), 410 411 TP_fast_assign( 412 __assign_str(dev_name); 413 __assign_str(b_name); 414 __entry->evt = evt; 415 __entry->b_up = test_bit(0, &b 416 __entry->carrier = netif_carri 417 __entry->oper = netif_oper_up( 418 ), 419 420 TP_printk("%s on: <%s>/<%s> oper: %s c 421 dev_evt_sym(__entry->evt), _ 422 __get_str(b_name), (__entry- 423 (__entry->carrier) ? "ok" : 424 (__entry->b_up) ? "up" : "do 425 ); 426 427 #endif /* _TIPC_TRACE_H */ 428 429 /* This part must be outside protection */ 430 #undef TRACE_INCLUDE_PATH 431 #define TRACE_INCLUDE_PATH . 432 #undef TRACE_INCLUDE_FILE 433 #define TRACE_INCLUDE_FILE trace 434 #include <trace/define_trace.h> 435
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.