summaryrefslogtreecommitdiffstats
path: root/hicn-plugin
diff options
context:
space:
mode:
authorAlberto Compagno <acompagn+fdio@cisco.com>2019-10-01 18:09:01 +0200
committerAlberto Compagno <acompagn+fdio@cisco.com>2019-10-06 23:27:05 +0200
commitdf63161bafa18c05318e7a87fd6422b1095e1a5a (patch)
tree4175ab5b02251741bb63ff9e157c53a509700d44 /hicn-plugin
parent85a791ac2cdd35d79c00141e748b4c68fbdafb0d (diff)
[HICN-287] Adding hicn section to the startup.conf
Checking if the size of the CS is greater than the number of vlib buffers available and size it accordingly. Removed unused parameters to set PIT lifetime Change-Id: I47679466542d4338e447d9e0b956038143164020 Signed-off-by: Alberto Compagno <acompagn+fdio@cisco.com>
Diffstat (limited to 'hicn-plugin')
-rw-r--r--hicn-plugin/CMakeLists.txt4
-rw-r--r--hicn-plugin/README.md2
-rw-r--r--hicn-plugin/cmake/Modules/Packaging.cmake15
-rw-r--r--hicn-plugin/scripts/post19
-rw-r--r--hicn-plugin/scripts/postinst18
-rw-r--r--hicn-plugin/scripts/postun5
-rw-r--r--hicn-plugin/src/cli.c72
-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/params.h9
-rw-r--r--hicn-plugin/src/strategy.c10
14 files changed, 210 insertions, 218 deletions
diff --git a/hicn-plugin/CMakeLists.txt b/hicn-plugin/CMakeLists.txt
index 4a6d5e47d..0da096e22 100644
--- a/hicn-plugin/CMakeLists.txt
+++ b/hicn-plugin/CMakeLists.txt
@@ -189,6 +189,9 @@ set(HICN_VAPI_GENERATED_FILES
${CMAKE_CURRENT_BINARY_DIR}/vpp_plugins/hicn/hicn.api.vapi.h
${CMAKE_CURRENT_BINARY_DIR}/vpp_plugins/hicn/hicn.api.vapi.hpp)
+set(HICN_VPP_STARTUP_CONF_FILE
+ ${CMAKE_BINARY_DIR}/startup.conf)
+
if (NOT VPP_HOME)
set(VPP_HOME /usr)
endif()
@@ -266,6 +269,7 @@ add_library(hicn_api_test_plugin SHARED
set(VPP_INSTALL_PLUGIN ${HICN_INSTALL_PREFIX}/vpp_plugins)
set(VPP_INSTALL_API_TEST_PLUGIN ${HICN_INSTALL_PREFIX}/vpp_api_test_plugins CACHE STRING "vpp_install_api_test_plugin")
+set(VPP_STARTUP_CONF /etc/vpp/)
set_target_properties(hicn_plugin
PROPERTIES
diff --git a/hicn-plugin/README.md b/hicn-plugin/README.md
index 5da8d6a5b..664b9a446 100644
--- a/hicn-plugin/README.md
+++ b/hicn-plugin/README.md
@@ -186,7 +186,7 @@ vpp# hicn ?
```
hicn control param { pit { size <entries> | { dfltlife | minlife | maxlife } <seconds> } | cs {size <entries> | app <portion to reserved to app>} }
- <entries> :set the maximum number of entry in the PIT or CS. Default for PIT is 131072, for CS is 4096.
+ <entries> :set the maximum number of entry in the PIT or CS. Default for PIT is 131072, for CS is 4096. CS size cannot be grater than PIT size. Moreover CS size must be smaller than (# of vlib buffer - 8196).
<seconds> :set the default, maximum or minimum lifetime of pit entries. Default value 2s (default), 0.2s (minumum), 20s (maximum)
<portion to reserved to app> :set the portion of CS to reserve to application running locally on the forwarder. Default is 30% of the cs size.
```
diff --git a/hicn-plugin/cmake/Modules/Packaging.cmake b/hicn-plugin/cmake/Modules/Packaging.cmake
index 8cace744b..61453d6fd 100644
--- a/hicn-plugin/cmake/Modules/Packaging.cmake
+++ b/hicn-plugin/cmake/Modules/Packaging.cmake
@@ -29,3 +29,18 @@ set(${HICN_PLUGIN}_RPM_DEPENDENCIES
"vpp >= stable_version-release, vpp < next_version-release, vpp-plugins >= stable_version-release, vpp-plugins < next_version-release"
CACHE STRING "Dependencies for deb/rpm package."
)
+
+set(${HICN_PLUGIN}_DEB_PACKAGE_CONTROL_EXTRA
+ "${CMAKE_CURRENT_SOURCE_DIR}/scripts/postinst"
+ CACHE STRING "Control scripts conffiles, postinst, postrm, prerm."
+)
+
+set(${HICN_PLUGIN}_RPM_POST_INSTALL_SCRIPT_FILE
+ "${CMAKE_CURRENT_SOURCE_DIR}/scripts/post"
+ CACHE STRING "Install script that will be copied in the %post section"
+)
+
+set(${HICN_PLUGIN}_RPM_POST_UNINSTALL_SCRIPT_FILE
+ "${CMAKE_CURRENT_SOURCE_DIR}/scripts/postun"
+ CACHE STRING "Uninstall script that will be copied in the %postun section"
+) \ No newline at end of file
diff --git a/hicn-plugin/scripts/post b/hicn-plugin/scripts/post
new file mode 100644
index 000000000..3cde599ca
--- /dev/null
+++ b/hicn-plugin/scripts/post
@@ -0,0 +1,19 @@
+#!/bin/bash
+
+if [ -e /etc/vpp/startup.conf ]; then
+ if ! grep -q "hicn" /etc/vpp/startup.conf; then
+ printf '\n hicn {
+ ## Set PIT size. Default is 131 072 entries
+ # pit-size 500000
+ #
+ ## Set CS size. Default is 4096
+ # cs-size 50000
+ #
+ ## Set maximum PIT entries lifetime in milliseconds. Assigned to a PIT entry in case an interest carries a bigger lifetime
+ # pit-lifetime-max 20
+ #
+ ## Percentage of CS to reserve for application producer faces
+ # cs-reserved-app 20\n}' >> /etc/vpp/startup.conf
+ fi;
+fi;
+ln -s /usr/lib64/vpp_plugins/hicn_plugin.so /usr/lib/vpp_plugins/hicn_plugin.so \ No newline at end of file
diff --git a/hicn-plugin/scripts/postinst b/hicn-plugin/scripts/postinst
new file mode 100644
index 000000000..012fc3571
--- /dev/null
+++ b/hicn-plugin/scripts/postinst
@@ -0,0 +1,18 @@
+#!/bin/bash
+
+if [ -e /etc/vpp/startup.conf ]; then
+ if ! grep -q "hicn" /etc/vpp/startup.conf; then
+ printf '\n hicn {
+ ## Set PIT size. Default is 131 072 entries
+ # pit-size 500000
+ #
+ ## Set CS size. Default is 4096
+ # cs-size 50000
+ #
+ ## Set maximum PIT entries lifetime in milliseconds. Assigned to a PIT entry in case an interest carries a bigger lifetime
+ # pit-lifetime-max 20
+ #
+ ## Percentage of CS to reserve for application producer faces
+ # cs-reserved-app 20\n}' >> /etc/vpp/startup.conf
+ fi;
+fi; \ No newline at end of file
diff --git a/hicn-plugin/scripts/postun b/hicn-plugin/scripts/postun
new file mode 100644
index 000000000..c319f014e
--- /dev/null
+++ b/hicn-plugin/scripts/postun
@@ -0,0 +1,5 @@
+#!/bin/bash
+
+if [ -L /usr/lib/vpp_plugins/hicn_plugin.so ]; then
+ rm /usr/lib/vpp_plugins/hicn_plugin.so
+fi; \ No newline at end of file
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/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 7db6cca79..9bca748e6 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/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/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))
{