1 /* SPDX-License-Identifier: GPL-2.0 */
3 #define TRACE_SYSTEM fib
5 #if !defined(_TRACE_FIB_H) || defined(TRACE_HEADER_MULTI_READ)
8 #include <linux/skbuff.h>
9 #include <linux/netdevice.h>
10 #include <net/ip_fib.h>
11 #include <linux/tracepoint.h>
13 TRACE_EVENT(fib_table_lookup,
15 TP_PROTO(u32 tb_id, const struct flowi4 *flp),
24 __field( __u8, scope )
25 __field( __u8, flags )
26 __array( __u8, src, 4 )
27 __array( __u8, dst, 4 )
33 __entry->tb_id = tb_id;
34 __entry->oif = flp->flowi4_oif;
35 __entry->iif = flp->flowi4_iif;
36 __entry->tos = flp->flowi4_tos;
37 __entry->scope = flp->flowi4_scope;
38 __entry->flags = flp->flowi4_flags;
40 p32 = (__be32 *) __entry->src;
43 p32 = (__be32 *) __entry->dst;
47 TP_printk("table %u oif %d iif %d src %pI4 dst %pI4 tos %d scope %d flags %x",
48 __entry->tb_id, __entry->oif, __entry->iif,
49 __entry->src, __entry->dst, __entry->tos, __entry->scope,
53 TRACE_EVENT(fib_table_lookup_nh,
55 TP_PROTO(const struct fib_nh *nh),
60 __string( name, nh->nh_dev->name)
62 __array( __u8, src, 4 )
66 __be32 *p32 = (__be32 *) __entry->src;
68 __assign_str(name, nh->nh_dev ? nh->nh_dev->name : "not set");
69 __entry->oif = nh->nh_oif;
73 TP_printk("nexthop dev %s oif %d src %pI4",
74 __get_str(name), __entry->oif, __entry->src)
77 TRACE_EVENT(fib_validate_source,
79 TP_PROTO(const struct net_device *dev, const struct flowi4 *flp),
84 __string( name, dev->name )
88 __array( __u8, src, 4 )
89 __array( __u8, dst, 4 )
95 __assign_str(name, dev ? dev->name : "not set");
96 __entry->oif = flp->flowi4_oif;
97 __entry->iif = flp->flowi4_iif;
98 __entry->tos = flp->flowi4_tos;
100 p32 = (__be32 *) __entry->src;
103 p32 = (__be32 *) __entry->dst;
107 TP_printk("dev %s oif %d iif %d tos %d src %pI4 dst %pI4",
108 __get_str(name), __entry->oif, __entry->iif, __entry->tos,
109 __entry->src, __entry->dst)
111 #endif /* _TRACE_FIB_H */
113 /* This part must be outside protection */
114 #include <trace/define_trace.h>