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,
16 const struct fib_nh *nh, int err),
18 TP_ARGS(tb_id, flp, nh, err),
26 __field( __u8, scope )
27 __field( __u8, flags )
28 __array( __u8, src, 4 )
29 __array( __u8, dst, 4 )
30 __array( __u8, gw, 4 )
31 __array( __u8, saddr, 4 )
35 __dynamic_array(char, name, IFNAMSIZ )
41 __entry->tb_id = tb_id;
43 __entry->oif = flp->flowi4_oif;
44 __entry->iif = flp->flowi4_iif;
45 __entry->tos = flp->flowi4_tos;
46 __entry->scope = flp->flowi4_scope;
47 __entry->flags = flp->flowi4_flags;
49 p32 = (__be32 *) __entry->src;
52 p32 = (__be32 *) __entry->dst;
55 __entry->proto = flp->flowi4_proto;
56 if (__entry->proto == IPPROTO_TCP ||
57 __entry->proto == IPPROTO_UDP) {
58 __entry->sport = ntohs(flp->fl4_sport);
59 __entry->dport = ntohs(flp->fl4_dport);
66 p32 = (__be32 *) __entry->saddr;
69 p32 = (__be32 *) __entry->gw;
72 __assign_str(name, nh->nh_dev ? nh->nh_dev->name : "-");
74 p32 = (__be32 *) __entry->saddr;
77 p32 = (__be32 *) __entry->gw;
80 __assign_str(name, "-");
84 TP_printk("table %u oif %d iif %d proto %u %pI4/%u -> %pI4/%u tos %d scope %d flags %x ==> dev %s gw %pI4 src %pI4 err %d",
85 __entry->tb_id, __entry->oif, __entry->iif, __entry->proto,
86 __entry->src, __entry->sport, __entry->dst, __entry->dport,
87 __entry->tos, __entry->scope, __entry->flags,
88 __get_str(name), __entry->gw, __entry->saddr, __entry->err)
90 #endif /* _TRACE_FIB_H */
92 /* This part must be outside protection */
93 #include <trace/define_trace.h>