hsa: Add option for multiple ips
[vpp.git] / src / plugins / hs_apps / sapi / vpp_echo_common.c
index a5bdeb4..e7829f3 100644 (file)
@@ -457,6 +457,20 @@ unformat_ip6_address (unformat_input_t * input, va_list * args)
   }
 }
 
+uword
+unformat_ip46_address (unformat_input_t * input, va_list * args)
+{
+  ip46_address_t *ip = va_arg (*args, ip46_address_t *);
+
+  if (unformat (input, "%U", unformat_ip4_address, &ip->ip4))
+    ;
+  else if (unformat (input, "%U", unformat_ip6_address, &ip->ip6))
+    ;
+  else
+    return 0;
+  return 1;
+}
+
 u8 *
 echo_format_crypto_engine (u8 * s, va_list * args)
 {
@@ -517,14 +531,15 @@ echo_session_handle_add_del (echo_main_t * em, u64 handle, u32 sid)
 echo_session_t *
 echo_session_new (echo_main_t * em)
 {
-  /* thread safe new prealloced session */
+  /* thread safe new prealloced session
+   * see echo_session_prealloc */
   return pool_elt_at_index (em->sessions,
                            clib_atomic_fetch_add (&em->nxt_available_sidx,
                                                   1));
 }
 
 int
-echo_send_rpc (echo_main_t * em, void *fp, void *arg, u32 opaque)
+echo_send_rpc (echo_main_t * em, void *fp, echo_rpc_args_t * args)
 {
   svm_msg_q_msg_t msg;
   echo_rpc_msg_t *evt;
@@ -541,9 +556,8 @@ echo_send_rpc (echo_main_t * em, void *fp, void *arg, u32 opaque)
     }
   msg = svm_msg_q_alloc_msg_w_ring (em->rpc_msq_queue, 0);
   evt = (echo_rpc_msg_t *) svm_msg_q_msg_data (em->rpc_msq_queue, &msg);
-  evt->arg = arg;
-  evt->opaque = opaque;
   evt->fp = fp;
+  clib_memcpy (&evt->args, args, sizeof (evt->args));
 
   svm_msg_q_add_and_unlock (em->rpc_msq_queue, &msg);
   return 0;