From c7f942175b8c25c77ddc21561b52e3e6b5620b80 Mon Sep 17 00:00:00 2001 From: Alberto Compagno Date: Sat, 19 Jan 2019 17:28:57 +0100 Subject: Improved performance on data-fwd node: - Removed full pit entry initialization in favor of a lighter initialization on few fields - Squeezed pit entry size in order to store only the number of incomplete faces (as set in HICN_PARAM_PIT_ENTRY_PHOPS_MAX). The bitmap size is now determined by HICN_PARAM_FACES_MAX and optimized to do a fast lookup Replaced the field is_appface with the field flags in the hicn_buffer_t: - is_appface is now a flag with value 0x01 (HICN_BUFFER_FLAGS_FACE_IS_APP) - Added flag HICN_BUFFER_FLAGS_PKT_LESS_TWO_CL (0x02) to handle the copy of pkt with length < than 2*CACHE_LINES (in this case cloning is prevented by the cloning function in vpp). Such flag is initialized by the incoming face of the pkt. Change-Id: Ia956fd5719a28ee29f7fa2fd23d283964743efd8 Signed-off-by: Alberto Compagno --- hicn-plugin/src/data_fwd_node.c | 36 ++++++++++++++++++++++++++++-------- 1 file changed, 28 insertions(+), 8 deletions(-) (limited to 'hicn-plugin/src/data_fwd_node.c') diff --git a/hicn-plugin/src/data_fwd_node.c b/hicn-plugin/src/data_fwd_node.c index 088683fe0..1d37fdbcc 100755 --- a/hicn-plugin/src/data_fwd_node.c +++ b/hicn-plugin/src/data_fwd_node.c @@ -112,10 +112,6 @@ hicn_data_node_fn (vlib_main_t * vm, vlib_node_runtime_t * node, b1 = vlib_get_buffer (vm, from[1]); CLIB_PREFETCH (b1, 2 * CLIB_CACHE_LINE_BYTES, STORE); CLIB_PREFETCH (b1->data, CLIB_CACHE_LINE_BYTES, STORE); - - /* HICN PREFETCH */ - hicn_buffer_t *hicnb1 = hicn_get_buffer (b1); - hicn_prefetch_pcs_entry (hicnb1, pitcs); } /* Dequeue a packet buffer */ /* @@ -288,6 +284,8 @@ hicn_satisfy_faces (vlib_main_t * vm, u32 bi0, u32 n_left_from = 0; u32 next0 = HICN_DATA_FWD_NEXT_ERROR_DROP, next1 = HICN_DATA_FWD_NEXT_ERROR_DROP; + u16 buffer_advance = isv6 ? sizeof (ip6_header_t) + sizeof (tcp_header_t) : + sizeof (ip4_header_t) + sizeof (tcp_header_t); /* * We have a hard limit on the number of vlib_buffer that we can @@ -304,11 +302,32 @@ hicn_satisfy_faces (vlib_main_t * vm, u32 bi0, /* Clone bi0 */ vlib_buffer_t *b0 = vlib_get_buffer (vm, bi0); - /* Add one reference to maintain the buffer in the CS */ - b0->n_add_refs++; + hicn_buffer_t *hicnb = hicn_get_buffer (b0); + /* + * Mark the buffer as smaller than TWO_CL. It will be stored as is in the CS, without excluding + * the hicn_header. Cloning is not possible, it will be copied. + */ + if (b0->current_length <= buffer_advance + CLIB_CACHE_LINE_BYTES * 2) + { + /* In this case the packet is copied. We don't need to add a reference as no buffer are + * chained to it. + */ + hicnb->flags |= HICN_BUFFER_FLAGS_PKT_LESS_TWO_CL; + } + else + { + /* Add one reference to maintain the buffer in the CS. + * b0->n_add_refs == 0 has two meaning: it has 1 buffer or no buffer chained to it. + * vlib_buffer_clone2 add a number of reference equalt to pitp->u.pit.faces.n_faces - 1 + * as vlib_buffer_clone does. So after all the packet are forwarded the buffer stored in + * the CS will have n_add_refs == 0; + */ + b0->n_add_refs++; + } + found = n_left_from = vlib_buffer_clone2 (vm, bi0, clones, pitp->u.pit.faces.n_faces, - VLIB_BUFFER_MIN_CHAIN_SEG_SIZE); + buffer_advance); ASSERT (n_left_from == pitp->u.pit.faces.n_faces); @@ -474,7 +493,8 @@ clone_data_to_cs (vlib_main_t * vm, hicn_pit_cs_t * pitcs, */ hicn_buffer_t *hicnb0 = hicn_get_buffer (b0); hicn_pit_to_cs (vm, pitcs, pitp, hash_entry, nodep, dpo_vft, hicn_dpo_id, - &hicnb->face_dpo_id, hicnb0->is_appface); + &hicnb->face_dpo_id, + hicnb0->flags & HICN_BUFFER_FLAGS_FACE_IS_APP); pitp->shared.create_time = tnow; -- cgit 1.2.3-korg