aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/svs/svs.c
diff options
context:
space:
mode:
authorNeale Ranns <nranns@cisco.com>2019-12-04 06:11:00 +0000
committerOle Trøan <otroan@employees.org>2019-12-04 22:47:12 +0000
commit3bab8f9c5396a7bf1115b93a9e0691a76a9ed14c (patch)
tree0212708b47f042ac393848e0471669f837788278 /src/plugins/svs/svs.c
parent5f8f6173328f8d77feea5fd100e150c3094c11f0 (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/plugins/svs/svs.c')
-rw-r--r--src/plugins/svs/svs.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/plugins/svs/svs.c b/src/plugins/svs/svs.c
index 8c1487c6ebc..555283397ff 100644
--- a/src/plugins/svs/svs.c
+++ b/src/plugins/svs/svs.c
@@ -26,10 +26,12 @@
u32 *svs_itf_db[FIB_PROTOCOL_IP_MAX];
+static fib_source_t svs_fib_src;
+
int
svs_table_add (fib_protocol_t fproto, u32 table_id)
{
- fib_table_find_or_create_and_lock (fproto, table_id, FIB_SOURCE_PLUGIN_LOW);
+ fib_table_find_or_create_and_lock (fproto, table_id, svs_fib_src);
return (0);
}
@@ -50,7 +52,7 @@ svs_table_delete (fib_protocol_t fproto, u32 table_id)
if (~0 == fib_index)
return VNET_API_ERROR_NO_SUCH_FIB;
- fib_table_unlock (fib_index, fproto, FIB_SOURCE_PLUGIN_LOW);
+ fib_table_unlock (fib_index, fproto, svs_fib_src);
return (0);
}
@@ -68,7 +70,7 @@ svs_route_add_i (u32 fib_index, const fib_prefix_t * pfx, u32 src_fib_index)
LOOKUP_TABLE_FROM_CONFIG, &dpo);
fib_table_entry_special_dpo_add (fib_index, pfx,
- FIB_SOURCE_PLUGIN_LOW,
+ svs_fib_src,
FIB_ENTRY_FLAG_EXCLUSIVE, &dpo);
dpo_unlock (&dpo);
@@ -107,7 +109,7 @@ svs_route_delete (u32 table_id, const fib_prefix_t * pfx)
if (~0 == fib_index)
return VNET_API_ERROR_NO_SUCH_FIB;
- fib_table_entry_special_remove (fib_index, pfx, FIB_SOURCE_PLUGIN_LOW);
+ fib_table_entry_special_remove (fib_index, pfx, svs_fib_src);
return (0);
}
@@ -214,7 +216,7 @@ svs_disable (fib_protocol_t fproto, u32 table_id, u32 sw_if_index)
"svs-ip4" :
"svs-ip6"), sw_if_index, 0, NULL, 0);
- fib_table_entry_special_remove (fib_index, &pfx, FIB_SOURCE_PLUGIN_LOW);
+ fib_table_entry_special_remove (fib_index, &pfx, svs_fib_src);
return (0);
}
@@ -607,6 +609,10 @@ svs_init (vlib_main_t * vm)
};
vec_add1 (ip4_main.table_bind_callbacks, cbt4);
+ svs_fib_src = fib_source_allocate ("svs",
+ FIB_SOURCE_PRIORITY_LOW,
+ FIB_SOURCE_BH_SIMPLE);
+
return (NULL);
}