Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a07f5f50 authored by Stephen Hemminger's avatar Stephen Hemminger Committed by David S. Miller
Browse files

[IPV4] fib_trie: style cleanup



Style cleanups:
      * make check_leaf return -1 or plen, rather than by reference
      * Get rid of #ifdef that is always set
      * split out embedded function calls in if statements.
      * checkpatch warnings

Signed-off-by: default avatarStephen Hemminger <stephen.hemminger@vyatta.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent bc3c8c1e
Loading
Loading
Loading
Loading
+142 −95
Original line number Original line Diff line number Diff line
@@ -155,7 +155,8 @@ struct trie {
};
};


static void put_child(struct trie *t, struct tnode *tn, int i, struct node *n);
static void put_child(struct trie *t, struct tnode *tn, int i, struct node *n);
static void tnode_put_child_reorg(struct tnode *tn, int i, struct node *n, int wasfull);
static void tnode_put_child_reorg(struct tnode *tn, int i, struct node *n,
				  int wasfull);
static struct node *resize(struct trie *t, struct tnode *tn);
static struct node *resize(struct trie *t, struct tnode *tn);
static struct tnode *inflate(struct trie *t, struct tnode *tn);
static struct tnode *inflate(struct trie *t, struct tnode *tn);
static struct tnode *halve(struct trie *t, struct tnode *tn);
static struct tnode *halve(struct trie *t, struct tnode *tn);
@@ -427,7 +428,8 @@ static inline int tnode_full(const struct tnode *tn, const struct node *n)
	return ((struct tnode *) n)->pos == tn->pos + tn->bits;
	return ((struct tnode *) n)->pos == tn->pos + tn->bits;
}
}


static inline void put_child(struct trie *t, struct tnode *tn, int i, struct node *n)
static inline void put_child(struct trie *t, struct tnode *tn, int i,
			     struct node *n)
{
{
	tnode_put_child_reorg(tn, i, n, -1);
	tnode_put_child_reorg(tn, i, n, -1);
}
}
@@ -437,7 +439,8 @@ static inline void put_child(struct trie *t, struct tnode *tn, int i, struct nod
  * Update the value of full_children and empty_children.
  * Update the value of full_children and empty_children.
  */
  */


static void tnode_put_child_reorg(struct tnode *tn, int i, struct node *n, int wasfull)
static void tnode_put_child_reorg(struct tnode *tn, int i, struct node *n,
				  int wasfull)
{
{
	struct node *chi = tn->child[i];
	struct node *chi = tn->child[i];
	int isfull;
	int isfull;
@@ -577,11 +580,13 @@ static struct node *resize(struct trie *t, struct tnode *tn)
	err = 0;
	err = 0;
	max_resize = 10;
	max_resize = 10;
	while ((tn->full_children > 0 &&  max_resize-- &&
	while ((tn->full_children > 0 &&  max_resize-- &&
	       50 * (tn->full_children + tnode_child_length(tn) - tn->empty_children) >=
		50 * (tn->full_children + tnode_child_length(tn)
				inflate_threshold_use * tnode_child_length(tn))) {
		      - tn->empty_children)
		>= inflate_threshold_use * tnode_child_length(tn))) {


		old_tn = tn;
		old_tn = tn;
		tn = inflate(t, tn);
		tn = inflate(t, tn);

		if (IS_ERR(tn)) {
		if (IS_ERR(tn)) {
			tn = old_tn;
			tn = old_tn;
#ifdef CONFIG_IP_FIB_TRIE_STATS
#ifdef CONFIG_IP_FIB_TRIE_STATS
@@ -593,10 +598,12 @@ static struct node *resize(struct trie *t, struct tnode *tn)


	if (max_resize < 0) {
	if (max_resize < 0) {
		if (!tn->parent)
		if (!tn->parent)
			printk(KERN_WARNING "Fix inflate_threshold_root. Now=%d size=%d bits\n",
			pr_warning("Fix inflate_threshold_root."
				   " Now=%d size=%d bits\n",
				   inflate_threshold_root, tn->bits);
				   inflate_threshold_root, tn->bits);
		else
		else
			printk(KERN_WARNING "Fix inflate_threshold. Now=%d size=%d bits\n",
			pr_warning("Fix inflate_threshold."
				   " Now=%d size=%d bits\n",
				   inflate_threshold, tn->bits);
				   inflate_threshold, tn->bits);
	}
	}


@@ -634,10 +641,12 @@ static struct node *resize(struct trie *t, struct tnode *tn)


	if (max_resize < 0) {
	if (max_resize < 0) {
		if (!tn->parent)
		if (!tn->parent)
			printk(KERN_WARNING "Fix halve_threshold_root. Now=%d size=%d bits\n",
			pr_warning("Fix halve_threshold_root."
				   " Now=%d size=%d bits\n",
				   halve_threshold_root, tn->bits);
				   halve_threshold_root, tn->bits);
		else
		else
			printk(KERN_WARNING "Fix halve_threshold. Now=%d size=%d bits\n",
			pr_warning("Fix halve_threshold."
				   " Now=%d size=%d bits\n",
				   halve_threshold, tn->bits);
				   halve_threshold, tn->bits);
	}
	}


@@ -681,8 +690,9 @@ static struct tnode *inflate(struct trie *t, struct tnode *tn)
	 */
	 */


	for (i = 0; i < olen; i++) {
	for (i = 0; i < olen; i++) {
		struct tnode *inode = (struct tnode *) tnode_get_child(oldtnode, i);
		struct tnode *inode;


		inode = (struct tnode *) tnode_get_child(oldtnode, i);
		if (inode &&
		if (inode &&
		    IS_TNODE(inode) &&
		    IS_TNODE(inode) &&
		    inode->pos == oldtnode->pos + oldtnode->bits &&
		    inode->pos == oldtnode->pos + oldtnode->bits &&
@@ -722,7 +732,8 @@ static struct tnode *inflate(struct trie *t, struct tnode *tn)


		if (IS_LEAF(node) || ((struct tnode *) node)->pos >
		if (IS_LEAF(node) || ((struct tnode *) node)->pos >
		   tn->pos + tn->bits - 1) {
		   tn->pos + tn->bits - 1) {
			if (tkey_extract_bits(node->key, oldtnode->pos + oldtnode->bits,
			if (tkey_extract_bits(node->key,
					      oldtnode->pos + oldtnode->bits,
					      1) == 0)
					      1) == 0)
				put_child(t, tn, 2*i, node);
				put_child(t, tn, 2*i, node);
			else
			else
@@ -949,7 +960,10 @@ fib_find_node(struct trie *t, u32 key)


		if (tkey_sub_equals(tn->key, pos, tn->pos-pos, key)) {
		if (tkey_sub_equals(tn->key, pos, tn->pos-pos, key)) {
			pos = tn->pos + tn->bits;
			pos = tn->pos + tn->bits;
			n = tnode_get_child_rcu(tn, tkey_extract_bits(key, tn->pos, tn->bits));
			n = tnode_get_child_rcu(tn,
						tkey_extract_bits(key,
								  tn->pos,
								  tn->bits));
		} else
		} else
			break;
			break;
	}
	}
@@ -971,7 +985,9 @@ static struct node *trie_rebalance(struct trie *t, struct tnode *tn)
		cindex = tkey_extract_bits(key, tp->pos, tp->bits);
		cindex = tkey_extract_bits(key, tp->pos, tp->bits);
		wasfull = tnode_full(tp, tnode_get_child(tp, cindex));
		wasfull = tnode_full(tp, tnode_get_child(tp, cindex));
		tn = (struct tnode *) resize(t, (struct tnode *)tn);
		tn = (struct tnode *) resize(t, (struct tnode *)tn);
		tnode_put_child_reorg((struct tnode *)tp, cindex,(struct node*)tn, wasfull);

		tnode_put_child_reorg((struct tnode *)tp, cindex,
				      (struct node *)tn, wasfull);


		tp = node_parent((struct node *) tn);
		tp = node_parent((struct node *) tn);
		if (!tp)
		if (!tp)
@@ -1028,7 +1044,10 @@ static struct list_head *fib_insert_node(struct trie *t, u32 key, int plen)
		if (tkey_sub_equals(tn->key, pos, tn->pos-pos, key)) {
		if (tkey_sub_equals(tn->key, pos, tn->pos-pos, key)) {
			tp = tn;
			tp = tn;
			pos = tn->pos + tn->bits;
			pos = tn->pos + tn->bits;
			n = tnode_get_child(tn, tkey_extract_bits(key, tn->pos, tn->bits));
			n = tnode_get_child(tn,
					    tkey_extract_bits(key,
							      tn->pos,
							      tn->bits));


			BUG_ON(n && node_parent(n) != tn);
			BUG_ON(n && node_parent(n) != tn);
		} else
		} else
@@ -1113,15 +1132,17 @@ static struct list_head *fib_insert_node(struct trie *t, u32 key, int plen)


		if (tp) {
		if (tp) {
			cindex = tkey_extract_bits(key, tp->pos, tp->bits);
			cindex = tkey_extract_bits(key, tp->pos, tp->bits);
			put_child(t, (struct tnode *)tp, cindex, (struct node *)tn);
			put_child(t, (struct tnode *)tp, cindex,
				  (struct node *)tn);
		} else {
		} else {
			rcu_assign_pointer(t->trie, (struct node *)tn); /* First tnode */
			rcu_assign_pointer(t->trie, (struct node *)tn);
			tp = tn;
			tp = tn;
		}
		}
	}
	}


	if (tp && tp->pos + tp->bits > 32)
	if (tp && tp->pos + tp->bits > 32)
		printk(KERN_WARNING "fib_trie tp=%p pos=%d, bits=%d, key=%0x plen=%d\n",
		pr_warning("fib_trie"
			   " tp=%p pos=%d, bits=%d, key=%0x plen=%d\n",
			   tp, tp->pos, tp->bits, key, plen);
			   tp, tp->pos, tp->bits, key, plen);


	/* Rebalance the trie */
	/* Rebalance the trie */
@@ -1235,10 +1256,10 @@ static int fn_trie_insert(struct fib_table *tb, struct fib_config *cfg)
				break;
				break;
			if (fa->fa_type == cfg->fc_type &&
			if (fa->fa_type == cfg->fc_type &&
			    fa->fa_scope == cfg->fc_scope &&
			    fa->fa_scope == cfg->fc_scope &&
			    fa->fa_info == fi) {
			    fa->fa_info == fi)
				goto out;
				goto out;
		}
		}
		}

		if (!(cfg->fc_nlflags & NLM_F_APPEND))
		if (!(cfg->fc_nlflags & NLM_F_APPEND))
			fa = fa_orig;
			fa = fa_orig;
	}
	}
@@ -1289,38 +1310,40 @@ static int fn_trie_insert(struct fib_table *tb, struct fib_config *cfg)




/* should be called with rcu_read_lock */
/* should be called with rcu_read_lock */
static inline int check_leaf(struct trie *t, struct leaf *l,
static int check_leaf(struct trie *t, struct leaf *l,
			     t_key key, int *plen, const struct flowi *flp,
		      t_key key,  const struct flowi *flp,
		      struct fib_result *res)
		      struct fib_result *res)
{
{
	int err, i;
	__be32 mask;
	struct leaf_info *li;
	struct leaf_info *li;
	struct hlist_head *hhead = &l->list;
	struct hlist_head *hhead = &l->list;
	struct hlist_node *node;
	struct hlist_node *node;


	hlist_for_each_entry_rcu(li, node, hhead, hlist) {
	hlist_for_each_entry_rcu(li, node, hhead, hlist) {
		i = li->plen;
		int err;
		mask = inet_make_mask(i);
		int plen = li->plen;
		__be32 mask = inet_make_mask(plen);

		if (l->key != (key & ntohl(mask)))
		if (l->key != (key & ntohl(mask)))
			continue;
			continue;


		if ((err = fib_semantic_match(&li->falh, flp, res, htonl(l->key), mask, i)) <= 0) {
		err = fib_semantic_match(&li->falh, flp, res,
			*plen = i;
					 htonl(l->key), mask, plen);

#ifdef CONFIG_IP_FIB_TRIE_STATS
#ifdef CONFIG_IP_FIB_TRIE_STATS
		if (err <= 0)
			t->stats.semantic_match_passed++;
			t->stats.semantic_match_passed++;
#endif
		else
			return err;
		}
#ifdef CONFIG_IP_FIB_TRIE_STATS
			t->stats.semantic_match_miss++;
			t->stats.semantic_match_miss++;
#endif
#endif
		if (err <= 0)
			return plen;
	}
	}
	return 1;

	return -1;
}
}


static int
static int fn_trie_lookup(struct fib_table *tb, const struct flowi *flp,
fn_trie_lookup(struct fib_table *tb, const struct flowi *flp, struct fib_result *res)
			  struct fib_result *res)
{
{
	struct trie *t = (struct trie *) tb->tb_data;
	struct trie *t = (struct trie *) tb->tb_data;
	int plen, ret = 0;
	int plen, ret = 0;
@@ -1347,10 +1370,13 @@ fn_trie_lookup(struct fib_table *tb, const struct flowi *flp, struct fib_result


	/* Just a leaf? */
	/* Just a leaf? */
	if (IS_LEAF(n)) {
	if (IS_LEAF(n)) {
		if ((ret = check_leaf(t, (struct leaf *)n, key, &plen, flp, res)) <= 0)
		plen = check_leaf(t, (struct leaf *)n, key, flp, res);
			goto found;
		if (plen < 0)
			goto failed;
			goto failed;
		ret = 0;
		goto found;
	}
	}

	pn = (struct tnode *) n;
	pn = (struct tnode *) n;
	chopped_off = 0;
	chopped_off = 0;


@@ -1372,14 +1398,14 @@ fn_trie_lookup(struct fib_table *tb, const struct flowi *flp, struct fib_result
		}
		}


		if (IS_LEAF(n)) {
		if (IS_LEAF(n)) {
			if ((ret = check_leaf(t, (struct leaf *)n, key, &plen, flp, res)) <= 0)
			plen = check_leaf(t, (struct leaf *)n, key, flp, res);
				goto found;
			if (plen < 0)
			else
				goto backtrace;
				goto backtrace;

			ret = 0;
			goto found;
		}
		}


#define HL_OPTIMIZE
#ifdef HL_OPTIMIZE
		cn = (struct tnode *)n;
		cn = (struct tnode *)n;


		/*
		/*
@@ -1408,12 +1434,13 @@ fn_trie_lookup(struct fib_table *tb, const struct flowi *flp, struct fib_result
		 * *are* zero.
		 * *are* zero.
		 */
		 */


		/* NOTA BENE: CHECKING ONLY SKIPPED BITS FOR THE NEW NODE HERE */
		/* NOTA BENE: Checking only skipped bits
		   for the new node here */


		if (current_prefix_length < pos+bits) {
		if (current_prefix_length < pos+bits) {
			if (tkey_extract_bits(cn->key, current_prefix_length,
			if (tkey_extract_bits(cn->key, current_prefix_length,
						cn->pos - current_prefix_length) != 0 ||
						cn->pos - current_prefix_length)
			    !(cn->child[0]))
			    || !(cn->child[0]))
				goto backtrace;
				goto backtrace;
		}
		}


@@ -1436,14 +1463,17 @@ fn_trie_lookup(struct fib_table *tb, const struct flowi *flp, struct fib_result
		 * new tnode's key.
		 * new tnode's key.
		 */
		 */


		/* Note: We aren't very concerned about the piece of the key
		/*
		 * that precede pn->pos+pn->bits, since these have already been
		 * Note: We aren't very concerned about the piece of
		 * checked. The bits after cn->pos aren't checked since these are
		 * the key that precede pn->pos+pn->bits, since these
		 * by definition "unknown" at this point. Thus, what we want to
		 * have already been checked. The bits after cn->pos
		 * see is if we are about to enter the "prefix matching" state,
		 * aren't checked since these are by definition
		 * and in that case verify that the skipped bits that will prevail
		 * "unknown" at this point. Thus, what we want to see
		 * throughout this subtree are zero, as they have to be if we are
		 * is if we are about to enter the "prefix matching"
		 * to find a matching prefix.
		 * state, and in that case verify that the skipped
		 * bits that will prevail throughout this subtree are
		 * zero, as they have to be if we are to find a
		 * matching prefix.
		 */
		 */


		node_prefix = mask_pfx(cn->key, cn->pos);
		node_prefix = mask_pfx(cn->key, cn->pos);
@@ -1451,8 +1481,10 @@ fn_trie_lookup(struct fib_table *tb, const struct flowi *flp, struct fib_result
		pref_mismatch = key_prefix^node_prefix;
		pref_mismatch = key_prefix^node_prefix;
		mp = 0;
		mp = 0;


		/* In short: If skipped bits in this node do not match the search
		/*
		 * key, enter the "prefix matching" state.directly.
		 * In short: If skipped bits in this node do not match
		 * the search key, enter the "prefix matching"
		 * state.directly.
		 */
		 */
		if (pref_mismatch) {
		if (pref_mismatch) {
			while (!(pref_mismatch & (1<<(KEYLENGTH-1)))) {
			while (!(pref_mismatch & (1<<(KEYLENGTH-1)))) {
@@ -1467,7 +1499,7 @@ fn_trie_lookup(struct fib_table *tb, const struct flowi *flp, struct fib_result
			if (current_prefix_length >= cn->pos)
			if (current_prefix_length >= cn->pos)
				current_prefix_length = mp;
				current_prefix_length = mp;
		}
		}
#endif

		pn = (struct tnode *)n; /* Descend */
		pn = (struct tnode *)n; /* Descend */
		chopped_off = 0;
		chopped_off = 0;
		continue;
		continue;
@@ -1476,12 +1508,14 @@ fn_trie_lookup(struct fib_table *tb, const struct flowi *flp, struct fib_result
		chopped_off++;
		chopped_off++;


		/* As zero don't change the child key (cindex) */
		/* As zero don't change the child key (cindex) */
		while ((chopped_off <= pn->bits) && !(cindex & (1<<(chopped_off-1))))
		while ((chopped_off <= pn->bits)
		       && !(cindex & (1<<(chopped_off-1))))
			chopped_off++;
			chopped_off++;


		/* Decrease current_... with bits chopped off */
		/* Decrease current_... with bits chopped off */
		if (current_prefix_length > pn->pos + pn->bits - chopped_off)
		if (current_prefix_length > pn->pos + pn->bits - chopped_off)
			current_prefix_length = pn->pos + pn->bits - chopped_off;
			current_prefix_length = pn->pos + pn->bits
				- chopped_off;


		/*
		/*
		 * Either we do the actual chop off according or if we have
		 * Either we do the actual chop off according or if we have
@@ -1531,7 +1565,8 @@ static int trie_leaf_remove(struct trie *t, t_key key)
	while (n != NULL && IS_TNODE(n)) {
	while (n != NULL && IS_TNODE(n)) {
		struct tnode *tn = (struct tnode *) n;
		struct tnode *tn = (struct tnode *) n;
		check_tnode(tn);
		check_tnode(tn);
		n = tnode_get_child(tn ,tkey_extract_bits(key, tn->pos, tn->bits));
		n = tnode_get_child(tn, tkey_extract_bits(key,
							  tn->pos, tn->bits));


		BUG_ON(n && node_parent(n) != tn);
		BUG_ON(n && node_parent(n) != tn);
	}
	}
@@ -1765,8 +1800,9 @@ static int fn_trie_flush(struct fib_table *tb)
	return found;
	return found;
}
}


static void
static void fn_trie_select_default(struct fib_table *tb,
fn_trie_select_default(struct fib_table *tb, const struct flowi *flp, struct fib_result *res)
				   const struct flowi *flp,
				   struct fib_result *res)
{
{
	struct trie *t = (struct trie *) tb->tb_data;
	struct trie *t = (struct trie *) tb->tb_data;
	int order, last_idx;
	int order, last_idx;
@@ -1837,7 +1873,8 @@ fn_trie_select_default(struct fib_table *tb, const struct flowi *flp, struct fib
	rcu_read_unlock();
	rcu_read_unlock();
}
}


static int fn_trie_dump_fa(t_key key, int plen, struct list_head *fah, struct fib_table *tb,
static int fn_trie_dump_fa(t_key key, int plen, struct list_head *fah,
			   struct fib_table *tb,
			   struct sk_buff *skb, struct netlink_callback *cb)
			   struct sk_buff *skb, struct netlink_callback *cb)
{
{
	int i, s_i;
	int i, s_i;
@@ -1876,8 +1913,8 @@ static int fn_trie_dump_fa(t_key key, int plen, struct list_head *fah, struct fi
	return skb->len;
	return skb->len;
}
}


static int fn_trie_dump_plen(struct trie *t, int plen, struct fib_table *tb, struct sk_buff *skb,
static int fn_trie_dump_plen(struct trie *t, int plen, struct fib_table *tb,
			     struct netlink_callback *cb)
			     struct sk_buff *skb, struct netlink_callback *cb)
{
{
	int h, s_h;
	int h, s_h;
	struct list_head *fa_head;
	struct list_head *fa_head;
@@ -1909,7 +1946,8 @@ static int fn_trie_dump_plen(struct trie *t, int plen, struct fib_table *tb, str
	return skb->len;
	return skb->len;
}
}


static int fn_trie_dump(struct fib_table *tb, struct sk_buff *skb, struct netlink_callback *cb)
static int fn_trie_dump(struct fib_table *tb, struct sk_buff *skb,
			struct netlink_callback *cb)
{
{
	int m, s_m;
	int m, s_m;
	struct trie *t = (struct trie *) tb->tb_data;
	struct trie *t = (struct trie *) tb->tb_data;
@@ -1939,7 +1977,8 @@ static int fn_trie_dump(struct fib_table *tb, struct sk_buff *skb, struct netlin


void __init fib_hash_init(void)
void __init fib_hash_init(void)
{
{
	fn_alias_kmem = kmem_cache_create("ip_fib_alias", sizeof(struct fib_alias),
	fn_alias_kmem = kmem_cache_create("ip_fib_alias",
					  sizeof(struct fib_alias),
					  0, SLAB_PANIC, NULL);
					  0, SLAB_PANIC, NULL);


	trie_leaf_kmem = kmem_cache_create("ip_fib_trie",
	trie_leaf_kmem = kmem_cache_create("ip_fib_trie",
@@ -1973,7 +2012,7 @@ struct fib_table *fib_hash_table(u32 id)
	memset(t, 0, sizeof(*t));
	memset(t, 0, sizeof(*t));


	if (id == RT_TABLE_LOCAL)
	if (id == RT_TABLE_LOCAL)
		printk(KERN_INFO "IPv4 FIB: Using LC-trie version %s\n", VERSION);
		pr_info("IPv4 FIB: Using LC-trie version %s\n", VERSION);


	return tb;
	return tb;
}
}
@@ -2107,7 +2146,8 @@ static void trie_show_stats(struct seq_file *seq, struct trie_stat *stat)
	else
	else
		avdepth = 0;
		avdepth = 0;


	seq_printf(seq, "\tAver depth:     %u.%02d\n", avdepth / 100, avdepth % 100 );
	seq_printf(seq, "\tAver depth:     %u.%02d\n",
		   avdepth / 100, avdepth % 100);
	seq_printf(seq, "\tMax depth:      %u\n", stat->maxdepth);
	seq_printf(seq, "\tMax depth:      %u\n", stat->maxdepth);


	seq_printf(seq, "\tLeaves:         %u\n", stat->leaves);
	seq_printf(seq, "\tLeaves:         %u\n", stat->leaves);
@@ -2141,14 +2181,18 @@ static void trie_show_usage(struct seq_file *seq,
	seq_printf(seq, "\nCounters:\n---------\n");
	seq_printf(seq, "\nCounters:\n---------\n");
	seq_printf(seq, "gets = %u\n", stats->gets);
	seq_printf(seq, "gets = %u\n", stats->gets);
	seq_printf(seq, "backtracks = %u\n", stats->backtrack);
	seq_printf(seq, "backtracks = %u\n", stats->backtrack);
	seq_printf(seq,"semantic match passed = %u\n", stats->semantic_match_passed);
	seq_printf(seq, "semantic match passed = %u\n",
	seq_printf(seq,"semantic match miss = %u\n", stats->semantic_match_miss);
		   stats->semantic_match_passed);
	seq_printf(seq, "semantic match miss = %u\n",
		   stats->semantic_match_miss);
	seq_printf(seq, "null node hit= %u\n", stats->null_node_hit);
	seq_printf(seq, "null node hit= %u\n", stats->null_node_hit);
	seq_printf(seq,"skipped node resize = %u\n\n", stats->resize_node_skipped);
	seq_printf(seq, "skipped node resize = %u\n\n",
		   stats->resize_node_skipped);
}
}
#endif /*  CONFIG_IP_FIB_TRIE_STATS */
#endif /*  CONFIG_IP_FIB_TRIE_STATS */


static void fib_trie_show(struct seq_file *seq, const char *name, struct trie *trie)
static void fib_trie_show(struct seq_file *seq, const char *name,
			  struct trie *trie)
{
{
	struct trie_stat stat;
	struct trie_stat stat;


@@ -2166,7 +2210,8 @@ static int fib_triestat_seq_show(struct seq_file *seq, void *v)
	struct fib_table *tb;
	struct fib_table *tb;


	seq_printf(seq,
	seq_printf(seq,
		   "Basic info: size of leaf: %Zd bytes, size of tnode: %Zd bytes.\n",
		   "Basic info: size of leaf:"
		   " %Zd bytes, size of tnode: %Zd bytes.\n",
		   sizeof(struct leaf), sizeof(struct tnode));
		   sizeof(struct leaf), sizeof(struct tnode));


	tb = fib_get_table(net, RT_TABLE_LOCAL);
	tb = fib_get_table(net, RT_TABLE_LOCAL);
@@ -2439,6 +2484,7 @@ static int fib_route_seq_show(struct seq_file *seq, void *v)


	if (iter->trie == iter->trie_local)
	if (iter->trie == iter->trie_local)
		return 0;
		return 0;

	if (IS_TNODE(l))
	if (IS_TNODE(l))
		return 0;
		return 0;


@@ -2469,7 +2515,8 @@ static int fib_route_seq_show(struct seq_file *seq, void *v)
					 fi->fib_nh->nh_gw, flags, 0, 0,
					 fi->fib_nh->nh_gw, flags, 0, 0,
					 fi->fib_priority,
					 fi->fib_priority,
					 mask,
					 mask,
					 (fi->fib_advmss ? fi->fib_advmss + 40 : 0),
					 (fi->fib_advmss ?
					  fi->fib_advmss + 40 : 0),
					 fi->fib_window,
					 fi->fib_window,
					 fi->fib_rtt >> 3);
					 fi->fib_rtt >> 3);
			else
			else