summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--cmake/Modules/Packager.cmake12
-rw-r--r--ctrl/sysrepo-plugins/README.md200
-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
16 files changed, 278 insertions, 362 deletions
diff --git a/cmake/Modules/Packager.cmake b/cmake/Modules/Packager.cmake
index 27a269b88..898e40bcb 100644
--- a/cmake/Modules/Packager.cmake
+++ b/cmake/Modules/Packager.cmake
@@ -116,6 +116,10 @@ macro(make_packages)
set(CPACK_${type}_${uc}_PACKAGE_DEPENDS "${DEB_DEPS}")
set(CPACK_${type}_${uc}_PACKAGE_NAME "${lc}")
set(CPACK_COMPONENT_${uc}_DESCRIPTION "${${lc}_DESCRIPTION}")
+
+ if (NOT ${${lc}_DEB_PACKAGE_CONTROL_EXTRA} STREQUAL "")
+ set(CPACK_DEBIAN_${uc}_PACKAGE_CONTROL_EXTRA "${${lc}_DEB_PACKAGE_CONTROL_EXTRA}")
+ endif()
endforeach()
elseif(OS_ID_LIKE MATCHES "rhel")
set(CPACK_GENERATOR "RPM")
@@ -152,6 +156,14 @@ macro(make_packages)
set(CPACK_RPM_${uc}_PACKAGE_NAME "${package_name}")
set(CPACK_${type}_${uc}_FILE_NAME "${package_name}-${rpm_ver}.${arch}.rpm")
+
+ if (NOT ${${lc}_RPM_POST_INSTALL_SCRIPT_FILE} STREQUAL "")
+ set(CPACK_RPM_${uc}_POST_INSTALL_SCRIPT_FILE "${${lc}_RPM_POST_INSTALL_SCRIPT_FILE}")
+ endif()
+
+ if (NOT ${${lc}_RPM_POST_UNINSTALL_SCRIPT_FILE} STREQUAL "")
+ set(CPACK_RPM_${uc}_POST_UNINSTALL_SCRIPT_FILE "${${lc}_RPM_POST_UNINSTALL_SCRIPT_FILE}")
+ endif()
endforeach()
endif()
diff --git a/ctrl/sysrepo-plugins/README.md b/ctrl/sysrepo-plugins/README.md
index 3f0ed2e34..0940fff67 100644
--- a/ctrl/sysrepo-plugins/README.md
+++ b/ctrl/sysrepo-plugins/README.md
@@ -1,6 +1,8 @@
# Sysrepo plugin for hicn-plugin (2019)
-These plugins serve as a data management agent. They provide yang models via NETCONF to allow the management of hicn-light, and hicn-plugin which runs in VPP instance from out-of-box.
+These plugins serve as a data management agent. They provide yang models via
+NETCONF to allow the management of hicn-light, and hicn-plugin which runs in VPP
+instance from out-of-box.
## Software Requirement
@@ -15,7 +17,7 @@ These plugins serve as a data management agent. They provide yang models via NET
## hICN yang model
You can install the yang model using the following bash script:
-
+```
EXIT_CODE=0
command -v sysrepoctl > /dev/null
if [ $? != 0 ]; then
@@ -24,53 +26,21 @@ if [ $? != 0 ]; then
else
sysrepoctl --install --yang=path_to_hicn_yang_model
fi
-
-hicn.yang can be found in the yang-model. It consists of two container nodes: hicn-conf and hicn-state. One is used to hold the configuration data (i.e., hicn-conf) and one for providing the state data (i.e., hicn-state). The hicn-conf has one node, params, which contains the hICN configuration parameters. Controler can configure these parameters through the edit-config RPC call. This node can be used to enable and to initialize the hicn-plugin in VPP instance. Hicn-state container is used to provide the state data to the controler. It consists of state, strategy, strategies, route, and face-ip-params nodes with the coresponding leaves. In hicn model variety of RPCs are provided to allow controler to communicate with hicn-plugin as well as update the state data in hicn-state. Here you can find the schematic view of the described hicn model:
-
-
-module: hicn
- +--rw hicn-conf
- | +--rw params
- | +--rw enable_disable? boolean
- | +--rw pit_max_size? int32
- | +--rw cs_max_size? int32
- | +--rw cs_reserved_app? int32
- | +--rw pit_dflt_lifetime_sec? float
- | +--rw pit_max_lifetime_sec? float
- | +--rw pit_min_lifetime_sec? float
- +--ro hicn-state
- +--ro states
- | +--ro pkts_processed? uint64
- | +--ro pkts_interest_count? uint64
- | +--ro pkts_data_count? uint64
- | +--ro pkts_from_cache_count? uint64
- | +--ro pkts_no_pit_count? uint64
- | +--ro pit_expired_count? uint64
- | +--ro cs_expired_count? uint64
- | +--ro cs_lru_count? uint64
- | +--ro pkts_drop_no_buf? uint64
- | +--ro interests_aggregated? uint64
- | +--ro interests_retx? uint64
- | +--ro interests_hash_collision? uint64
- | +--ro pit_entries_count? uint64
- | +--ro cs_entries_count? uint64
- | +--ro cs_entries_ntw_count? uint64
- +--ro strategy
- | +--ro description? uint8
- +--ro route
- | +--ro faceids? uint16
- | +--ro strategy_id? uint32
- +--ro strategies
- | +--ro n_strategies? uint8
- | +--ro strategy_id? uint32
- +--ro face-ip-params
- +--ro nh_addr? uint64
- +--ro swif? uint32
- +--ro flags? uint32
-
+```
+hicn.yang can be found in the yang-model. It consists of two container nodes:
+hicn-conf and hicn-state. One is used to hold the configuration data (i.e.,
+hicn-conf) and one for providing the state data (i.e., hicn-state). The
+hicn-conf has one node, params, which contains the hICN configuration
+parameters. A controller can configure these parameters through the edit-config RPC
+call. This node can be used to enable and to initialize the hicn-plugin in VPP
+instance. Hicn-state container is used to provide the state data to the
+controller. It consists of state, strategy, strategies, route, and face-ip-params
+nodes with the corresponding leaves. In the hicn model a variety of RPCs are provided
+to allow controller to communicate with the hicn-plugin as well as update the state
+data in hicn-state.
To setup the startup configuration you can use the following script:
-
+```
EXIT_CODE=0
command -v sysrepocfg > /dev/null
if [ $? != 0 ]; then
@@ -79,10 +49,10 @@ if [ $? != 0 ]; then
else
sysrepocfg -d startup -i path_to_startup_xml -f xml hicn
fi
-
+```
startup.xml is placed in the yang-model. Here you can find the content:
-
+```
<hicn-conf xmlns="urn:sysrepo:hicn">
<params>
<enable_disable>false</enable_disable>
@@ -94,81 +64,17 @@ startup.xml is placed in the yang-model. Here you can find the content:
<pit_min_lifetime_sec>-1</pit_min_lifetime_sec>
</params>
</hicn-conf>
-
-As can be seen, it contains the leaves of the params in hicn-conf node which is used as the startup configuration. This configuration can be changed through the controler by subscribing which changes the target to the running state. hicn yang model provides a list of RPCs which allows controler to communicate directly with the hicn-plugin. This RPCs may also cause the modification in state data. Here you can find the list of RPCs:
-
- rpcs:
- +---x node-params-set
- | +---w input
- | +---w enable_disable? boolean
- | +---w pit_max_size? int32
- | +---w cs_max_size? int32
- | +---w cs_reserved_app? int32
- | +---w pit_dflt_lifetime_sec? float
- | +---w pit_max_lifetime_sec? float
- | +---w pit_min_lifetime_sec? float
- +---x node-params-get
- +---x node-stat-get
- +---x strategy-get
- | +---w input
- | +---w strategy_id? uint32
- +---x strategies-get
- +---x route-get
- | +---w input
- | +---w prefix0? uint64
- | +---w prefix1? uint64
- | +---w len? uint8
- +---x route-del
- | +---w input
- | +---w prefix0? uint64
- | +---w prefix1? uint64
- | +---w len? uint8
- +---x route-nhops-add
- | +---w input
- | +---w prefix0? uint64
- | +---w prefix1? uint64
- | +---w len? uint8
- | +---w face_ids0? uint32
- | +---w face_ids1? uint32
- | +---w face_ids2? uint32
- | +---w face_ids3? uint32
- | +---w face_ids4? uint32
- | +---w face_ids5? uint32
- | +---w face_ids6? uint32
- | +---w n_faces? uint8
- +---x route-nhops-del
- | +---w input
- | +---w prefix0? uint64
- | +---w prefix1? uint64
- | +---w len? uint8
- | +---w faceid? uint16
- +---x face-ip-params-get
- | +---w input
- | +---w faceid? uint16
- +---x face-ip-add
- | +---w input
- | +---w nh_addr0? uint64
- | +---w nh_addr1? uint64
- | +---w swif? uint32
- +---x face-ip-del
- | +---w input
- | +---w faceid? uint16
- +---x punting-add
- | +---w input
- | +---w prefix0? uint64
- | +---w prefix1? uint64
- | +---w len? uint8
- | +---w swif? uint32
- +---x punting-del
- +---w input
- +---w prefix0? uint64
- +---w prefix1? uint64
- +---w len? uint8
- +---w swif? uint32
-
-
-In order to run different RPCs from controler you can use the examples in the controler_rpcs_instances.xml in the yang-model. Here you can find the content:
-
+```
+As can be seen, it contains the leaves of the params in hicn-conf node which is
+used as the startup configuration. This configuration can be changed through the
+controller by subscribing which changes the target to the running state. hicn
+yang model provides a list of RPCs which allows controller to communicate
+directly with the hicn-plugin. This RPCs may also cause the modification in
+state data.
+
+In order to run different RPCs from controller you can use the examples in the
+controler_rpcs_instances.xml in the yang-model. Here you can find the content:
+```
<node-params-get xmlns="urn:sysrepo:hicn"/>
<node-stat-get xmlns="urn:sysrepo:hicn"/>
@@ -179,7 +85,6 @@ In order to run different RPCs from controler you can use the examples in the co
<strategies-get xmlns="urn:sysrepo:hicn"/>
-
<route-get xmlns="urn:sysrepo:hicn">
<prefix0>10</prefix0>
<prefix1>20</prefix1>
@@ -213,7 +118,6 @@ In order to run different RPCs from controler you can use the examples in the co
<faceid>40</faceid>
</route-nhops-del>
-
<face-ip-params-get xmlns="urn:sysrepo:hicn">
<faceid>10</faceid>
</face-ip-params-get>
@@ -235,27 +139,33 @@ In order to run different RPCs from controler you can use the examples in the co
<swif>40</swif>
</punting-add>
-
<punting-del xmlns="urn:sysrepo:hicn">
<prefix0>10</prefix0>
<prefix1>20</prefix1>
<len>30</len>
<swif>40</swif>
</punting-del>
-
+```
## Run the plugin
-Firstly, verify the plugin and binary libraries are located correctly, then run the vpp through (service vpp start). Next, run the sysrepo daemon (sysrepod), for debug mode: sysrepo -d -l 4 which runs with high verbosity. Then, run the sysrepo plugin (sysrepo-plugind), for debug mode: sysrep-plugind -d -l 4 which runs with high verbosity. Now, the hicn sysrepo plugin is loaded. Then, run the netopeer2-server which serves as NETCONF server.
+Firstly, verify the plugin and binary libraries are located correctly, then run
+the vpp through (service vpp start). Next, run the sysrepo daemon (sysrepod),
+for debug mode: sysrepo -d -l 4 which runs with high verbosity. Then, run the
+sysrepo plugin (sysrepo-plugind), for debug mode: sysrep-plugind -d -l 4 which
+runs with high verbosity. Now, the hicn sysrepo plugin is loaded. Then, run the
+netopeer2-server which serves as NETCONF server.
## Connect from netopeer2-cli
In order to connect through the netopeer client run the netopeer2-cli. Then, follow these steps:
-connect --host XXX --login XXX
---> get (you can get the configuration and operational data)
---> get-config (you can get the configuratoin data)
---> edit-config --target running --config (you can modify the configuration but it needs an xml configuration input. For example,
+- connect --host XXX --login XXX
+- get (you can get the configuration and operational data)
+- get-config (you can get the configuration data)
+- edit-config --target running --config
+ you can modify the configuration but it needs an xml configuration input
+```
<hicn-conf xmlns="urn:sysrepo:hicn">
<params>
<enable_disable>false</enable_disable>
@@ -267,15 +177,16 @@ connect --host XXX --login XXX
<pit_min_lifetime_sec>-1</pit_min_lifetime_sec>
</params>
</hicn-conf>
-)
---> user-rpc (you can call one of the rpc proposed by hicn model but it needs an xml input, you can pick one in controler_rpcs_instances.xml)
+```
+- user-rpc (you can call one of the rpc proposed by hicn model but it needs an xml input)
-## Connect from OpenDayligh (ODL) controller
+## Connect from OpenDaylight (ODL) controller
-In order to connect througt the OpenDaylight follow these procedure:
+In order to connect through the OpenDaylight follow these procedure:
- run karaf distribution (./opendayligh_installation_folder/bin/karaf)
-- install the required feature list in DOL (feature:install odl-netconf-server odl-netconf-connector odl-restconf-all odl-netconf-topology or
+- install the required feature list in DOL (feature:install odl-netconf-server
+ odl-netconf-connector odl-restconf-all odl-netconf-topology or
odl-netconf-clustered-topology)
- run a rest client program (e.g., postman or RESTClient)
- mount the remote netopeer2-server to the OpenDaylight by the following REST API:
@@ -283,7 +194,7 @@ In order to connect througt the OpenDaylight follow these procedure:
PUT http://localhost:8181/restconf/config/network-topology:network-topology/topology/topology-netconf/node/hicn-node
with the following body
-
+```
<node xmlns="urn:TBD:params:xml:ns:yang:network-topology">
<node-id>hicn-node</node-id>
<host xmlns="urn:opendaylight:netconf-node-topology">Remote_NETCONF_SERVER_IP</host>
@@ -293,8 +204,8 @@ with the following body
<tcp-only xmlns="urn:opendaylight:netconf-node-topology">false</tcp-only>
<keepalive-delay xmlns="urn:opendaylight:netconf-node-topology">1</keepalive-delay>
</node>
-
-Note that the header files must be set to Content-Type: application/xml, Accept: application/xml. There are more options which can be set but for simplicity we keep a short configuration to mount the remote node.
+```
+Note that the header files must be set to Content-Type: application/xml, Accept: application/xml.
- send the operation through the following REST API:
@@ -304,7 +215,9 @@ The body can be used the same as edit-config in netopeer2-cli.
## Connect from Network Services Orchestrator (NSO)
-To connect NSO to the netopeer2-server, first, you need to write a NED package for your device. The procudeure to create NED for hicn is explaned in the following:
+To connect NSO to the netopeer2-server, first, you need to write a NED package
+for your device. The procedure to create NED for hicn is explained in the
+following:
Place hicn.yang model in a folder called hicn-yang-model, and follow these steps:
@@ -323,7 +236,6 @@ Place hicn.yang model in a folder called hicn-yang-model, and follow these steps
At this point, we are able to connect to the remote device.
-
## Release note
-The current version is compatible with the 19.01 VPP stable and sysrepo 0.7.7.
+The current version is compatible with the 19.01 VPP stable and sysrepo 0.7.7. \ No newline at end of file
diff --git a/hicn-plugin/CMakeLists.txt b/hicn-plugin/CMakeLists.txt
index b6738e5b5..97279e540 100644
--- a/hicn-plugin/CMakeLists.txt
+++ b/hicn-plugin/CMakeLists.txt
@@ -195,6 +195,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()
@@ -273,6 +276,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))
{