diff options
| author | Linus Torvalds <torvalds@g5.osdl.org> | 2005-10-04 16:55:22 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@g5.osdl.org> | 2005-10-04 16:55:22 -0400 |
| commit | f6e63cfb5cfcccca510672155b90dd39bf45a35f (patch) | |
| tree | bc15910c506a87a89eb0bf4392d9a6175ff4e402 | |
| parent | fad1c45c939bb246a488be1fa06f539e85b80545 (diff) | |
| parent | e6308be85afee685347fa3440bed10faaa5d6c1a (diff) | |
Merge master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
| -rw-r--r-- | net/ipv4/fib_trie.c | 23 | ||||
| -rw-r--r-- | net/ipv6/udp.c | 4 |
2 files changed, 24 insertions, 3 deletions
diff --git a/net/ipv4/fib_trie.c b/net/ipv4/fib_trie.c index 50c0519cd70d..0093ea08c7f5 100644 --- a/net/ipv4/fib_trie.c +++ b/net/ipv4/fib_trie.c | |||
| @@ -286,6 +286,8 @@ static inline void check_tnode(const struct tnode *tn) | |||
| 286 | 286 | ||
| 287 | static int halve_threshold = 25; | 287 | static int halve_threshold = 25; |
| 288 | static int inflate_threshold = 50; | 288 | static int inflate_threshold = 50; |
| 289 | static int halve_threshold_root = 15; | ||
| 290 | static int inflate_threshold_root = 25; | ||
| 289 | 291 | ||
| 290 | 292 | ||
| 291 | static void __alias_free_mem(struct rcu_head *head) | 293 | static void __alias_free_mem(struct rcu_head *head) |
| @@ -449,6 +451,8 @@ static struct node *resize(struct trie *t, struct tnode *tn) | |||
| 449 | int i; | 451 | int i; |
| 450 | int err = 0; | 452 | int err = 0; |
| 451 | struct tnode *old_tn; | 453 | struct tnode *old_tn; |
| 454 | int inflate_threshold_use; | ||
| 455 | int halve_threshold_use; | ||
| 452 | 456 | ||
| 453 | if (!tn) | 457 | if (!tn) |
| 454 | return NULL; | 458 | return NULL; |
| @@ -541,10 +545,17 @@ static struct node *resize(struct trie *t, struct tnode *tn) | |||
| 541 | 545 | ||
| 542 | check_tnode(tn); | 546 | check_tnode(tn); |
| 543 | 547 | ||
| 548 | /* Keep root node larger */ | ||
| 549 | |||
| 550 | if(!tn->parent) | ||
| 551 | inflate_threshold_use = inflate_threshold_root; | ||
| 552 | else | ||
| 553 | inflate_threshold_use = inflate_threshold; | ||
| 554 | |||
| 544 | err = 0; | 555 | err = 0; |
| 545 | while ((tn->full_children > 0 && | 556 | while ((tn->full_children > 0 && |
| 546 | 50 * (tn->full_children + tnode_child_length(tn) - tn->empty_children) >= | 557 | 50 * (tn->full_children + tnode_child_length(tn) - tn->empty_children) >= |
| 547 | inflate_threshold * tnode_child_length(tn))) { | 558 | inflate_threshold_use * tnode_child_length(tn))) { |
| 548 | 559 | ||
| 549 | old_tn = tn; | 560 | old_tn = tn; |
| 550 | tn = inflate(t, tn); | 561 | tn = inflate(t, tn); |
| @@ -564,10 +575,18 @@ static struct node *resize(struct trie *t, struct tnode *tn) | |||
| 564 | * node is above threshold. | 575 | * node is above threshold. |
| 565 | */ | 576 | */ |
| 566 | 577 | ||
| 578 | |||
| 579 | /* Keep root node larger */ | ||
| 580 | |||
| 581 | if(!tn->parent) | ||
| 582 | halve_threshold_use = halve_threshold_root; | ||
| 583 | else | ||
| 584 | halve_threshold_use = halve_threshold; | ||
| 585 | |||
| 567 | err = 0; | 586 | err = 0; |
| 568 | while (tn->bits > 1 && | 587 | while (tn->bits > 1 && |
| 569 | 100 * (tnode_child_length(tn) - tn->empty_children) < | 588 | 100 * (tnode_child_length(tn) - tn->empty_children) < |
| 570 | halve_threshold * tnode_child_length(tn)) { | 589 | halve_threshold_use * tnode_child_length(tn)) { |
| 571 | 590 | ||
| 572 | old_tn = tn; | 591 | old_tn = tn; |
| 573 | tn = halve(t, tn); | 592 | tn = halve(t, tn); |
diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c index e4cad11f284a..bf9519341fd3 100644 --- a/net/ipv6/udp.c +++ b/net/ipv6/udp.c | |||
| @@ -99,7 +99,7 @@ static int udp_v6_get_port(struct sock *sk, unsigned short snum) | |||
| 99 | next:; | 99 | next:; |
| 100 | } | 100 | } |
| 101 | result = best; | 101 | result = best; |
| 102 | for(;; result += UDP_HTABLE_SIZE) { | 102 | for(i = 0; i < (1 << 16) / UDP_HTABLE_SIZE; i++, result += UDP_HTABLE_SIZE) { |
| 103 | if (result > sysctl_local_port_range[1]) | 103 | if (result > sysctl_local_port_range[1]) |
| 104 | result = sysctl_local_port_range[0] | 104 | result = sysctl_local_port_range[0] |
| 105 | + ((result - sysctl_local_port_range[0]) & | 105 | + ((result - sysctl_local_port_range[0]) & |
| @@ -107,6 +107,8 @@ static int udp_v6_get_port(struct sock *sk, unsigned short snum) | |||
| 107 | if (!udp_lport_inuse(result)) | 107 | if (!udp_lport_inuse(result)) |
| 108 | break; | 108 | break; |
| 109 | } | 109 | } |
| 110 | if (i >= (1 << 16) / UDP_HTABLE_SIZE) | ||
| 111 | goto fail; | ||
| 110 | gotit: | 112 | gotit: |
| 111 | udp_port_rover = snum = result; | 113 | udp_port_rover = snum = result; |
| 112 | } else { | 114 | } else { |
