LISP-GPE: return index of newly created fwd entry, VPP-868

Change-Id: I4fc45097cb994ab6a59503d9fcfb693d1c7ec442
Signed-off-by: Filip Tehlar <ftehlar@cisco.com>
diff --git a/src/vnet/lisp-gpe/lisp_gpe.api b/src/vnet/lisp-gpe/lisp_gpe.api
index 7af1533..706f20d 100644
--- a/src/vnet/lisp-gpe/lisp_gpe.api
+++ b/src/vnet/lisp-gpe/lisp_gpe.api
@@ -43,7 +43,7 @@
     @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 @@
   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 d86a225..f040564 100644
--- a/src/vnet/lisp-gpe/lisp_gpe.h
+++ b/src/vnet/lisp-gpe/lisp_gpe.h
@@ -221,6 +221,9 @@
 /** */
 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 e2c055b..ab081b3 100644
--- a/src/vnet/lisp-gpe/lisp_gpe_api.c
+++ b/src/vnet/lisp-gpe/lisp_gpe_api.c
@@ -358,7 +358,12 @@
   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 c898b9f..c1fea80 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 @@
 
   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 @@
 
   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 @@
 
   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 :