vat: unload unused vat plugins
If the corresponding vpp plugin is absent, return a non-zero
clib_error_t * from vat_plugin_register ("xxx plugin not loaded"). The
vat plugin calls dlclose on the vat plugin, and it disappears.
Depending on the plugin configuration, this can reduce the vpp virtual
size by several gigabytes.
Added a VAT_PLUGIN(<plugin-name>) macro to vat_helper_macros, clean up
boilerplate vat_plugin_register() implementations. Fixed a number of
non-standard vat_plugin_register methods.
Type: refactor
Change-Id: Iac908e5af7d5497c78d6aa9c3c51cdae08374045
Signed-off-by: Dave Barach <dave@barachs.net>
This commit is contained in:
committed by
Florin Coras
parent
3f5ebed6ea
commit
21a438465c
@@ -33,19 +33,19 @@ uword unformat_sw_if_index (unformat_input_t * input, va_list * args);
|
||||
|
||||
/* define message structures */
|
||||
#define vl_typedefs
|
||||
#include <sample/sample_all_api_h.h>
|
||||
#include <sample/sample_all_api_h.h>
|
||||
#undef vl_typedefs
|
||||
|
||||
/* declare message handlers for each api */
|
||||
|
||||
#define vl_endianfun /* define message structures */
|
||||
#include <sample/sample_all_api_h.h>
|
||||
#include <sample/sample_all_api_h.h>
|
||||
#undef vl_endianfun
|
||||
|
||||
/* instantiate all the print functions we know about */
|
||||
#define vl_print(handle, ...)
|
||||
#define vl_printfun
|
||||
#include <sample/sample_all_api_h.h>
|
||||
#include <sample/sample_all_api_h.h>
|
||||
#undef vl_printfun
|
||||
|
||||
/* Get the API version number. */
|
||||
@@ -81,7 +81,7 @@ _(sample_macswap_enable_disable_reply)
|
||||
foreach_standard_reply_retval_handler;
|
||||
#undef _
|
||||
|
||||
/*
|
||||
/*
|
||||
* Table of message reply handlers, must include boilerplate handlers
|
||||
* we just generated
|
||||
*/
|
||||
@@ -108,12 +108,12 @@ static int api_sample_macswap_enable_disable (vat_main_t * vam)
|
||||
else
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
if (sw_if_index == ~0) {
|
||||
errmsg ("missing interface name / explicit sw_if_index number \n");
|
||||
return -99;
|
||||
}
|
||||
|
||||
|
||||
/* Construct the API message */
|
||||
M(SAMPLE_MACSWAP_ENABLE_DISABLE, mp);
|
||||
mp->sw_if_index = ntohl (sw_if_index);
|
||||
@@ -127,7 +127,7 @@ static int api_sample_macswap_enable_disable (vat_main_t * vam)
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
/*
|
||||
* List of messages that the api test plugin sends,
|
||||
* and that the data plane plugin processes
|
||||
*/
|
||||
@@ -145,35 +145,19 @@ static void sample_api_hookup (vat_main_t *vam)
|
||||
vl_noop_handler, \
|
||||
vl_api_##n##_t_endian, \
|
||||
vl_api_##n##_t_print, \
|
||||
sizeof(vl_api_##n##_t), 1);
|
||||
sizeof(vl_api_##n##_t), 1);
|
||||
foreach_vpe_api_reply_msg;
|
||||
#undef _
|
||||
|
||||
/* API messages we can send */
|
||||
#define _(n,h) hash_set_mem (vam->function_by_name, #n, api_##n);
|
||||
foreach_vpe_api_msg;
|
||||
#undef _
|
||||
|
||||
#undef _
|
||||
|
||||
/* Help strings */
|
||||
#define _(n,h) hash_set_mem (vam->help_by_name, #n, h);
|
||||
foreach_vpe_api_msg;
|
||||
#undef _
|
||||
}
|
||||
|
||||
clib_error_t * vat_plugin_register (vat_main_t *vam)
|
||||
{
|
||||
sample_test_main_t * sm = &sample_test_main;
|
||||
u8 * name;
|
||||
|
||||
sm->vat_main = vam;
|
||||
|
||||
name = format (0, "sample_%08x%c", api_version, 0);
|
||||
sm->msg_id_base = vl_client_get_first_plugin_msg_id ((char *) name);
|
||||
|
||||
if (sm->msg_id_base != (u16) ~0)
|
||||
sample_api_hookup (vam);
|
||||
|
||||
vec_free(name);
|
||||
|
||||
return 0;
|
||||
}
|
||||
VAT_PLUGIN_REGISTER(sample);
|
||||
|
||||
@@ -1489,7 +1489,7 @@ _(acl_plugin_get_conn_table_max_entries, "")
|
||||
|
||||
|
||||
static
|
||||
void acl_vat_api_hookup (vat_main_t *vam)
|
||||
void acl_api_hookup (vat_main_t *vam)
|
||||
{
|
||||
acl_test_main_t * sm = &acl_test_main;
|
||||
/* Hook up handlers for replies from the data plane plug-in */
|
||||
@@ -1515,20 +1515,4 @@ void acl_vat_api_hookup (vat_main_t *vam)
|
||||
#undef _
|
||||
}
|
||||
|
||||
clib_error_t * vat_plugin_register (vat_main_t *vam)
|
||||
{
|
||||
acl_test_main_t * sm = &acl_test_main;
|
||||
u8 * name;
|
||||
|
||||
sm->vat_main = vam;
|
||||
|
||||
name = format (0, "acl_%08x%c", api_version, 0);
|
||||
sm->msg_id_base = vl_client_get_first_plugin_msg_id ((char *) name);
|
||||
|
||||
if (sm->msg_id_base != (u16) ~0)
|
||||
acl_vat_api_hookup (vam);
|
||||
|
||||
vec_free(name);
|
||||
|
||||
return 0;
|
||||
}
|
||||
VAT_PLUGIN_REGISTER(acl);
|
||||
|
||||
@@ -202,7 +202,7 @@ _(avf_create, "<pci-address> [rx-queue-size <size>] " \
|
||||
_(avf_delete, "<sw_if_index>")
|
||||
|
||||
static void
|
||||
avf_vat_api_hookup (vat_main_t * vam)
|
||||
avf_api_hookup (vat_main_t * vam)
|
||||
{
|
||||
avf_test_main_t *avm __attribute__ ((unused)) = &avf_test_main;
|
||||
#define _(N,n) \
|
||||
@@ -226,24 +226,7 @@ avf_vat_api_hookup (vat_main_t * vam)
|
||||
#undef _
|
||||
}
|
||||
|
||||
clib_error_t *
|
||||
vat_plugin_register (vat_main_t * vam)
|
||||
{
|
||||
avf_test_main_t *avm = &avf_test_main;
|
||||
u8 *name;
|
||||
|
||||
avm->vat_main = vam;
|
||||
|
||||
name = format (0, "avf_%08x%c", api_version, 0);
|
||||
avm->msg_id_base = vl_client_get_first_plugin_msg_id ((char *) name);
|
||||
|
||||
if (avm->msg_id_base != (u16) ~ 0)
|
||||
avf_vat_api_hookup (vam);
|
||||
|
||||
vec_free (name);
|
||||
|
||||
return 0;
|
||||
}
|
||||
VAT_PLUGIN_REGISTER (avf);
|
||||
|
||||
/*
|
||||
* fd.io coding-style-patch-verification: ON
|
||||
|
||||
@@ -150,25 +150,7 @@ cdp_api_hookup (vat_main_t * vam)
|
||||
#undef _
|
||||
}
|
||||
|
||||
clib_error_t *
|
||||
vat_plugin_register (vat_main_t * vam)
|
||||
{
|
||||
cdp_test_main_t *sm = &cdp_test_main;
|
||||
u8 *name;
|
||||
|
||||
sm->vat_main = vam;
|
||||
|
||||
/* Ask the vpp engine for the first assigned message-id */
|
||||
name = format (0, "cdp_%08x%c", api_version, 0);
|
||||
sm->msg_id_base = vl_client_get_first_plugin_msg_id ((char *) name);
|
||||
|
||||
if (sm->msg_id_base != (u16) ~ 0)
|
||||
cdp_api_hookup (vam);
|
||||
|
||||
vec_free (name);
|
||||
|
||||
return 0;
|
||||
}
|
||||
VAT_PLUGIN_REGISTER (cdp);
|
||||
|
||||
/*
|
||||
* fd.io coding-style-patch-verification: ON
|
||||
|
||||
@@ -173,25 +173,7 @@ ct6_api_hookup (vat_main_t * vam)
|
||||
#undef _
|
||||
}
|
||||
|
||||
clib_error_t *
|
||||
vat_plugin_register (vat_main_t * vam)
|
||||
{
|
||||
ct6_test_main_t *ctmp = &ct6_test_main;
|
||||
u8 *name;
|
||||
|
||||
ctmp->vat_main = vam;
|
||||
|
||||
/* Ask the vpp engine for the first assigned message-id */
|
||||
name = format (0, "ct6_%08x%c", api_version, 0);
|
||||
ctmp->msg_id_base = vl_client_get_first_plugin_msg_id ((char *) name);
|
||||
|
||||
if (ctmp->msg_id_base != (u16) ~ 0)
|
||||
ct6_api_hookup (vam);
|
||||
|
||||
vec_free (name);
|
||||
|
||||
return 0;
|
||||
}
|
||||
VAT_PLUGIN_REGISTER (ct6);
|
||||
|
||||
/*
|
||||
* fd.io coding-style-patch-verification: ON
|
||||
|
||||
@@ -77,7 +77,7 @@ _(sw_interface_set_dpdk_hqos_tctbl_reply)
|
||||
foreach_standard_reply_retval_handler;
|
||||
#undef _
|
||||
|
||||
/*
|
||||
/*
|
||||
* Table of message reply handlers, must include boilerplate handlers
|
||||
* we just generated
|
||||
*/
|
||||
@@ -336,7 +336,7 @@ api_sw_interface_set_dpdk_hqos_tctbl (vat_main_t * vam)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
/*
|
||||
* List of messages that the api test plugin sends,
|
||||
* and that the data plane plugin processes
|
||||
*/
|
||||
@@ -361,36 +361,19 @@ static void dpdk_api_hookup (vat_main_t *vam)
|
||||
vl_noop_handler, \
|
||||
vl_api_##n##_t_endian, \
|
||||
vl_api_##n##_t_print, \
|
||||
sizeof(vl_api_##n##_t), 1);
|
||||
sizeof(vl_api_##n##_t), 1);
|
||||
foreach_vpe_api_reply_msg;
|
||||
#undef _
|
||||
|
||||
/* API messages we can send */
|
||||
#define _(n,h) hash_set_mem (vam->function_by_name, #n, api_##n);
|
||||
foreach_vpe_api_msg;
|
||||
#undef _
|
||||
|
||||
#undef _
|
||||
|
||||
/* Help strings */
|
||||
#define _(n,h) hash_set_mem (vam->help_by_name, #n, h);
|
||||
foreach_vpe_api_msg;
|
||||
#undef _
|
||||
}
|
||||
|
||||
clib_error_t * vat_plugin_register (vat_main_t *vam)
|
||||
{
|
||||
dpdk_test_main_t * dm = &dpdk_test_main;
|
||||
u8 * name;
|
||||
|
||||
dm->vat_main = vam;
|
||||
|
||||
/* Ask the vpp engine for the first assigned message-id */
|
||||
name = format (0, "dpdk_%08x%c", api_version, 0);
|
||||
dm->msg_id_base = vl_client_get_first_plugin_msg_id ((char *) name);
|
||||
|
||||
if (dm->msg_id_base != (u16) ~0)
|
||||
dpdk_api_hookup (vam);
|
||||
|
||||
vec_free(name);
|
||||
|
||||
return 0;
|
||||
}
|
||||
VAT_PLUGIN_REGISTER(dpdk);
|
||||
|
||||
@@ -206,7 +206,7 @@ _(flowprobe_tx_interface_add_del, "<intfc> [disable]") \
|
||||
_(flowprobe_params, "record <[l2] [l3] [l4]> [active <timer> passive <timer>]")
|
||||
|
||||
static void
|
||||
flowprobe_vat_api_hookup (vat_main_t * vam)
|
||||
flowprobe_api_hookup (vat_main_t * vam)
|
||||
{
|
||||
flowprobe_test_main_t *sm = &flowprobe_test_main;
|
||||
/* Hook up handlers for replies from the data plane plug-in */
|
||||
@@ -232,26 +232,7 @@ flowprobe_vat_api_hookup (vat_main_t * vam)
|
||||
#undef _
|
||||
}
|
||||
|
||||
clib_error_t *
|
||||
vat_plugin_register (vat_main_t * vam)
|
||||
{
|
||||
flowprobe_test_main_t *sm = &flowprobe_test_main;
|
||||
u8 *name;
|
||||
|
||||
sm->vat_main = vam;
|
||||
|
||||
/* Ask the vpp engine for the first assigned message-id */
|
||||
name = format (0, "flowprobe_%08x%c", api_version, 0);
|
||||
sm->msg_id_base = vl_client_get_first_plugin_msg_id ((char *) name);
|
||||
|
||||
/* Don't attempt to hook up API messages if the data plane plugin is AWOL */
|
||||
if (sm->msg_id_base != (u16) ~ 0)
|
||||
flowprobe_vat_api_hookup (vam);
|
||||
|
||||
vec_free (name);
|
||||
|
||||
return 0;
|
||||
}
|
||||
VAT_PLUGIN_REGISTER (flowprobe);
|
||||
|
||||
/*
|
||||
* fd.io coding-style-patch-verification: ON
|
||||
|
||||
@@ -450,7 +450,7 @@ _(gtpu_add_del_tunnel, \
|
||||
_(gtpu_tunnel_dump, "[<intfc> | sw_if_index <nn>]") \
|
||||
|
||||
static void
|
||||
gtpu_vat_api_hookup (vat_main_t *vam)
|
||||
gtpu_api_hookup (vat_main_t *vam)
|
||||
{
|
||||
gtpu_test_main_t * gtm = >pu_test_main;
|
||||
/* Hook up handlers for replies from the data plane plug-in */
|
||||
@@ -476,22 +476,4 @@ gtpu_vat_api_hookup (vat_main_t *vam)
|
||||
#undef _
|
||||
}
|
||||
|
||||
clib_error_t * vat_plugin_register (vat_main_t *vam)
|
||||
{
|
||||
gtpu_test_main_t * gtm = >pu_test_main;
|
||||
|
||||
u8 * name;
|
||||
|
||||
gtm->vat_main = vam;
|
||||
|
||||
/* Ask the vpp engine for the first assigned message-id */
|
||||
name = format (0, "gtpu_%08x%c", api_version, 0);
|
||||
gtm->msg_id_base = vl_client_get_first_plugin_msg_id ((char *) name);
|
||||
|
||||
if (gtm->msg_id_base != (u16) ~0)
|
||||
gtpu_vat_api_hookup (vam);
|
||||
|
||||
vec_free(name);
|
||||
|
||||
return 0;
|
||||
}
|
||||
VAT_PLUGIN_REGISTER(gtpu);
|
||||
|
||||
@@ -208,25 +208,7 @@ http_static_api_hookup (vat_main_t * vam)
|
||||
#undef _
|
||||
}
|
||||
|
||||
clib_error_t *
|
||||
vat_plugin_register (vat_main_t * vam)
|
||||
{
|
||||
http_static_test_main_t *htmp = &http_static_test_main;
|
||||
u8 *name;
|
||||
|
||||
htmp->vat_main = vam;
|
||||
|
||||
/* Ask the vpp engine for the first assigned message-id */
|
||||
name = format (0, "http_static_%08x%c", api_version, 0);
|
||||
htmp->msg_id_base = vl_client_get_first_plugin_msg_id ((char *) name);
|
||||
|
||||
if (htmp->msg_id_base != (u16) ~ 0)
|
||||
http_static_api_hookup (vam);
|
||||
|
||||
vec_free (name);
|
||||
|
||||
return 0;
|
||||
}
|
||||
VAT_PLUGIN_REGISTER (http_static);
|
||||
|
||||
/*
|
||||
* fd.io coding-style-patch-verification: ON
|
||||
|
||||
@@ -807,7 +807,7 @@ _(ikev2_initiate_del_child_sa, "<ispi>") \
|
||||
_(ikev2_initiate_rekey_child_sa, "<ispi>")
|
||||
|
||||
static void
|
||||
ikev2_vat_api_hookup (vat_main_t * vam)
|
||||
ikev2_api_hookup (vat_main_t * vam)
|
||||
{
|
||||
ikev2_test_main_t *sm = &ikev2_test_main;
|
||||
/* Hook up handlers for replies from the data plane plug-in */
|
||||
@@ -833,24 +833,7 @@ ikev2_vat_api_hookup (vat_main_t * vam)
|
||||
#undef _
|
||||
}
|
||||
|
||||
clib_error_t *
|
||||
vat_plugin_register (vat_main_t * vam)
|
||||
{
|
||||
ikev2_test_main_t *sm = &ikev2_test_main;
|
||||
u8 *name;
|
||||
|
||||
sm->vat_main = vam;
|
||||
|
||||
name = format (0, "ikev2_%08x%c", api_version, 0);
|
||||
sm->msg_id_base = vl_client_get_first_plugin_msg_id ((char *) name);
|
||||
|
||||
if (sm->msg_id_base != (u16) ~ 0)
|
||||
ikev2_vat_api_hookup (vam);
|
||||
|
||||
vec_free (name);
|
||||
|
||||
return 0;
|
||||
}
|
||||
VAT_PLUGIN_REGISTER (ikev2);
|
||||
|
||||
/*
|
||||
* fd.io coding-style-patch-verification: ON
|
||||
|
||||
@@ -111,7 +111,7 @@ foreach_standard_reply_retval_handler;
|
||||
foreach_custom_reply_retval_handler;
|
||||
#undef _
|
||||
|
||||
/*
|
||||
/*
|
||||
* Table of message reply handlers, must include boilerplate handlers
|
||||
* we just generated
|
||||
*/
|
||||
@@ -167,7 +167,7 @@ static int api_pot_profile_add (vat_main_t *vam)
|
||||
rv = -99;
|
||||
goto OUT;
|
||||
}
|
||||
|
||||
|
||||
M2(POT_PROFILE_ADD, mp, vec_len(name));
|
||||
|
||||
mp->list_name_len = vec_len(name);
|
||||
@@ -187,11 +187,11 @@ static int api_pot_profile_add (vat_main_t *vam)
|
||||
}
|
||||
mp->id = id;
|
||||
mp->max_bits = bits;
|
||||
|
||||
|
||||
S(mp);
|
||||
W (ret);
|
||||
return ret;
|
||||
|
||||
|
||||
OUT:
|
||||
vec_free(name);
|
||||
return(rv);
|
||||
@@ -206,7 +206,7 @@ static int api_pot_profile_activate (vat_main_t *vam)
|
||||
u8 id = 0;
|
||||
int rv = 0;
|
||||
int ret;
|
||||
|
||||
|
||||
while (unformat_check_input(input) != UNFORMAT_END_OF_INPUT)
|
||||
{
|
||||
if (unformat(input, "name %s", &name))
|
||||
@@ -223,17 +223,17 @@ static int api_pot_profile_activate (vat_main_t *vam)
|
||||
rv = -99;
|
||||
goto OUT;
|
||||
}
|
||||
|
||||
|
||||
M2(POT_PROFILE_ACTIVATE, mp, vec_len(name));
|
||||
|
||||
mp->list_name_len = vec_len(name);
|
||||
clib_memcpy(mp->list_name, name, mp->list_name_len);
|
||||
mp->id = id;
|
||||
|
||||
|
||||
S(mp);
|
||||
W (ret);
|
||||
return ret;
|
||||
|
||||
|
||||
OUT:
|
||||
vec_free(name);
|
||||
return(rv);
|
||||
@@ -244,7 +244,7 @@ static int api_pot_profile_del (vat_main_t *vam)
|
||||
{
|
||||
vl_api_pot_profile_del_t *mp;
|
||||
int ret;
|
||||
|
||||
|
||||
M(POT_PROFILE_DEL, mp);
|
||||
mp->list_name_len = 0;
|
||||
S(mp);
|
||||
@@ -274,7 +274,7 @@ static int api_pot_profile_show_config_dump (vat_main_t *vam)
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
/*
|
||||
* List of messages that the api test plugin sends,
|
||||
* and that the data plane plugin processes
|
||||
*/
|
||||
@@ -287,7 +287,7 @@ _(pot_profile_activate, "name <name> id [0-1] ") \
|
||||
_(pot_profile_del, "[id <nn>]") \
|
||||
_(pot_profile_show_config_dump, "id [0-1]")
|
||||
|
||||
static void
|
||||
static void
|
||||
pot_vat_api_hookup (vat_main_t *vam)
|
||||
{
|
||||
pot_test_main_t * sm = &pot_test_main;
|
||||
@@ -299,21 +299,22 @@ pot_vat_api_hookup (vat_main_t *vam)
|
||||
vl_noop_handler, \
|
||||
vl_api_##n##_t_endian, \
|
||||
vl_api_##n##_t_print, \
|
||||
sizeof(vl_api_##n##_t), 1);
|
||||
sizeof(vl_api_##n##_t), 1);
|
||||
foreach_vpe_api_reply_msg;
|
||||
#undef _
|
||||
|
||||
/* API messages we can send */
|
||||
#define _(n,h) hash_set_mem (vam->function_by_name, #n, api_##n);
|
||||
foreach_vpe_api_msg;
|
||||
#undef _
|
||||
|
||||
#undef _
|
||||
|
||||
/* Help strings */
|
||||
#define _(n,h) hash_set_mem (vam->help_by_name, #n, h);
|
||||
foreach_vpe_api_msg;
|
||||
#undef _
|
||||
}
|
||||
|
||||
|
||||
clib_error_t *
|
||||
pot_vat_plugin_register (vat_main_t *vam)
|
||||
{
|
||||
@@ -324,11 +325,12 @@ pot_vat_plugin_register (vat_main_t *vam)
|
||||
|
||||
name = format (0, "ioam_pot_%08x%c", api_version, 0);
|
||||
sm->msg_id_base = vl_client_get_first_plugin_msg_id ((char *) name);
|
||||
vec_free(name);
|
||||
|
||||
if (sm->msg_id_base != (u16) ~0)
|
||||
pot_vat_api_hookup (vam);
|
||||
|
||||
vec_free(name);
|
||||
|
||||
else
|
||||
return clib_error_return (0, "ioam_pot plugin not loaded...");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -206,6 +206,10 @@ vat_plugin_register (vat_main_t * vam)
|
||||
/* Ask the vpp engine for the first assigned message-id */
|
||||
name = format (0, "lacp_%08x%c", api_version, 0);
|
||||
lm->msg_id_base = vl_client_get_first_plugin_msg_id ((char *) name);
|
||||
vec_free (name);
|
||||
|
||||
if (lm->msg_id_base == (u16) ~ 0)
|
||||
return clib_error_return (0, "lacp plugin not loaded...");
|
||||
|
||||
/* Get the control ping ID */
|
||||
#define _(id,n,crc) \
|
||||
@@ -217,8 +221,6 @@ vat_plugin_register (vat_main_t * vam)
|
||||
if (lm->msg_id_base != (u16) ~ 0)
|
||||
lacp_vat_api_hookup (vam);
|
||||
|
||||
vec_free (name);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -349,8 +349,8 @@ _(lb_add_del_vip, "<prefix> " \
|
||||
_(lb_add_del_as, "<vip-prefix> [protocol (tcp|udp) port <n>] " \
|
||||
"[<address>] [del] [flush]")
|
||||
|
||||
static void
|
||||
lb_vat_api_hookup (vat_main_t *vam)
|
||||
static void
|
||||
lb_api_hookup (vat_main_t *vam)
|
||||
{
|
||||
lb_test_main_t * lbtm = &lb_test_main;
|
||||
/* Hook up handlers for replies from the data plane plug-in */
|
||||
@@ -376,22 +376,4 @@ lb_vat_api_hookup (vat_main_t *vam)
|
||||
#undef _
|
||||
}
|
||||
|
||||
clib_error_t * vat_plugin_register (vat_main_t *vam)
|
||||
{
|
||||
lb_test_main_t * lbtm = &lb_test_main;
|
||||
|
||||
u8 * name;
|
||||
|
||||
lbtm->vat_main = vam;
|
||||
|
||||
/* Ask the vpp engine for the first assigned message-id */
|
||||
name = format (0, "lb_%08x%c", api_version, 0);
|
||||
lbtm->msg_id_base = vl_client_get_first_plugin_msg_id ((char *) name);
|
||||
|
||||
if (lbtm->msg_id_base != (u16) ~0)
|
||||
lb_vat_api_hookup (vam);
|
||||
|
||||
vec_free(name);
|
||||
|
||||
return 0;
|
||||
}
|
||||
VAT_PLUGIN_REGISTER(lb);
|
||||
|
||||
@@ -300,25 +300,7 @@ mactime_api_hookup (vat_main_t * vam)
|
||||
#undef _
|
||||
}
|
||||
|
||||
clib_error_t *
|
||||
vat_plugin_register (vat_main_t * vam)
|
||||
{
|
||||
mactime_test_main_t *sm = &mactime_test_main;
|
||||
u8 *name;
|
||||
|
||||
sm->vat_main = vam;
|
||||
|
||||
/* Ask the vpp engine for the first assigned message-id */
|
||||
name = format (0, "mactime_%08x%c", api_version, 0);
|
||||
sm->msg_id_base = vl_client_get_first_plugin_msg_id ((char *) name);
|
||||
|
||||
if (sm->msg_id_base != (u16) ~ 0)
|
||||
mactime_api_hookup (vam);
|
||||
|
||||
vec_free (name);
|
||||
|
||||
return 0;
|
||||
}
|
||||
VAT_PLUGIN_REGISTER (mactime);
|
||||
|
||||
/*
|
||||
* fd.io coding-style-patch-verification: ON
|
||||
|
||||
@@ -482,6 +482,10 @@ vat_plugin_register (vat_main_t * vam)
|
||||
/* Ask the vpp engine for the first assigned message-id */
|
||||
name = format (0, "memif_%08x%c", api_version, 0);
|
||||
mm->msg_id_base = vl_client_get_first_plugin_msg_id ((char *) name);
|
||||
vec_free (name);
|
||||
|
||||
if (mm->msg_id_base == (u16) ~ 0)
|
||||
return clib_error_return (0, "memif plugin not loaded...");
|
||||
|
||||
/* Get the control ping ID */
|
||||
#define _(id,n,crc) \
|
||||
@@ -493,8 +497,6 @@ vat_plugin_register (vat_main_t * vam)
|
||||
if (mm->msg_id_base != (u16) ~ 0)
|
||||
memif_vat_api_hookup (vam);
|
||||
|
||||
vec_free (name);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -1171,11 +1171,12 @@ clib_error_t * vat_plugin_register (vat_main_t *vam)
|
||||
/* Ask the vpp engine for the first assigned message-id */
|
||||
name = format (0, "nat_%08x%c", api_version, 0);
|
||||
sm->msg_id_base = vl_client_get_first_plugin_msg_id ((char *) name);
|
||||
vec_free(name);
|
||||
|
||||
if (sm->msg_id_base != (u16) ~0)
|
||||
snat_vat_api_hookup (vam);
|
||||
|
||||
vec_free(name);
|
||||
else
|
||||
return clib_error_return (0, "nat plugin not loaded...");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -402,11 +402,12 @@ clib_error_t * vat_plugin_register (vat_main_t *vam)
|
||||
/* Ask the vpp engine for the first assigned message-id */
|
||||
name = format (0, "nsh_%08x%c", api_version, 0);
|
||||
sm->msg_id_base = vl_client_get_first_plugin_msg_id ((char *) name);
|
||||
vec_free(name);
|
||||
|
||||
if (sm->msg_id_base != (u16) ~0)
|
||||
nsh_vat_api_hookup (vam);
|
||||
|
||||
vec_free(name);
|
||||
else
|
||||
return clib_error_return (0, "nsh plugin not loaded...");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -306,25 +306,7 @@ nsim_api_hookup (vat_main_t * vam)
|
||||
#undef _
|
||||
}
|
||||
|
||||
clib_error_t *
|
||||
vat_plugin_register (vat_main_t * vam)
|
||||
{
|
||||
nsim_test_main_t *sm = &nsim_test_main;
|
||||
u8 *name;
|
||||
|
||||
sm->vat_main = vam;
|
||||
|
||||
/* Ask the vpp engine for the first assigned message-id */
|
||||
name = format (0, "nsim_%08x%c", api_version, 0);
|
||||
sm->msg_id_base = vl_client_get_first_plugin_msg_id ((char *) name);
|
||||
|
||||
if (sm->msg_id_base != (u16) ~ 0)
|
||||
nsim_api_hookup (vam);
|
||||
|
||||
vec_free (name);
|
||||
|
||||
return 0;
|
||||
}
|
||||
VAT_PLUGIN_REGISTER (nsim);
|
||||
|
||||
/*
|
||||
* fd.io coding-style-patch-verification: ON
|
||||
|
||||
@@ -283,7 +283,7 @@ _(pppoe_add_del_session, \
|
||||
_(pppoe_session_dump, "[<intfc> | sw_if_index <nn>]") \
|
||||
|
||||
static void
|
||||
pppoe_vat_api_hookup (vat_main_t *vam)
|
||||
pppoe_api_hookup (vat_main_t *vam)
|
||||
{
|
||||
pppoe_test_main_t * pem = &pppoe_test_main;
|
||||
/* Hook up handlers for replies from the data plane plug-in */
|
||||
@@ -309,22 +309,4 @@ pppoe_vat_api_hookup (vat_main_t *vam)
|
||||
#undef _
|
||||
}
|
||||
|
||||
clib_error_t * vat_plugin_register (vat_main_t *vam)
|
||||
{
|
||||
pppoe_test_main_t * pem = &pppoe_test_main;
|
||||
|
||||
u8 * name;
|
||||
|
||||
pem->vat_main = vam;
|
||||
|
||||
/* Ask the vpp engine for the first assigned message-id */
|
||||
name = format (0, "pppoe_%08x%c", api_version, 0);
|
||||
pem->msg_id_base = vl_client_get_first_plugin_msg_id ((char *) name);
|
||||
|
||||
if (pem->msg_id_base != (u16) ~0)
|
||||
pppoe_vat_api_hookup (vam);
|
||||
|
||||
vec_free(name);
|
||||
|
||||
return 0;
|
||||
}
|
||||
VAT_PLUGIN_REGISTER(pppoe);
|
||||
|
||||
@@ -154,6 +154,10 @@ vat_plugin_register (vat_main_t * vam)
|
||||
|
||||
name = format (0, "stn_%08x%c", api_version, 0);
|
||||
sm->msg_id_base = vl_client_get_first_plugin_msg_id ((char *) name);
|
||||
vec_free (name);
|
||||
|
||||
if (sm->msg_id_base == (u16) ~ 0)
|
||||
return clib_error_return (0, "stn plugin not loaded...");
|
||||
|
||||
/* Get the control ping ID */
|
||||
#define _(id,n,crc) \
|
||||
@@ -165,8 +169,6 @@ vat_plugin_register (vat_main_t * vam)
|
||||
if (sm->msg_id_base != (u16) ~ 0)
|
||||
stn_vat_api_hookup (vam);
|
||||
|
||||
vec_free (name);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -330,6 +330,10 @@ vat_plugin_register (vat_main_t * vam)
|
||||
|
||||
name = format (0, "vmxnet3_%08x%c", api_version, 0);
|
||||
vxm->msg_id_base = vl_client_get_first_plugin_msg_id ((char *) name);
|
||||
vec_free (name);
|
||||
|
||||
if (vxm->msg_id_base == (u16) ~ 0)
|
||||
return clib_error_return (0, "vmxnet3 plugin not loaded...");
|
||||
|
||||
/* Get the control ping ID */
|
||||
#define _(id,n,crc) \
|
||||
@@ -338,10 +342,7 @@ vat_plugin_register (vat_main_t * vam)
|
||||
#undef _
|
||||
vxm->ping_id = vl_msg_api_get_msg_index ((u8 *) (VL_API_CONTROL_PING_CRC));
|
||||
|
||||
if (vxm->msg_id_base != (u16) ~ 0)
|
||||
vmxnet3_vat_api_hookup (vam);
|
||||
|
||||
vec_free (name);
|
||||
vmxnet3_vat_api_hookup (vam);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -109,5 +109,26 @@ do { \
|
||||
} \
|
||||
} while(0);
|
||||
|
||||
#define VAT_PLUGIN_REGISTER(plug) \
|
||||
clib_error_t * vat_plugin_register (vat_main_t *vam) \
|
||||
{ \
|
||||
plug##_test_main_t * mp = &plug##_test_main; \
|
||||
u8 * name; \
|
||||
\
|
||||
mp->vat_main = vam; \
|
||||
\
|
||||
/* Ask the vpp engine for the first assigned message-id */ \
|
||||
name = format (0, #plug "_%08x%c", api_version, 0); \
|
||||
mp->msg_id_base = \
|
||||
vl_client_get_first_plugin_msg_id ((char *) name); \
|
||||
vec_free(name); \
|
||||
\
|
||||
if (mp->msg_id_base != (u16) ~0) \
|
||||
plug##_api_hookup (vam); \
|
||||
else \
|
||||
return clib_error_return (0, #plug " plugin not loaded...");\
|
||||
return 0; \
|
||||
}
|
||||
|
||||
|
||||
#endif /* __vat_helper_macros_h__ */
|
||||
|
||||
Reference in New Issue
Block a user