^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) /* SPDX-License-Identifier: GPL-2.0 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) #undef TRACE_SYSTEM
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) #define TRACE_SYSTEM fib6
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) #if !defined(_TRACE_FIB6_H) || defined(TRACE_HEADER_MULTI_READ)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) #define _TRACE_FIB6_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) #include <linux/in6.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) #include <net/flow.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) #include <net/ip6_fib.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) #include <linux/tracepoint.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) TRACE_EVENT(fib6_table_lookup,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) TP_PROTO(const struct net *net, const struct fib6_result *res,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) struct fib6_table *table, const struct flowi6 *flp),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) TP_ARGS(net, res, table, flp),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) TP_STRUCT__entry(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) __field( u32, tb_id )
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) __field( int, err )
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) __field( int, oif )
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) __field( int, iif )
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) __field( __u8, tos )
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) __field( __u8, scope )
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) __field( __u8, flags )
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) __array( __u8, src, 16 )
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) __array( __u8, dst, 16 )
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) __field( u16, sport )
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) __field( u16, dport )
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) __field( u8, proto )
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) __field( u8, rt_type )
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) __dynamic_array( char, name, IFNAMSIZ )
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) __array( __u8, gw, 16 )
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) ),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) TP_fast_assign(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) struct in6_addr *in6;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) __entry->tb_id = table->tb6_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) __entry->err = ip6_rt_type_to_error(res->fib6_type);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) __entry->oif = flp->flowi6_oif;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) __entry->iif = flp->flowi6_iif;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) __entry->tos = ip6_tclass(flp->flowlabel);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) __entry->scope = flp->flowi6_scope;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) __entry->flags = flp->flowi6_flags;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) in6 = (struct in6_addr *)__entry->src;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) *in6 = flp->saddr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) in6 = (struct in6_addr *)__entry->dst;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) *in6 = flp->daddr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) __entry->proto = flp->flowi6_proto;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) if (__entry->proto == IPPROTO_TCP ||
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) __entry->proto == IPPROTO_UDP) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) __entry->sport = ntohs(flp->fl6_sport);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) __entry->dport = ntohs(flp->fl6_dport);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) } else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) __entry->sport = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) __entry->dport = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) if (res->nh && res->nh->fib_nh_dev) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) __assign_str(name, res->nh->fib_nh_dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) } else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) __assign_str(name, "-");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) if (res->f6i == net->ipv6.fib6_null_entry) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) struct in6_addr in6_zero = {};
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) in6 = (struct in6_addr *)__entry->gw;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) *in6 = in6_zero;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) } else if (res->nh) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) in6 = (struct in6_addr *)__entry->gw;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) *in6 = res->nh->fib_nh_gw6;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) ),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) TP_printk("table %3u oif %d iif %d proto %u %pI6c/%u -> %pI6c/%u tos %d scope %d flags %x ==> dev %s gw %pI6c err %d",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) __entry->tb_id, __entry->oif, __entry->iif, __entry->proto,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) __entry->src, __entry->sport, __entry->dst, __entry->dport,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) __entry->tos, __entry->scope, __entry->flags,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) __get_str(name), __entry->gw, __entry->err)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) );
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) #endif /* _TRACE_FIB6_H */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91) /* This part must be outside protection */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) #include <trace/define_trace.h>