aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/fib
diff options
context:
space:
mode:
authorNeale Ranns <nranns@cisco.com>2017-09-10 04:39:11 -0700
committerDamjan Marion <dmarion.lists@gmail.com>2017-09-11 10:14:36 +0000
commit1500254bee11355bbd69cc1dd9705be4f002f2bd (patch)
treec403642105f399baccb3a727020232b5732fe8f7 /src/vnet/fib
parenta7191840beeb2c3a0f2598707ed1051a9f23c45f (diff)
FIB table add/delete API
part 2; - this adds the code to create an IP and MPLS table via the API. - but the enforcement that the table must be created before it is used is still missing, this is so that CSIT can pass. Change-Id: Id124d884ade6cb7da947225200e3bb193454c555 Signed-off-by: Neale Ranns <nranns@cisco.com>
Diffstat (limited to 'src/vnet/fib')
-rw-r--r--src/vnet/fib/fib_api.h1
-rw-r--r--src/vnet/fib/fib_entry.c15
-rw-r--r--src/vnet/fib/fib_entry.h1
-rw-r--r--src/vnet/fib/fib_entry_src_mpls.c7
-rw-r--r--src/vnet/fib/fib_table.c43
-rw-r--r--src/vnet/fib/fib_table.h32
-rw-r--r--src/vnet/fib/fib_test.c27
-rw-r--r--src/vnet/fib/ip4_fib.c41
-rw-r--r--src/vnet/fib/ip4_fib.h5
-rw-r--r--src/vnet/fib/ip6_fib.c41
-rw-r--r--src/vnet/fib/ip6_fib.h5
-rw-r--r--src/vnet/fib/mpls_fib.c16
-rw-r--r--src/vnet/fib/mpls_fib.h5
13 files changed, 171 insertions, 68 deletions
diff --git a/src/vnet/fib/fib_api.h b/src/vnet/fib/fib_api.h
index d07d6caee66..f5a107ca352 100644
--- a/src/vnet/fib/fib_api.h
+++ b/src/vnet/fib/fib_api.h
@@ -23,7 +23,6 @@ add_del_route_check (fib_protocol_t table_proto,
u32 next_hop_sw_if_index,
dpo_proto_t next_hop_table_proto,
u32 next_hop_table_id,
- u8 create_missing_tables,
u8 is_rpf_id,
u32 * fib_index, u32 * next_hop_fib_index);
diff --git a/src/vnet/fib/fib_entry.c b/src/vnet/fib/fib_entry.c
index 2027f2be8b9..4cb6cf6050c 100644
--- a/src/vnet/fib/fib_entry.c
+++ b/src/vnet/fib/fib_entry.c
@@ -90,6 +90,17 @@ fib_entry_get_default_chain_type (const fib_entry_t *fib_entry)
}
u8 *
+format_fib_source (u8 * s, va_list * args)
+{
+ fib_source_t source = va_arg (*args, int);
+
+ s = format (s, "\n src:%s ",
+ fib_source_names[source]);
+
+ return (s);
+}
+
+u8 *
format_fib_entry (u8 * s, va_list * args)
{
fib_forward_chain_type_t fct;
@@ -114,8 +125,8 @@ format_fib_entry (u8 * s, va_list * args)
FOR_EACH_SRC_ADDED(fib_entry, src, source,
({
- s = format (s, "\n src:%s ",
- fib_source_names[source]);
+ s = format (s, "\n src:%U ",
+ format_fib_source, source);
s = fib_entry_src_format(fib_entry, source, s);
s = format (s, " refs:%d ", src->fes_ref_count);
if (FIB_ENTRY_FLAG_NONE != src->fes_entry_flags) {
diff --git a/src/vnet/fib/fib_entry.h b/src/vnet/fib/fib_entry.h
index 93b8016d44f..2f6e37fe69a 100644
--- a/src/vnet/fib/fib_entry.h
+++ b/src/vnet/fib/fib_entry.h
@@ -431,6 +431,7 @@ typedef struct fib_entry_t_ {
#define FIB_ENTRY_FORMAT_DETAIL2 (0x2)
extern u8 *format_fib_entry (u8 * s, va_list * args);
+extern u8 *format_fib_source (u8 * s, va_list * args);
extern fib_node_index_t fib_entry_create_special(u32 fib_index,
const fib_prefix_t *prefix,
diff --git a/src/vnet/fib/fib_entry_src_mpls.c b/src/vnet/fib/fib_entry_src_mpls.c
index a616458fcbe..6fdd5c0ac66 100644
--- a/src/vnet/fib/fib_entry_src_mpls.c
+++ b/src/vnet/fib/fib_entry_src_mpls.c
@@ -94,7 +94,9 @@ fib_entry_src_mpls_set_data (fib_entry_src_t *src,
fib_table_entry_delete_index(src->mpls.fesm_lfes[eos],
FIB_SOURCE_SPECIAL);
}
- fib_table_unlock(MPLS_FIB_DEFAULT_TABLE_ID, FIB_PROTOCOL_MPLS);
+ fib_table_unlock(MPLS_FIB_DEFAULT_TABLE_ID,
+ FIB_PROTOCOL_MPLS,
+ FIB_SOURCE_MPLS);
src->mpls.fesm_label = label;
}
else
@@ -113,7 +115,8 @@ fib_entry_src_mpls_set_data (fib_entry_src_t *src,
{
fib_index =
fib_table_find_or_create_and_lock(FIB_PROTOCOL_MPLS,
- MPLS_FIB_DEFAULT_TABLE_ID);
+ MPLS_FIB_DEFAULT_TABLE_ID,
+ FIB_SOURCE_MPLS);
}
else
{
diff --git a/src/vnet/fib/fib_table.c b/src/vnet/fib/fib_table.c
index 6b6cc5cb99a..75d15628c26 100644
--- a/src/vnet/fib/fib_table.c
+++ b/src/vnet/fib/fib_table.c
@@ -1039,7 +1039,8 @@ fib_table_find (fib_protocol_t proto,
u32
fib_table_find_or_create_and_lock (fib_protocol_t proto,
- u32 table_id)
+ u32 table_id,
+ fib_source_t src)
{
fib_table_t *fib_table;
fib_node_index_t fi;
@@ -1047,13 +1048,13 @@ fib_table_find_or_create_and_lock (fib_protocol_t proto,
switch (proto)
{
case FIB_PROTOCOL_IP4:
- fi = ip4_fib_table_find_or_create_and_lock(table_id);
+ fi = ip4_fib_table_find_or_create_and_lock(table_id, src);
break;
case FIB_PROTOCOL_IP6:
- fi = ip6_fib_table_find_or_create_and_lock(table_id);
+ fi = ip6_fib_table_find_or_create_and_lock(table_id, src);
break;
case FIB_PROTOCOL_MPLS:
- fi = mpls_fib_table_find_or_create_and_lock(table_id);
+ fi = mpls_fib_table_find_or_create_and_lock(table_id, src);
break;
default:
return (~0);
@@ -1070,6 +1071,7 @@ fib_table_find_or_create_and_lock (fib_protocol_t proto,
u32
fib_table_create_and_lock (fib_protocol_t proto,
+ fib_source_t src,
const char *const fmt,
...)
{
@@ -1082,13 +1084,13 @@ fib_table_create_and_lock (fib_protocol_t proto,
switch (proto)
{
case FIB_PROTOCOL_IP4:
- fi = ip4_fib_table_create_and_lock();
+ fi = ip4_fib_table_create_and_lock(src);
break;
case FIB_PROTOCOL_IP6:
- fi = ip6_fib_table_create_and_lock();
+ fi = ip6_fib_table_create_and_lock(src);
break;
case FIB_PROTOCOL_MPLS:
- fi = mpls_fib_table_create_and_lock();
+ fi = mpls_fib_table_create_and_lock(src);
break;
default:
return (~0);
@@ -1143,26 +1145,43 @@ fib_table_walk (u32 fib_index,
void
fib_table_unlock (u32 fib_index,
- fib_protocol_t proto)
+ fib_protocol_t proto,
+ fib_source_t source)
{
fib_table_t *fib_table;
fib_table = fib_table_get(fib_index, proto);
- fib_table->ft_locks--;
+ fib_table->ft_locks[source]--;
+ fib_table->ft_locks[FIB_TABLE_TOTAL_LOCKS]--;
- if (0 == fib_table->ft_locks)
+ if (0 == fib_table->ft_locks[source])
{
+ /*
+ * The source no longer needs the table. flush any routes
+ * from it just in case
+ */
+ fib_table_flush(fib_index, proto, source);
+ }
+
+ if (0 == fib_table->ft_locks[FIB_TABLE_TOTAL_LOCKS])
+ {
+ /*
+ * no more locak from any source - kill it
+ */
fib_table_destroy(fib_table);
}
}
+
void
fib_table_lock (u32 fib_index,
- fib_protocol_t proto)
+ fib_protocol_t proto,
+ fib_source_t source)
{
fib_table_t *fib_table;
fib_table = fib_table_get(fib_index, proto);
- fib_table->ft_locks++;
+ fib_table->ft_locks[source]++;
+ fib_table->ft_locks[FIB_TABLE_TOTAL_LOCKS]++;
}
u32
diff --git a/src/vnet/fib/fib_table.h b/src/vnet/fib/fib_table.h
index 579740e9c42..6b7011b3316 100644
--- a/src/vnet/fib/fib_table.h
+++ b/src/vnet/fib/fib_table.h
@@ -23,6 +23,12 @@
#include <vnet/mpls/packet.h>
/**
+ * Keep a lock per-source and a total
+ */
+#define FIB_TABLE_N_LOCKS (FIB_SOURCE_MAX+1)
+#define FIB_TABLE_TOTAL_LOCKS FIB_SOURCE_MAX
+
+/**
* @brief
* A protocol Independent FIB table
*/
@@ -34,9 +40,9 @@ typedef struct fib_table_t_
fib_protocol_t ft_proto;
/**
- * number of locks on the table
+ * per-source number of locks on the table
*/
- u16 ft_locks;
+ u16 ft_locks[FIB_TABLE_N_LOCKS];
/**
* Table ID (hash key) for this FIB.
@@ -628,9 +634,13 @@ extern u32 fib_table_find(fib_protocol_t proto, u32 table_id);
*
* @return fib_index
* The index of the FIB
+ *
+ * @param source
+ * The ID of the client/source.
*/
extern u32 fib_table_find_or_create_and_lock(fib_protocol_t proto,
- u32 table_id);
+ u32 table_id,
+ fib_source_t source);
/**
* @brief
@@ -643,10 +653,14 @@ extern u32 fib_table_find_or_create_and_lock(fib_protocol_t proto,
* @param fmt
* A string to describe the table
*
+ * @param source
+ * The ID of the client/source.
+ *
* @return fib_index
* The index of the FIB
*/
extern u32 fib_table_create_and_lock(fib_protocol_t proto,
+ fib_source_t source,
const char *const fmt,
...);
@@ -704,9 +718,13 @@ extern void fib_table_set_flow_hash_config(u32 fib_index,
*
* @paran proto
* The protocol of the FIB (and thus the entries therein)
+ *
+ * @param source
+ * The ID of the client/source.
*/
extern void fib_table_unlock(u32 fib_index,
- fib_protocol_t proto);
+ fib_protocol_t proto,
+ fib_source_t source);
/**
* @brief
@@ -718,9 +736,13 @@ extern void fib_table_unlock(u32 fib_index,
*
* @paran proto
* The protocol of the FIB (and thus the entries therein)
+ *
+ * @param source
+ * The ID of the client/source.
*/
extern void fib_table_lock(u32 fib_index,
- fib_protocol_t proto);
+ fib_protocol_t proto,
+ fib_source_t source);
/**
* @brief
diff --git a/src/vnet/fib/fib_test.c b/src/vnet/fib/fib_test.c
index 6867cca8959..572d7f0d156 100644
--- a/src/vnet/fib/fib_test.c
+++ b/src/vnet/fib/fib_test.c
@@ -739,7 +739,8 @@ fib_test_v4 (void)
lb_count = pool_elts(load_balance_pool);
/* Find or create FIB table 11 */
- fib_index = fib_table_find_or_create_and_lock(FIB_PROTOCOL_IP4, 11);
+ fib_index = fib_table_find_or_create_and_lock(FIB_PROTOCOL_IP4, 11,
+ FIB_SOURCE_API);
for (ii = 0; ii < 4; ii++)
{
@@ -4150,7 +4151,7 @@ fib_test_v4 (void)
FIB_SOURCE_INTERFACE)),
"NO INterface Source'd prefixes");
- fib_table_unlock(fib_index, FIB_PROTOCOL_IP4);
+ fib_table_unlock(fib_index, FIB_PROTOCOL_IP4, FIB_SOURCE_API);
FIB_TEST((0 == fib_path_list_db_size()), "path list DB population:%d",
fib_path_list_db_size());
@@ -4201,7 +4202,8 @@ fib_test_v6 (void)
dpo_drop = drop_dpo_get(DPO_PROTO_IP6);
/* Find or create FIB table 11 */
- fib_index = fib_table_find_or_create_and_lock(FIB_PROTOCOL_IP6, 11);
+ fib_index = fib_table_find_or_create_and_lock(FIB_PROTOCOL_IP6, 11,
+ FIB_SOURCE_API);
for (ii = 0; ii < 4; ii++)
{
@@ -5025,7 +5027,7 @@ fib_test_v6 (void)
/*
* now remove the VRF
*/
- fib_table_unlock(fib_index, FIB_PROTOCOL_IP6);
+ fib_table_unlock(fib_index, FIB_PROTOCOL_IP6, FIB_SOURCE_API);
FIB_TEST((0 == fib_path_list_db_size()), "path list DB population:%d",
fib_path_list_db_size());
@@ -5157,7 +5159,9 @@ fib_test_ae (void)
*/
u32 import_fib_index1;
- import_fib_index1 = fib_table_find_or_create_and_lock(FIB_PROTOCOL_IP4, 11);
+ import_fib_index1 = fib_table_find_or_create_and_lock(FIB_PROTOCOL_IP4,
+ 11,
+ FIB_SOURCE_CLI);
/*
* Add an attached route in the import FIB
@@ -5233,7 +5237,8 @@ fib_test_ae (void)
*/
u32 import_fib_index2;
- import_fib_index2 = fib_table_find_or_create_and_lock(FIB_PROTOCOL_IP4, 12);
+ import_fib_index2 = fib_table_find_or_create_and_lock(FIB_PROTOCOL_IP4, 12,
+ FIB_SOURCE_CLI);
/*
* Add an attached route in the import FIB
@@ -5595,8 +5600,8 @@ fib_test_ae (void)
&local_pfx,
FIB_SOURCE_API);
- fib_table_unlock(import_fib_index1, FIB_PROTOCOL_IP4);
- fib_table_unlock(import_fib_index2, FIB_PROTOCOL_IP4);
+ fib_table_unlock(import_fib_index1, FIB_PROTOCOL_IP4, FIB_SOURCE_CLI);
+ fib_table_unlock(import_fib_index2, FIB_PROTOCOL_IP4, FIB_SOURCE_CLI);
FIB_TEST((0 == adj_nbr_db_size()), "ADJ DB size is %d",
adj_nbr_db_size());
@@ -8168,9 +8173,10 @@ lfib_test (void)
/*
* MPLS enable an interface so we get the MPLS table created
*/
+ mpls_table_create(MPLS_FIB_DEFAULT_TABLE_ID, FIB_SOURCE_API);
mpls_sw_interface_enable_disable(&mpls_main,
tm->hw[0]->sw_if_index,
- 1);
+ 1, 1);
ip46_address_t nh_10_10_10_1 = {
.ip4.as_u32 = clib_host_to_net_u32(0x0a0a0a01),
@@ -8662,7 +8668,8 @@ lfib_test (void)
*/
mpls_sw_interface_enable_disable(&mpls_main,
tm->hw[0]->sw_if_index,
- 0);
+ 0, 1);
+ mpls_table_delete(MPLS_FIB_DEFAULT_TABLE_ID, FIB_SOURCE_API);
FIB_TEST(lb_count == pool_elts(load_balance_pool),
"Load-balance resources freed %d of %d",
diff --git a/src/vnet/fib/ip4_fib.c b/src/vnet/fib/ip4_fib.c
index d563bafda0c..865e2dd5faf 100644
--- a/src/vnet/fib/ip4_fib.c
+++ b/src/vnet/fib/ip4_fib.c
@@ -101,7 +101,8 @@ static const ip4_fib_table_special_prefix_t ip4_specials[] = {
static u32
-ip4_create_fib_with_table_id (u32 table_id)
+ip4_create_fib_with_table_id (u32 table_id,
+ fib_source_t src)
{
fib_table_t *fib_table;
ip4_fib_t *v4_fib;
@@ -128,7 +129,7 @@ ip4_create_fib_with_table_id (u32 table_id)
v4_fib->fwd_classify_table_index = ~0;
v4_fib->rev_classify_table_index = ~0;
- fib_table_lock(fib_table->ft_index, FIB_PROTOCOL_IP4);
+ fib_table_lock(fib_table->ft_index, FIB_PROTOCOL_IP4, src);
ip4_mtrie_init(&v4_fib->mtrie);
@@ -198,23 +199,24 @@ ip4_fib_table_destroy (u32 fib_index)
u32
-ip4_fib_table_find_or_create_and_lock (u32 table_id)
+ip4_fib_table_find_or_create_and_lock (u32 table_id,
+ fib_source_t src)
{
u32 index;
index = ip4_fib_index_from_table_id(table_id);
if (~0 == index)
- return ip4_create_fib_with_table_id(table_id);
+ return ip4_create_fib_with_table_id(table_id, src);
- fib_table_lock(index, FIB_PROTOCOL_IP4);
+ fib_table_lock(index, FIB_PROTOCOL_IP4, src);
return (index);
}
u32
-ip4_fib_table_create_and_lock (void)
+ip4_fib_table_create_and_lock (fib_source_t src)
{
- return (ip4_create_fib_with_table_id(~0));
+ return (ip4_create_fib_with_table_id(~0, src));
}
u32
@@ -525,17 +527,32 @@ ip4_show_fib (vlib_main_t * vm,
pool_foreach (fib_table, im4->fibs,
({
ip4_fib_t *fib = pool_elt_at_index(im4->v4_fibs, fib_table->ft_index);
+ fib_source_t source;
+ u8 *s = NULL;
if (table_id >= 0 && table_id != (int)fib->table_id)
continue;
if (fib_index != ~0 && fib_index != (int)fib->index)
continue;
- vlib_cli_output (vm, "%U, fib_index:%d, flow hash:[%U] locks:%d",
- format_fib_table_name, fib->index, FIB_PROTOCOL_IP4,
- fib->index,
- format_ip_flow_hash_config, fib_table->ft_flow_hash_config,
- fib_table->ft_locks);
+ s = format(s, "%U, fib_index:%d, flow hash:[%U] locks:[",
+ format_fib_table_name, fib->index,
+ FIB_PROTOCOL_IP4,
+ fib->index,
+ format_ip_flow_hash_config,
+ fib_table->ft_flow_hash_config);
+ FOR_EACH_FIB_SOURCE(source)
+ {
+ if (0 != fib_table->ft_locks[source])
+ {
+ s = format(s, "%U:%d, ",
+ format_fib_source, source,
+ fib_table->ft_locks[source]);
+ }
+ }
+ s = format (s, "]");
+ vlib_cli_output (vm, "%V", s);
+ vec_free(s);
/* Show summary? */
if (! verbose)
diff --git a/src/vnet/fib/ip4_fib.h b/src/vnet/fib/ip4_fib.h
index 006163b4d13..495b45ccab4 100644
--- a/src/vnet/fib/ip4_fib.h
+++ b/src/vnet/fib/ip4_fib.h
@@ -127,8 +127,9 @@ ip4_fib_lookup (ip4_main_t * im, u32 sw_if_index, ip4_address_t * dst)
* @returns A pointer to the retrieved or created fib.
*
*/
-extern u32 ip4_fib_table_find_or_create_and_lock(u32 table_id);
-extern u32 ip4_fib_table_create_and_lock(void);
+extern u32 ip4_fib_table_find_or_create_and_lock(u32 table_id,
+ fib_source_t src);
+extern u32 ip4_fib_table_create_and_lock(fib_source_t src);
static inline
diff --git a/src/vnet/fib/ip6_fib.c b/src/vnet/fib/ip6_fib.c
index 8fde6f9f46e..3ddb8453eaa 100644
--- a/src/vnet/fib/ip6_fib.c
+++ b/src/vnet/fib/ip6_fib.c
@@ -50,7 +50,8 @@ vnet_ip6_fib_init (u32 fib_index)
}
static u32
-create_fib_with_table_id (u32 table_id)
+create_fib_with_table_id (u32 table_id,
+ fib_source_t src)
{
fib_table_t *fib_table;
ip6_fib_t *v6_fib;
@@ -77,29 +78,30 @@ create_fib_with_table_id (u32 table_id)
fib_table->ft_flow_hash_config = IP_FLOW_HASH_DEFAULT;
vnet_ip6_fib_init(fib_table->ft_index);
- fib_table_lock(fib_table->ft_index, FIB_PROTOCOL_IP6);
+ fib_table_lock(fib_table->ft_index, FIB_PROTOCOL_IP6, src);
return (fib_table->ft_index);
}
u32
-ip6_fib_table_find_or_create_and_lock (u32 table_id)
+ip6_fib_table_find_or_create_and_lock (u32 table_id,
+ fib_source_t src)
{
uword * p;
p = hash_get (ip6_main.fib_index_by_table_id, table_id);
if (NULL == p)
- return create_fib_with_table_id(table_id);
+ return create_fib_with_table_id(table_id, src);
- fib_table_lock(p[0], FIB_PROTOCOL_IP6);
+ fib_table_lock(p[0], FIB_PROTOCOL_IP6, src);
return (p[0]);
}
u32
-ip6_fib_table_create_and_lock (void)
+ip6_fib_table_create_and_lock (fib_source_t src)
{
- return (create_fib_with_table_id(~0));
+ return (create_fib_with_table_id(~0, src));
}
void
@@ -588,16 +590,33 @@ ip6_show_fib (vlib_main_t * vm,
pool_foreach (fib_table, im6->fibs,
({
+ fib_source_t source;
+ u8 *s = NULL;
+
fib = pool_elt_at_index(im6->v6_fibs, fib_table->ft_index);
if (table_id >= 0 && table_id != (int)fib->table_id)
continue;
if (fib_index != ~0 && fib_index != (int)fib->index)
continue;
- vlib_cli_output (vm, "%s, fib_index:%d, flow hash:[%U] locks:%d",
- fib_table->ft_desc, fib->index,
- format_ip_flow_hash_config, fib_table->ft_flow_hash_config,
- fib_table->ft_locks);
+ s = format(s, "%U, fib_index:%d, flow hash:[%U] locks:[",
+ format_fib_table_name, fib->index,
+ FIB_PROTOCOL_IP6,
+ fib->index,
+ format_ip_flow_hash_config,
+ fib_table->ft_flow_hash_config);
+ FOR_EACH_FIB_SOURCE(source)
+ {
+ if (0 != fib_table->ft_locks[source])
+ {
+ s = format(s, "%U:%d, ",
+ format_fib_source, source,
+ fib_table->ft_locks[source]);
+ }
+ }
+ s = format (s, "]");
+ vlib_cli_output (vm, "%V", s);
+ vec_free(s);
/* Show summary? */
if (! verbose)
diff --git a/src/vnet/fib/ip6_fib.h b/src/vnet/fib/ip6_fib.h
index aad8305c990..9728eecca8b 100644
--- a/src/vnet/fib/ip6_fib.h
+++ b/src/vnet/fib/ip6_fib.h
@@ -144,8 +144,9 @@ ip6_src_lookup_for_packet (ip6_main_t * im,
* \returns A pointer to the retrieved or created fib.
*
*/
-extern u32 ip6_fib_table_find_or_create_and_lock(u32 table_id);
-extern u32 ip6_fib_table_create_and_lock(void);
+extern u32 ip6_fib_table_find_or_create_and_lock(u32 table_id,
+ fib_source_t src);
+extern u32 ip6_fib_table_create_and_lock(fib_source_t src);
static inline ip6_fib_t *
ip6_fib_get (fib_node_index_t index)
diff --git a/src/vnet/fib/mpls_fib.c b/src/vnet/fib/mpls_fib.c
index ca6271fe3d7..4eeef7abb73 100644
--- a/src/vnet/fib/mpls_fib.c
+++ b/src/vnet/fib/mpls_fib.c
@@ -83,7 +83,8 @@ mpls_fib_index_from_table_id (u32 table_id)
}
static u32
-mpls_fib_create_with_table_id (u32 table_id)
+mpls_fib_create_with_table_id (u32 table_id,
+ fib_source_t src)
{
dpo_id_t dpo = DPO_INVALID;
fib_table_t *fib_table;
@@ -107,7 +108,7 @@ mpls_fib_create_with_table_id (u32 table_id)
fib_table->ft_table_id = table_id;
fib_table->ft_flow_hash_config = MPLS_FLOW_HASH_DEFAULT;
- fib_table_lock(fib_table->ft_index, FIB_PROTOCOL_MPLS);
+ fib_table_lock(fib_table->ft_index, FIB_PROTOCOL_MPLS, src);
if (INDEX_INVALID == mpls_fib_drop_dpo_index)
{
@@ -220,22 +221,23 @@ mpls_fib_create_with_table_id (u32 table_id)
}
u32
-mpls_fib_table_find_or_create_and_lock (u32 table_id)
+mpls_fib_table_find_or_create_and_lock (u32 table_id,
+ fib_source_t src)
{
u32 index;
index = mpls_fib_index_from_table_id(table_id);
if (~0 == index)
- return mpls_fib_create_with_table_id(table_id);
+ return mpls_fib_create_with_table_id(table_id, src);
- fib_table_lock(index, FIB_PROTOCOL_MPLS);
+ fib_table_lock(index, FIB_PROTOCOL_MPLS, src);
return (index);
}
u32
-mpls_fib_table_create_and_lock (void)
+mpls_fib_table_create_and_lock (fib_source_t src)
{
- return (mpls_fib_create_with_table_id(~0));
+ return (mpls_fib_create_with_table_id(~0, src));
}
void
diff --git a/src/vnet/fib/mpls_fib.h b/src/vnet/fib/mpls_fib.h
index dfb8b7fc37a..29cd1d20dab 100644
--- a/src/vnet/fib/mpls_fib.h
+++ b/src/vnet/fib/mpls_fib.h
@@ -59,8 +59,9 @@ mpls_fib_get (fib_node_index_t index)
return (pool_elt_at_index(mpls_main.mpls_fibs, index));
}
-extern u32 mpls_fib_table_find_or_create_and_lock(u32 table_id);
-extern u32 mpls_fib_table_create_and_lock(void);
+extern u32 mpls_fib_table_find_or_create_and_lock(u32 table_id,
+ fib_source_t src);
+extern u32 mpls_fib_table_create_and_lock(fib_source_t src);
// extern mpls_fib_t * mpls_fib_find(u32 table_id);
extern u32 mpls_fib_index_from_table_id(u32 table_id);