Commit 0af7e7c1 authored by David Ahern's avatar David Ahern Committed by David S. Miller

ipv4: Update fib_table_lookup tracepoint to take common nexthop

Update fib_table_lookup tracepoint to take a fib_nh_common struct and
dump the v6 gateway address if the nexthop uses it.

Over the years saddr has not proven useful and the output of the
tracepoint produces very long lines. Since saddr is not part of
fib_nh_common, drop it. If it needs to be added later, fib_nh which
contains saddr can be obtained from a fib_nh_common via container_of.
Signed-off-by: default avatarDavid Ahern <dsahern@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 4950c2ba
...@@ -13,9 +13,9 @@ ...@@ -13,9 +13,9 @@
TRACE_EVENT(fib_table_lookup, TRACE_EVENT(fib_table_lookup,
TP_PROTO(u32 tb_id, const struct flowi4 *flp, TP_PROTO(u32 tb_id, const struct flowi4 *flp,
const struct fib_nh *nh, int err), const struct fib_nh_common *nhc, int err),
TP_ARGS(tb_id, flp, nh, err), TP_ARGS(tb_id, flp, nhc, err),
TP_STRUCT__entry( TP_STRUCT__entry(
__field( u32, tb_id ) __field( u32, tb_id )
...@@ -28,14 +28,17 @@ TRACE_EVENT(fib_table_lookup, ...@@ -28,14 +28,17 @@ TRACE_EVENT(fib_table_lookup,
__field( __u8, flags ) __field( __u8, flags )
__array( __u8, src, 4 ) __array( __u8, src, 4 )
__array( __u8, dst, 4 ) __array( __u8, dst, 4 )
__array( __u8, gw, 4 ) __array( __u8, gw4, 4 )
__array( __u8, saddr, 4 ) __array( __u8, gw6, 16 )
__field( u16, sport ) __field( u16, sport )
__field( u16, dport ) __field( u16, dport )
__dynamic_array(char, name, IFNAMSIZ ) __dynamic_array(char, name, IFNAMSIZ )
), ),
TP_fast_assign( TP_fast_assign(
struct in6_addr in6_zero = {};
struct net_device *dev;
struct in6_addr *in6;
__be32 *p32; __be32 *p32;
__entry->tb_id = tb_id; __entry->tb_id = tb_id;
...@@ -62,33 +65,37 @@ TRACE_EVENT(fib_table_lookup, ...@@ -62,33 +65,37 @@ TRACE_EVENT(fib_table_lookup,
__entry->dport = 0; __entry->dport = 0;
} }
if (nh) { dev = nhc ? nhc->nhc_dev : NULL;
struct net_device *dev; __assign_str(name, dev ? dev->name : "-");
p32 = (__be32 *) __entry->saddr;
*p32 = nh->nh_saddr;
p32 = (__be32 *) __entry->gw; if (nhc) {
*p32 = nh->fib_nh_gw4; if (nhc->nhc_family == AF_INET) {
p32 = (__be32 *) __entry->gw4;
*p32 = nhc->nhc_gw.ipv4;
dev = nh->fib_nh_dev; in6 = (struct in6_addr *)__entry->gw6;
__assign_str(name, dev ? dev->name : "-"); *in6 = in6_zero;
} else { } else if (nhc->nhc_family == AF_INET6) {
p32 = (__be32 *) __entry->saddr; p32 = (__be32 *) __entry->gw4;
*p32 = 0; *p32 = 0;
p32 = (__be32 *) __entry->gw; in6 = (struct in6_addr *)__entry->gw6;
*in6 = nhc->nhc_gw.ipv6;
}
} else {
p32 = (__be32 *) __entry->gw4;
*p32 = 0; *p32 = 0;
__assign_str(name, "-"); in6 = (struct in6_addr *)__entry->gw6;
*in6 = in6_zero;
} }
), ),
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", TP_printk("table %u oif %d iif %d proto %u %pI4/%u -> %pI4/%u tos %d scope %d flags %x ==> dev %s gw %pI4/%pI6c err %d",
__entry->tb_id, __entry->oif, __entry->iif, __entry->proto, __entry->tb_id, __entry->oif, __entry->iif, __entry->proto,
__entry->src, __entry->sport, __entry->dst, __entry->dport, __entry->src, __entry->sport, __entry->dst, __entry->dport,
__entry->tos, __entry->scope, __entry->flags, __entry->tos, __entry->scope, __entry->flags,
__get_str(name), __entry->gw, __entry->saddr, __entry->err) __get_str(name), __entry->gw4, __entry->gw6, __entry->err)
); );
#endif /* _TRACE_FIB_H */ #endif /* _TRACE_FIB_H */
......
...@@ -1498,7 +1498,7 @@ int fib_table_lookup(struct fib_table *tb, const struct flowi4 *flp, ...@@ -1498,7 +1498,7 @@ int fib_table_lookup(struct fib_table *tb, const struct flowi4 *flp,
#ifdef CONFIG_IP_FIB_TRIE_STATS #ifdef CONFIG_IP_FIB_TRIE_STATS
this_cpu_inc(stats->semantic_match_passed); this_cpu_inc(stats->semantic_match_passed);
#endif #endif
trace_fib_table_lookup(tb->tb_id, flp, nh, err); trace_fib_table_lookup(tb->tb_id, flp, &nh->nh_common, err);
return err; return err;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment