aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorStephen Hemminger <shemminger@vyatta.com>2009-09-20 06:35:36 -0400
committerDavid S. Miller <davem@davemloft.net>2009-10-05 03:21:56 -0400
commit16c6cf8bb471392fd09b48b7c27e7d83a446b4bc (patch)
tree6b7c83c37314b54508f6a37613c33610e388d85b /include
parent977750076d98c7ff6cbda51858bb5a5894a9d9ab (diff)
ipv4: fib table algorithm performance improvement
The FIB algorithim for IPV4 is set at compile time, but kernel goes through the overhead of function call indirection at runtime. Save some cycles by turning the indirect calls to direct calls to either hash or trie code. Signed-off-by: Stephen Hemminger <shemminger@vyatta.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include')
-rw-r--r--include/net/ip_fib.h25
1 files changed, 14 insertions, 11 deletions
diff --git a/include/net/ip_fib.h b/include/net/ip_fib.h
index ef91fe924ba4..68fd5ebd0949 100644
--- a/include/net/ip_fib.h
+++ b/include/net/ip_fib.h
@@ -144,18 +144,21 @@ struct fib_table {
144 struct hlist_node tb_hlist; 144 struct hlist_node tb_hlist;
145 u32 tb_id; 145 u32 tb_id;
146 int tb_default; 146 int tb_default;
147 int (*tb_lookup)(struct fib_table *tb, const struct flowi *flp, struct fib_result *res);
148 int (*tb_insert)(struct fib_table *, struct fib_config *);
149 int (*tb_delete)(struct fib_table *, struct fib_config *);
150 int (*tb_dump)(struct fib_table *table, struct sk_buff *skb,
151 struct netlink_callback *cb);
152 int (*tb_flush)(struct fib_table *table);
153 void (*tb_select_default)(struct fib_table *table,
154 const struct flowi *flp, struct fib_result *res);
155
156 unsigned char tb_data[0]; 147 unsigned char tb_data[0];
157}; 148};
158 149
150extern int fib_table_lookup(struct fib_table *tb, const struct flowi *flp,
151 struct fib_result *res);
152extern int fib_table_insert(struct fib_table *, struct fib_config *);
153extern int fib_table_delete(struct fib_table *, struct fib_config *);
154extern int fib_table_dump(struct fib_table *table, struct sk_buff *skb,
155 struct netlink_callback *cb);
156extern int fib_table_flush(struct fib_table *table);
157extern void fib_table_select_default(struct fib_table *table,
158 const struct flowi *flp,
159 struct fib_result *res);
160
161
159#ifndef CONFIG_IP_MULTIPLE_TABLES 162#ifndef CONFIG_IP_MULTIPLE_TABLES
160 163
161#define TABLE_LOCAL_INDEX 0 164#define TABLE_LOCAL_INDEX 0
@@ -182,11 +185,11 @@ static inline int fib_lookup(struct net *net, const struct flowi *flp,
182 struct fib_table *table; 185 struct fib_table *table;
183 186
184 table = fib_get_table(net, RT_TABLE_LOCAL); 187 table = fib_get_table(net, RT_TABLE_LOCAL);
185 if (!table->tb_lookup(table, flp, res)) 188 if (!fib_table_lookup(table, flp, res))
186 return 0; 189 return 0;
187 190
188 table = fib_get_table(net, RT_TABLE_MAIN); 191 table = fib_get_table(net, RT_TABLE_MAIN);
189 if (!table->tb_lookup(table, flp, res)) 192 if (!fib_table_lookup(table, flp, res))
190 return 0; 193 return 0;
191 return -ENETUNREACH; 194 return -ENETUNREACH;
192} 195}