diff options
-rw-r--r-- | src/plugins/memif/device.c | 16 | ||||
-rw-r--r-- | src/plugins/memif/memif.c | 20 | ||||
-rw-r--r-- | src/plugins/memif/private.h | 3 |
3 files changed, 23 insertions, 16 deletions
diff --git a/src/plugins/memif/device.c b/src/plugins/memif/device.c index aa79f884eef..9debf2be204 100644 --- a/src/plugins/memif/device.c +++ b/src/plugins/memif/device.c @@ -475,22 +475,6 @@ memif_interface_rx_mode_change (vnet_main_t * vnm, u32 hw_if_index, u32 qid, } static clib_error_t * -memif_interface_admin_up_down (vnet_main_t * vnm, u32 hw_if_index, u32 flags) -{ - memif_main_t *mm = &memif_main; - vnet_hw_interface_t *hw = vnet_get_hw_interface (vnm, hw_if_index); - memif_if_t *mif = pool_elt_at_index (mm->interfaces, hw->dev_instance); - static clib_error_t *error = 0; - - if (flags & VNET_SW_INTERFACE_FLAG_ADMIN_UP) - mif->flags |= MEMIF_IF_FLAG_ADMIN_UP; - else - mif->flags &= ~MEMIF_IF_FLAG_ADMIN_UP; - - return error; -} - -static clib_error_t * memif_subif_add_del_function (vnet_main_t * vnm, u32 hw_if_index, struct vnet_sw_interface_t *st, int is_add) diff --git a/src/plugins/memif/memif.c b/src/plugins/memif/memif.c index bf09509266f..7f228832344 100644 --- a/src/plugins/memif/memif.c +++ b/src/plugins/memif/memif.c @@ -551,6 +551,8 @@ memif_process (vlib_main_t * vm, vlib_node_runtime_t * rt, vlib_frame_t * f) case MEMIF_PROCESS_EVENT_STOP: enabled = 0; continue; + case MEMIF_PROCESS_EVENT_ADMIN_UP_DOWN: + break; default: ASSERT (0); } @@ -1079,6 +1081,24 @@ done: return rv; } +clib_error_t * +memif_interface_admin_up_down (vnet_main_t *vnm, u32 hw_if_index, u32 flags) +{ + memif_main_t *mm = &memif_main; + vnet_hw_interface_t *hw = vnet_get_hw_interface (vnm, hw_if_index); + memif_if_t *mif = pool_elt_at_index (mm->interfaces, hw->dev_instance); + static clib_error_t *error = 0; + + if (flags & VNET_SW_INTERFACE_FLAG_ADMIN_UP) + mif->flags |= MEMIF_IF_FLAG_ADMIN_UP; + else + mif->flags &= ~MEMIF_IF_FLAG_ADMIN_UP; + + vlib_process_signal_event (vnm->vlib_main, memif_process_node.index, + MEMIF_PROCESS_EVENT_ADMIN_UP_DOWN, 0); + return error; +} + static clib_error_t * memif_init (vlib_main_t * vm) { diff --git a/src/plugins/memif/private.h b/src/plugins/memif/private.h index 187888d5b95..daa96d0f412 100644 --- a/src/plugins/memif/private.h +++ b/src/plugins/memif/private.h @@ -259,6 +259,7 @@ typedef enum { MEMIF_PROCESS_EVENT_START = 1, MEMIF_PROCESS_EVENT_STOP = 2, + MEMIF_PROCESS_EVENT_ADMIN_UP_DOWN = 3, } memif_process_event_t; typedef struct @@ -285,6 +286,8 @@ int memif_socket_filename_add_del (u8 is_add, u32 sock_id, int memif_create_if (vlib_main_t * vm, memif_create_if_args_t * args); int memif_delete_if (vlib_main_t * vm, memif_if_t * mif); clib_error_t *memif_plugin_api_hookup (vlib_main_t * vm); +clib_error_t *memif_interface_admin_up_down (vnet_main_t *vnm, u32 hw_if_index, + u32 flags); static_always_inline void * memif_get_buffer (memif_if_t * mif, memif_ring_t * ring, u16 slot) |