diff options
author | Neale Ranns <nranns@cisco.com> | 2019-12-04 06:11:00 +0000 |
---|---|---|
committer | Ole Trøan <otroan@employees.org> | 2019-12-04 22:47:12 +0000 |
commit | 3bab8f9c5396a7bf1115b93a9e0691a76a9ed14c (patch) | |
tree | 0212708b47f042ac393848e0471669f837788278 /src/vnet/fib/fib_entry_src.c | |
parent | 5f8f6173328f8d77feea5fd100e150c3094c11f0 (diff) |
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 <nranns@cisco.com>
Change-Id: I890ee820fbc16079ee417ea1fbc163192806e853
Diffstat (limited to 'src/vnet/fib/fib_entry_src.c')
-rw-r--r-- | src/vnet/fib/fib_entry_src.c | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/src/vnet/fib/fib_entry_src.c b/src/vnet/fib/fib_entry_src.c index 176818abc0a..d534135d330 100644 --- a/src/vnet/fib/fib_entry_src.c +++ b/src/vnet/fib/fib_entry_src.c @@ -28,7 +28,7 @@ /* * per-source type vft */ -static fib_entry_src_vft_t fib_entry_src_vft[FIB_SOURCE_MAX]; +static fib_entry_src_vft_t fib_entry_src_bh_vft[FIB_SOURCE_BH_MAX]; /** * Get the VFT for a given source. This is a combination of the source @@ -37,12 +37,16 @@ static fib_entry_src_vft_t fib_entry_src_vft[FIB_SOURCE_MAX]; const fib_entry_src_vft_t* fib_entry_src_get_vft (const fib_entry_src_t *esrc) { + fib_source_behaviour_t bh; + + bh = fib_source_get_behaviour(esrc->fes_src); + if (esrc->fes_entry_flags & FIB_ENTRY_FLAG_INTERPOSE) { - return (&fib_entry_src_vft[FIB_SOURCE_INTERPOSE]); + return (&fib_entry_src_bh_vft[FIB_SOURCE_BH_INTERPOSE]); } - return (&fib_entry_src_vft[esrc->fes_src]); + return (&fib_entry_src_bh_vft[bh]); } static void @@ -54,14 +58,14 @@ fib_entry_src_copy_default (const fib_entry_src_t *orig_src, } void -fib_entry_src_register (fib_source_t source, - const fib_entry_src_vft_t *vft) +fib_entry_src_behaviour_register (fib_source_behaviour_t bh, + const fib_entry_src_vft_t *vft) { - fib_entry_src_vft[source] = *vft; + fib_entry_src_bh_vft[bh] = *vft; - if (NULL == fib_entry_src_vft[source].fesv_copy) + if (NULL == fib_entry_src_bh_vft[bh].fesv_copy) { - fib_entry_src_vft[source].fesv_copy = fib_entry_src_copy_default; + fib_entry_src_bh_vft[bh].fesv_copy = fib_entry_src_copy_default; } } @@ -71,7 +75,8 @@ fib_entry_src_cmp_for_sort (void * v1, { fib_entry_src_t *esrc1 = v1, *esrc2 = v2; - return (esrc1->fes_src - esrc2->fes_src); + return (fib_source_get_prio(esrc1->fes_src) - + fib_source_get_prio(esrc2->fes_src)); } static void @@ -1925,8 +1930,8 @@ fib_entry_src_module_init (void) fib_entry_src_rr_register(); fib_entry_src_interface_register(); fib_entry_src_interpose_register(); - fib_entry_src_default_route_register(); - fib_entry_src_special_register(); + fib_entry_src_drop_register(); + fib_entry_src_simple_register(); fib_entry_src_api_register(); fib_entry_src_adj_register(); fib_entry_src_mpls_register(); |