diff options
author | Neale Ranns <nranns@cisco.com> | 2018-04-25 01:41:24 -0700 |
---|---|---|
committer | Dave Barach <openvpp@barachs.net> | 2018-04-30 15:03:40 +0000 |
commit | 56f949b9d3d1c3ba6816169fff852a51bbe47a15 (patch) | |
tree | adffd84ca4c3c3c7932a61b564df3a42c6969902 /src | |
parent | 404d85acf829fb03be76cc0dc007a9c03ebe09dc (diff) |
FIB: elide cover walk for insert of host route
Change-Id: I2d39e56ff605e3a24927d6330d65d0406f588381
Signed-off-by: Neale Ranns <nranns@cisco.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/vnet/fib/fib_entry.c | 13 | ||||
-rw-r--r-- | src/vnet/fib/fib_entry.h | 1 | ||||
-rw-r--r-- | src/vnet/fib/fib_table.c | 14 |
3 files changed, 25 insertions, 3 deletions
diff --git a/src/vnet/fib/fib_entry.c b/src/vnet/fib/fib_entry.c index cd1300dee39..a12edcb1867 100644 --- a/src/vnet/fib/fib_entry.c +++ b/src/vnet/fib/fib_entry.c @@ -1428,6 +1428,19 @@ fib_entry_get_best_source (fib_node_index_t entry_index) } /** + * Return !0 is the entry represents a host prefix + */ +int +fib_entry_is_host (fib_node_index_t fib_entry_index) +{ + fib_prefix_t pfx; + + fib_entry_get_prefix(fib_entry_index, &pfx); + + return (fib_prefix_is_host(&pfx)); +} + +/** * Return !0 is the entry is reoslved, i.e. will return a valid forwarding * chain */ diff --git a/src/vnet/fib/fib_entry.h b/src/vnet/fib/fib_entry.h index ddaf914389e..dcc310e8fbc 100644 --- a/src/vnet/fib/fib_entry.h +++ b/src/vnet/fib/fib_entry.h @@ -613,6 +613,7 @@ extern int fib_entry_is_sourced(fib_node_index_t fib_entry_index, extern fib_node_index_t fib_entry_get_path_list(fib_node_index_t fib_entry_index); extern int fib_entry_is_resolved(fib_node_index_t fib_entry_index); +extern int fib_entry_is_host(fib_node_index_t fib_entry_index); extern void fib_entry_set_flow_hash_config(fib_node_index_t fib_entry_index, flow_hash_config_t hash_config); diff --git a/src/vnet/fib/fib_table.c b/src/vnet/fib/fib_table.c index d0bc33639b9..c37ac1dbd49 100644 --- a/src/vnet/fib/fib_table.c +++ b/src/vnet/fib/fib_table.c @@ -197,10 +197,18 @@ fib_table_post_insert_actions (fib_table_t *fib_table, /* * inform the covering entry that a new more specific - * has been inserted beneath it + * has been inserted beneath it. + * If the prefix that has been inserted is a host route + * then it is not possible that it will be the cover for any + * other entry, so we can elide the walk. This is particularly + * beneficial since there are often many host entries sharing the + * same cover (i.e. ADJ or RR sourced entries). */ - fib_entry_cover_change_notify(fib_entry_cover_index, - fib_entry_index); + if (!fib_entry_is_host(fib_entry_index)) + { + fib_entry_cover_change_notify(fib_entry_cover_index, + fib_entry_index); + } } } |