Skip to content
Snippets Groups Projects
Commit 21d8c49e authored by David S. Miller's avatar David S. Miller
Browse files

ipv4: Call fib_select_default() only when actually necessary.


fib_select_default() is a complete NOP, and completely pointless
to invoke, when we have no more than 1 default route installed.

And this is far and away the common case.

So remember how many prefixlen==0 routes we have in the routing
table, and elide the call when we have no more than one of those.

This cuts output route creation time by 157 cycles on Niagara2+.

In order to add the new int to fib_table, we have to correct the type
of ->tb_data[] to unsigned long, otherwise the private area will be
unaligned on 64-bit systems.

Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Reviewed-by: default avatarEric Dumazet <eric.dumazet@gmail.com>
parent 8849b720
No related branches found
No related tags found
No related merge requests found
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment