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.h | 1 + hicn-plugin/src/data_fwd_node.c | 33 +++++++++++++++++++++++++++++++-- hicn-plugin/src/data_pcslookup_node.c | 2 +- hicn-plugin/src/interest_hitcs.h | 1 + hicn-plugin/src/interest_hitcs_node.c | 1 + 5 files changed, 35 insertions(+), 3 deletions(-) (limited to 'hicn-plugin') diff --git a/hicn-plugin/src/data_fwd.h b/hicn-plugin/src/data_fwd.h index d5cf3cae4..4e37e6087 100644 --- a/hicn-plugin/src/data_fwd.h +++ b/hicn-plugin/src/data_fwd.h @@ -44,6 +44,7 @@ typedef enum { HICN_DATA_FWD_NEXT_V4_LOOKUP, HICN_DATA_FWD_NEXT_V6_LOOKUP, + HICN_DATA_FWD_NEXT_PUSH, HICN_DATA_FWD_NEXT_ERROR_DROP, HICN_DATA_FWD_N_NEXT, } hicn_data_fwd_next_t; 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", }, }; diff --git a/hicn-plugin/src/data_pcslookup_node.c b/hicn-plugin/src/data_pcslookup_node.c index 231d8557e..0a5793056 100644 --- a/hicn-plugin/src/data_pcslookup_node.c +++ b/hicn-plugin/src/data_pcslookup_node.c @@ -87,7 +87,7 @@ hicn_data_pcslookup_node_fn (vlib_main_t * vm, vlib_node_runtime_t * node, { vlib_buffer_t *b1; b1 = vlib_get_buffer (vm, from[1]); - //Prefetch one cache line-- 64 byte-- so that we load the hicn_buffer_t as well + //Prefetch two cache lines-- 128 byte-- so that we load the hicn_buffer_t as well CLIB_PREFETCH (b1, 2 * CLIB_CACHE_LINE_BYTES, STORE); CLIB_PREFETCH (b1->data, CLIB_CACHE_LINE_BYTES, LOAD); } diff --git a/hicn-plugin/src/interest_hitcs.h b/hicn-plugin/src/interest_hitcs.h index 82b0ace54..3588d4e08 100644 --- a/hicn-plugin/src/interest_hitcs.h +++ b/hicn-plugin/src/interest_hitcs.h @@ -42,6 +42,7 @@ typedef enum { HICN_INTEREST_HITCS_NEXT_V4_LOOKUP, HICN_INTEREST_HITCS_NEXT_V6_LOOKUP, + HICN_INTEREST_HITCS_NEXT_PUSH, HICN_INTEREST_HITCS_NEXT_ERROR_DROP, HICN_INTEREST_HITCS_N_NEXT, } hicn_interest_hitcs_next_t; diff --git a/hicn-plugin/src/interest_hitcs_node.c b/hicn-plugin/src/interest_hitcs_node.c index 97879b328..8ddd4f59e 100644 --- a/hicn-plugin/src/interest_hitcs_node.c +++ b/hicn-plugin/src/interest_hitcs_node.c @@ -280,6 +280,7 @@ VLIB_REGISTER_NODE(hicn_interest_hitcs_node) = { [HICN_INTEREST_HITCS_NEXT_V4_LOOKUP] = "ip4-lookup", [HICN_INTEREST_HITCS_NEXT_V6_LOOKUP] = "ip6-lookup", + [HICN_INTEREST_HITCS_NEXT_PUSH] = "hicn-data-push", [HICN_INTEREST_HITCS_NEXT_ERROR_DROP] = "error-drop", }, }; -- cgit 1.2.3-korg