aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/memif
diff options
context:
space:
mode:
authorMauro Sardara <msardara@cisco.com>2022-03-14 20:08:22 +0000
committerDamjan Marion <dmarion@me.com>2022-03-15 08:15:21 +0000
commitb0f0f8c8dd9d694bfc13652f89b8b577e9c1c708 (patch)
tree0bbb588659c6250338f25405ef70e17f72b6d61b /src/plugins/memif
parent41a1bbffc6238b0ed52b55f58ba884fe2f26e11f (diff)
memif: fix memif_process_desc indexing
The index i was incremented in the wrong place, and the check on the presence of a next buffer in the chain was actually done for the next desc_status rather than the current one. Type: fix Signed-off-by: Mauro Sardara <msardara@cisco.com> Change-Id: I74a64a34fea497900b7969cd96e1aeeb570a1bba
Diffstat (limited to 'src/plugins/memif')
-rw-r--r--src/plugins/memif/node.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/plugins/memif/node.c b/src/plugins/memif/node.c
index 5bb10fc6eec..ce9f95bc453 100644
--- a/src/plugins/memif/node.c
+++ b/src/plugins/memif/node.c
@@ -247,7 +247,7 @@ memif_process_desc (vlib_main_t *vm, vlib_node_runtime_t *node,
u32 n_buffers = 0;
u32 n_left = ptd->n_packets;
u32 packet_len;
- int i = 0;
+ int i = -1;
/* construct copy and packet vector out of ring slots */
while (n_left)
@@ -261,6 +261,7 @@ memif_process_desc (vlib_main_t *vm, vlib_node_runtime_t *node,
dst_off = start_offset;
next_slot:
+ i++; /* next descriptor */
n_bytes_left = desc_len[i];
packet_len += n_bytes_left;
@@ -287,9 +288,6 @@ memif_process_desc (vlib_main_t *vm, vlib_node_runtime_t *node,
}
while (PREDICT_FALSE (n_bytes_left));
- /* next descriptor */
- i++;
-
if (desc_status[i].next)
{
src_off = 0;