aboutsummaryrefslogtreecommitdiffstats
path: root/hicn-plugin/src
diff options
context:
space:
mode:
Diffstat (limited to 'hicn-plugin/src')
-rw-r--r--hicn-plugin/src/cli.c72
-rw-r--r--hicn-plugin/src/data_fwd_node.c5
-rw-r--r--hicn-plugin/src/data_pcslookup_node.c35
-rw-r--r--hicn-plugin/src/hicn.api12
-rw-r--r--hicn-plugin/src/hicn.c102
-rw-r--r--hicn-plugin/src/hicn_api.c118
-rw-r--r--hicn-plugin/src/hicn_api_test.c28
-rw-r--r--hicn-plugin/src/infra.h14
-rw-r--r--hicn-plugin/src/mgmt.c4
-rw-r--r--hicn-plugin/src/params.h9
-rw-r--r--hicn-plugin/src/pcs.h2
-rw-r--r--hicn-plugin/src/strategy.c10
12 files changed, 173 insertions, 238 deletions
diff --git a/hicn-plugin/src/cli.c b/hicn-plugin/src/cli.c
index 8af56dcba..bd789acad 100644
--- a/hicn-plugin/src/cli.c
+++ b/hicn-plugin/src/cli.c
@@ -40,8 +40,6 @@ extern ip_version_t ipv6;
static vl_api_hicn_api_node_params_set_t node_ctl_params = {
.pit_max_size = -1,
- .pit_dflt_lifetime_sec = -1.0f,
- .pit_min_lifetime_sec = -1.0f,
.pit_max_lifetime_sec = -1.0f,
.cs_max_size = -1,
.cs_reserved_app = -1,
@@ -85,12 +83,7 @@ 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_max_lifetime_sec,
node_ctl_params.cs_max_size,
node_ctl_params.cs_reserved_app);
@@ -133,12 +126,7 @@ 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_max_lifetime_sec,
node_ctl_params.cs_max_size,
node_ctl_params.cs_reserved_app);
@@ -197,28 +185,6 @@ hicn_cli_node_ctl_param_set_command_fn (vlib_main_t * vm,
}
node_ctl_params.pit_max_size = table_size;
}
- else if (unformat (line_input, "dfltlife %f", &lifetime))
- {
- if (!DFLTD_RANGE_OK
- (lifetime, HICN_PARAM_PIT_LIFETIME_BOUND_MIN_SEC,
- HICN_PARAM_PIT_LIFETIME_BOUND_MAX_SEC))
- {
- rv = HICN_ERROR_PIT_CONFIG_DFTLT_OOB;
- break;
- }
- node_ctl_params.pit_dflt_lifetime_sec = lifetime;
- }
- else if (unformat (line_input, "minlife %f", &lifetime))
- {
- if (!DFLTD_RANGE_OK
- (lifetime, HICN_PARAM_PIT_LIFETIME_BOUND_MIN_SEC,
- HICN_PARAM_PIT_LIFETIME_BOUND_MAX_SEC))
- {
- rv = HICN_ERROR_PIT_CONFIG_MINLT_OOB;
- break;
- }
- node_ctl_params.pit_min_lifetime_sec = lifetime;
- }
else if (unformat (line_input, "maxlife %f", &lifetime))
{
if (!DFLTD_RANGE_OK
@@ -332,8 +298,6 @@ hicn_cli_show_command_fn (vlib_main_t * vm, unformat_input_t * main_input,
if (!hicn_main.is_enabled)
{
if (node_ctl_params.pit_max_size == -1 &&
- node_ctl_params.pit_dflt_lifetime_sec == -1 &&
- node_ctl_params.pit_min_lifetime_sec == -1 &&
node_ctl_params.pit_max_lifetime_sec == -1 &&
node_ctl_params.cs_max_size == -1 &&
node_ctl_params.cs_reserved_app == -1)
@@ -349,16 +313,6 @@ hicn_cli_show_command_fn (vlib_main_t * vm, unformat_input_t * main_input,
vlib_cli_output (vm, " PIT:: max entries:%d\n",
node_ctl_params.pit_max_size);
}
- if (node_ctl_params.pit_dflt_lifetime_sec != -1)
- {
- vlib_cli_output (vm, " PIT:: dflt lifetime: %05.3f seconds\n",
- node_ctl_params.pit_dflt_lifetime_sec);
- }
- if (node_ctl_params.pit_min_lifetime_sec != -1)
- {
- vlib_cli_output (vm, " PIT:: min lifetime: %05.3f seconds\n",
- node_ctl_params.pit_min_lifetime_sec);
- }
if (node_ctl_params.pit_max_lifetime_sec != -1)
{
vlib_cli_output (vm, " PIT:: max lifetime: %05.3f seconds\n",
@@ -380,12 +334,10 @@ hicn_cli_show_command_fn (vlib_main_t * vm, unformat_input_t * main_input,
vlib_cli_output (vm,
"Forwarder: %sabled\n"
" PIT:: max entries:%d,"
- " lifetime default: %05.3f sec (min:%05.3f, max:%05.3f)\n"
+ " lifetime default: max:%05.3f\n"
" CS:: max entries:%d, network entries:%d, app entries:%d (allocated %d, free %d)\n",
hicn_main.is_enabled ? "en" : "dis",
hicn_infra_pit_size,
- ((f64) hicn_main.pit_lifetime_dflt_ms) / SEC_MS,
- ((f64) hicn_main.pit_lifetime_min_ms) / SEC_MS,
((f64) hicn_main.pit_lifetime_max_ms) / SEC_MS,
hicn_infra_cs_size,
hicn_infra_cs_size - hicn_main.pitcs.pcs_app_max,
@@ -445,7 +397,7 @@ done:
"Bucke count %d, Overflow buckets count %d, used %d\n",
hicn_main.pitcs.pcs_table->ht_bucket_count,
hicn_main.pitcs.pcs_table->ht_overflow_bucket_count,
- hicn_main.pitcs.pcs_table->ht_overflow_buckets_used);
+ hicn_main.pitcs.pcs_table->ht_overflow_buckets_used);
}
return (ret == HICN_ERROR_NONE) ? 0 : clib_error_return (0, "%s\n",
@@ -823,8 +775,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 */
@@ -861,8 +813,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 */
@@ -1032,8 +984,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 */
@@ -1059,8 +1011,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 */
diff --git a/hicn-plugin/src/data_fwd_node.c b/hicn-plugin/src/data_fwd_node.c
index 53308a49d..ca3baaa0d 100644
--- a/hicn-plugin/src/data_fwd_node.c
+++ b/hicn-plugin/src/data_fwd_node.c
@@ -176,6 +176,7 @@ 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);
+#if HICN_FEATURE_CS
if (hicnb0->flags & HICN_BUFFER_FLAGS_FACE_IS_APP)
{
push_in_cache (vm, bi0, &n_left_to_next, &next0, &to_next,
@@ -186,6 +187,10 @@ hicn_data_node_fn (vlib_main_t * vm, vlib_node_runtime_t * node,
drop_packet (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);
+#endif
stats.pit_expired_count++;
if (PREDICT_FALSE ((node->flags & VLIB_NODE_FLAG_TRACE) &&
diff --git a/hicn-plugin/src/data_pcslookup_node.c b/hicn-plugin/src/data_pcslookup_node.c
index aeb8c2276..fdf855e57 100644
--- a/hicn-plugin/src/data_pcslookup_node.c
+++ b/hicn-plugin/src/data_pcslookup_node.c
@@ -102,27 +102,17 @@ hicn_data_pcslookup_node_fn (vlib_main_t * vm, vlib_node_runtime_t * node,
b0 = vlib_get_buffer (vm, bi0);
hb0 = hicn_get_buffer (b0);
+ next0 = HICN_DATA_PCSLOOKUP_NEXT_ERROR_DROP;
/* Incr packet counter */
stats.pkts_processed += 1;
ret0 = hicn_data_parse_pkt (b0, &name, &namelen, &hicn0, &isv6);
-
- if (PREDICT_TRUE (ret0 == HICN_ERROR_NONE))
- {
- next0 =
- isv6 ? HICN_DATA_PCSLOOKUP_NEXT_V6_LOOKUP :
- HICN_DATA_PCSLOOKUP_NEXT_V4_LOOKUP;
- }
nameptr = (u8 *) (&name);
- if (PREDICT_FALSE
- (ret0 != HICN_ERROR_NONE
- || hicn_hashtb_fullhash (nameptr, namelen,
- &name_hash) != HICN_ERROR_NONE))
- {
- next0 = HICN_DATA_PCSLOOKUP_NEXT_ERROR_DROP;
- }
- else
+
+ if (PREDICT_TRUE (ret0 == HICN_ERROR_NONE &&
+ hicn_hashtb_fullhash (nameptr, namelen,
+ &name_hash) == HICN_ERROR_NONE))
{
int res =
hicn_hashtb_lookup_node (rt->pitcs->pcs_table, nameptr,
@@ -137,9 +127,10 @@ hicn_data_pcslookup_node_fn (vlib_main_t * vm, vlib_node_runtime_t * node,
stats.pkts_data_count += 1;
+#if HICN_FEATURE_CS
if ((res == HICN_ERROR_HASHTB_HASH_NOT_FOUND
|| (res == HICN_ERROR_NONE && is_cs0))
- && (hb0->flags & HICN_BUFFER_FLAGS_FACE_IS_APP))
+ && ((hb0->flags & HICN_BUFFER_FLAGS_FACE_IS_APP)))
{
next0 = HICN_DATA_PCSLOOKUP_NEXT_STORE_DATA;
}
@@ -153,6 +144,18 @@ hicn_data_pcslookup_node_fn (vlib_main_t * vm, vlib_node_runtime_t * node,
next0 = HICN_DATA_PCSLOOKUP_NEXT_DATA_FWD + is_cs0;
}
}
+#else
+ if (res == HICN_ERROR_NONE)
+ {
+ /*
+ * In case the result of the lookup
+ * is a CS entry, the packet is
+ * dropped
+ */
+ next0 = HICN_DATA_PCSLOOKUP_NEXT_DATA_FWD + is_cs0;
+ }
+ }
+#endif
hicn_store_internal_state (b0, name_hash, node_id0, dpo_ctx_id0,
vft_id0, hash_entry_id, bucket_id,
diff --git a/hicn-plugin/src/hicn.api b/hicn-plugin/src/hicn.api
index d344061ba..da14a9faf 100644
--- a/hicn-plugin/src/hicn.api
+++ b/hicn-plugin/src/hicn.api
@@ -33,12 +33,6 @@ define hicn_api_node_params_set
/* Portion of CS reserved to application, otherwise -1 to assign default value */
i32 cs_reserved_app;
- /* Default PIT entry lifetime, otherwise -1 to assign default value */
- f64 pit_dflt_lifetime_sec;
-
- /* Lower bound on PIT entry lifetime, otherwise -1 to assign default value */
- f64 pit_min_lifetime_sec;
-
/* Upper bound on PIT entry lifetime, otherwise -1 to assign default value */
f64 pit_max_lifetime_sec;
};
@@ -84,12 +78,6 @@ define hicn_api_node_params_get_reply
/* CS maximum size, otherwise -1 to assign default value */
u32 cs_max_size;
- /* Default PIT entry lifetime */
- f64 pit_dflt_lifetime_sec;
-
- /* Lower bound on PIT entry lifetime */
- f64 pit_min_lifetime_sec;
-
/* Upper bound on PIT entry lifetime */
f64 pit_max_lifetime_sec;
};
diff --git a/hicn-plugin/src/hicn.c b/hicn-plugin/src/hicn.c
index a7b04de74..a30eac4ff 100644
--- a/hicn-plugin/src/hicn.c
+++ b/hicn-plugin/src/hicn.c
@@ -15,6 +15,7 @@
#include <vnet/vnet.h>
#include <vnet/plugin/plugin.h>
+#include <vlib/vlib.h>
#include "hicn.h"
#include "params.h"
@@ -84,8 +85,6 @@ done:
int
hicn_infra_plugin_enable_disable (int enable_disable,
int pit_size_req,
- f64 pit_dflt_lifetime_sec_req,
- f64 pit_min_lifetime_sec_req,
f64 pit_max_lifetime_sec_req,
int cs_size_req, int cs_reserved_app)
{
@@ -103,21 +102,6 @@ hicn_infra_plugin_enable_disable (int enable_disable,
/* Set up params and call fwdr_init set up PIT/CS, forwarder nodes */
/* Check the range and assign some globals */
- if (pit_min_lifetime_sec_req < 0)
- {
- sm->pit_lifetime_min_ms = HICN_PARAM_PIT_LIFETIME_DFLT_MIN_MS;
- }
- else
- {
- if (pit_min_lifetime_sec_req < HICN_PARAM_PIT_LIFETIME_BOUND_MIN_SEC ||
- pit_min_lifetime_sec_req > HICN_PARAM_PIT_LIFETIME_BOUND_MAX_SEC)
- {
- ret = HICN_ERROR_PIT_CONFIG_MINLT_OOB;
- goto done;
- }
- sm->pit_lifetime_min_ms = pit_min_lifetime_sec_req * SEC_MS;
- }
-
if (pit_max_lifetime_sec_req < 0)
{
sm->pit_lifetime_max_ms = HICN_PARAM_PIT_LIFETIME_DFLT_MAX_MS;
@@ -132,25 +116,7 @@ hicn_infra_plugin_enable_disable (int enable_disable,
}
sm->pit_lifetime_max_ms = pit_max_lifetime_sec_req * SEC_MS;
}
- if (sm->pit_lifetime_min_ms > sm->pit_lifetime_max_ms)
- {
- ret = HICN_ERROR_PIT_CONFIG_MINMAXLT;
- goto done;
- }
- if (pit_dflt_lifetime_sec_req < 0)
- {
- sm->pit_lifetime_dflt_ms = HICN_PARAM_PIT_LIFETIME_DFLT_DFLT_MS;
- }
- else
- {
- sm->pit_lifetime_dflt_ms = pit_dflt_lifetime_sec_req * SEC_MS;
- }
- if (sm->pit_lifetime_dflt_ms < sm->pit_lifetime_min_ms ||
- sm->pit_lifetime_dflt_ms > sm->pit_lifetime_max_ms)
- {
- ret = HICN_ERROR_PIT_CONFIG_DFTLT_OOB;
- goto done;
- }
+
if (pit_size_req < 0)
{
pit_size = HICN_PARAM_PIT_ENTRIES_DFLT;
@@ -172,10 +138,32 @@ hicn_infra_plugin_enable_disable (int enable_disable,
}
else
{
- if (cs_size_req > HICN_PARAM_CS_ENTRIES_MAX)
+ /*
+ * This should be relatively safe
+ * At this point vlib buffers should have been already allocated
+ */
+
+ vlib_buffer_main_t *bm;
+ vlib_buffer_pool_t *bp;
+ vlib_main_t *vm = vlib_get_main ();
+ bm = vm->buffer_main;
+
+ u32 n_buffers = 0;
+ vec_foreach (bp, bm->buffer_pools)
+ n_buffers = n_buffers < bp->n_buffers ? bp->n_buffers : n_buffers;
+
+ // check if CS is bugger tha PIT or bigger than the available vlib_buffers
+ uword cs_buffers =
+ (n_buffers >
+ HICN_PARAM_CS_MIN_MBUF) ? n_buffers - HICN_PARAM_CS_MIN_MBUF : 0;
+
+ if (cs_size_req > (pit_size_req / 2) || cs_size_req > cs_buffers)
{
- ret = HICN_ERROR_CS_CONFIG_SIZE_OOB;
- goto done;
+ cs_size_req =
+ ((pit_size_req / 2) > cs_buffers) ? cs_buffers : pit_size_req / 2;
+ vlib_cli_output (vm,
+ "WARNING!! CS too large. Please check size of PIT or the number of buffers available in VPP\n");
+
}
cs_size = (uint32_t) cs_size_req;
}
@@ -208,6 +196,42 @@ done:
return (ret);
}
+static clib_error_t *
+hicn_configure (vlib_main_t * vm, unformat_input_t * input)
+{
+ u32 pit_size = HICN_PARAM_PIT_ENTRIES_DFLT;
+ u32 cs_size = HICN_PARAM_CS_ENTRIES_DFLT;
+ u64 pit_lifetime_max_sec = HICN_PARAM_PIT_LIFETIME_DFLT_MAX_MS / SEC_MS;
+ int cs_reserved = HICN_PARAM_CS_RESERVED_APP;
+
+ while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
+ {
+ if (unformat (input, "pit-size %u", &pit_size))
+ ;
+ else if (unformat (input, "cs-size %u", &cs_size))
+ ;
+ else if (unformat (input, "pit-lifetime-max %u", &pit_lifetime_max_sec))
+ ;
+ else if (unformat (input, "cs-reserved-app %u", &cs_reserved))
+ ;
+ else
+ break;
+// clib_error_return (0,
+// "hICN parameter unknown");
+ }
+
+ unformat_free (input);
+
+ hicn_infra_plugin_enable_disable (1, pit_size,
+ pit_lifetime_max_sec,
+ cs_size, cs_reserved);
+
+
+ return 0;
+}
+
+VLIB_CONFIG_FUNCTION (hicn_configure, "hicn");
+
/*
* Init entry-point for the icn plugin
*/
diff --git a/hicn-plugin/src/hicn_api.c b/hicn-plugin/src/hicn_api.c
index 42c7a804a..f8933206d 100644
--- a/hicn-plugin/src/hicn_api.c
+++ b/hicn-plugin/src/hicn_api.c
@@ -112,20 +112,10 @@ vl_api_hicn_api_node_params_set_t_handler (vl_api_hicn_api_node_params_set_t *
pit_max_size =
pit_max_size == -1 ? HICN_PARAM_PIT_ENTRIES_DFLT : pit_max_size;
- f64 pit_dflt_lifetime_sec = mp->pit_dflt_lifetime_sec;
- pit_dflt_lifetime_sec =
- pit_dflt_lifetime_sec ==
- -1 ? HICN_PARAM_PIT_LIFETIME_DFLT_DFLT_MS : pit_dflt_lifetime_sec;
-
- f64 pit_min_lifetime_sec = mp->pit_min_lifetime_sec;
- pit_min_lifetime_sec =
- pit_min_lifetime_sec ==
- -1 ? HICN_PARAM_PIT_LIFETIME_DFLT_MIN_MS : pit_min_lifetime_sec;
-
f64 pit_max_lifetime_sec = mp->pit_max_lifetime_sec;
pit_max_lifetime_sec =
pit_max_lifetime_sec ==
- -1 ? HICN_PARAM_PIT_LIFETIME_DFLT_MAX_MS : pit_max_lifetime_sec;
+ -1 ? HICN_PARAM_PIT_LIFETIME_DFLT_MAX_MS / SEC_MS : pit_max_lifetime_sec;
int cs_max_size = clib_net_to_host_i32 (mp->cs_max_size);
cs_max_size = cs_max_size == -1 ? HICN_PARAM_CS_ENTRIES_DFLT : cs_max_size;
@@ -136,8 +126,6 @@ vl_api_hicn_api_node_params_set_t_handler (vl_api_hicn_api_node_params_set_t *
rv = hicn_infra_plugin_enable_disable ((int) (mp->enable_disable),
pit_max_size,
- pit_dflt_lifetime_sec,
- pit_min_lifetime_sec,
pit_max_lifetime_sec,
cs_max_size, cs_reserved_app);
@@ -159,8 +147,6 @@ vl_api_hicn_api_node_params_get_t_handler (vl_api_hicn_api_node_params_get_t *
rmp->is_enabled = sm->is_enabled;
rmp->feature_cs = HICN_FEATURE_CS;
rmp->pit_max_size = clib_host_to_net_u32 (hicn_infra_pit_size);
- rmp->pit_dflt_lifetime_sec = ((f64) sm->pit_lifetime_dflt_ms) / SEC_MS;
- rmp->pit_min_lifetime_sec = ((f64) sm->pit_lifetime_min_ms) / SEC_MS;
rmp->pit_max_lifetime_sec = ((f64) sm->pit_lifetime_max_ms) / SEC_MS;
rmp->cs_max_size = clib_host_to_net_u32 (hicn_infra_cs_size);
rmp->retval = clib_host_to_net_i32 (rv);
@@ -491,18 +477,17 @@ static void vl_api_hicn_api_route_get_t_handler
static void
send_route_details (vl_api_registration_t * reg,
- const fib_prefix_t *pfx, u32 context)
+ const fib_prefix_t * pfx, u32 context)
{
vl_api_hicn_api_routes_details_t *mp;
hicn_main_t *hm = &hicn_main;
mp = vl_msg_api_alloc (sizeof (*mp));
memset (mp, 0, sizeof (*mp));
- mp->_vl_msg_id =
- htons (VL_API_HICN_API_ROUTES_DETAILS + hm->msg_id_base);
+ mp->_vl_msg_id = htons (VL_API_HICN_API_ROUTES_DETAILS + hm->msg_id_base);
mp->context = context;
- clib_memcpy(&mp->prefix, &pfx->fp_addr, sizeof(ip46_address_t));
+ clib_memcpy (&mp->prefix, &pfx->fp_addr, sizeof (ip46_address_t));
mp->len = pfx->fp_len;
mp->nfaces = 0;
@@ -511,21 +496,25 @@ send_route_details (vl_api_registration_t * reg,
hicn_dpo_ctx_t *hicn_dpo_ctx;
u32 fib_index;
- int rv = hicn_route_get_dpo (&pfx->fp_addr, pfx->fp_len, &hicn_dpo_id, &fib_index);
+ int rv =
+ hicn_route_get_dpo (&pfx->fp_addr, pfx->fp_len, &hicn_dpo_id, &fib_index);
if (rv == HICN_ERROR_NONE)
{
- hicn_dpo_vft = hicn_dpo_get_vft(hicn_dpo_id->dpoi_type);
- hicn_dpo_ctx = hicn_dpo_vft->hicn_dpo_get_ctx(hicn_dpo_id->dpoi_index);
+ hicn_dpo_vft = hicn_dpo_get_vft (hicn_dpo_id->dpoi_type);
+ hicn_dpo_ctx = hicn_dpo_vft->hicn_dpo_get_ctx (hicn_dpo_id->dpoi_index);
for (int i = 0; i < hicn_dpo_ctx->entry_count; i++)
- {
- if (dpo_id_is_valid(&hicn_dpo_ctx->next_hops[i]))
- {
- mp->faceids[i] = clib_host_to_net_u32(((dpo_id_t *) &hicn_dpo_ctx->next_hops[i])->dpoi_index);
- mp->nfaces++;
- }
- }
- mp->strategy_id = clib_host_to_net_u32(hicn_dpo_get_vft_id(hicn_dpo_id));
+ {
+ if (dpo_id_is_valid (&hicn_dpo_ctx->next_hops[i]))
+ {
+ mp->faceids[i] =
+ clib_host_to_net_u32 (((dpo_id_t *) & hicn_dpo_ctx->
+ next_hops[i])->dpoi_index);
+ mp->nfaces++;
+ }
+ }
+ mp->strategy_id =
+ clib_host_to_net_u32 (hicn_dpo_get_vft_id (hicn_dpo_id));
}
vl_api_send_msg (reg, (u8 *) mp);
@@ -537,41 +526,40 @@ typedef struct vl_api_hicn_api_route_dump_walk_ctx_t_
} vl_api_hicn_api_route_dump_walk_ctx_t;
static fib_table_walk_rc_t
-vl_api_hicn_api_route_dump_walk(fib_node_index_t fei, void *arg)
+vl_api_hicn_api_route_dump_walk (fib_node_index_t fei, void *arg)
{
vl_api_hicn_api_route_dump_walk_ctx_t *ctx = arg;
int found = 0;
const dpo_id_t *former_dpo_id;
/* Route already existing. We need to update the dpo. */
- const dpo_id_t * load_balance_dpo_id =
+ const dpo_id_t *load_balance_dpo_id =
fib_entry_contribute_ip_forwarding (fei);
/* The dpo is not a load balance dpo as expected */
if (load_balance_dpo_id->dpoi_type == DPO_LOAD_BALANCE)
{
/* former_dpo_id is a load_balance dpo */
- load_balance_t *lb =
- load_balance_get (load_balance_dpo_id->dpoi_index);
+ load_balance_t *lb = load_balance_get (load_balance_dpo_id->dpoi_index);
/* FIB entry exists but there is no hicn dpo. */
for (int i = 0; i < lb->lb_n_buckets && !found; i++)
- {
- former_dpo_id = load_balance_get_bucket_i (lb, i);
-
- if (dpo_is_hicn (former_dpo_id))
- {
- vec_add1 (ctx->feis, fei);
- }
- }
+ {
+ former_dpo_id = load_balance_get_bucket_i (lb, i);
+
+ if (dpo_is_hicn (former_dpo_id))
+ {
+ vec_add1 (ctx->feis, fei);
+ }
+ }
}
return (FIB_TABLE_WALK_CONTINUE);
}
static void
-vl_api_hicn_api_routes_dump_t_handler
-(vl_api_hicn_api_face_stats_dump_t * mp)
+ vl_api_hicn_api_routes_dump_t_handler
+ (vl_api_hicn_api_face_stats_dump_t * mp)
{
vl_api_registration_t *reg;
fib_table_t *fib_table;
@@ -580,34 +568,34 @@ vl_api_hicn_api_routes_dump_t_handler
fib_node_index_t *lfeip;
const fib_prefix_t *pfx;
vl_api_hicn_api_route_dump_walk_ctx_t ctx = {
- .feis = NULL,
+ .feis = NULL,
};
reg = vl_api_client_index_to_registration (mp->client_index);
if (!reg)
return;
- pool_foreach (fib_table, im->fibs,
- ({
- fib_table_walk(fib_table->ft_index,
- FIB_PROTOCOL_IP4,
- vl_api_hicn_api_route_dump_walk,
- &ctx);
- }));
-
- pool_foreach (fib_table, im6->fibs,
- ({
- fib_table_walk(fib_table->ft_index,
- FIB_PROTOCOL_IP6,
- vl_api_hicn_api_route_dump_walk,
- &ctx);
- }));
+ pool_foreach (fib_table, im->fibs, (
+ {
+ fib_table_walk (fib_table->ft_index,
+ FIB_PROTOCOL_IP4,
+ vl_api_hicn_api_route_dump_walk,
+ &ctx);}
+ ));
+
+ pool_foreach (fib_table, im6->fibs, (
+ {
+ fib_table_walk (fib_table->ft_index,
+ FIB_PROTOCOL_IP6,
+ vl_api_hicn_api_route_dump_walk,
+ &ctx);}
+ ));
vec_foreach (lfeip, ctx.feis)
- {
- pfx = fib_entry_get_prefix (*lfeip);
- send_route_details (reg, pfx, mp->context);
- }
+ {
+ pfx = fib_entry_get_prefix (*lfeip);
+ send_route_details (reg, pfx, mp->context);
+ }
vec_free (ctx.feis);
@@ -842,7 +830,7 @@ hicn_face_api_entry_params_serialize (hicn_face_id_t faceid,
clib_host_to_net_u64 (face_ip->remote_addr.as_u64[1]);
reply->swif = clib_host_to_net_u32 (face->shared.sw_if);
reply->flags = clib_host_to_net_u32 (face->shared.flags);
- reply->faceid = clib_host_to_net_u32(faceid);
+ reply->faceid = clib_host_to_net_u32 (faceid);
}
else
rv = HICN_ERROR_FACE_IP_ADJ_NOT_FOUND;
diff --git a/hicn-plugin/src/hicn_api_test.c b/hicn-plugin/src/hicn_api_test.c
index e73538814..8cd4ece36 100644
--- a/hicn-plugin/src/hicn_api_test.c
+++ b/hicn-plugin/src/hicn_api_test.c
@@ -150,8 +150,7 @@ api_hicn_api_node_params_set (vat_main_t * vam)
unformat_input_t *input = vam->input;
int enable_disable = 1;
int pit_size = -1, cs_size = -1;
- f64 pit_dflt_lifetime_sec = -1.0f;
- f64 pit_min_lifetime_sec = -1.0f, pit_max_lifetime_sec = -1.0f;
+ f64 pit_max_lifetime_sec = -1.0f;
int ret;
vl_api_hicn_api_node_params_set_t *mp;
@@ -169,12 +168,6 @@ api_hicn_api_node_params_set (vat_main_t * vam)
else if (unformat (input, "CS size %d", &cs_size))
{;
}
- else if (unformat (input, "PIT dfltlife %f", &pit_dflt_lifetime_sec))
- {;
- }
- else if (unformat (input, "PIT minlife %f", &pit_min_lifetime_sec))
- {;
- }
else if (unformat (input, "PIT maxlife %f", &pit_max_lifetime_sec))
{;
}
@@ -189,8 +182,6 @@ api_hicn_api_node_params_set (vat_main_t * vam)
mp->enable_disable = enable_disable;
mp->pit_max_size = clib_host_to_net_i32 (pit_size);
mp->cs_max_size = clib_host_to_net_i32 (cs_size);
- mp->pit_dflt_lifetime_sec = pit_dflt_lifetime_sec;
- mp->pit_min_lifetime_sec = pit_min_lifetime_sec;
mp->pit_max_lifetime_sec = pit_max_lifetime_sec;
/* send it... */
@@ -250,8 +241,6 @@ static void
mp->is_enabled,
mp->feature_cs,
clib_net_to_host_u32 (mp->pit_max_size),
- mp->pit_dflt_lifetime_sec,
- mp->pit_min_lifetime_sec,
mp->pit_max_lifetime_sec, clib_net_to_host_u32 (mp->cs_max_size));
}
@@ -627,7 +616,7 @@ api_hicn_api_route_get (vat_main_t * vam)
}
static int
-api_hicn_api_routes_dump (vat_main_t *vam)
+api_hicn_api_routes_dump (vat_main_t * vam)
{
hicn_test_main_t *hm = &hicn_test_main;
@@ -708,8 +697,8 @@ vl_api_hicn_api_route_get_reply_t_handler (vl_api_hicn_api_route_get_reply_t *
/* face_stats-details message handler */
static void
-vl_api_hicn_api_routes_details_t_handler
-(vl_api_hicn_api_routes_details_t * mp)
+ vl_api_hicn_api_routes_details_t_handler
+ (vl_api_hicn_api_routes_details_t * mp)
{
vat_main_t *vam = hicn_test_main.vat_main;
@@ -717,14 +706,15 @@ vl_api_hicn_api_routes_details_t_handler
u8 *sbuf = 0;
vec_reset_length (sbuf);
- sbuf = format (sbuf, "Prefix: %U/%u\n", format_ip46_address, &mp->prefix, 0, mp->len);
+ sbuf =
+ format (sbuf, "Prefix: %U/%u\n", format_ip46_address, &mp->prefix, 0,
+ mp->len);
sbuf = format (sbuf, "Faces: \n");
- for( int i = 0; i < mp->nfaces; i++)
+ for (int i = 0; i < mp->nfaces; i++)
{
faceid = clib_net_to_host_u32 (mp->faceids[i]);
- sbuf =
- format (sbuf, " faceid %d\n", faceid);
+ sbuf = format (sbuf, " faceid %d\n", faceid);
}
fformat (vam->ofp, "%sStrategy: %d\n",
diff --git a/hicn-plugin/src/infra.h b/hicn-plugin/src/infra.h
index a9744fe97..b859b8e46 100644
--- a/hicn-plugin/src/infra.h
+++ b/hicn-plugin/src/infra.h
@@ -38,15 +38,9 @@ typedef struct hicn_main_s
/* Global PIT lifetime info */
/*
- * Default PIT entry timeout to use in case an interest does not
- * contain a valid interest lifetime
+ * Boundaries for the interest lifetime. If greater than
+ * pit_lifetime_max_ms, pit_lifetime_max_ms is used in the PIT
*/
- u64 pit_lifetime_dflt_ms;
- /*
- * Boundarier for the interest lifetime. If outside,
- * pit_lifetime_dflt_ms is used in the PIT
- */
- u64 pit_lifetime_min_ms;
u64 pit_lifetime_max_ms;
} hicn_main_t;
@@ -65,8 +59,6 @@ u32 hicn_infra_cs_size;
* Enable the time the hICN plugin and set the forwarder parameters.
* @param enable_disable 1 if to enable, 0 otherwisw (currently only enable is supported)
* @param pit_max_size Max size of the PIT
- * @param pit_dflt_lifetime_sec_req Default PIT entry timeout to use in case an interest does not contain a valid interest lifetime
- * @param pit_min_lifetime_sec_req Minimum timeout allowed for a PIT entry lifetime
* @param pit_max_lifetime_sec_req Maximum timeout allowed for a PIT entry lifetime
* @param cs_max_size CS size. Must be <= than pit_max_size
* @param cs_reserved_app Amount of CS reserved for application faces
@@ -74,8 +66,6 @@ u32 hicn_infra_cs_size;
int
hicn_infra_plugin_enable_disable (int enable_disable,
int pit_max_size,
- f64 pit_dflt_lifetime_sec_req,
- f64 pit_min_lifetime_sec_req,
f64 pit_max_lifetime_sec_req,
int cs_max_size, int cs_reserved_app);
diff --git a/hicn-plugin/src/mgmt.c b/hicn-plugin/src/mgmt.c
index b992ba15c..cfeef6cb6 100644
--- a/hicn-plugin/src/mgmt.c
+++ b/hicn-plugin/src/mgmt.c
@@ -66,10 +66,6 @@ hicn_mgmt_node_stats_get (vl_api_hicn_api_node_stats_get_reply_t * rmp)
rmp->pkts_processed +=
clib_host_to_net_u64 (em->counters[node_cntr_base_idx +
HICNFWD_ERROR_PROCESSED]);
- n =
- vlib_get_node (this_vlib_main,
- hicn_data_pcslookup_node.index);
- node_cntr_base_idx = n->error_heap_index;
rmp->pkts_data_count +=
clib_host_to_net_u64 (em->counters[node_cntr_base_idx +
HICNFWD_ERROR_DATAS]);
diff --git a/hicn-plugin/src/params.h b/hicn-plugin/src/params.h
index 5e9d20ab7..a484d076a 100644
--- a/hicn-plugin/src/params.h
+++ b/hicn-plugin/src/params.h
@@ -62,13 +62,11 @@ STATIC_ASSERT ((ceil (log2 ((HICN_PARAM_PIT_ENTRY_PHOPS_MAX - 4)))) ==
STATIC_ASSERT ((HICN_PARAM_PIT_ENTRY_PHOPS_MAX <= HICN_PARAM_FACES_MAX),
"HICN_PARAM_PIT_ENTRY_PHOP_MAX must be <= than HICN_PARAM_FACES_MAX");
-// PIT lifetime limits on API override this(in mseconds, integer type)
-#define HICN_PARAM_PIT_LIFETIME_BOUND_MIN_SEC 100
-#define HICN_PARAM_PIT_LIFETIME_BOUND_MAX_SEC 20000
+// PIT lifetime limits on API override this(in seconds, integer type)
+#define HICN_PARAM_PIT_LIFETIME_BOUND_MIN_SEC 0
+#define HICN_PARAM_PIT_LIFETIME_BOUND_MAX_SEC 200
//PIT lifetime params if not set at API(in mseconds, integer type)
-#define HICN_PARAM_PIT_LIFETIME_DFLT_MIN_MS 200
-#define HICN_PARAM_PIT_LIFETIME_DFLT_DFLT_MS 20000
#define HICN_PARAM_PIT_LIFETIME_DFLT_MAX_MS 20000
// Face CS reservation params
@@ -92,6 +90,7 @@ STATIC_ASSERT ((HICN_PARAM_PIT_ENTRY_PHOPS_MAX <= HICN_PARAM_FACES_MAX),
/* CS reserved portion for applications */
#define HICN_PARAM_CS_RESERVED_APP 50 //%
+#define HICN_PARAM_CS_MIN_MBUF 4096 //this seems to be the minumim default number of mbuf we can have in vpp
/* Cloning parameters */
/* ip4 */
diff --git a/hicn-plugin/src/pcs.h b/hicn-plugin/src/pcs.h
index 28f9c3c37..c7e8a4b59 100644
--- a/hicn-plugin/src/pcs.h
+++ b/hicn-plugin/src/pcs.h
@@ -685,9 +685,9 @@ hicn_pcs_pit_delete (hicn_pit_cs_t * pitcs, hicn_pcs_entry_t ** pcs_entryp,
const hicn_dpo_vft_t * dpo_vft, dpo_id_t * hicn_dpo_id)
{
hash_entry->locks--;
- pitcs->pcs_pit_count--;
if (hash_entry->locks == 0)
{
+ pitcs->pcs_pit_count--;
hicn_pcs_delete_internal
(pitcs, pcs_entryp, hash_entry, node, vm, dpo_vft, hicn_dpo_id);
}
diff --git a/hicn-plugin/src/strategy.c b/hicn-plugin/src/strategy.c
index a6c058e4f..d07045a72 100644
--- a/hicn-plugin/src/strategy.c
+++ b/hicn-plugin/src/strategy.c
@@ -77,10 +77,9 @@ hicn_new_interest (hicn_strategy_runtime_t * rt, vlib_buffer_t * b0,
hicn_ops_vft[type.l1]->get_lifetime (type, &hicn0->protocol,
&imsg_lifetime);
- if (imsg_lifetime < sm->pit_lifetime_min_ms
- || imsg_lifetime > sm->pit_lifetime_max_ms)
+ if (imsg_lifetime > sm->pit_lifetime_max_ms)
{
- imsg_lifetime = sm->pit_lifetime_dflt_ms;
+ imsg_lifetime = sm->pit_lifetime_max_ms;
}
pitp->shared.expire_time = hicn_pcs_get_exp_time (tnow, imsg_lifetime);
@@ -210,8 +209,9 @@ hicn_forward_interest_fn (vlib_main_t * vm,
*/
if (PREDICT_TRUE
(ret == HICN_ERROR_NONE && HICN_IS_NAMEHASH_CACHED (b0)
- && strategy->hicn_select_next_hop (vnet_buffer (b0)->ip.
- adj_index[VLIB_TX], &nh_idx,
+ && strategy->hicn_select_next_hop (vnet_buffer (b0)->
+ ip.adj_index[VLIB_TX],
+ &nh_idx,
&outface) ==
HICN_ERROR_NONE))
{