summaryrefslogtreecommitdiffstats
path: root/src/plugins/memif/memif.c
diff options
context:
space:
mode:
authorChun Li <chunl2@cisco.com>2018-02-06 15:17:20 +0800
committerDamjan Marion <dmarion.lists@gmail.com>2018-02-09 09:08:01 +0000
commit15e598c76e815786dea8e964db7b6de35a2fc4ca (patch)
treef0e11fc2a5c66732d18f08c3a26ddad844ac4aa2 /src/plugins/memif/memif.c
parent08118f00e113424ca8ae22d83c766b14297a15f8 (diff)
memif: fix crash caused by zero pkt len in memif and clear dirty cache while interface reconnect.
Change-Id: Ifc7eb2494a22c334d8899422545fca1a4bba4d05 Signed-off-by: Chun Li <chunl2@cisco.com>
Diffstat (limited to 'src/plugins/memif/memif.c')
-rw-r--r--src/plugins/memif/memif.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/src/plugins/memif/memif.c b/src/plugins/memif/memif.c
index 7267ef2e000..d630f2a6182 100644
--- a/src/plugins/memif/memif.c
+++ b/src/plugins/memif/memif.c
@@ -341,6 +341,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);
@@ -357,6 +358,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;
@@ -592,12 +594,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);