aboutsummaryrefslogtreecommitdiffstats
path: root/src/vlib/buffer_node.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/vlib/buffer_node.h')
-rw-r--r--src/vlib/buffer_node.h35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/vlib/buffer_node.h b/src/vlib/buffer_node.h
index bff7a78cb94..2163b72de5e 100644
--- a/src/vlib/buffer_node.h
+++ b/src/vlib/buffer_node.h
@@ -448,6 +448,41 @@ vlib_buffer_enqueue_to_next (vlib_main_t * vm, vlib_node_runtime_t * node,
vlib_put_next_frame (vm, node, next_index, n_left_to_next);
}
+static_always_inline void
+vlib_buffer_enqueue_to_single_next (vlib_main_t * vm,
+ vlib_node_runtime_t * node, u32 * buffers,
+ u16 next_index, u32 count)
+{
+ u32 *to_next, n_left_to_next, n_enq;
+
+ vlib_get_next_frame (vm, node, next_index, to_next, n_left_to_next);
+
+ if (PREDICT_TRUE (n_left_to_next >= count))
+ {
+ clib_memcpy_fast (to_next, buffers, count * sizeof (u32));
+ n_left_to_next -= count;
+ vlib_put_next_frame (vm, node, next_index, n_left_to_next);
+ return;
+ }
+
+ n_enq = n_left_to_next;
+next:
+ clib_memcpy_fast (to_next, buffers, n_enq * sizeof (u32));
+ n_left_to_next -= n_enq;
+
+ if (PREDICT_FALSE (count > n_enq))
+ {
+ count -= n_enq;
+ buffers += n_enq;
+
+ vlib_put_next_frame (vm, node, next_index, n_left_to_next);
+ vlib_get_next_frame (vm, node, next_index, to_next, n_left_to_next);
+ n_enq = clib_min (n_left_to_next, count);
+ goto next;
+ }
+ vlib_put_next_frame (vm, node, next_index, n_left_to_next);
+}
+
static_always_inline u32
vlib_buffer_enqueue_to_thread (vlib_main_t * vm, u32 frame_queue_index,
u32 * buffer_indices, u16 * thread_indices,