aboutsummaryrefslogtreecommitdiffstats
path: root/include/net/ip_fib.h
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2011-04-14 14:49:37 -0700
committerDavid S. Miller <davem@davemloft.net>2011-04-14 15:05:22 -0700
commit21d8c49e01a0c1c6eb6c750cd04110db4a539284 (patch)
tree03e19c4f6f24fd67da407463508c0ee27f6f9785 /include/net/ip_fib.h
parentNET: AX.25, NETROM, ROSE: Remove SOCK_DEBUG calls (diff)
downloadlinux-dev-21d8c49e01a0c1c6eb6c750cd04110db4a539284.tar.xz
linux-dev-21d8c49e01a0c1c6eb6c750cd04110db4a539284.zip
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: David S. Miller <davem@davemloft.net> Reviewed-by: Eric Dumazet <eric.dumazet@gmail.com>
Diffstat (limited to 'include/net/ip_fib.h')
-rw-r--r--include/net/ip_fib.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/include/net/ip_fib.h b/include/net/ip_fib.h
index 514627f56339..10422ef14e28 100644
--- a/include/net/ip_fib.h
+++ b/include/net/ip_fib.h
@@ -160,7 +160,8 @@ struct fib_table {
struct hlist_node tb_hlist;
u32 tb_id;
int tb_default;
- unsigned char tb_data[0];
+ int tb_num_default;
+ unsigned long tb_data[0];
};
extern int fib_table_lookup(struct fib_table *tb, const struct flowi4 *flp,