summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSteven <sluong@cisco.com>2018-03-30 22:18:11 -0700
committersteven luong <sluong@cisco.com>2018-03-31 14:38:12 +0000
commitca33d08caf2400d182705836c1533442a8a13aff (patch)
tree3524cc1a3fb30631fb343d5f94a7360368193106 /src
parent213831192dc3cc8785c98c97482a3ec46df6dd47 (diff)
tapv2: Sporadic SIGABRT in ethernet_input [VPP-1183]
virtio_free_rx_buffers uses the wrong slot in the vring to get the buffer index. It uses desc_next. It should be last_used_idx which is the slot number for the first valid descriptor. Change-Id: I6b62b794f06869fbffffce45430b8b2e37b1266c Signed-off-by: Steven <sluong@cisco.com> (cherry picked from commit 074f698be5c2e6afc9df776b56a366bc3f404d95)
Diffstat (limited to 'src')
-rw-r--r--src/vnet/devices/tap/cli.c5
-rw-r--r--src/vnet/devices/virtio/virtio.c6
2 files changed, 6 insertions, 5 deletions
diff --git a/src/vnet/devices/tap/cli.c b/src/vnet/devices/tap/cli.c
index 7dd525b169d..17e29b8cbe0 100644
--- a/src/vnet/devices/tap/cli.c
+++ b/src/vnet/devices/tap/cli.c
@@ -258,8 +258,9 @@ tap_show_command_fn (vlib_main_t * vm, unformat_input_t * input,
// RX = 0, TX = 1
vring = vec_elt_at_index (vif->vrings, i);
vlib_cli_output (vm, " Virtqueue (%s)", (i & 1) ? "TX" : "RX");
- vlib_cli_output (vm, " qsz %d, last_used_idx %d, desc_in_use %d",
- vring->size, vring->last_used_idx,
+ vlib_cli_output (vm,
+ " qsz %d, last_used_idx %d, desc_next %d, desc_in_use %d",
+ vring->size, vring->last_used_idx, vring->desc_next,
vring->desc_in_use);
vlib_cli_output (vm,
" avail.flags 0x%x avail.idx %d used.flags 0x%x used.idx %d",
diff --git a/src/vnet/devices/virtio/virtio.c b/src/vnet/devices/virtio/virtio.c
index 3867cf03a46..782ede1a525 100644
--- a/src/vnet/devices/virtio/virtio.c
+++ b/src/vnet/devices/virtio/virtio.c
@@ -138,13 +138,13 @@ static_always_inline void
virtio_free_rx_buffers (vlib_main_t * vm, virtio_vring_t * vring)
{
u16 used = vring->desc_in_use;
- u16 next = vring->desc_next;
+ u16 last = vring->last_used_idx;
u16 mask = vring->size - 1;
while (used)
{
- vlib_buffer_free (vm, &vring->buffers[next], 1);
- next = (next + 1) & mask;
+ vlib_buffer_free (vm, &vring->buffers[last & mask], 1);
+ last++;
used--;
}
}