summaryrefslogtreecommitdiffstats
path: root/src/vnet/mpls/mpls_api.c
diff options
context:
space:
mode:
authorNeale Ranns <neale.ranns@cisco.com>2018-07-30 08:04:40 -0700
committerNeale Ranns <neale.ranns@cisco.com>2018-07-30 08:04:40 -0700
commitc5d4317ad0425d01893dbb4afad9f16c2cde077d (patch)
tree2bbb6b86a5bf9f051cacc5065a6b6c58be7cbcb6 /src/vnet/mpls/mpls_api.c
parent1f895c9a40f446ca9f1b7803f350c70ebb3ad0fa (diff)
FIB: return entry prefix by const reference to avoid the copy
Change-Id: I09b8406168df4b6b28df3ede24ee839681be0195 Signed-off-by: Neale Ranns <neale.ranns@cisco.com>
Diffstat (limited to 'src/vnet/mpls/mpls_api.c')
-rw-r--r--src/vnet/mpls/mpls_api.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/src/vnet/mpls/mpls_api.c b/src/vnet/mpls/mpls_api.c
index 9f5100a7f83..a35e94d3411 100644
--- a/src/vnet/mpls/mpls_api.c
+++ b/src/vnet/mpls/mpls_api.c
@@ -460,7 +460,7 @@ static void
send_mpls_fib_details (vpe_api_main_t * am,
vl_api_registration_t * reg,
const fib_table_t * table,
- u32 label, u32 eos,
+ const fib_prefix_t * pfx,
fib_route_path_encode_t * api_rpaths, u32 context)
{
vl_api_mpls_fib_details_t *mp;
@@ -479,8 +479,8 @@ send_mpls_fib_details (vpe_api_main_t * am,
mp->table_id = htonl (table->ft_table_id);
memcpy (mp->table_name, table->ft_desc,
clib_min (vec_len (table->ft_desc), sizeof (mp->table_name)));
- mp->eos_bit = eos;
- mp->label = htonl (label);
+ mp->eos_bit = pfx->fp_eos;
+ mp->label = htonl (pfx->fp_label);
mp->count = htonl (path_count);
fp = mp->path;
@@ -517,7 +517,7 @@ vl_api_mpls_fib_dump_t_handler (vl_api_mpls_fib_dump_t * mp)
fib_table_t *fib_table;
mpls_fib_t *mpls_fib;
fib_node_index_t *lfeip = NULL;
- fib_prefix_t pfx;
+ const fib_prefix_t *pfx;
u32 fib_index;
fib_route_path_encode_t *api_rpaths;
vl_api_mpls_fib_dump_table_walk_ctx_t ctx = {
@@ -540,14 +540,12 @@ vl_api_mpls_fib_dump_t_handler (vl_api_mpls_fib_dump_t * mp)
vec_foreach (lfeip, ctx.lfeis)
{
- fib_entry_get_prefix (*lfeip, &pfx);
+ pfx = fib_entry_get_prefix (*lfeip);
fib_index = fib_entry_get_fib_index (*lfeip);
- fib_table = fib_table_get (fib_index, pfx.fp_proto);
+ fib_table = fib_table_get (fib_index, pfx->fp_proto);
api_rpaths = NULL;
fib_entry_encode (*lfeip, &api_rpaths);
- send_mpls_fib_details (am, reg,
- fib_table, pfx.fp_label,
- pfx.fp_eos, api_rpaths, mp->context);
+ send_mpls_fib_details (am, reg, fib_table, pfx, api_rpaths, mp->context);
vec_free (api_rpaths);
}