summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--hicn-plugin/src/cli.c36
-rw-r--r--hicn-plugin/src/data_fwd_node.c80
-rw-r--r--hicn-plugin/src/data_push_node.c28
-rw-r--r--hicn-plugin/src/params.h2
4 files changed, 100 insertions, 46 deletions
diff --git a/hicn-plugin/src/cli.c b/hicn-plugin/src/cli.c
index c8c0be4ff..b03d6a29c 100644
--- a/hicn-plugin/src/cli.c
+++ b/hicn-plugin/src/cli.c
@@ -86,9 +86,12 @@ hicn_cli_node_ctl_start_set_command_fn (vlib_main_t * vm,
ret = hicn_infra_plugin_enable_disable (1 /* enable */ ,
node_ctl_params.pit_max_size,
- node_ctl_params.pit_dflt_lifetime_sec,
- node_ctl_params.pit_min_lifetime_sec,
- node_ctl_params.pit_max_lifetime_sec,
+ node_ctl_params.
+ pit_dflt_lifetime_sec,
+ node_ctl_params.
+ pit_min_lifetime_sec,
+ node_ctl_params.
+ pit_max_lifetime_sec,
node_ctl_params.cs_max_size,
node_ctl_params.cs_reserved_app);
@@ -131,9 +134,12 @@ hicn_cli_node_ctl_stop_set_command_fn (vlib_main_t * vm,
}
ret = hicn_infra_plugin_enable_disable (0 /* !enable */ ,
node_ctl_params.pit_max_size,
- node_ctl_params.pit_dflt_lifetime_sec,
- node_ctl_params.pit_min_lifetime_sec,
- node_ctl_params.pit_max_lifetime_sec,
+ node_ctl_params.
+ pit_dflt_lifetime_sec,
+ node_ctl_params.
+ pit_min_lifetime_sec,
+ node_ctl_params.
+ pit_max_lifetime_sec,
node_ctl_params.cs_max_size,
node_ctl_params.cs_reserved_app);
@@ -877,8 +883,8 @@ hicn_cli_pgen_client_set_command_fn (vlib_main_t * vm,
{
/* Add data node to the vpp graph */
u32 next_hit_node = vlib_node_add_next (vm,
- hicn_punt_glb.
- hicn_node_info.ip4_inacl_node_index,
+ hicn_punt_glb.hicn_node_info.
+ ip4_inacl_node_index,
hicn_pg_data_node.index);
/* Add pgen_client node to the vpp graph */
@@ -915,8 +921,8 @@ hicn_cli_pgen_client_set_command_fn (vlib_main_t * vm,
{
/* Add node to the vpp graph */
u32 next_hit_node = vlib_node_add_next (vm,
- hicn_punt_glb.hicn_node_info.
- ip6_inacl_node_index,
+ hicn_punt_glb.
+ hicn_node_info.ip6_inacl_node_index,
hicn_pg_data_node.index);
/* Add pgen_client node to the vpp graph */
@@ -1086,8 +1092,8 @@ hicn_cli_pgen_server_set_command_fn (vlib_main_t * vm,
{
/* Add node to the vpp graph */
u32 next_hit_node = vlib_node_add_next (vm,
- hicn_punt_glb.
- hicn_node_info.ip4_inacl_node_index,
+ hicn_punt_glb.hicn_node_info.
+ ip4_inacl_node_index,
hicn_pg_server_node.index);
/* Create the punting table if it does not exist */
@@ -1113,8 +1119,8 @@ hicn_cli_pgen_server_set_command_fn (vlib_main_t * vm,
{
/* Add node to the vpp graph */
u32 next_hit_node = vlib_node_add_next (vm,
- hicn_punt_glb.hicn_node_info.
- ip6_inacl_node_index,
+ hicn_punt_glb.
+ hicn_node_info.ip6_inacl_node_index,
hicn_pg_server_node.index);
/* Create the punting table if it does not exist */
@@ -1210,7 +1216,7 @@ VLIB_CLI_COMMAND(hicn_cli_show_command, static)=
VLIB_CLI_COMMAND(hicn_cli_punting_command, static)=
{
.path = "hicn punting",
- .short_help = "hicn punting {add|delete} prefix <ip_address/mask> intfc <interface> type <ip/udp>",
+ .short_help = "hicn punting {add|delete} prefix <ip_address/mask> intfc <interface> {type ip | type <udp4|udp6> src_port <port> dst_port <port>}",
.function = hicn_cli_punting_command_fn,
};
diff --git a/hicn-plugin/src/data_fwd_node.c b/hicn-plugin/src/data_fwd_node.c
index b25c9e0ac..19181ac03 100644
--- a/hicn-plugin/src/data_fwd_node.c
+++ b/hicn-plugin/src/data_fwd_node.c
@@ -50,7 +50,7 @@ clone_data_to_cs (vlib_main_t * vm, hicn_pit_cs_t * pitcs,
hicn_hash_node_t * nodep, vlib_buffer_t * b0,
hicn_hash_entry_t * hash_entry, u64 name_hash,
hicn_buffer_t * hicnb, const hicn_dpo_vft_t * dpo_vft,
- dpo_id_t * hicn_dpo_id);
+ dpo_id_t * hicn_dpo_id, hicn_lifetime_t dmsg_lifetime);
/* packet trace format function */
@@ -221,24 +221,69 @@ hicn_data_node_fn (vlib_main_t * vm, vlib_node_runtime_t * node,
pitp->u.pit.pe_txnh);
#if HICN_FEATURE_CS
- /*
- * Clone data packet in the content store and
- * convert the PIT entry into a CS entry
- */
- clone_data_to_cs (vm, pitcs, pitp, hicn0, tnow, node0,
- b0, hash_entry0, hicnb0->name_hash, hicnb0,
- dpo_vft0, &hicn_dpo_id0);
+ hicn_lifetime_t dmsg_lifetime;
- hicn_pcs_remove_lock (pitcs, &pitp, &node0, vm,
- hash_entry0, NULL, NULL);
+ hicn_type_t type = hicnb0->type;
+ hicn_ops_vft[type.l1]->get_lifetime (type, &hicn0->protocol,
+ &dmsg_lifetime);
+
+ if (dmsg_lifetime)
+ {
+ /*
+ * Clone data packet in the content store and
+ * convert the PIT entry into a CS entry
+ */
+ clone_data_to_cs (vm, pitcs, pitp, hicn0, tnow, node0,
+ b0, hash_entry0, hicnb0->name_hash,
+ hicnb0, dpo_vft0, &hicn_dpo_id0,
+ dmsg_lifetime);
+
+ hicn_pcs_remove_lock (pitcs, &pitp, &node0, vm,
+ hash_entry0, NULL, NULL);
+ }
+ else
+ {
+ /*
+ * If the packet is copied and not cloned, we need to free the vlib_buffer
+ */
+ if (hicnb0->flags & HICN_BUFFER_FLAGS_PKT_LESS_TWO_CL)
+ {
+ vlib_buffer_free_one (vm, bi0);
+ }
+ else
+ {
+ /*
+ * Remove one reference as the buffer is no
+ * longer in any frame. The vlib_buffer will be freed when
+ * all its cloned vlib_buffer will be freed.
+ */
+ b0->n_add_refs--;
+ }
+
+ /* Delete the PIT entry */
+ hicn_pcs_pit_delete (pitcs, &pitp, &node0, vm,
+ hash_entry0, dpo_vft0, &hicn_dpo_id0);
+ }
#else
ASSERT (pitp == hicn_pit_get_data (node0));
/*
- * Remove one reference as the buffer is no
- * longer in any frame
+ * If the packet is copied and not cloned, we need to free the vlib_buffer
*/
- b0->n_add_refs--;
- /* If not enabled, delete the PIT entry */
+ if (hicnb0->flags & HICN_BUFFER_FLAGS_PKT_LESS_TWO_CL)
+ {
+ vlib_buffer_free_one (vm, bi0);
+ }
+ else
+ {
+ /*
+ * Remove one reference as the buffer is no
+ * longer in any frame. The vlib_buffer will be freed when
+ * all its cloned vlib_buffer will be freed.
+ */
+ b0->n_add_refs--;
+ }
+
+ /* Delete the PIT entry */
hicn_pcs_pit_delete (pitcs, &pitp, &node0, vm,
hash_entry0, dpo_vft0, &hicn_dpo_id0);
#endif
@@ -490,9 +535,8 @@ clone_data_to_cs (vlib_main_t * vm, hicn_pit_cs_t * pitcs,
hicn_hash_node_t * nodep, vlib_buffer_t * b0,
hicn_hash_entry_t * hash_entry, u64 name_hash,
hicn_buffer_t * hicnb, const hicn_dpo_vft_t * dpo_vft,
- dpo_id_t * hicn_dpo_id)
+ dpo_id_t * hicn_dpo_id, hicn_lifetime_t dmsg_lifetime)
{
- hicn_lifetime_t dmsg_lifetime;
/*
* At this point we think we're safe to proceed. Store the CS buf in
* the PIT/CS hashtable entry
@@ -510,10 +554,6 @@ clone_data_to_cs (vlib_main_t * vm, hicn_pit_cs_t * pitcs,
pitp->shared.create_time = tnow;
- hicn_type_t type = hicnb0->type;
- hicn_ops_vft[type.l1]->get_lifetime (type, &hicn0->protocol,
- &dmsg_lifetime);
-
if (dmsg_lifetime < HICN_PARAM_CS_LIFETIME_MIN
|| dmsg_lifetime > HICN_PARAM_CS_LIFETIME_MAX)
{
diff --git a/hicn-plugin/src/data_push_node.c b/hicn-plugin/src/data_push_node.c
index d530173bc..b955a765d 100644
--- a/hicn-plugin/src/data_push_node.c
+++ b/hicn-plugin/src/data_push_node.c
@@ -97,7 +97,7 @@ hicn_new_data (vlib_main_t * vm, hicn_data_push_runtime_t * rt,
u32 bi0 = vlib_get_buffer_index (vm, b0);
hicn_hash_node_t *nodep;
hicn_pcs_entry_t *pitp;
- hicn_header_t *hicn0;
+ hicn_header_t *hicn0 = vlib_buffer_get_current (b0);
hicn_buffer_t *hicnb0 = hicn_get_buffer (b0);
u32 node_id0 = 0;
u8 dpo_ctx_id0 = ~0;
@@ -108,6 +108,17 @@ hicn_new_data (vlib_main_t * vm, hicn_data_push_runtime_t * rt,
u8 bucket_is_overflow = 0;
hicn_lifetime_t dmsg_lifetime;
+ hicnb0 = hicn_get_buffer (b0);
+ hicn_type_t type = hicnb0->type;
+ hicn_ops_vft[type.l1]->get_lifetime (type, &hicn0->protocol,
+ &dmsg_lifetime);
+
+ if (!dmsg_lifetime)
+ {
+ vlib_buffer_free_one (vm, bi0);
+ return HICN_ERROR_NONE;
+ }
+
/* Create PIT node and init PIT entry */
nodep = hicn_hashtb_alloc_node (rt->pitcs->pcs_table);
if (PREDICT_FALSE (nodep == NULL))
@@ -121,12 +132,6 @@ hicn_new_data (vlib_main_t * vm, hicn_data_push_runtime_t * rt,
hicn_pit_init_data (pitp);
pitp->shared.create_time = tnow;
- hicn0 = vlib_buffer_get_current (b0);
-
- hicn_type_t type = hicnb0->type;
- hicn_ops_vft[type.l1]->get_lifetime (type, &hicn0->protocol,
- &dmsg_lifetime);
-
if (dmsg_lifetime < HICN_PARAM_CS_LIFETIME_MIN
|| dmsg_lifetime > HICN_PARAM_CS_LIFETIME_MAX)
{
@@ -238,10 +243,13 @@ hicn_data_push_fn (vlib_main_t * vm,
ret0 = hicn_data_parse_pkt (b0, &name, &namelen, &hicn0, &isv6);
nameptr = (u8 *) (&name);
+
if (PREDICT_TRUE (ret0 == HICN_ERROR_NONE))
- hicn_new_data (vm, rt, b0, &to_forward, &n_to_forward, tnow, nameptr,
- namelen, isv6);
- stats.pkts_data_count++;
+ {
+ hicn_new_data (vm, rt, b0, &to_forward, &n_to_forward, tnow,
+ nameptr, namelen, isv6);
+ stats.pkts_data_count++;
+ }
}
to_forward -= n_to_forward;
diff --git a/hicn-plugin/src/params.h b/hicn-plugin/src/params.h
index 5adafd7e6..f3af714ec 100644
--- a/hicn-plugin/src/params.h
+++ b/hicn-plugin/src/params.h
@@ -80,7 +80,7 @@ STATIC_ASSERT ((HICN_PARAM_PIT_ENTRY_PHOPS_MAX <= HICN_PARAM_FACES_MAX),
#define HICN_PARAM_CS_LRU_DEFAULT (16 * 1024)
/* CS lifetime defines, in mseconds, integer type */
-#define HICN_PARAM_CS_LIFETIME_MIN 100
+#define HICN_PARAM_CS_LIFETIME_MIN 0
#define HICN_PARAM_CS_LIFETIME_DFLT (5 * 60 * 1000) // 300 seconds
#define HICN_PARAM_CS_LIFETIME_MAX (24 * 3600 * 1000) //24 hours...