diff options
author | Anlu Yan <ayan@cisco.com> | 2017-02-14 18:07:40 -0800 |
---|---|---|
committer | Damjan Marion <dmarion.lists@gmail.com> | 2017-02-16 15:09:26 +0000 |
commit | a4cb12b30d51be3463315688179297404783fe8d (patch) | |
tree | 66bbe4f2a622e72648f503ba845d142dff97f084 /src/examples/sample-plugin/sample/sample.c | |
parent | b33f413af46ec8dff7f222dbd5bc3bcec1502d3d (diff) |
Fix sample plugin breakage.
Add vat_helper_macros.h to be installed in /usr/include/vlibapi
Define a version for the sample plugin (separate from the VPP versioning).
Hook up vnet_main in plugin init.
Change-Id: I293b9dc824d0813ea2bb8747d535e4210a88b385
Signed-off-by: Anlu Yan <ayan@cisco.com>
Diffstat (limited to 'src/examples/sample-plugin/sample/sample.c')
-rw-r--r-- | src/examples/sample-plugin/sample/sample.c | 27 |
1 files changed, 7 insertions, 20 deletions
diff --git a/src/examples/sample-plugin/sample/sample.c b/src/examples/sample-plugin/sample/sample.c index 603cb2d0ee4..7588dbc0aea 100644 --- a/src/examples/sample-plugin/sample/sample.c +++ b/src/examples/sample-plugin/sample/sample.c @@ -79,26 +79,11 @@ do { \ #define foreach_sample_plugin_api_msg \ _(SAMPLE_MACSWAP_ENABLE_DISABLE, sample_macswap_enable_disable) -/* - * This routine exists to convince the vlib plugin framework that - * we haven't accidentally copied a random .dll into the plugin directory. - * - * Also collects global variable pointers passed from the vpp engine - */ - -clib_error_t * -vlib_plugin_register (vlib_main_t * vm, vnet_plugin_handoff_t * h, - int from_early_init) -{ - sample_main_t * sm = &sample_main; - clib_error_t * error = 0; - - sm->vlib_main = vm; - sm->vnet_main = h->vnet_main; - sm->ethernet_main = h->ethernet_main; - - return error; -} +/* *INDENT-OFF* */ +VLIB_PLUGIN_REGISTER () = { + .version = SAMPLE_PLUGIN_BUILD_VER, +}; +/* *INDENT-ON* */ /* Action function shared between message handler and debug CLI */ @@ -229,6 +214,8 @@ static clib_error_t * sample_init (vlib_main_t * vm) clib_error_t * error = 0; u8 * name; + sm->vnet_main = vnet_get_main (); + name = format (0, "sample_%08x%c", api_version, 0); /* Ask for a correctly-sized block of API message decode slots */ |