aboutsummaryrefslogtreecommitdiffstats
path: root/hicn-plugin/src/data_fwd_node.c
diff options
context:
space:
mode:
authorAlberto Compagno <acompagn+fdio@cisco.com>2019-03-08 09:30:39 +0100
committerAlberto Compagno <acompagn+fdio@cisco.com>2019-03-08 09:30:39 +0100
commitc87345903a3cdb7a392b4bbb0f25ed2c1b7fbd45 (patch)
tree2f371b5c14c9378c6be6853dd399f47f104a6d1e /hicn-plugin/src/data_fwd_node.c
parentce1429f7c9ccaf93d15cbad1b6a7a4dd0976f1a2 (diff)
[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 <acompagn+fdio@cisco.com>
Diffstat (limited to 'hicn-plugin/src/data_fwd_node.c')
-rw-r--r--hicn-plugin/src/data_fwd_node.c33
1 files changed, 31 insertions, 2 deletions
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",
},
};