1 /* SPDX-License-Identifier: GPL-2.0 */ 2 #undef TRACE_SYSTEM 3 #define TRACE_SYSTEM fib6 4 5 #if !defined(_TRACE_FIB6_H) || defined(TRACE_HEADER_MULTI_READ) 6 #define _TRACE_FIB6_H 7 8 #include <linux/in6.h> 9 #include <net/flow.h> 10 #include <net/ip6_fib.h> 11 #include <linux/tracepoint.h> 12 13 TRACE_EVENT(fib6_table_lookup, 14 15 TP_PROTO(const struct net *net, const struct rt6_info *rt, 16 struct fib6_table *table, const struct flowi6 *flp), 17 18 TP_ARGS(net, rt, table, flp), 19 20 TP_STRUCT__entry( 21 __field( u32, tb_id ) 22 23 __field( int, oif ) 24 __field( int, iif ) 25 __field( __u8, tos ) 26 __field( __u8, scope ) 27 __field( __u8, flags ) 28 __array( __u8, src, 16 ) 29 __array( __u8, dst, 16 ) 30 31 __dynamic_array( char, name, IFNAMSIZ ) 32 __array( __u8, gw, 16 ) 33 ), 34 35 TP_fast_assign( 36 struct in6_addr *in6; 37 38 __entry->tb_id = table->tb6_id; 39 __entry->oif = flp->flowi6_oif; 40 __entry->iif = flp->flowi6_iif; 41 __entry->tos = ip6_tclass(flp->flowlabel); 42 __entry->scope = flp->flowi6_scope; 43 __entry->flags = flp->flowi6_flags; 44 45 in6 = (struct in6_addr *)__entry->src; 46 *in6 = flp->saddr; 47 48 in6 = (struct in6_addr *)__entry->dst; 49 *in6 = flp->daddr; 50 51 if (rt->rt6i_idev) { 52 __assign_str(name, rt->rt6i_idev->dev->name); 53 } else { 54 __assign_str(name, ""); 55 } 56 if (rt == net->ipv6.ip6_null_entry) { 57 struct in6_addr in6_zero = {}; 58 59 in6 = (struct in6_addr *)__entry->gw; 60 *in6 = in6_zero; 61 62 } else if (rt) { 63 in6 = (struct in6_addr *)__entry->gw; 64 *in6 = rt->rt6i_gateway; 65 } 66 ), 67 68 TP_printk("table %3u oif %d iif %d src %pI6c dst %pI6c tos %d scope %d flags %x ==> dev %s gw %pI6c", 69 __entry->tb_id, __entry->oif, __entry->iif, 70 __entry->src, __entry->dst, __entry->tos, __entry->scope, 71 __entry->flags, __get_str(name), __entry->gw) 72 ); 73 74 #endif /* _TRACE_FIB6_H */ 75 76 /* This part must be outside protection */ 77 #include <trace/define_trace.h> 78