X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=plugins%2Fsample-plugin%2Fsample%2Fsample.c;h=321b66c0fb1b73da13751ac4ffdcf7eb1a143118;hb=b7e2f3d312927f2a8f1b2c8030b2e8ffe3288bab;hp=155c845a332fbb001eabfe38e3b5ec7160758428;hpb=3a4ed3934585eb841fa36f6f062adf4dce9b4661;p=vpp.git diff --git a/plugins/sample-plugin/sample/sample.c b/plugins/sample-plugin/sample/sample.c index 155c845a332..321b66c0fb1 100644 --- a/plugins/sample-plugin/sample/sample.c +++ b/plugins/sample-plugin/sample/sample.c @@ -106,8 +106,7 @@ int sample_macswap_enable_disable (sample_main_t * sm, u32 sw_if_index, int enable_disable) { vnet_sw_interface_t * sw; - int rv; - u32 node_index = enable_disable ? sample_node.index : ~0; + int rv = 0; /* Utterly wrong? */ if (pool_is_free_index (sm->vnet_main->interface_main.sw_interfaces, @@ -119,15 +118,9 @@ int sample_macswap_enable_disable (sample_main_t * sm, u32 sw_if_index, if (sw->type != VNET_SW_INTERFACE_TYPE_HARDWARE) return VNET_API_ERROR_INVALID_SW_IF_INDEX; - /* - * Redirect pkts from the driver to the macswap node. - * Returns VNET_API_ERROR_UNIMPLEMENTED if the h/w driver - * doesn't implement the API. - * - * Node_index = ~0 => shut off redirection - */ - rv = vnet_hw_interface_rx_redirect_to_node (sm->vnet_main, sw_if_index, - node_index); + vnet_feature_enable_disable ("device-input", "sample", + sw_if_index, enable_disable, 0, 0); + return rv; } @@ -238,4 +231,9 @@ static clib_error_t * sample_init (vlib_main_t * vm) VLIB_INIT_FUNCTION (sample_init); - +VNET_FEATURE_INIT (sample, static) = +{ + .arc_name = "device-input", + .node_name = "sample", + .runs_before = VNET_FEATURES ("ethernet-input"), +};