summaryrefslogtreecommitdiffstats
path: root/src/vnet
diff options
context:
space:
mode:
authorFilip Tehlar <ftehlar@cisco.com>2021-06-21 12:11:28 +0000
committerOle Tr�an <otroan@employees.org>2021-06-21 16:29:24 +0000
commit83e5a116ec731bfa89d97d8b4abebcc9b7fc3b6a (patch)
tree28d1f7fb74e07cab92a84ecb8e6fb8ac0b2efcd8 /src/vnet
parent53dea2792b55bc2bc1b29a7a1b7169023acae406 (diff)
pg: api cleanup
Use autogenerated code. Does not change API definitions. Type: improvement Signed-off-by: Filip Tehlar <ftehlar@cisco.com> Change-Id: Idf0c24c9c8f8f3c267285c6a231c9c1a364a902a
Diffstat (limited to 'src/vnet')
-rw-r--r--src/vnet/pg/pg.h2
-rw-r--r--src/vnet/pg/pg_api.c57
-rw-r--r--src/vnet/vnet_all_api_h.h1
3 files changed, 10 insertions, 50 deletions
diff --git a/src/vnet/pg/pg.h b/src/vnet/pg/pg.h
index ffa2f8a82f4..963d23a8e01 100644
--- a/src/vnet/pg/pg.h
+++ b/src/vnet/pg/pg.h
@@ -356,6 +356,8 @@ typedef struct pg_main_t
/* Per VLIB node information. */
pg_node_t *nodes;
+
+ u16 msg_id_base;
} pg_main_t;
/* Global main structure. */
diff --git a/src/vnet/pg/pg_api.c b/src/vnet/pg/pg_api.c
index b3eb315e807..468c88ee8bb 100644
--- a/src/vnet/pg/pg_api.c
+++ b/src/vnet/pg/pg_api.c
@@ -19,35 +19,15 @@
#include <vnet/vnet.h>
#include <vlibmemory/api.h>
-
#include <vnet/pg/pg.h>
-#include <vnet/vnet_msg_enum.h>
-
-#define vl_typedefs /* define message structures */
-#include <vnet/vnet_all_api_h.h>
-#undef vl_typedefs
-
-#define vl_endianfun /* define message structures */
-#include <vnet/vnet_all_api_h.h>
-#undef vl_endianfun
-
-/* instantiate all the print functions we know about */
-#define vl_print(handle, ...) vlib_cli_output (handle, __VA_ARGS__)
-#define vl_printfun
-#include <vnet/vnet_all_api_h.h>
-#undef vl_printfun
+#include <vnet/format_fns.h>
+#include <vnet/pg/pg.api_enum.h>
+#include <vnet/pg/pg.api_types.h>
+#define REPLY_MSG_ID_BASE pg->msg_id_base
#include <vlibapi/api_helper_macros.h>
-#define foreach_pg_api_msg \
- _ (PG_CREATE_INTERFACE, pg_create_interface) \
- _ (PG_CREATE_INTERFACE_V2, pg_create_interface_v2) \
- _ (PG_CAPTURE, pg_capture) \
- _ (PG_ENABLE_DISABLE, pg_enable_disable) \
- _ (PG_INTERFACE_ENABLE_DISABLE_COALESCE, \
- pg_interface_enable_disable_coalesce)
-
static void
vl_api_pg_create_interface_t_handler (vl_api_pg_create_interface_t * mp)
{
@@ -122,6 +102,7 @@ static void
static void
vl_api_pg_capture_t_handler (vl_api_pg_capture_t * mp)
{
+ pg_main_t *pg = &pg_main;
vl_api_pg_capture_reply_t *rmp;
int rv = 0;
@@ -187,37 +168,15 @@ vl_api_pg_enable_disable_t_handler (vl_api_pg_enable_disable_t * mp)
REPLY_MACRO (VL_API_PG_ENABLE_DISABLE_REPLY);
}
-#define vl_msg_name_crc_list
-#include <vnet/pg/pg.api.h>
-#undef vl_msg_name_crc_list
-
-static void
-setup_message_id_table (api_main_t * am)
-{
-#define _(id,n,crc) vl_msg_api_add_msg_name_crc (am, #n "_" #crc, id);
- foreach_vl_msg_name_crc_pg;
-#undef _
-}
-
+#include <vnet/pg/pg.api.c>
static clib_error_t *
pg_api_hookup (vlib_main_t * vm)
{
- api_main_t *am = vlibapi_get_main ();
-
-#define _(N,n) \
- vl_msg_api_set_handlers(VL_API_##N, #n, \
- vl_api_##n##_t_handler, \
- vl_noop_handler, \
- vl_api_##n##_t_endian, \
- vl_api_##n##_t_print, \
- sizeof(vl_api_##n##_t), 1);
- foreach_pg_api_msg;
-#undef _
-
+ pg_main_t *pg = &pg_main;
/*
* Set up the (msg_name, crc, message-id) table
*/
- setup_message_id_table (am);
+ pg->msg_id_base = setup_message_id_table ();
return 0;
}
diff --git a/src/vnet/vnet_all_api_h.h b/src/vnet/vnet_all_api_h.h
index 47e22795cbf..113b9dd3ded 100644
--- a/src/vnet/vnet_all_api_h.h
+++ b/src/vnet/vnet_all_api_h.h
@@ -52,7 +52,6 @@
#include <vnet/tcp/tcp.api.h>
#include <vnet/udp/udp.api.h>
#include <vnet/ip/punt.api.h>
-#include <vnet/pg/pg.api.h>
#include <vnet/feature/feature.api.h>
#include <vnet/qos/qos.api.h>
#include <vnet/devices/pipe/pipe.api.h>