diff options
author | Damjan Marion <damarion@cisco.com> | 2022-02-10 15:01:03 +0100 |
---|---|---|
committer | Damjan Marion <damarion@cisco.com> | 2022-02-10 19:12:50 +0100 |
commit | efeea5b111db9075ffdab73191f6343f6872bfb2 (patch) | |
tree | 3cf2be9242aa0fb83499a769a8464e3d93df1748 /src/vnet/interface_output.c | |
parent | f5756175e6296939c3d580c2120306ba28bab91b (diff) |
vlib: vlib frame bitmaps
Special bitmaps with VLIB_FRAME_SIZE bits.
Type: improvement
Change-Id: I48747e422e519e7b5e930fa720397459d3adbb8e
Signed-off-by: Damjan Marion <damarion@cisco.com>
Diffstat (limited to 'src/vnet/interface_output.c')
-rw-r--r-- | src/vnet/interface_output.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/src/vnet/interface_output.c b/src/vnet/interface_output.c index cf64eeed093..6d5697deac4 100644 --- a/src/vnet/interface_output.c +++ b/src/vnet/interface_output.c @@ -405,7 +405,7 @@ enqueue_one_to_tx_node (vlib_main_t *vm, vlib_node_runtime_t *node, u32 *ppqi, u32 n_vectors, u32 n_left, u32 next_index) { u32 tmp[VLIB_FRAME_SIZE]; - u64 mask[VLIB_FRAME_SIZE / 64] = {}; + vlib_frame_bitmap_t mask = {}; vlib_frame_t *f; vnet_hw_if_tx_frame_t *tf; u32 *to; @@ -1259,8 +1259,7 @@ VLIB_NODE_FN (vnet_interface_output_arc_end_node) vnet_hw_interface_t *hi; vlib_buffer_t *bufs[VLIB_FRAME_SIZE], **b = bufs; u32 sw_if_indices[VLIB_FRAME_SIZE], *sw_if_index = sw_if_indices; - u64 used_elts[VLIB_FRAME_SIZE / 64] = {}; - u64 mask[VLIB_FRAME_SIZE / 64] = {}; + vlib_frame_bitmap_t used_elts = {}, mask = {}; u32 *tmp, *from, n_left, n_comp, n_p_comp, swif, off; u16 next_index; void *ptr[VLIB_FRAME_SIZE], **p = ptr; @@ -1350,8 +1349,7 @@ drop: if (n_left) { /* store comparison mask so we can find next unused element */ - for (int i = 0; i < ARRAY_LEN (used_elts); i++) - used_elts[i] |= mask[i]; + vlib_frame_bitmap_or (used_elts, mask); /* fine first unused sw_if_index by scanning trough used_elts bitmap */ while (PREDICT_FALSE (used_elts[off] == ~0)) |