Message ID | 20191210172402.463397-8-idosch@idosch.org |
---|---|
State | Changes Requested |
Delegated to: | David Miller |
Headers | show |
Series | Simplify IPv4 route offload API | expand |
On 12/10/19 10:24 AM, Ido Schimmel wrote: > From: Ido Schimmel <idosch@mellanox.com> > > When a new listener is registered to the FIB notification chain it > receives a dump of all the available routes in the system. Instead, make > sure to only replay the IPv4 routes that are actually used in the data > path and are of any interest to the new listener. > > Signed-off-by: Ido Schimmel <idosch@mellanox.com> > --- > net/ipv4/fib_trie.c | 11 +++++++++++ > 1 file changed, 11 insertions(+) > Reviewed-by: David Ahern <dsahern@gmail.com>
diff --git a/net/ipv4/fib_trie.c b/net/ipv4/fib_trie.c index 60947a44d363..eff45e7795ba 100644 --- a/net/ipv4/fib_trie.c +++ b/net/ipv4/fib_trie.c @@ -2096,6 +2096,7 @@ static int fib_leaf_notify(struct key_vector *l, struct fib_table *tb, struct netlink_ext_ack *extack) { struct fib_alias *fa; + int last_slen = -1; int err; hlist_for_each_entry_rcu(fa, &l->leaf, fa_list) { @@ -2115,6 +2116,16 @@ static int fib_leaf_notify(struct key_vector *l, struct fib_table *tb, fa, extack); if (err) return err; + + if (fa->fa_slen == last_slen) + continue; + + last_slen = fa->fa_slen; + err = call_fib_entry_notifier(nb, FIB_EVENT_ENTRY_REPLACE_TMP, + l->key, KEYLENGTH - fa->fa_slen, + fa, extack); + if (err) + return err; } return 0; }