From c87345903a3cdb7a392b4bbb0f25ed2c1b7fbd45 Mon Sep 17 00:00:00 2001 From: Alberto Compagno Date: Fri, 8 Mar 2019 09:30:39 +0100 Subject: [HICN-100] When the incoming face of a data is an application face, the data is always stored in the face CS (if any) Change-Id: I87e296caa57e04964f6f3971f37737d4c6e49c8f Signed-off-by: Alberto Compagno --- hicn-plugin/src/data_fwd_node.c | 33 +++++++++++++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 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 19181ac03..f7c8ae70b 100644 --- a/hicn-plugin/src/data_fwd_node.c +++ b/hicn-plugin/src/data_fwd_node.c @@ -37,6 +37,11 @@ drop_packet (vlib_main_t * vm, u32 bi0, u32 * n_left_to_next, u32 * next0, u32 ** to_next, u32 * next_index, vlib_node_runtime_t * node); +always_inline void +push_in_cache (vlib_main_t * vm, u32 bi0, + u32 * n_left_to_next, u32 * next0, u32 ** to_next, + u32 * next_index, vlib_node_runtime_t * node); + always_inline int hicn_satisfy_faces (vlib_main_t * vm, u32 b0, hicn_pcs_entry_t * pitp, u32 * n_left_to_next, @@ -170,8 +175,16 @@ hicn_data_node_fn (vlib_main_t * vm, vlib_node_runtime_t * node, hicn_pcs_delete (pitcs, &pitp, &node0, vm, hash_entry0, dpo_vft0, &hicn_dpo_id0); - drop_packet (vm, bi0, &n_left_to_next, &next0, &to_next, - &next_index, node); + if (hicnb0->flags & HICN_BUFFER_FLAGS_FACE_IS_APP) + { + push_in_cache (vm, bi0, &n_left_to_next, &next0, &to_next, + &next_index, node); + } + else + { + drop_packet (vm, bi0, &n_left_to_next, &next0, &to_next, + &next_index, node); + } stats.pit_expired_count++; if (PREDICT_FALSE ((node->flags & VLIB_NODE_FLAG_TRACE) && @@ -329,6 +342,21 @@ drop_packet (vlib_main_t * vm, u32 bi0, *to_next, *n_left_to_next, bi0, *next0); } +always_inline void +push_in_cache (vlib_main_t * vm, u32 bi0, + u32 * n_left_to_next, u32 * next0, u32 ** to_next, + u32 * next_index, vlib_node_runtime_t * node) +{ + *next0 = HICN_DATA_FWD_NEXT_PUSH; + + (*to_next)[0] = bi0; + *to_next += 1; + *n_left_to_next -= 1; + + vlib_validate_buffer_enqueue_x1 (vm, node, *next_index, + *to_next, *n_left_to_next, bi0, *next0); +} + always_inline int hicn_satisfy_faces (vlib_main_t * vm, u32 bi0, hicn_pcs_entry_t * pitp, u32 * n_left_to_next, @@ -601,6 +629,7 @@ VLIB_REGISTER_NODE(hicn_data_fwd_node) = .next_nodes = { [HICN_DATA_FWD_NEXT_V4_LOOKUP] = "ip4-lookup", [HICN_DATA_FWD_NEXT_V6_LOOKUP] = "ip6-lookup", + [HICN_DATA_FWD_NEXT_PUSH] = "hicn-data-push", [HICN_DATA_FWD_NEXT_ERROR_DROP] = "error-drop", }, }; -- cgit 1.2.3-korg