From 3bab8f9c5396a7bf1115b93a9e0691a76a9ed14c Mon Sep 17 00:00:00 2001 From: Neale Ranns Date: Wed, 4 Dec 2019 06:11:00 +0000 Subject: fib: Decouple source from priority and behaviour Type: feature the fib_source_t enum alone no longer defines the priority and behaviour, instead each source must be allocated these attributes. This allows the creation of other sources by the plugins (and soon over the API). Signed-off-by: Neale Ranns Change-Id: I890ee820fbc16079ee417ea1fbc163192806e853 --- src/plugins/gbp/gbp_route_domain.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src/plugins/gbp/gbp_route_domain.c') diff --git a/src/plugins/gbp/gbp_route_domain.c b/src/plugins/gbp/gbp_route_domain.c index ab998591982..f0aa694d44a 100644 --- a/src/plugins/gbp/gbp_route_domain.c +++ b/src/plugins/gbp/gbp_route_domain.c @@ -53,6 +53,7 @@ typedef struct gbp_route_domain_db_t } gbp_route_domain_db_t; static gbp_route_domain_db_t gbp_route_domain_db; +static fib_source_t gbp_fib_source; /** * logger @@ -154,7 +155,7 @@ gbp_route_domain_add_and_lock (u32 rd_id, grd->grd_fib_index[fproto] = fib_table_find_or_create_and_lock (fproto, grd->grd_table_id[fproto], - FIB_SOURCE_PLUGIN_HI); + gbp_fib_source); if (~0 != grd->grd_uu_sw_if_index[fproto]) { @@ -221,8 +222,7 @@ gbp_route_domain_unlock (index_t index) FOR_EACH_FIB_IP_PROTOCOL (fproto) { - fib_table_unlock (grd->grd_fib_index[fproto], - fproto, FIB_SOURCE_PLUGIN_HI); + fib_table_unlock (grd->grd_fib_index[fproto], fproto, gbp_fib_source); if (INDEX_INVALID != grd->grd_adj[fproto]) adj_unlock (grd->grd_adj[fproto]); } @@ -430,6 +430,9 @@ static clib_error_t * gbp_route_domain_init (vlib_main_t * vm) { grd_logger = vlib_log_register_class ("gbp", "rd"); + gbp_fib_source = fib_source_allocate ("gbp-rd", + FIB_SOURCE_PRIORITY_HI, + FIB_SOURCE_BH_DROP); return (NULL); } -- cgit 1.2.3-korg