Skip to content

Commit b65f164

Browse files
Paolo Abenidavem330
authored andcommitted
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: Paolo Abeni <[email protected]> Acked-by: Steven Rostedt (VMware) <[email protected]> Acked-by: David Ahern <[email protected]> Acked-by: Martin KaFai Lau <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent f730cc9 commit b65f164

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

include/trace/events/fib6.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@
1212
TRACE_EVENT(fib6_table_lookup,
1313

1414
TP_PROTO(const struct net *net, const struct rt6_info *rt,
15-
u32 tb_id, const struct flowi6 *flp),
15+
struct fib6_table *table, const struct flowi6 *flp),
1616

17-
TP_ARGS(net, rt, tb_id, flp),
17+
TP_ARGS(net, rt, table, flp),
1818

1919
TP_STRUCT__entry(
2020
__field( u32, tb_id )
@@ -34,7 +34,7 @@ TRACE_EVENT(fib6_table_lookup,
3434
TP_fast_assign(
3535
struct in6_addr *in6;
3636

37-
__entry->tb_id = tb_id;
37+
__entry->tb_id = table->tb6_id;
3838
__entry->oif = flp->flowi6_oif;
3939
__entry->iif = flp->flowi6_iif;
4040
__entry->tos = ip6_tclass(flp->flowlabel);

net/ipv6/route.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -945,7 +945,7 @@ static struct rt6_info *ip6_pol_route_lookup(struct net *net,
945945

946946
rcu_read_unlock();
947947

948-
trace_fib6_table_lookup(net, rt, table->tb6_id, fl6);
948+
trace_fib6_table_lookup(net, rt, table, fl6);
949949

950950
return rt;
951951

@@ -1682,15 +1682,15 @@ struct rt6_info *ip6_pol_route(struct net *net, struct fib6_table *table,
16821682
if (rt == net->ipv6.ip6_null_entry) {
16831683
rcu_read_unlock();
16841684
dst_hold(&rt->dst);
1685-
trace_fib6_table_lookup(net, rt, table->tb6_id, fl6);
1685+
trace_fib6_table_lookup(net, rt, table, fl6);
16861686
return rt;
16871687
} else if (rt->rt6i_flags & RTF_CACHE) {
16881688
if (ip6_hold_safe(net, &rt, true)) {
16891689
dst_use_noref(&rt->dst, jiffies);
16901690
rt6_dst_from_metrics_check(rt);
16911691
}
16921692
rcu_read_unlock();
1693-
trace_fib6_table_lookup(net, rt, table->tb6_id, fl6);
1693+
trace_fib6_table_lookup(net, rt, table, fl6);
16941694
return rt;
16951695
} else if (unlikely((fl6->flowi6_flags & FLOWI_FLAG_KNOWN_NH) &&
16961696
!(rt->rt6i_flags & RTF_GATEWAY))) {
@@ -1726,7 +1726,7 @@ struct rt6_info *ip6_pol_route(struct net *net, struct fib6_table *table,
17261726
}
17271727

17281728
uncached_rt_out:
1729-
trace_fib6_table_lookup(net, uncached_rt, table->tb6_id, fl6);
1729+
trace_fib6_table_lookup(net, uncached_rt, table, fl6);
17301730
return uncached_rt;
17311731

17321732
} else {
@@ -1754,7 +1754,7 @@ struct rt6_info *ip6_pol_route(struct net *net, struct fib6_table *table,
17541754
}
17551755
local_bh_enable();
17561756
rcu_read_unlock();
1757-
trace_fib6_table_lookup(net, pcpu_rt, table->tb6_id, fl6);
1757+
trace_fib6_table_lookup(net, pcpu_rt, table, fl6);
17581758
return pcpu_rt;
17591759
}
17601760
}
@@ -2195,7 +2195,7 @@ static struct rt6_info *__ip6_route_redirect(struct net *net,
21952195

21962196
rcu_read_unlock();
21972197

2198-
trace_fib6_table_lookup(net, rt, table->tb6_id, fl6);
2198+
trace_fib6_table_lookup(net, rt, table, fl6);
21992199
return rt;
22002200
};
22012201

0 commit comments

Comments
 (0)