summaryrefslogtreecommitdiffstats
path: root/src/vlib
diff options
context:
space:
mode:
authorDamjan Marion <damarion@cisco.com>2019-02-21 20:24:54 +0100
committerDamjan Marion <damarion@cisco.com>2019-02-22 11:31:43 +0100
commitc41559afe58d37b5a544767b99c45ade3aaf5f58 (patch)
treec2f0e6d854c0d9c612bba95312e31603cf516014 /src/vlib
parentdc2a250f0616a3d853982b46597133780715bf57 (diff)
Add no-append flag to vlib_frame_t
Change-Id: I01c4f5755d579282773ac227b0bc24f8ddbb2bd1 Signed-off-by: Damjan Marion <damarion@cisco.com>
Diffstat (limited to 'src/vlib')
-rw-r--r--src/vlib/main.c10
-rw-r--r--src/vlib/node.h3
-rw-r--r--src/vlib/node_funcs.h6
3 files changed, 15 insertions, 4 deletions
diff --git a/src/vlib/main.c b/src/vlib/main.c
index ae78c430134..049d80d9d17 100644
--- a/src/vlib/main.c
+++ b/src/vlib/main.c
@@ -233,7 +233,7 @@ vlib_frame_free (vlib_main_t * vm, vlib_node_runtime_t * r, vlib_frame_t * f)
ASSERT (nf->frame_index != frame_index);
}
- f->frame_flags &= ~VLIB_FRAME_IS_ALLOCATED;
+ f->frame_flags &= ~(VLIB_FRAME_IS_ALLOCATED | VLIB_FRAME_NO_APPEND);
vec_add1 (fs->free_frame_indices, frame_index);
ASSERT (fs->n_alloc_frames > 0);
@@ -387,9 +387,11 @@ vlib_get_next_frame_internal (vlib_main_t * vm,
f->flags = 0;
}
- /* Allocate new frame if current one is already full. */
+ /* Allocate new frame if current one is marked as no-append or
+ it is already full. */
n_used = f->n_vectors;
- if (n_used >= VLIB_FRAME_SIZE || (allocate_new_next_frame && n_used > 0))
+ if (n_used >= VLIB_FRAME_SIZE || (allocate_new_next_frame && n_used > 0) ||
+ (f->frame_flags & VLIB_FRAME_NO_APPEND))
{
/* Old frame may need to be freed after dispatch, since we'll have
two redundant frames from node -> next node. */
@@ -1347,7 +1349,7 @@ dispatch_pending_node (vlib_main_t * vm, uword pending_frame_index,
VLIB_NODE_STATE_POLLING,
f, last_time_stamp);
- f->frame_flags &= ~VLIB_FRAME_PENDING;
+ f->frame_flags &= ~(VLIB_FRAME_PENDING | VLIB_FRAME_NO_APPEND);
/* Frame is ready to be used again, so restore it. */
if (restore_frame_index != ~0)
diff --git a/src/vlib/node.h b/src/vlib/node.h
index f41eb60aa2c..a4ab0e34d1c 100644
--- a/src/vlib/node.h
+++ b/src/vlib/node.h
@@ -438,6 +438,9 @@ typedef struct
#define VLIB_FRAME_NO_FREE_AFTER_DISPATCH \
VLIB_NODE_FLAG_FRAME_NO_FREE_AFTER_DISPATCH
+ /* Don't append this frame */
+#define VLIB_FRAME_NO_APPEND (1 << 14)
+
/* This next frame owns enqueue to node
corresponding to node_runtime_index. */
#define VLIB_FRAME_OWNER (1 << 15)
diff --git a/src/vlib/node_funcs.h b/src/vlib/node_funcs.h
index 777746a0f78..bf11a0eb6d4 100644
--- a/src/vlib/node_funcs.h
+++ b/src/vlib/node_funcs.h
@@ -242,6 +242,12 @@ vlib_get_frame (vlib_main_t * vm, uword frame_index)
return f;
}
+always_inline void
+vlib_frame_no_append (vlib_frame_t * f)
+{
+ f->frame_flags |= VLIB_FRAME_NO_APPEND;
+}
+
always_inline u32
vlib_frame_index (vlib_main_t * vm, vlib_frame_t * f)
{