Commit b65f164d authored by Paolo Abeni's avatar Paolo Abeni Committed by David S. Miller

ipv6: let trace_fib6_table_lookup() dereference the fib table

The perf traces for ipv6 routing code show a relevant cost around
trace_fib6_table_lookup(), even if no trace is enabled. This is
due to the fib6_table de-referencing currently performed by the
caller.

Let's the tracing code pay this overhead, passing to the trace
helper the table pointer. This gives small but measurable
performance improvement under UDP flood.
Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
Acked-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
Acked-by: default avatarDavid Ahern <dsa@cumulusnetworks.com>
Acked-by: default avatarMartin KaFai Lau <kafai@fb.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent f730cc9f
...@@ -12,9 +12,9 @@ ...@@ -12,9 +12,9 @@
TRACE_EVENT(fib6_table_lookup, TRACE_EVENT(fib6_table_lookup,
TP_PROTO(const struct net *net, const struct rt6_info *rt, TP_PROTO(const struct net *net, const struct rt6_info *rt,
u32 tb_id, const struct flowi6 *flp), struct fib6_table *table, const struct flowi6 *flp),
TP_ARGS(net, rt, tb_id, flp), TP_ARGS(net, rt, table, flp),
TP_STRUCT__entry( TP_STRUCT__entry(
__field( u32, tb_id ) __field( u32, tb_id )
...@@ -34,7 +34,7 @@ TRACE_EVENT(fib6_table_lookup, ...@@ -34,7 +34,7 @@ TRACE_EVENT(fib6_table_lookup,
TP_fast_assign( TP_fast_assign(
struct in6_addr *in6; struct in6_addr *in6;
__entry->tb_id = tb_id; __entry->tb_id = table->tb6_id;
__entry->oif = flp->flowi6_oif; __entry->oif = flp->flowi6_oif;
__entry->iif = flp->flowi6_iif; __entry->iif = flp->flowi6_iif;
__entry->tos = ip6_tclass(flp->flowlabel); __entry->tos = ip6_tclass(flp->flowlabel);
......
...@@ -945,7 +945,7 @@ static struct rt6_info *ip6_pol_route_lookup(struct net *net, ...@@ -945,7 +945,7 @@ static struct rt6_info *ip6_pol_route_lookup(struct net *net,
rcu_read_unlock(); rcu_read_unlock();
trace_fib6_table_lookup(net, rt, table->tb6_id, fl6); trace_fib6_table_lookup(net, rt, table, fl6);
return rt; return rt;
...@@ -1682,7 +1682,7 @@ struct rt6_info *ip6_pol_route(struct net *net, struct fib6_table *table, ...@@ -1682,7 +1682,7 @@ struct rt6_info *ip6_pol_route(struct net *net, struct fib6_table *table,
if (rt == net->ipv6.ip6_null_entry) { if (rt == net->ipv6.ip6_null_entry) {
rcu_read_unlock(); rcu_read_unlock();
dst_hold(&rt->dst); dst_hold(&rt->dst);
trace_fib6_table_lookup(net, rt, table->tb6_id, fl6); trace_fib6_table_lookup(net, rt, table, fl6);
return rt; return rt;
} else if (rt->rt6i_flags & RTF_CACHE) { } else if (rt->rt6i_flags & RTF_CACHE) {
if (ip6_hold_safe(net, &rt, true)) { if (ip6_hold_safe(net, &rt, true)) {
...@@ -1690,7 +1690,7 @@ struct rt6_info *ip6_pol_route(struct net *net, struct fib6_table *table, ...@@ -1690,7 +1690,7 @@ struct rt6_info *ip6_pol_route(struct net *net, struct fib6_table *table,
rt6_dst_from_metrics_check(rt); rt6_dst_from_metrics_check(rt);
} }
rcu_read_unlock(); rcu_read_unlock();
trace_fib6_table_lookup(net, rt, table->tb6_id, fl6); trace_fib6_table_lookup(net, rt, table, fl6);
return rt; return rt;
} else if (unlikely((fl6->flowi6_flags & FLOWI_FLAG_KNOWN_NH) && } else if (unlikely((fl6->flowi6_flags & FLOWI_FLAG_KNOWN_NH) &&
!(rt->rt6i_flags & RTF_GATEWAY))) { !(rt->rt6i_flags & RTF_GATEWAY))) {
...@@ -1726,7 +1726,7 @@ struct rt6_info *ip6_pol_route(struct net *net, struct fib6_table *table, ...@@ -1726,7 +1726,7 @@ struct rt6_info *ip6_pol_route(struct net *net, struct fib6_table *table,
} }
uncached_rt_out: uncached_rt_out:
trace_fib6_table_lookup(net, uncached_rt, table->tb6_id, fl6); trace_fib6_table_lookup(net, uncached_rt, table, fl6);
return uncached_rt; return uncached_rt;
} else { } else {
...@@ -1754,7 +1754,7 @@ struct rt6_info *ip6_pol_route(struct net *net, struct fib6_table *table, ...@@ -1754,7 +1754,7 @@ struct rt6_info *ip6_pol_route(struct net *net, struct fib6_table *table,
} }
local_bh_enable(); local_bh_enable();
rcu_read_unlock(); rcu_read_unlock();
trace_fib6_table_lookup(net, pcpu_rt, table->tb6_id, fl6); trace_fib6_table_lookup(net, pcpu_rt, table, fl6);
return pcpu_rt; return pcpu_rt;
} }
} }
...@@ -2195,7 +2195,7 @@ static struct rt6_info *__ip6_route_redirect(struct net *net, ...@@ -2195,7 +2195,7 @@ static struct rt6_info *__ip6_route_redirect(struct net *net,
rcu_read_unlock(); rcu_read_unlock();
trace_fib6_table_lookup(net, rt, table->tb6_id, fl6); trace_fib6_table_lookup(net, rt, table, fl6);
return rt; return rt;
}; };
......
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