Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 22226
b: refs/heads/master
c: 06ef921
h: refs/heads/master
v: v3
  • Loading branch information
Robert Olsson authored and David S. Miller committed Mar 21, 2006
1 parent dc22a54 commit be5773f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 5ddf0eb2bfd613e941dd8748870c71da2e5ad409
refs/heads/master: 06ef921d60bbf6f765d1b9492fb4fc88ac7814bd
14 changes: 8 additions & 6 deletions trunk/net/ipv4/fib_trie.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
* Patrick McHardy <kaber@trash.net>
*/

#define VERSION "0.405"
#define VERSION "0.406"

#include <linux/config.h>
#include <asm/uaccess.h>
Expand Down Expand Up @@ -84,7 +84,7 @@
#include "fib_lookup.h"

#undef CONFIG_IP_FIB_TRIE_STATS
#define MAX_CHILDS 16384
#define MAX_STAT_DEPTH 32

#define KEYLENGTH (8*sizeof(t_key))
#define MASK_PFX(k, l) (((l)==0)?0:(k >> (KEYLENGTH-l)) << (KEYLENGTH-l))
Expand Down Expand Up @@ -154,7 +154,7 @@ struct trie_stat {
unsigned int tnodes;
unsigned int leaves;
unsigned int nullpointers;
unsigned int nodesizes[MAX_CHILDS];
unsigned int nodesizes[MAX_STAT_DEPTH];
};

struct trie {
Expand Down Expand Up @@ -2080,7 +2080,9 @@ static void trie_collect_stats(struct trie *t, struct trie_stat *s)
int i;

s->tnodes++;
s->nodesizes[tn->bits]++;
if(tn->bits < MAX_STAT_DEPTH)
s->nodesizes[tn->bits]++;

for (i = 0; i < (1<<tn->bits); i++)
if (!tn->child[i])
s->nullpointers++;
Expand Down Expand Up @@ -2110,8 +2112,8 @@ static void trie_show_stats(struct seq_file *seq, struct trie_stat *stat)
seq_printf(seq, "\tInternal nodes: %d\n\t", stat->tnodes);
bytes += sizeof(struct tnode) * stat->tnodes;

max = MAX_CHILDS-1;
while (max >= 0 && stat->nodesizes[max] == 0)
max = MAX_STAT_DEPTH;
while (max > 0 && stat->nodesizes[max-1] == 0)
max--;

pointers = 0;
Expand Down

0 comments on commit be5773f

Please sign in to comment.