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

Commit 02525368 authored by Alexander Duyck's avatar Alexander Duyck Committed by David S. Miller
Browse files

fib_trie: Move fib_find_alias to file where it is used



The function fib_find_alias is only accessed by functions in fib_trie.c as
such it makes sense to relocate it and cast it as static so that the
compiler can take advantage of optimizations it can do to it as a local
function.

Signed-off-by: default avatarAlexander Duyck <alexander.h.duyck@redhat.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 30cfe7c9
Loading
Loading
Loading
Loading
+0 −1
Original line number Original line Diff line number Diff line
@@ -32,7 +32,6 @@ int fib_dump_info(struct sk_buff *skb, u32 pid, u32 seq, int event, u32 tb_id,
		  unsigned int);
		  unsigned int);
void rtmsg_fib(int event, __be32 key, struct fib_alias *fa, int dst_len,
void rtmsg_fib(int event, __be32 key, struct fib_alias *fa, int dst_len,
	       u32 tb_id, const struct nl_info *info, unsigned int nlm_flags);
	       u32 tb_id, const struct nl_info *info, unsigned int nlm_flags);
struct fib_alias *fib_find_alias(struct list_head *fah, u8 tos, u32 prio);


static inline void fib_result_assign(struct fib_result *res,
static inline void fib_result_assign(struct fib_result *res,
				     struct fib_info *fi)
				     struct fib_info *fi)
+0 −18
Original line number Original line Diff line number Diff line
@@ -411,24 +411,6 @@ void rtmsg_fib(int event, __be32 key, struct fib_alias *fa,
		rtnl_set_sk_err(info->nl_net, RTNLGRP_IPV4_ROUTE, err);
		rtnl_set_sk_err(info->nl_net, RTNLGRP_IPV4_ROUTE, err);
}
}


/* Return the first fib alias matching TOS with
 * priority less than or equal to PRIO.
 */
struct fib_alias *fib_find_alias(struct list_head *fah, u8 tos, u32 prio)
{
	if (fah) {
		struct fib_alias *fa;
		list_for_each_entry(fa, fah, fa_list) {
			if (fa->fa_tos > tos)
				continue;
			if (fa->fa_info->fib_priority >= prio ||
			    fa->fa_tos < tos)
				return fa;
		}
	}
	return NULL;
}

static int fib_detect_death(struct fib_info *fi, int order,
static int fib_detect_death(struct fib_info *fi, int order,
			    struct fib_info **last_resort, int *last_idx,
			    struct fib_info **last_resort, int *last_idx,
			    int dflt)
			    int dflt)
+20 −0
Original line number Original line Diff line number Diff line
@@ -998,6 +998,26 @@ static struct tnode *fib_find_node(struct trie *t, u32 key)
	return n;
	return n;
}
}


/* Return the first fib alias matching TOS with
 * priority less than or equal to PRIO.
 */
static struct fib_alias *fib_find_alias(struct list_head *fah, u8 tos, u32 prio)
{
	struct fib_alias *fa;

	if (!fah)
		return NULL;

	list_for_each_entry(fa, fah, fa_list) {
		if (fa->fa_tos > tos)
			continue;
		if (fa->fa_info->fib_priority >= prio || fa->fa_tos < tos)
			return fa;
	}

	return NULL;
}

static void trie_rebalance(struct trie *t, struct tnode *tn)
static void trie_rebalance(struct trie *t, struct tnode *tn)
{
{
	struct tnode *tp;
	struct tnode *tp;