[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <23c1daed-d770-a61b-2e89-8466de2afc70@gmail.com>
Date: Thu, 9 Jan 2020 08:47:13 -0700
From: David Ahern <dsahern@...il.com>
To: Ido Schimmel <idosch@...sch.org>, netdev@...r.kernel.org
Cc: davem@...emloft.net, jiri@...lanox.com,
jakub.kicinski@...ronome.com, roopa@...ulusnetworks.com,
mlxsw@...lanox.com, Ido Schimmel <idosch@...lanox.com>
Subject: Re: [PATCH net-next 03/10] ipv4: Add "offload" and "trap" indications
to routes
On 1/7/20 8:45 AM, Ido Schimmel wrote:
> diff --git a/net/ipv4/fib_trie.c b/net/ipv4/fib_trie.c
> index 75af3f8ae50e..272c9f73e4b3 100644
> --- a/net/ipv4/fib_trie.c
> +++ b/net/ipv4/fib_trie.c
> @@ -1012,6 +1012,56 @@ static struct fib_alias *fib_find_alias(struct hlist_head *fah, u8 slen,
> return NULL;
> }
>
> +static struct fib_alias *
> +fib_find_matching_alias(struct net *net, u32 dst, int dst_len,
> + const struct fib_info *fi, u8 tos, u8 type, u32 tb_id)
> +{
> + u8 slen = KEYLENGTH - dst_len;
> + struct key_vector *l, *tp;
> + struct fib_table *tb;
> + struct fib_alias *fa;
> + struct trie *t;
> +
> + tb = fib_get_table(net, tb_id);
> + if (!tb)
> + return NULL;
> +
> + t = (struct trie *)tb->tb_data;
> + l = fib_find_node(t, &tp, dst);
> + if (!l)
> + return NULL;
> +
> + hlist_for_each_entry_rcu(fa, &l->leaf, fa_list) {
> + if (fa->fa_slen == slen && fa->tb_id == tb_id &&
> + fa->fa_tos == tos && fa->fa_info == fi &&
> + fa->fa_type == type)
> + return fa;
> + }
> +
> + return NULL;
> +}
> +
> +void fib_alias_hw_flags_set(struct net *net, u32 dst, int dst_len,
> + const struct fib_info *fi, u8 tos, u8 type,
> + u32 tb_id, bool offload, bool trap)
Seem like struct fib_rt_info from the previous patch be used here and
then passed to fib_find_matching_alias.
> +{
> + struct fib_alias *fa_match;
> +
> + rcu_read_lock();
> +
> + fa_match = fib_find_matching_alias(net, dst, dst_len, fi, tos, type,
> + tb_id);
> + if (!fa_match)
> + goto out;
> +
> + fa_match->offload = offload;
> + fa_match->trap = trap;
> +
> +out:
> + rcu_read_unlock();
> +}
> +EXPORT_SYMBOL_GPL(fib_alias_hw_flags_set);
> +
> static void trie_rebalance(struct trie *t, struct key_vector *tn)
> {
> while (!IS_TRIE(tn))
Powered by blists - more mailing lists