]> nv-tegra.nvidia Code Review - linux-2.6.git/blobdiff - net/ipv4/fib_hash.c
ipv4: fib table algorithm performance improvement
[linux-2.6.git] / net / ipv4 / fib_hash.c
index ecd39454235c0b12f5d99ed86a554220408f403d..14972017b9c2ad727369a124f95116ff95af430d 100644 (file)
@@ -242,8 +242,8 @@ fn_new_zone(struct fn_hash *table, int z)
        return fz;
 }
 
-static int
-fn_hash_lookup(struct fib_table *tb, const struct flowi *flp, struct fib_result *res)
+int fib_table_lookup(struct fib_table *tb,
+                    const struct flowi *flp, struct fib_result *res)
 {
        int err;
        struct fn_zone *fz;
@@ -274,8 +274,8 @@ out:
        return err;
 }
 
-static void
-fn_hash_select_default(struct fib_table *tb, const struct flowi *flp, struct fib_result *res)
+void fib_table_select_default(struct fib_table *tb,
+                             const struct flowi *flp, struct fib_result *res)
 {
        int order, last_idx;
        struct hlist_node *node;
@@ -366,7 +366,7 @@ static struct fib_node *fib_find_node(struct fn_zone *fz, __be32 key)
        return NULL;
 }
 
-static int fn_hash_insert(struct fib_table *tb, struct fib_config *cfg)
+int fib_table_insert(struct fib_table *tb, struct fib_config *cfg)
 {
        struct fn_hash *table = (struct fn_hash *) tb->tb_data;
        struct fib_node *new_f = NULL;
@@ -544,8 +544,7 @@ out:
        return err;
 }
 
-
-static int fn_hash_delete(struct fib_table *tb, struct fib_config *cfg)
+int fib_table_delete(struct fib_table *tb, struct fib_config *cfg)
 {
        struct fn_hash *table = (struct fn_hash *)tb->tb_data;
        struct fib_node *f;
@@ -662,7 +661,7 @@ static int fn_flush_list(struct fn_zone *fz, int idx)
        return found;
 }
 
-static int fn_hash_flush(struct fib_table *tb)
+int fib_table_flush(struct fib_table *tb)
 {
        struct fn_hash *table = (struct fn_hash *) tb->tb_data;
        struct fn_zone *fz;
@@ -743,7 +742,8 @@ fn_hash_dump_zone(struct sk_buff *skb, struct netlink_callback *cb,
        return skb->len;
 }
 
-static int fn_hash_dump(struct fib_table *tb, struct sk_buff *skb, struct netlink_callback *cb)
+int fib_table_dump(struct fib_table *tb, struct sk_buff *skb,
+                  struct netlink_callback *cb)
 {
        int m, s_m;
        struct fn_zone *fz;
@@ -787,12 +787,7 @@ struct fib_table *fib_hash_table(u32 id)
 
        tb->tb_id = id;
        tb->tb_default = -1;
-       tb->tb_lookup = fn_hash_lookup;
-       tb->tb_insert = fn_hash_insert;
-       tb->tb_delete = fn_hash_delete;
-       tb->tb_flush = fn_hash_flush;
-       tb->tb_select_default = fn_hash_select_default;
-       tb->tb_dump = fn_hash_dump;
+
        memset(tb->tb_data, 0, sizeof(struct fn_hash));
        return tb;
 }