aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/fib_hash.c
diff options
context:
space:
mode:
authorPatrick McHardy <kaber@trash.net>2006-08-11 02:10:46 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2006-09-22 17:54:26 -0400
commit1af5a8c4a11cfed0c9a7f30fcfb689981750599c (patch)
tree9affafefd0b4a023d527e3f5d386957bd1dace7b /net/ipv4/fib_hash.c
parent9e762a4a89b302cb3b26a1f9bb33eff459eaeca9 (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_hash.c')
-rw-r--r--net/ipv4/fib_hash.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/net/ipv4/fib_hash.c b/net/ipv4/fib_hash.c
index f8d5c8024ccb..b5bee1a71e5c 100644
--- a/net/ipv4/fib_hash.c
+++ b/net/ipv4/fib_hash.c
@@ -684,7 +684,7 @@ fn_hash_dump_bucket(struct sk_buff *skb, struct netlink_callback *cb,
684 struct fib_node *f; 684 struct fib_node *f;
685 int i, s_i; 685 int i, s_i;
686 686
687 s_i = cb->args[3]; 687 s_i = cb->args[4];
688 i = 0; 688 i = 0;
689 hlist_for_each_entry(f, node, head, fn_hash) { 689 hlist_for_each_entry(f, node, head, fn_hash) {
690 struct fib_alias *fa; 690 struct fib_alias *fa;
@@ -704,14 +704,14 @@ fn_hash_dump_bucket(struct sk_buff *skb, struct netlink_callback *cb,
704 fa->fa_tos, 704 fa->fa_tos,
705 fa->fa_info, 705 fa->fa_info,
706 NLM_F_MULTI) < 0) { 706 NLM_F_MULTI) < 0) {
707 cb->args[3] = i; 707 cb->args[4] = i;
708 return -1; 708 return -1;
709 } 709 }
710 next: 710 next:
711 i++; 711 i++;
712 } 712 }
713 } 713 }
714 cb->args[3] = i; 714 cb->args[4] = i;
715 return skb->len; 715 return skb->len;
716} 716}
717 717
@@ -722,21 +722,21 @@ fn_hash_dump_zone(struct sk_buff *skb, struct netlink_callback *cb,
722{ 722{
723 int h, s_h; 723 int h, s_h;
724 724
725 s_h = cb->args[2]; 725 s_h = cb->args[3];
726 for (h=0; h < fz->fz_divisor; h++) { 726 for (h=0; h < fz->fz_divisor; h++) {
727 if (h < s_h) continue; 727 if (h < s_h) continue;
728 if (h > s_h) 728 if (h > s_h)
729 memset(&cb->args[3], 0, 729 memset(&cb->args[4], 0,
730 sizeof(cb->args) - 3*sizeof(cb->args[0])); 730 sizeof(cb->args) - 4*sizeof(cb->args[0]));
731 if (fz->fz_hash == NULL || 731 if (fz->fz_hash == NULL ||
732 hlist_empty(&fz->fz_hash[h])) 732 hlist_empty(&fz->fz_hash[h]))
733 continue; 733 continue;
734 if (fn_hash_dump_bucket(skb, cb, tb, fz, &fz->fz_hash[h])<0) { 734 if (fn_hash_dump_bucket(skb, cb, tb, fz, &fz->fz_hash[h])<0) {
735 cb->args[2] = h; 735 cb->args[3] = h;
736 return -1; 736 return -1;
737 } 737 }
738 } 738 }
739 cb->args[2] = h; 739 cb->args[3] = h;
740 return skb->len; 740 return skb->len;
741} 741}
742 742
@@ -746,21 +746,21 @@ static int fn_hash_dump(struct fib_table *tb, struct sk_buff *skb, struct netlin
746 struct fn_zone *fz; 746 struct fn_zone *fz;
747 struct fn_hash *table = (struct fn_hash*)tb->tb_data; 747 struct fn_hash *table = (struct fn_hash*)tb->tb_data;
748 748
749 s_m = cb->args[1]; 749 s_m = cb->args[2];
750 read_lock(&fib_hash_lock); 750 read_lock(&fib_hash_lock);
751 for (fz = table->fn_zone_list, m=0; fz; fz = fz->fz_next, m++) { 751 for (fz = table->fn_zone_list, m=0; fz; fz = fz->fz_next, m++) {
752 if (m < s_m) continue; 752 if (m < s_m) continue;
753 if (m > s_m) 753 if (m > s_m)
754 memset(&cb->args[2], 0, 754 memset(&cb->args[3], 0,
755 sizeof(cb->args) - 2*sizeof(cb->args[0])); 755 sizeof(cb->args) - 3*sizeof(cb->args[0]));
756 if (fn_hash_dump_zone(skb, cb, tb, fz) < 0) { 756 if (fn_hash_dump_zone(skb, cb, tb, fz) < 0) {
757 cb->args[1] = m; 757 cb->args[2] = m;
758 read_unlock(&fib_hash_lock); 758 read_unlock(&fib_hash_lock);
759 return -1; 759 return -1;
760 } 760 }
761 } 761 }
762 read_unlock(&fib_hash_lock); 762 read_unlock(&fib_hash_lock);
763 cb->args[1] = m; 763 cb->args[2] = m;
764 return skb->len; 764 return skb->len;
765} 765}
766 766