misc: api move continued 32/33732/10
authorFlorin Coras <fcoras@cisco.com>
Wed, 15 Sep 2021 16:02:08 +0000 (09:02 -0700)
committerOle Tr�an <otroan@employees.org>
Mon, 27 Sep 2021 08:01:44 +0000 (08:01 +0000)
Move control ping and change dependencies from vpe.api_types to
memclnt.api_types

Type: refactor

Signed-off-by: Florin Coras <fcoras@cisco.com>
Change-Id: I9f8bc442e28738c48d64d1f6794082c8c4f5725b

27 files changed:
src/plugins/arping/arping_test.c
src/plugins/geneve/geneve_test.c
src/plugins/ikev2/ikev2_test.c
src/plugins/l2tp/l2tp_test.c
src/plugins/lacp/lacp_test.c
src/plugins/lisp/lisp-cp/lisp_cp_test.c
src/plugins/lisp/lisp-cp/one_test.c
src/plugins/lisp/lisp-gpe/lisp_gpe_test.c
src/plugins/memif/memif_test.c
src/plugins/stn/stn_test.c
src/plugins/tracedump/graph_test.c
src/plugins/vmxnet3/vmxnet3_test.c
src/plugins/vrrp/vrrp_test.c
src/tools/vppapigen/vppapigen_c.py
src/vat/api_format.c
src/vat2/vat2_helpers.h
src/vlibmemory/vlib.api
src/vlibmemory/vlib_api.c
src/vlibmemory/vlibapi_test.c
src/vnet/arp/arp_test.c
src/vnet/ip/ip_test.c
src/vnet/ip6-nd/ip6_nd_test.c
src/vpp-api/client/test.c
src/vpp-api/vapi/vapi.c
src/vpp-api/vapi/vapi_c_gen.py
src/vpp/api/api.c
src/vpp/api/vpe.api

index 9001b70..ac4349d 100644 (file)
 
 #define __plugin_msg_base arping_test_main.msg_id_base
 #include <vlibapi/vat_helper_macros.h>
+#include <vlibmemory/vlib.api_types.h>
 
 /* declare message IDs */
 #include <vnet/format_fns.h>
 #include <arping/arping.api_enum.h>
 #include <arping/arping.api_types.h>
-#include <vpp/api/vpe.api_types.h>
 #include <vnet/ip/ip_types_api.h>
 
 typedef struct
index ad6d329..2eb3821 100644 (file)
@@ -26,7 +26,7 @@
 #include <vnet/format_fns.h>
 #include <geneve/geneve.api_enum.h>
 #include <geneve/geneve.api_types.h>
-#include <vpp/api/vpe.api_types.h>
+#include <vlibmemory/vlib.api_types.h>
 
 typedef struct
 {
index b63778e..9f57281 100644 (file)
@@ -32,7 +32,7 @@
 #include <vnet/format_fns.h>
 #include <ikev2/ikev2.api_enum.h>
 #include <ikev2/ikev2.api_types.h>
-#include <vpp/api/vpe.api_types.h>
+#include <vlibmemory/vlib.api_types.h>
 
 #define vl_endianfun           /* define message structures */
 #include <plugins/ikev2/ikev2.api.h>
index 87abf5d..fef6121 100644 (file)
@@ -26,7 +26,7 @@
 /* define message IDs */
 #include <l2tp/l2tp.api_enum.h>
 #include <l2tp/l2tp.api_types.h>
-#include <vpp/api/vpe.api_types.h>
+#include <vlibmemory/vlib.api_types.h>
 
 typedef struct
 {
index 3a5e635..e507852 100644 (file)
@@ -31,7 +31,7 @@
 #include <vnet/format_fns.h>
 #include <lacp/lacp.api_enum.h>
 #include <lacp/lacp.api_types.h>
-#include <vpp/api/vpe.api_types.h>
+#include <vlibmemory/vlib.api_types.h>
 
 typedef struct
 {
index c0284d3..0ab4180 100644 (file)
@@ -26,7 +26,7 @@
 /* define message IDs */
 #include <lisp/lisp-cp/lisp.api_enum.h>
 #include <lisp/lisp-cp/lisp.api_types.h>
-#include <vpp/api/vpe.api_types.h>
+#include <vlibmemory/vlib.api_types.h>
 
 typedef struct
 {
index 6966122..7ca1f31 100644 (file)
@@ -26,7 +26,7 @@
 /* define message IDs */
 #include <lisp/lisp-cp/one.api_enum.h>
 #include <lisp/lisp-cp/one.api_types.h>
-#include <vpp/api/vpe.api_types.h>
+#include <vlibmemory/vlib.api_types.h>
 
 typedef struct
 {
index 54f7713..6f40e64 100644 (file)
@@ -26,7 +26,7 @@
 /* define message IDs */
 #include <lisp/lisp-gpe/lisp_gpe.api_enum.h>
 #include <lisp/lisp-gpe/lisp_gpe.api_types.h>
-#include <vpp/api/vpe.api_types.h>
+#include <vlibmemory/vlib.api_types.h>
 
 typedef struct
 {
index 1ec6703..98c9354 100644 (file)
@@ -33,8 +33,7 @@
 #include <vnet/format_fns.h>
 #include <memif/memif.api_enum.h>
 #include <memif/memif.api_types.h>
-#include <vpp/api/vpe.api_types.h>
-//#include <vnet/ethernet/ethernet_types.api_types.h>
+#include <vlibmemory/vlib.api_types.h>
 
 typedef struct
 {
index c7514cf..2499ba7 100644 (file)
@@ -23,9 +23,9 @@
 #include <vlibapi/vat_helper_macros.h>
 
 /* Declare message IDs */
-#include <vpp/api/vpe.api_types.h>
 #include <stn/stn.api_enum.h>
 #include <stn/stn.api_types.h>
+#include <vlibmemory/vlib.api_types.h>
 
 typedef struct
 {
index 79e1df6..37dfbcd 100644 (file)
@@ -27,7 +27,7 @@
 #include <vnet/format_fns.h>
 #include <tracedump/graph.api_enum.h>
 #include <tracedump/graph.api_types.h>
-#include <vpp/api/vpe.api_types.h>
+#include <vlibmemory/vlib.api_types.h>
 
 typedef struct
 {
index 6fa9373..9b73c09 100644 (file)
@@ -34,7 +34,7 @@
 /* declare message IDs */
 #include <vmxnet3/vmxnet3.api_enum.h>
 #include <vmxnet3/vmxnet3.api_types.h>
-#include <vpp/api/vpe.api_types.h>
+#include <vlibmemory/vlib.api_types.h>
 
 typedef struct
 {
index 199f541..194e6ad 100644 (file)
@@ -19,8 +19,7 @@ uword unformat_sw_if_index (unformat_input_t * input, va_list * args);
 #include <vnet/format_fns.h>
 #include <vrrp/vrrp.api_enum.h>
 #include <vrrp/vrrp.api_types.h>
-#include <vpp/api/vpe.api_types.h>
-
+#include <vlibmemory/vlib.api_types.h>
 
 typedef struct
 {
index 2d526c1..db684ad 100644 (file)
@@ -1682,8 +1682,8 @@ def generate_c_test2_boilerplate(services, defines, module, stream):
 
 #define vl_typedefs             /* define message structures */
 #include <vlibmemory/vl_memory_api_h.h>
-#include <vpp/api/vpe_types.api.h>
-#include <vpp/api/vpe.api.h>
+#include <vlibmemory/vlib.api_types.h>
+#include <vlibmemory/vlib.api.h>
 #undef vl_typedefs
 
 #include "{module}.api_enum.h"
index 8f23d77..33e5a27 100644 (file)
@@ -620,49 +620,6 @@ static void vl_api_show_version_reply_t_handler_json
 #define vl_api_bridge_domain_details_t_endian vl_noop_handler
 #define vl_api_bridge_domain_details_t_print vl_noop_handler
 
-static void vl_api_control_ping_reply_t_handler
-  (vl_api_control_ping_reply_t * mp)
-{
-  vat_main_t *vam = &vat_main;
-  i32 retval = ntohl (mp->retval);
-  if (vam->async_mode)
-    {
-      vam->async_errors += (retval < 0);
-    }
-  else
-    {
-      vam->retval = retval;
-      vam->result_ready = 1;
-    }
-  if (vam->socket_client_main)
-    vam->socket_client_main->control_pings_outstanding--;
-}
-
-static void vl_api_control_ping_reply_t_handler_json
-  (vl_api_control_ping_reply_t * mp)
-{
-  vat_main_t *vam = &vat_main;
-  i32 retval = ntohl (mp->retval);
-
-  if (VAT_JSON_NONE != vam->json_tree.type)
-    {
-      vat_json_print (vam->ofp, &vam->json_tree);
-      vat_json_free (&vam->json_tree);
-      vam->json_tree.type = VAT_JSON_NONE;
-    }
-  else
-    {
-      /* just print [] */
-      vat_json_init_array (&vam->json_tree);
-      vat_json_print (vam->ofp, &vam->json_tree);
-      vam->json_tree.type = VAT_JSON_NONE;
-    }
-
-  vam->retval = retval;
-  vam->result_ready = 1;
-}
-
-
 static void vl_api_get_first_msg_id_reply_t_handler
   (vl_api_get_first_msg_id_reply_t * mp)
 {
@@ -778,7 +735,6 @@ foreach_standard_reply_retval_handler;
 
 #define foreach_vpe_api_reply_msg                                             \
   _ (GET_FIRST_MSG_ID_REPLY, get_first_msg_id_reply)                          \
-  _ (CONTROL_PING_REPLY, control_ping_reply)                                  \
   _ (SHOW_VERSION_REPLY, show_version_reply)                                  \
 
 #define foreach_standalone_reply_msg                                   \
index 929c012..beb2a78 100644 (file)
 #ifndef included_vat2_helpers_h
 #define included_vat2_helpers_h
 
+#include <vlibmemory/vlib.api_types.h>
+
 /* For control ping */
 #define vl_endianfun
-#include <vpp/api/vpe.api.h>
+#include <vlibmemory/vlib.api.h>
 #undef vl_endianfun
 
 static inline void
index 5e8ba47..c017fc7 100644 (file)
@@ -243,6 +243,30 @@ define get_f64_increment_by_one_reply
   f64 f64_value;
 };
 
+/** \brief Control ping from client to api server request
+    @param client_index - opaque cookie to identify the sender
+    @param context - sender context, to match reply w/ request
+*/
+define control_ping
+{
+  u32 client_index;
+  u32 context;
+};
+
+/** \brief Control ping from the client to the server response
+    @param client_index - opaque cookie to identify the sender
+    @param context - sender context, to match reply w/ request
+    @param retval - return code for the request
+    @param vpe_pid - the pid of the vpe, returned by the server
+*/
+define control_ping_reply
+{
+  u32 context;
+  i32 retval;
+  u32 client_index;
+  u32 vpe_pid;
+};
+
 /*
  * Local Variables:
  * eval: (c-set-style "gnu")
index e5d77eb..0d94446 100644 (file)
@@ -329,6 +329,16 @@ vl_api_get_f64_increment_by_one_t_handler (
                }));
 }
 
+static void
+vl_api_control_ping_t_handler (vl_api_control_ping_t *mp)
+{
+  vl_api_control_ping_reply_t *rmp;
+  int rv = 0;
+
+  REPLY_MACRO2 (VL_API_CONTROL_PING_REPLY,
+               ({ rmp->vpe_pid = ntohl (getpid ()); }));
+}
+
 #include <vlibmemory/vlib.api.c>
 static clib_error_t *
 vlib_apis_hookup (vlib_main_t *vm)
@@ -341,6 +351,8 @@ vlib_apis_hookup (vlib_main_t *vm)
   msg_id_base = setup_message_id_table ();
 
   am->is_mp_safe[VL_API_GET_NODE_GRAPH] = 1;
+  am->is_mp_safe[VL_API_CONTROL_PING] = 1;
+  am->is_mp_safe[VL_API_CONTROL_PING_REPLY] = 1;
 
   return 0;
 }
index 820096a..c91cd79 100644 (file)
@@ -449,6 +449,31 @@ api_get_node_graph (vat_main_t *vam)
   return ret;
 }
 
+static void
+vl_api_control_ping_reply_t_handler (vl_api_control_ping_reply_t *mp)
+{
+  vat_main_t *vam = &vat_main;
+  i32 retval = ntohl (mp->retval);
+  if (vam->async_mode)
+    {
+      vam->async_errors += (retval < 0);
+    }
+  else
+    {
+      vam->retval = retval;
+      vam->result_ready = 1;
+    }
+  if (vam->socket_client_main)
+    vam->socket_client_main->control_pings_outstanding--;
+}
+
+static int
+api_control_ping (vat_main_t *vam)
+{
+  // not yet implemented
+  return -1;
+}
+
 #define VL_API_LOCAL_SETUP_MESSAGE_ID_TABLE local_setup_message_id_table
 static void
 local_setup_message_id_table (vat_main_t *vam)
index b92fa06..9eaea91 100644 (file)
@@ -43,7 +43,7 @@ uword unformat_sw_if_index (unformat_input_t * input, va_list * args);
 /* Declare message IDs */
 #include <vnet/arp/arp.api_enum.h>
 #include <vnet/arp/arp.api_types.h>
-#include <vpp/api/vpe.api_types.h>
+#include <vlibmemory/vlib.api_types.h>
 
 static int
 api_proxy_arp_dump (vat_main_t * vam)
index 81a84c1..3ba38d3 100644 (file)
@@ -30,6 +30,7 @@
 #include <vnet/format_fns.h>
 #include <vnet/ip/ip.api_enum.h>
 #include <vnet/ip/ip.api_types.h>
+#include <vlibmemory/vlib.api_types.h>
 
 #define vl_endianfun /* define message structures */
 #include <vnet/ip/ip.api.h>
index 99f869a..933029d 100644 (file)
@@ -25,7 +25,7 @@
 /* define message IDs */
 #include <ip6-nd/ip6_nd.api_enum.h>
 #include <ip6-nd/ip6_nd.api_types.h>
-#include <vpp/api/vpe.api_types.h>
+#include <vlibmemory/vlib.api_types.h>
 
 typedef struct
 {
index 9bfed99..4e98dc0 100644 (file)
@@ -37,6 +37,9 @@
 #include "vppapiclient.h"
 #include "stat_client.h"
 
+#include <vlibmemory/vlib.api_enum.h>
+#include <vlibmemory/vlib.api_types.h>
+
 #define vl_typedefs             /* define message structures */
 #include <vpp/api/vpe_all_api_h.h> 
 #undef vl_typedefs
index ec87e7b..1bd8e5b 100644 (file)
@@ -31,6 +31,7 @@
 #include <vlibapi/api_common.h>
 #include <vlibmemory/memory_client.h>
 
+#include <vapi/vlib.api.vapi.h>
 #include <vapi/memclnt.api.vapi.h>
 
 /* we need to use control pings for some stuff and because we're forced to put
@@ -40,7 +41,7 @@ vapi_msg_id_t vapi_msg_id_control_ping = 0;
 vapi_msg_id_t vapi_msg_id_control_ping_reply = 0;
 
 DEFINE_VAPI_MSG_IDS_MEMCLNT_API_JSON;
-DEFINE_VAPI_MSG_IDS_VPE_API_JSON;
+DEFINE_VAPI_MSG_IDS_VLIB_API_JSON;
 
 struct
 {
index f0a284c..eacfab4 100755 (executable)
@@ -705,12 +705,12 @@ def gen_json_unified_header(parser, logger, j, io, name):
     print("#ifdef __cplusplus")
     print("extern \"C\" {")
     print("#endif")
-    if name == "vpe.api.vapi.h":
+    if name == "vlib.api.vapi.h":
         print("")
         print("static inline vapi_error_e vapi_send_with_control_ping "
               "(vapi_ctx_t ctx, void * msg, u32 context);")
     else:
-        print("#include <vapi/vpe.api.vapi.h>")
+        print("#include <vapi/vlib.api.vapi.h>")
     print("")
     for m in parser.messages_by_json[j].values():
         print("extern vapi_msg_id_t %s;" % m.get_msg_id_name())
@@ -737,7 +737,7 @@ def gen_json_unified_header(parser, logger, j, io, name):
 
     print("")
 
-    if name == "vpe.api.vapi.h":
+    if name == "vlib.api.vapi.h":
         print("%s" % vapi_send_with_control_ping)
         print("")
 
index 5477ec9..70dfd1f 100644 (file)
@@ -77,7 +77,6 @@
 #include <vlibapi/api_helper_macros.h>
 
 #define foreach_vpe_api_msg                                                   \
-  _ (CONTROL_PING, control_ping)                                              \
   _ (SHOW_VERSION, show_version)                                              \
   _ (SHOW_VPE_SYSTEM_TIME, show_vpe_system_time)                              \
   _ (LOG_DUMP, log_dump)
@@ -115,20 +114,6 @@ memclnt_delete_callback (u32 client_index)
 
 VL_MSG_API_REAPER_FUNCTION (memclnt_delete_callback);
 
-static void
-vl_api_control_ping_t_handler (vl_api_control_ping_t * mp)
-{
-  vl_api_control_ping_reply_t *rmp;
-  int rv = 0;
-
-  /* *INDENT-OFF* */
-  REPLY_MACRO2(VL_API_CONTROL_PING_REPLY,
-  ({
-    rmp->vpe_pid = ntohl (getpid());
-  }));
-  /* *INDENT-ON* */
-}
-
 static void
 vl_api_show_version_t_handler (vl_api_show_version_t * mp)
 {
@@ -293,8 +278,6 @@ vpe_api_hookup (vlib_main_t * vm)
   /*
    * Thread-safe API messages
    */
-  am->is_mp_safe[VL_API_CONTROL_PING] = 1;
-  am->is_mp_safe[VL_API_CONTROL_PING_REPLY] = 1;
   am->is_mp_safe[VL_API_IP_ROUTE_ADD_DEL] = 1;
 
   /*
index 3c4c021..5976f3d 100644 (file)
@@ -53,30 +53,6 @@ import "vpp/api/vpe_types.api";
  * flow APIs: see .../vnet/vnet/flow/{flow.api, flow_api.c}
  */
 
-/** \brief Control ping from client to api server request
-    @param client_index - opaque cookie to identify the sender
-    @param context - sender context, to match reply w/ request
-*/
-define control_ping
-{
-  u32 client_index;
-  u32 context;
-};
-
-/** \brief Control ping from the client to the server response
-    @param client_index - opaque cookie to identify the sender
-    @param context - sender context, to match reply w/ request
-    @param retval - return code for the request
-    @param vpe_pid - the pid of the vpe, returned by the server
-*/
-define control_ping_reply
-{
-  u32 context;
-  i32 retval;
-  u32 client_index;
-  u32 vpe_pid;
-};
-
 /** \brief show version
     @param client_index - opaque cookie to identify the sender
     @param context - sender context, to match reply w/ request