summaryrefslogtreecommitdiffstats
path: root/src/plugins/memif
diff options
context:
space:
mode:
authorAndrew Yourtchenko <ayourtch@gmail.com>2019-10-14 10:55:31 +0000
committerDamjan Marion <dmarion@me.com>2019-10-14 22:44:03 +0000
commitddc9eb48e6ef5b60c261d857fb3f574c3fa38f4e (patch)
treec97bb48a9e04bb0252ce4c69dd11e143838a129c /src/plugins/memif
parenta66020becd7d01eefea55244cbcf5df9679a9443 (diff)
memif: Revert "memif buffer leaks during disconnect."
This reverts commit d570c4d18df404cb59ef72d20d56f8e31418c8e9. That commit introduced crash into memif make test-debug. To reproduce: "TEST=memif make test-debug". With this commit reverted the make test-debug for memif passes. Type: fix Change-Id: Ic335359e2050bb8a5d530b01c595b081476fa197 Signed-off-by: Andrew Yourtchenko <ayourtch@gmail.com>
Diffstat (limited to 'src/plugins/memif')
-rw-r--r--src/plugins/memif/memif.c38
1 files changed, 2 insertions, 36 deletions
diff --git a/src/plugins/memif/memif.c b/src/plugins/memif/memif.c
index c216a165d46..c2df8d3b12e 100644
--- a/src/plugins/memif/memif.c
+++ b/src/plugins/memif/memif.c
@@ -70,7 +70,6 @@ memif_disconnect (memif_if_t * mif, clib_error_t * err)
{
memif_main_t *mm = &memif_main;
vnet_main_t *vnm = vnet_get_main ();
- vlib_main_t *vm = vlib_get_main ();
memif_region_t *mr;
memif_queue_t *mq;
int i;
@@ -127,19 +126,7 @@ memif_disconnect (memif_if_t * mif, clib_error_t * err)
memif_log_warn (mif,
"Unable to unassign interface %d, queue %d: rc=%d",
mif->hw_if_index, i, rv);
- if (mif->flags & MEMIF_IF_FLAG_ZERO_COPY)
- {
-
- u16 cur_slot,last_slot, start;
- u16 ring_size = 1 << mq->log2_ring_size;
- u16 mask = ring_size - 1;
- cur_slot = mq->last_tail;
- last_slot = mq->ring->head - 1 ;
- start = (mq->last_tail & mask);
- u16 n_slots = ((last_slot - cur_slot) & mask) + 1;
- vlib_buffer_free_from_ring(vm,mq->buffers,start,ring_size,n_slots);
- }
- mq->ring = 0;
+ mq->ring = 0;
}
}
@@ -149,28 +136,7 @@ memif_disconnect (memif_if_t * mif, clib_error_t * err)
vec_free (mif->rx_queues);
vec_foreach (mq, mif->tx_queues)
- {
- if (mif->flags & MEMIF_IF_FLAG_ZERO_COPY)
- {
- memif_ring_t *ring = mq->ring;
- u16 cur_slot,last_slot, start;
- u16 ring_size = 1 << mq->log2_ring_size;
- u16 mask = ring_size - 1;
- u16 n_slots = ring->tail - mq->last_tail;
- cur_slot = mq->last_tail;
- last_slot = mq->ring->head;
- start = (mq->last_tail & mask);
- if(last_slot > cur_slot)
- n_slots = n_slots + ((last_slot - cur_slot)) ;
- else if (last_slot < cur_slot)
- n_slots = n_slots + (cur_slot - last_slot);
- vlib_buffer_free_from_ring_no_next (vm, mq->buffers,
- start,
- ring_size, n_slots);
- }
- memif_queue_intfd_close (mq);
- }
-
+ memif_queue_intfd_close (mq);
vec_free (mif->tx_queues);
/* free memory regions */