From 560274d042d12f31aceabff6a293cdf71429552d Mon Sep 17 00:00:00 2001 From: Filip Tehlar Date: Mon, 5 Jun 2017 13:40:13 +0200 Subject: LISP-GPE: return index of newly created fwd entry, VPP-868 Change-Id: I4fc45097cb994ab6a59503d9fcfb693d1c7ec442 Signed-off-by: Filip Tehlar --- src/vnet/lisp-gpe/lisp_gpe.api | 9 ++++++++- src/vnet/lisp-gpe/lisp_gpe.h | 3 +++ src/vnet/lisp-gpe/lisp_gpe_api.c | 7 ++++++- src/vnet/lisp-gpe/lisp_gpe_fwd_entry.c | 3 +++ 4 files changed, 20 insertions(+), 2 deletions(-) (limited to 'src/vnet/lisp-gpe') diff --git a/src/vnet/lisp-gpe/lisp_gpe.api b/src/vnet/lisp-gpe/lisp_gpe.api index 7af153355b7..706f20d4585 100644 --- a/src/vnet/lisp-gpe/lisp_gpe.api +++ b/src/vnet/lisp-gpe/lisp_gpe.api @@ -43,7 +43,7 @@ typeonly manual_print manual_endian define gpe_locator @param loc_num - number of locators @param locs - array of remote locators */ -autoreply manual_print manual_endian define gpe_add_del_fwd_entry +manual_print manual_endian define gpe_add_del_fwd_entry { u32 client_index; u32 context; @@ -60,6 +60,13 @@ autoreply manual_print manual_endian define gpe_add_del_fwd_entry vl_api_gpe_locator_t locs[loc_num]; }; +define gpe_add_del_fwd_entry_reply +{ + i32 retval; + u32 context; + u32 fwd_entry_index; +}; + /** \brief enable or disable gpe protocol @param client_index - opaque cookie to identify the sender @param context - sender context, to match reply w/ request diff --git a/src/vnet/lisp-gpe/lisp_gpe.h b/src/vnet/lisp-gpe/lisp_gpe.h index d86a225f5f8..f0405644b11 100644 --- a/src/vnet/lisp-gpe/lisp_gpe.h +++ b/src/vnet/lisp-gpe/lisp_gpe.h @@ -221,6 +221,9 @@ typedef enum /** */ typedef struct { + /** forwarding entry index of */ + u32 fwd_entry_index; + u8 is_src_dst; u8 is_add; diff --git a/src/vnet/lisp-gpe/lisp_gpe_api.c b/src/vnet/lisp-gpe/lisp_gpe_api.c index e2c055bafaf..ab081b350d1 100644 --- a/src/vnet/lisp-gpe/lisp_gpe_api.c +++ b/src/vnet/lisp-gpe/lisp_gpe_api.c @@ -358,7 +358,12 @@ vl_api_gpe_add_del_fwd_entry_t_handler (vl_api_gpe_add_del_fwd_entry_t * mp) rv = vnet_lisp_gpe_add_del_fwd_entry (a, 0); vec_free (pairs); send_reply: - REPLY_MACRO (VL_API_GPE_ADD_DEL_FWD_ENTRY_REPLY); + /* *INDENT-OFF* */ + REPLY_MACRO2 (VL_API_GPE_ADD_DEL_FWD_ENTRY_REPLY, + { + rmp->fwd_entry_index = clib_host_to_net_u32 (a->fwd_entry_index); + }); + /* *INDENT-ON* */ } static void diff --git a/src/vnet/lisp-gpe/lisp_gpe_fwd_entry.c b/src/vnet/lisp-gpe/lisp_gpe_fwd_entry.c index c898b9f7c31..c1fea804c56 100644 --- a/src/vnet/lisp-gpe/lisp_gpe_fwd_entry.c +++ b/src/vnet/lisp-gpe/lisp_gpe_fwd_entry.c @@ -478,6 +478,7 @@ add_ip_fwd_entry (lisp_gpe_main_t * lgm, hash_set_mem (lgm->lisp_gpe_fwd_entries, lfe->key, lfe - lgm->lisp_fwd_entry_pool); + a->fwd_entry_index = lfe - lgm->lisp_fwd_entry_pool; fproto = (IP4 == ip_prefix_version (&fid_addr_ippref (&lfe->key->rmt)) ? FIB_PROTOCOL_IP4 : FIB_PROTOCOL_IP6); @@ -791,6 +792,7 @@ add_l2_fwd_entry (lisp_gpe_main_t * lgm, hash_set_mem (lgm->lisp_gpe_fwd_entries, lfe->key, lfe - lgm->lisp_fwd_entry_pool); + a->fwd_entry_index = lfe - lgm->lisp_fwd_entry_pool; lfe->type = (a->is_negative ? LISP_GPE_FWD_ENTRY_TYPE_NEGATIVE : @@ -1064,6 +1066,7 @@ add_nsh_fwd_entry (lisp_gpe_main_t * lgm, hash_set_mem (lgm->lisp_gpe_fwd_entries, lfe->key, lfe - lgm->lisp_fwd_entry_pool); + a->fwd_entry_index = lfe - lgm->lisp_fwd_entry_pool; lfe->type = (a->is_negative ? LISP_GPE_FWD_ENTRY_TYPE_NEGATIVE : -- cgit 1.2.3-korg