#ifndef included_vlib_buffer_node_h
#define included_vlib_buffer_node_h
+/** \file
+ vlib buffer/node functions
+*/
+
+/** \brief Finish enqueueing two buffers forward in the graph.
+ Standard dual loop boilerplate element. This is a MACRO,
+ with MULTIPLE SIDE EFFECTS. In the ideal case,
+ <code>next_index == next0 == next1</code>,
+ which means that the speculative enqueue at the top of the dual loop
+ has correctly dealt with both packets. In that case, the macro does
+ nothing at all.
+
+ @param vm vlib_main_t pointer, varies by thread
+ @param node current node vlib_node_runtime_t pointer
+ @param next_index speculated next index used for both packets
+ @param to_next speculated vector pointer used for both packets
+ @param n_left_to_next number of slots left in speculated vector
+ @param bi0 first buffer index
+ @param bi1 second buffer index
+ @param next0 actual next index to be used for the first packet
+ @param next1 actual next index to be used for the second packet
+
+ @return @c next_index -- speculative next index to be used for future packets
+ @return @c to_next -- speculative frame to be used for future packets
+ @return @c n_left_to_next -- number of slots left in speculative frame
+*/
+
#define vlib_validate_buffer_enqueue_x2(vm,node,next_index,to_next,n_left_to_next,bi0,bi1,next0,next1) \
do { \
int enqueue_code = (next0 != next_index) + 2*(next1 != next_index); \
} \
} while (0)
+/** \brief Finish enqueueing one buffer forward in the graph.
+ Standard single loop boilerplate element. This is a MACRO,
+ with MULTIPLE SIDE EFFECTS. In the ideal case,
+ <code>next_index == next0</code>,
+ which means that the speculative enqueue at the top of the single loop
+ has correctly dealt with the packet in hand. In that case, the macro does
+ nothing at all.
+
+ @param vm vlib_main_t pointer, varies by thread
+ @param node current node vlib_node_runtime_t pointer
+ @param next_index speculated next index used for both packets
+ @param to_next speculated vector pointer used for both packets
+ @param n_left_to_next number of slots left in speculated vector
+ @param bi0 first buffer index
+ @param next0 actual next index to be used for the first packet
+
+ @return @c next_index -- speculative next index to be used for future packets
+ @return @c to_next -- speculative frame to be used for future packets
+ @return @c n_left_to_next -- number of slots left in speculative frame
+*/
#define vlib_validate_buffer_enqueue_x1(vm,node,next_index,to_next,n_left_to_next,bi0,next0) \
do { \
if (PREDICT_FALSE (next0 != next_index)) \
vlib_node_runtime_t * node,
vlib_frame_t * frame,
uword sizeof_trace,
- void * opaque1,
+ void *opaque1,
uword opaque2,
- void (* two_buffers) (vlib_main_t * vm,
- void * opaque1,
- uword opaque2,
- vlib_buffer_t * b0, vlib_buffer_t * b1,
- u32 * next0, u32 * next1),
- void (* one_buffer) (vlib_main_t * vm,
- void * opaque1,
+ void (*two_buffers) (vlib_main_t * vm,
+ void *opaque1,
uword opaque2,
vlib_buffer_t * b0,
- u32 * next0))
+ vlib_buffer_t * b1,
+ u32 * next0, u32 * next1),
+ void (*one_buffer) (vlib_main_t * vm,
+ void *opaque1, uword opaque2,
+ vlib_buffer_t * b0,
+ u32 * next0))
{
- u32 n_left_from, * from, * to_next;
+ u32 n_left_from, *from, *to_next;
u32 next_index;
from = vlib_frame_vector_args (frame);
{
u32 n_left_to_next;
- vlib_get_next_frame (vm, node, next_index,
- to_next, n_left_to_next);
+ vlib_get_next_frame (vm, node, next_index, to_next, n_left_to_next);
while (n_left_from >= 4 && n_left_to_next >= 2)
{
- vlib_buffer_t * p0, * p1;
+ vlib_buffer_t *p0, *p1;
u32 pi0, next0;
u32 pi1, next1;
/* Prefetch next iteration. */
{
- vlib_buffer_t * p2, * p3;
+ vlib_buffer_t *p2, *p3;
p2 = vlib_get_buffer (vm, from[2]);
p3 = vlib_get_buffer (vm, from[3]);
to_next, n_left_to_next,
pi0, pi1, next0, next1);
}
-
+
while (n_left_from > 0 && n_left_to_next > 0)
{
- vlib_buffer_t * p0;
+ vlib_buffer_t *p0;
u32 pi0, next0;
pi0 = from[0];
}
#endif /* included_vlib_buffer_node_h */
+
+/*
+ * fd.io coding-style-patch-verification: ON
+ *
+ * Local Variables:
+ * eval: (c-set-style "gnu")
+ * End:
+ */