summaryrefslogtreecommitdiffstats
path: root/src/vnet/mpls/mpls_api.c
diff options
context:
space:
mode:
authorNeale Ranns <nranns@cisco.com>2017-03-28 03:49:52 -0700
committerDamjan Marion <dmarion.lists@gmail.com>2017-04-01 16:48:31 +0000
commita3af337e06a79f7d1dacf42a319f241c907122fc (patch)
tree7f236558a16cf37298d57556ed8fa905a19b934b /src/vnet/mpls/mpls_api.c
parent8db1de83ec540e01bb0577b726770bbb2338edcb (diff)
MTRIE Optimisations 2
1) 16-8-8 stride. Reduce trie depth walk traded with increased memory in the top PLY. 2) separate the vector of protocol-independent (PI) fib_table_t with the vector of protocol dependent (PD) FIBs. PD FIBs are large structures, we don't want to burn the memory for ech PD type 3) Go straight to the PD FIB in the data-path thus avoiding an indirection through, e.g., a PLY pool. Change-Id: I800d1ed0b2049040d5da95213f3ed6b12bdd78b7 Signed-off-by: Neale Ranns <nranns@cisco.com>
Diffstat (limited to 'src/vnet/mpls/mpls_api.c')
-rw-r--r--src/vnet/mpls/mpls_api.c38
1 files changed, 28 insertions, 10 deletions
diff --git a/src/vnet/mpls/mpls_api.c b/src/vnet/mpls/mpls_api.c
index a36a504608f..f1aef6c92c6 100644
--- a/src/vnet/mpls/mpls_api.c
+++ b/src/vnet/mpls/mpls_api.c
@@ -26,6 +26,7 @@
#include <vnet/mpls/mpls_tunnel.h>
#include <vnet/fib/fib_table.h>
#include <vnet/fib/fib_api.h>
+#include <vnet/fib/mpls_fib.h>
#include <vnet/vnet_msg_enum.h>
@@ -369,6 +370,21 @@ send_mpls_fib_details (vpe_api_main_t * am,
vl_msg_api_send_shmem (q, (u8 *) & mp);
}
+typedef struct vl_api_mpls_fib_dump_table_walk_ctx_t_
+{
+ fib_node_index_t *lfeis;
+} vl_api_mpls_fib_dump_table_walk_ctx_t;
+
+static int
+vl_api_mpls_fib_dump_table_walk (fib_node_index_t fei, void *arg)
+{
+ vl_api_mpls_fib_dump_table_walk_ctx_t *ctx = arg;
+
+ vec_add1 (ctx->lfeis, fei);
+
+ return (1);
+}
+
static void
vl_api_mpls_fib_dump_t_handler (vl_api_mpls_fib_dump_t * mp)
{
@@ -376,28 +392,30 @@ vl_api_mpls_fib_dump_t_handler (vl_api_mpls_fib_dump_t * mp)
unix_shared_memory_queue_t *q;
mpls_main_t *mm = &mpls_main;
fib_table_t *fib_table;
- fib_node_index_t lfei, *lfeip, *lfeis = NULL;
- mpls_label_t key;
+ mpls_fib_t *mpls_fib;
+ fib_node_index_t *lfeip = NULL;
fib_prefix_t pfx;
u32 fib_index;
fib_route_path_encode_t *api_rpaths;
+ vl_api_mpls_fib_dump_table_walk_ctx_t ctx = {
+ .lfeis = NULL,
+ };
q = vl_api_client_index_to_input_queue (mp->client_index);
if (q == 0)
return;
/* *INDENT-OFF* */
- pool_foreach (fib_table, mm->fibs,
+ pool_foreach (mpls_fib, mm->mpls_fibs,
({
- hash_foreach(key, lfei, fib_table->mpls.mf_entries,
- ({
- vec_add1(lfeis, lfei);
- }));
+ mpls_fib_table_walk (mpls_fib,
+ vl_api_mpls_fib_dump_table_walk,
+ &ctx);
}));
/* *INDENT-ON* */
- vec_sort_with_function (lfeis, fib_entry_cmp_for_sort);
+ vec_sort_with_function (ctx.lfeis, fib_entry_cmp_for_sort);
- vec_foreach (lfeip, lfeis)
+ vec_foreach (lfeip, ctx.lfeis)
{
fib_entry_get_prefix (*lfeip, &pfx);
fib_index = fib_entry_get_fib_index (*lfeip);
@@ -410,7 +428,7 @@ vl_api_mpls_fib_dump_t_handler (vl_api_mpls_fib_dump_t * mp)
vec_free (api_rpaths);
}
- vec_free (lfeis);
+ vec_free (ctx.lfeis);
}
/*