diff options
author | Patrick McHardy <kaber@trash.net> | 2006-08-11 02:10:46 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2006-09-22 17:54:26 -0400 |
commit | 1af5a8c4a11cfed0c9a7f30fcfb689981750599c (patch) | |
tree | 9affafefd0b4a023d527e3f5d386957bd1dace7b /net/ipv4/fib_trie.c | |
parent | 9e762a4a89b302cb3b26a1f9bb33eff459eaeca9 (diff) |
[IPV4]: Increase number of possible routing tables to 2^32
Increase the number of possible routing tables to 2^32 by replacing the
fixed sized array of pointers by a hash table and replacing iterations
over all possible table IDs by hash table walking.
Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/fib_trie.c')
-rw-r--r-- | net/ipv4/fib_trie.c | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/net/ipv4/fib_trie.c b/net/ipv4/fib_trie.c index 4a27b2d573a3..2a580eb2579b 100644 --- a/net/ipv4/fib_trie.c +++ b/net/ipv4/fib_trie.c | |||
@@ -1848,7 +1848,7 @@ static int fn_trie_dump_fa(t_key key, int plen, struct list_head *fah, struct fi | |||
1848 | 1848 | ||
1849 | u32 xkey = htonl(key); | 1849 | u32 xkey = htonl(key); |
1850 | 1850 | ||
1851 | s_i = cb->args[3]; | 1851 | s_i = cb->args[4]; |
1852 | i = 0; | 1852 | i = 0; |
1853 | 1853 | ||
1854 | /* rcu_read_lock is hold by caller */ | 1854 | /* rcu_read_lock is hold by caller */ |
@@ -1870,12 +1870,12 @@ static int fn_trie_dump_fa(t_key key, int plen, struct list_head *fah, struct fi | |||
1870 | plen, | 1870 | plen, |
1871 | fa->fa_tos, | 1871 | fa->fa_tos, |
1872 | fa->fa_info, 0) < 0) { | 1872 | fa->fa_info, 0) < 0) { |
1873 | cb->args[3] = i; | 1873 | cb->args[4] = i; |
1874 | return -1; | 1874 | return -1; |
1875 | } | 1875 | } |
1876 | i++; | 1876 | i++; |
1877 | } | 1877 | } |
1878 | cb->args[3] = i; | 1878 | cb->args[4] = i; |
1879 | return skb->len; | 1879 | return skb->len; |
1880 | } | 1880 | } |
1881 | 1881 | ||
@@ -1886,14 +1886,14 @@ static int fn_trie_dump_plen(struct trie *t, int plen, struct fib_table *tb, str | |||
1886 | struct list_head *fa_head; | 1886 | struct list_head *fa_head; |
1887 | struct leaf *l = NULL; | 1887 | struct leaf *l = NULL; |
1888 | 1888 | ||
1889 | s_h = cb->args[2]; | 1889 | s_h = cb->args[3]; |
1890 | 1890 | ||
1891 | for (h = 0; (l = nextleaf(t, l)) != NULL; h++) { | 1891 | for (h = 0; (l = nextleaf(t, l)) != NULL; h++) { |
1892 | if (h < s_h) | 1892 | if (h < s_h) |
1893 | continue; | 1893 | continue; |
1894 | if (h > s_h) | 1894 | if (h > s_h) |
1895 | memset(&cb->args[3], 0, | 1895 | memset(&cb->args[4], 0, |
1896 | sizeof(cb->args) - 3*sizeof(cb->args[0])); | 1896 | sizeof(cb->args) - 4*sizeof(cb->args[0])); |
1897 | 1897 | ||
1898 | fa_head = get_fa_head(l, plen); | 1898 | fa_head = get_fa_head(l, plen); |
1899 | 1899 | ||
@@ -1904,11 +1904,11 @@ static int fn_trie_dump_plen(struct trie *t, int plen, struct fib_table *tb, str | |||
1904 | continue; | 1904 | continue; |
1905 | 1905 | ||
1906 | if (fn_trie_dump_fa(l->key, plen, fa_head, tb, skb, cb)<0) { | 1906 | if (fn_trie_dump_fa(l->key, plen, fa_head, tb, skb, cb)<0) { |
1907 | cb->args[2] = h; | 1907 | cb->args[3] = h; |
1908 | return -1; | 1908 | return -1; |
1909 | } | 1909 | } |
1910 | } | 1910 | } |
1911 | cb->args[2] = h; | 1911 | cb->args[3] = h; |
1912 | return skb->len; | 1912 | return skb->len; |
1913 | } | 1913 | } |
1914 | 1914 | ||
@@ -1917,23 +1917,23 @@ static int fn_trie_dump(struct fib_table *tb, struct sk_buff *skb, struct netlin | |||
1917 | int m, s_m; | 1917 | int m, s_m; |
1918 | struct trie *t = (struct trie *) tb->tb_data; | 1918 | struct trie *t = (struct trie *) tb->tb_data; |
1919 | 1919 | ||
1920 | s_m = cb->args[1]; | 1920 | s_m = cb->args[2]; |
1921 | 1921 | ||
1922 | rcu_read_lock(); | 1922 | rcu_read_lock(); |
1923 | for (m = 0; m <= 32; m++) { | 1923 | for (m = 0; m <= 32; m++) { |
1924 | if (m < s_m) | 1924 | if (m < s_m) |
1925 | continue; | 1925 | continue; |
1926 | if (m > s_m) | 1926 | if (m > s_m) |
1927 | memset(&cb->args[2], 0, | 1927 | memset(&cb->args[3], 0, |
1928 | sizeof(cb->args) - 2*sizeof(cb->args[0])); | 1928 | sizeof(cb->args) - 3*sizeof(cb->args[0])); |
1929 | 1929 | ||
1930 | if (fn_trie_dump_plen(t, 32-m, tb, skb, cb)<0) { | 1930 | if (fn_trie_dump_plen(t, 32-m, tb, skb, cb)<0) { |
1931 | cb->args[1] = m; | 1931 | cb->args[2] = m; |
1932 | goto out; | 1932 | goto out; |
1933 | } | 1933 | } |
1934 | } | 1934 | } |
1935 | rcu_read_unlock(); | 1935 | rcu_read_unlock(); |
1936 | cb->args[1] = m; | 1936 | cb->args[2] = m; |
1937 | return skb->len; | 1937 | return skb->len; |
1938 | out: | 1938 | out: |
1939 | rcu_read_unlock(); | 1939 | rcu_read_unlock(); |