diff options
Diffstat (limited to 'src/plugins/memif/memif.c')
-rw-r--r-- | src/plugins/memif/memif.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/src/plugins/memif/memif.c b/src/plugins/memif/memif.c index aa476be9a98..4ebd9ce8c0e 100644 --- a/src/plugins/memif/memif.c +++ b/src/plugins/memif/memif.c @@ -338,6 +338,7 @@ memif_init_regions_and_queues (memif_if_t * mif) mq->region = 0; mq->offset = (void *) mq->ring - (void *) mif->regions[mq->region].shm; mq->last_head = 0; + mq->type = MEMIF_RING_S2M; } ASSERT (mif->rx_queues == 0); @@ -354,6 +355,7 @@ memif_init_regions_and_queues (memif_if_t * mif) mq->region = 0; mq->offset = (void *) mq->ring - (void *) mif->regions[mq->region].shm; mq->last_head = 0; + mq->type = MEMIF_RING_M2S; } return 0; @@ -483,12 +485,15 @@ memif_delete_if (vlib_main_t * vm, memif_if_t * mif) memif_disconnect (mif, err); clib_error_free (err); - /* remove the interface */ - if (mif->mode == MEMIF_INTERFACE_MODE_IP) - vnet_delete_hw_interface (vnm, mif->hw_if_index); - else - ethernet_delete_interface (vnm, mif->hw_if_index); - mif->hw_if_index = ~0; + if (mif->hw_if_index != ~0) + { + /* remove the interface */ + if (mif->mode == MEMIF_INTERFACE_MODE_IP) + vnet_delete_hw_interface (vnm, mif->hw_if_index); + else + ethernet_delete_interface (vnm, mif->hw_if_index); + mif->hw_if_index = ~0; + } /* free interface data structures */ clib_spinlock_free (&mif->lockp); |