summaryrefslogtreecommitdiffstats
path: root/src/plugins/memif/device.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/memif/device.c')
-rw-r--r--src/plugins/memif/device.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/plugins/memif/device.c b/src/plugins/memif/device.c
index 4faeb0554f3..70bdb48ba9c 100644
--- a/src/plugins/memif/device.c
+++ b/src/plugins/memif/device.c
@@ -193,7 +193,7 @@ memif_interface_tx_inline (vlib_main_t * vm, vlib_node_runtime_t * node,
CLIB_MEMORY_STORE_BARRIER ();
ring->head = head;
- clib_spinlock_unlock (&mif->lockp);
+ clib_spinlock_unlock_if_init (&mif->lockp);
if (n_left)
{
@@ -255,9 +255,11 @@ static clib_error_t *
memif_interface_admin_up_down (vnet_main_t * vnm, u32 hw_if_index, u32 flags)
{
memif_main_t *apm = &memif_main;
- memif_msg_t msg;
+ vlib_main_t *vm = vlib_get_main ();
+ memif_msg_t msg = { 0 };
vnet_hw_interface_t *hw = vnet_get_hw_interface (vnm, hw_if_index);
memif_if_t *mif = pool_elt_at_index (apm->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;
@@ -269,11 +271,17 @@ memif_interface_admin_up_down (vnet_main_t * vnm, u32 hw_if_index, u32 flags)
{
msg.version = MEMIF_VERSION;
msg.type = MEMIF_MSG_TYPE_DISCONNECT;
- send (mif->connection.fd, &msg, sizeof (msg), 0);
+ if (send (mif->connection.fd, &msg, sizeof (msg), 0) < 0)
+ {
+ clib_unix_warning ("Failed to send disconnect request");
+ error = clib_error_return_unix (0, "send fd %d",
+ mif->connection.fd);
+ memif_disconnect (vm, mif);
+ }
}
}
- return 0;
+ return error;
}
static clib_error_t *