diff options
author | Damjan Marion <damarion@cisco.com> | 2019-02-21 20:24:54 +0100 |
---|---|---|
committer | Florin Coras <florin.coras@gmail.com> | 2019-02-22 01:25:08 +0000 |
commit | 296988d358cd570247dd8b9b8bd5816a856c3d30 (patch) | |
tree | 027fb46f207d6b2a829d7f421449eeba31b270d8 | |
parent | 67f935ec6eb9ec37b7d73029c5afa89cbf4a9aa2 (diff) |
Add no-append flag to vlib_frame_t
Change-Id: I01c4f5755d579282773ac227b0bc24f8ddbb2bd1
Signed-off-by: Damjan Marion <damarion@cisco.com>
-rw-r--r-- | src/plugins/avf/input.c | 1 | ||||
-rw-r--r-- | src/plugins/dpdk/device/node.c | 1 | ||||
-rw-r--r-- | src/plugins/memif/node.c | 1 | ||||
-rw-r--r-- | src/vlib/main.c | 10 | ||||
-rw-r--r-- | src/vlib/node.h | 3 | ||||
-rw-r--r-- | src/vlib/node_funcs.h | 6 | ||||
-rw-r--r-- | src/vnet/devices/virtio/vhost_user_input.c | 1 | ||||
-rw-r--r-- | src/vnet/pg/input.c | 1 |
8 files changed, 20 insertions, 4 deletions
diff --git a/src/plugins/avf/input.c b/src/plugins/avf/input.c index b0400e99efb..a5d3220c099 100644 --- a/src/plugins/avf/input.c +++ b/src/plugins/avf/input.c @@ -425,6 +425,7 @@ no_more_desc: if ((or_qw1 & AVF_RXD_ERROR_IPE) == 0) f->flags |= ETH_INPUT_FRAME_F_IP4_CKSUM_OK; + vlib_frame_no_append (f); } n_left_to_next -= n_rx_packets; diff --git a/src/plugins/dpdk/device/node.c b/src/plugins/dpdk/device/node.c index 0998844a3ea..31ca5419ee4 100644 --- a/src/plugins/dpdk/device/node.c +++ b/src/plugins/dpdk/device/node.c @@ -390,6 +390,7 @@ dpdk_device_input (vlib_main_t * vm, dpdk_main_t * dm, dpdk_device_t * xd, if (xd->flags & DPDK_DEVICE_FLAG_RX_IP4_CKSUM && (or_flags & PKT_RX_IP_CKSUM_BAD) == 0) f->flags |= ETH_INPUT_FRAME_F_IP4_CKSUM_OK; + vlib_frame_no_append (f); } n_left_to_next -= n_rx_packets; vlib_put_next_frame (vm, node, next_index, n_left_to_next); diff --git a/src/plugins/memif/node.c b/src/plugins/memif/node.c index 3f4f5c57144..07ce76dc6d5 100644 --- a/src/plugins/memif/node.c +++ b/src/plugins/memif/node.c @@ -370,6 +370,7 @@ memif_device_input_inline (vlib_main_t * vm, vlib_node_runtime_t * node, ef = vlib_frame_scalar_args (f); ef->sw_if_index = mif->sw_if_index; ef->hw_if_index = mif->hw_if_index; + vlib_frame_no_append (f); } } diff --git a/src/vlib/main.c b/src/vlib/main.c index eed627cf215..89202beaa42 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. */ @@ -1370,7 +1372,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 e5d46d83665..ec47f205d11 100644 --- a/src/vlib/node.h +++ b/src/vlib/node.h @@ -417,6 +417,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) { diff --git a/src/vnet/devices/virtio/vhost_user_input.c b/src/vnet/devices/virtio/vhost_user_input.c index 286fa7ed744..d7f628c4c1a 100644 --- a/src/vnet/devices/virtio/vhost_user_input.c +++ b/src/vnet/devices/virtio/vhost_user_input.c @@ -403,6 +403,7 @@ vhost_user_if_input (vlib_main_t * vm, ef = vlib_frame_scalar_args (f); ef->sw_if_index = vui->sw_if_index; ef->hw_if_index = vui->hw_if_index; + vlib_frame_no_append (f); } while (n_left > 0) diff --git a/src/vnet/pg/input.c b/src/vnet/pg/input.c index befa2786abe..39f06923072 100644 --- a/src/vnet/pg/input.c +++ b/src/vnet/pg/input.c @@ -1575,6 +1575,7 @@ pg_generate_packets (vlib_node_runtime_t * node, pi = pool_elt_at_index (pg->interfaces, s->pg_if_index); ef->sw_if_index = pi->sw_if_index; ef->hw_if_index = pi->hw_if_index; + vlib_frame_no_append (f); } else vlib_get_next_frame (vm, node, next_index, to_next, n_left); |