diff options
author | Steven Luong <sluong@cisco.com> | 2019-11-20 07:37:28 -0800 |
---|---|---|
committer | Steven Luong <sluong@cisco.com> | 2019-11-20 07:37:28 -0800 |
commit | ac0e98a67553747b823d8398896559bb07cafe3d (patch) | |
tree | c8a451e1fb6f9ded081831978ba9cfbcde464cd6 /src/vlib/node.h | |
parent | 187ddfb653aa24246f30851715b9439972a1c3ba (diff) |
vlib: convert frame_index into real pointers
The fast path almost always has to deal with the real
pointers. Deriving the frame pointer from a frame_index requires a
load of the 32bit frame_index from memory, another 64bit load of the
heap base pointer and some calculations.
Lets store the full pointer instead and do a single 64bit load only.
This helps avoiding problems when the heap is grown and frames are
allocated below vm->heap_aligned_base.
Type: refactor
Signed-off-by: Steven Luong <sluong@cisco.com>
Change-Id: I616fe3fbe501c4e2205cd74840eb95c550603508
Diffstat (limited to 'src/vlib/node.h')
-rw-r--r-- | src/vlib/node.h | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/vlib/node.h b/src/vlib/node.h index a4ab0e34d1c..011709b9705 100644 --- a/src/vlib/node.h +++ b/src/vlib/node.h @@ -425,8 +425,8 @@ typedef struct vlib_frame_t typedef struct { - /* Frame index. */ - u32 frame_index; + /* Frame pointer. */ + vlib_frame_t *frame; /* Node runtime for this next. */ u32 node_runtime_index; @@ -465,7 +465,6 @@ always_inline void vlib_next_frame_init (vlib_next_frame_t * nf) { clib_memset (nf, 0, sizeof (nf[0])); - nf->frame_index = ~0; nf->node_runtime_index = ~0; } @@ -476,7 +475,7 @@ typedef struct u32 node_runtime_index; /* Frame index (in the heap). */ - u32 frame_index; + vlib_frame_t *frame; /* Start of next frames for this node. */ u32 next_frame_index; @@ -561,8 +560,8 @@ typedef struct /* Number of allocated frames for this scalar/vector size. */ u32 n_alloc_frames; - /* Vector of free frame indices for this scalar/vector size. */ - u32 *free_frame_indices; + /* Vector of free frames for this scalar/vector size. */ + vlib_frame_t **free_frames; } vlib_frame_size_t; typedef struct |