summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--hicn-light/CMakeLists.txt5
-rw-r--r--hicn-light/src/CMakeLists.txt36
-rw-r--r--hicn-light/src/command_line/daemon/hicnLightDaemon_main.c7
-rw-r--r--hicn-light/src/config/configuration.c6
-rw-r--r--hicn-light/src/config/configurationListeners.c13
-rw-r--r--hicn-light/src/core/forwarder.c5
-rw-r--r--hicn-plugin/src/cli.c36
-rw-r--r--hicn-plugin/src/data_fwd.h3
-rw-r--r--hicn-plugin/src/data_fwd_node.c98
-rw-r--r--hicn-plugin/src/data_push_node.c274
-rw-r--r--hicn-plugin/src/faces/app/face_prod.c19
-rw-r--r--hicn-plugin/src/faces/face.c2
-rw-r--r--hicn-plugin/src/faces/ip/dpo_ip.h4
-rw-r--r--hicn-plugin/src/faces/ip/face_ip.c34
-rw-r--r--hicn-plugin/src/faces/ip/face_ip_node.c56
-rw-r--r--hicn-plugin/src/faces/ip/iface_ip_node.c39
-rw-r--r--hicn-plugin/src/faces/udp/dpo_udp.h20
-rw-r--r--hicn-plugin/src/faces/udp/face_udp.c67
-rw-r--r--hicn-plugin/src/faces/udp/face_udp_node.c81
-rw-r--r--hicn-plugin/src/faces/udp/iface_udp_node.c96
-rw-r--r--hicn-plugin/src/interest_hitcs_node.c20
-rw-r--r--hicn-plugin/src/params.h2
-rw-r--r--hicn-plugin/src/pcs.h2
-rw-r--r--hicn-plugin/src/strategies/dpo_mw.c32
-rw-r--r--hicn-plugin/src/strategies/strategy_mw.c6
-rw-r--r--hicn-plugin/src/strategy.c10
-rw-r--r--hicn-plugin/src/strategy.h2
-rw-r--r--libtransport/src/hicn/transport/core/memif_connector.cc7
-rw-r--r--libtransport/src/hicn/transport/core/name.cc2
-rw-r--r--libtransport/src/hicn/transport/core/vpp_forwarder_interface.cc19
-rw-r--r--libtransport/src/hicn/transport/utils/epoll_event_reactor.h3
-rw-r--r--pom.xml43
-rw-r--r--utils/src/hiperf.cc2
-rw-r--r--utils/src/ping_server.cc24
34 files changed, 697 insertions, 378 deletions
diff --git a/hicn-light/CMakeLists.txt b/hicn-light/CMakeLists.txt
index 7df740b4c..0d9e4d261 100644
--- a/hicn-light/CMakeLists.txt
+++ b/hicn-light/CMakeLists.txt
@@ -16,6 +16,8 @@ set(CMAKE_MODULE_PATH
set(CMAKE_C_STANDARD 11)
set(CMAKE_C_STANDARD_REQUIRED ON)
+option(ENABLE_PUNTING "Enable punting on linux systems" ON)
+
include( CTest )
include( detectCacheSize )
@@ -24,10 +26,11 @@ if(NOT WIN32)
else ()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /wd4996")
endif ()
+
if(ANDROID_API)
message("############ Detected cross compile for $ENV{CMAKE_SYSTEM_NAME}")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${ANDROID_C_FLAGS}")
- endif()
+endif()
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -DLIBRTA_DISABLE_VALIDATION -DPARCLibrary_DISABLE_VALIDATION")
diff --git a/hicn-light/src/CMakeLists.txt b/hicn-light/src/CMakeLists.txt
index 1951d00f7..851b961c7 100644
--- a/hicn-light/src/CMakeLists.txt
+++ b/hicn-light/src/CMakeLists.txt
@@ -4,7 +4,7 @@ include(BuildMacros)
configure_file(config.h.in config.h @ONLY)
if(NOT ANDROID_API AND NOT COMPILE_FOR_IOS)
- add_subdirectory(command_line)
+ add_subdirectory(command_line)
endif ()
add_subdirectory(config)
@@ -19,27 +19,35 @@ add_subdirectory(strategies)
add_subdirectory(utils)
list(APPEND HEADER_FILES
- ${CMAKE_CURRENT_BINARY_DIR}/config.h
+ ${CMAKE_CURRENT_BINARY_DIR}/config.h
)
-set(COMPILER_DEFINITIONS "-DWITH_MAPME -DWITH_MAPME_FIXES")
+if("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux" AND ENABLE_PUNTING)
+ list(APPEND COMPILER_DEFINITIONS
+ "-DPUNTING"
+ )
+endif()
+
+list(APPEND COMPILER_DEFINITIONS
+ "-DWITH_MAPME -DWITH_MAPME_FIXES"
+)
list(APPEND HICN_LIGHT_INCLUDE_DIRS
- ${CMAKE_CURRENT_SOURCE_DIR}/..
+ ${CMAKE_CURRENT_SOURCE_DIR}/..
)
if (INSTALL_HEADER)
- set(TO_INSTALL_HEADERS ${HEADER_FILES})
+ set(TO_INSTALL_HEADERS ${HEADER_FILES})
endif()
build_library(${LIBHICN_LIGHT}
- STATIC
- SOURCES ${SOURCE_FILES}
- INSTALL_HEADERS ${TO_INSTALL_HEADERS}
- LINK_LIBRARIES ${LIBRARIES}
- DEPENDS ${DEPENDENCIES}
- COMPONENT ${LIBHICN_LIGHT}
- INCLUDE_DIRS ${HICN_LIGHT_INCLUDE_DIRS}
- INSTALL_ROOT_DIR hicn/hicn-light
- DEFINITIONS ${COMPILER_DEFINITIONS}
+ STATIC
+ SOURCES ${SOURCE_FILES}
+ INSTALL_HEADERS ${TO_INSTALL_HEADERS}
+ LINK_LIBRARIES ${LIBRARIES}
+ DEPENDS ${DEPENDENCIES}
+ COMPONENT ${LIBHICN_LIGHT}
+ INCLUDE_DIRS ${HICN_LIGHT_INCLUDE_DIRS}
+ INSTALL_ROOT_DIR hicn/hicn-light
+ DEFINITIONS ${COMPILER_DEFINITIONS}
)
diff --git a/hicn-light/src/command_line/daemon/hicnLightDaemon_main.c b/hicn-light/src/command_line/daemon/hicnLightDaemon_main.c
index ce8c373ca..9a6c352fb 100644
--- a/hicn-light/src/command_line/daemon/hicnLightDaemon_main.c
+++ b/hicn-light/src/command_line/daemon/hicnLightDaemon_main.c
@@ -365,6 +365,13 @@ int main(int argc, const char *argv[]) {
// this will update the clock to the tick clock
Forwarder *forwarder = forwarder_Create(logger);
+ if (forwarder == NULL) {
+ logger_Log(logger, LoggerFacility_Core, PARCLogLevel_Error, "daemon",
+ "Forwarder initialization failed. Are you running it with sudo "
+ "privileges?");
+ return -1;
+ }
+
Configuration *configuration = forwarder_GetConfiguration(forwarder);
if (capacity > -1) {
diff --git a/hicn-light/src/config/configuration.c b/hicn-light/src/config/configuration.c
index 865dbca4d..48c26b4a2 100644
--- a/hicn-light/src/config/configuration.c
+++ b/hicn-light/src/config/configuration.c
@@ -310,8 +310,8 @@ static void configuration_SendResponse(Configuration *config, struct iovec *msg,
}
connection_SendCommandResponse(conn, msg);
- //IoOperations *ops = connection_GetIoOperations(conn);
- //streamState_SendCommandResponse(ops, msg);
+ // IoOperations *ops = connection_GetIoOperations(conn);
+ // streamState_SendCommandResponse(ops, msg);
}
struct iovec *configuration_ProcessCreateTunnel(Configuration *config,
@@ -370,7 +370,7 @@ struct iovec *configuration_ProcessCreateTunnel(Configuration *config,
logger_Log(config->logger, LoggerFacility_Config, PARCLogLevel_Error,
__func__, "Unsupported tunnel protocol: GRE");
break;
-#if !defined(__APPLE__) && !defined(_WIN32)
+#if !defined(__APPLE__) && !defined(_WIN32) && defined(PUNTING)
case HICN_CONN:
ops = hicnTunnel_Create(config->forwarder, source, destination);
break;
diff --git a/hicn-light/src/config/configurationListeners.c b/hicn-light/src/config/configurationListeners.c
index 6539e8c9f..3024d7bba 100644
--- a/hicn-light/src/config/configurationListeners.c
+++ b/hicn-light/src/config/configurationListeners.c
@@ -42,7 +42,7 @@
static bool _setupHicnListenerOnInet4(Forwarder *forwarder,
const char *symbolic, Address *address) {
bool success = false;
-#if !defined(__APPLE__) && !defined(_WIN32)
+#if !defined(__APPLE__) && !defined(_WIN32) && defined(PUNTING)
ListenerOps *ops =
hicnListener_CreateInet(forwarder, (char *)symbolic, address);
if (ops != NULL) {
@@ -57,7 +57,7 @@ static bool _setupHicnListenerOnInet4(Forwarder *forwarder,
static bool _setupHicnListenerOnInet6(Forwarder *forwarder,
const char *symbolic, Address *address) {
bool success = false;
-#if !defined(__APPLE__) && !defined(_WIN32)
+#if !defined(__APPLE__) && !defined(_WIN32) && defined(PUNTING)
ListenerOps *ops =
hicnListener_CreateInet6(forwarder, (char *)symbolic, address);
if (ops != NULL) {
@@ -81,7 +81,7 @@ bool configurationListeners_Remove(const Configuration *config) {
bool _AddPuntingInet(const Configuration *config, Punting *punting,
unsigned ingressId) {
-#if !defined(__APPLE__) && !defined(_WIN32)
+#if !defined(__APPLE__) && !defined(_WIN32) && defined(PUNTING)
struct sockaddr *addr = parcNetwork_SockAddress("0.0.0.0", 1234);
if (addr == NULL) {
printf("Error creating address\n");
@@ -141,7 +141,7 @@ bool _AddPuntingInet(const Configuration *config, Punting *punting,
bool _AddPuntingInet6(const Configuration *config, Punting *punting,
unsigned ingressId) {
-#if !defined(__APPLE__) && !defined(_WIN32)
+#if !defined(__APPLE__) && !defined(_WIN32) && defined(PUNTING)
struct sockaddr *addr = parcNetwork_SockAddress("0::0", 1234);
if (addr == NULL) {
printf("Error creating address\n");
@@ -231,7 +231,6 @@ static bool _setupTcpListenerOnInet(Forwarder *forwarder, ipv4_addr_t *addr4,
static bool _setupUdpListenerOnInet(Forwarder *forwarder, ipv4_addr_t *addr4,
uint16_t *port) {
-
bool success = false;
struct sockaddr_in addr;
@@ -537,6 +536,6 @@ void configurationListeners_SetutpLocalIPv4(const Configuration *config,
uint16_t port) {
Forwarder *forwarder = configuration_GetForwarder(config);
in_addr_t addr = inet_addr("127.0.0.1");
- _setupUdpListenerOnInet(forwarder, (ipv4_addr_t *) &(addr), &port);
- _setupTcpListenerOnInet(forwarder, (ipv4_addr_t *) &(addr), &port);
+ _setupUdpListenerOnInet(forwarder, (ipv4_addr_t *)&(addr), &port);
+ _setupTcpListenerOnInet(forwarder, (ipv4_addr_t *)&(addr), &port);
}
diff --git a/hicn-light/src/core/forwarder.c b/hicn-light/src/core/forwarder.c
index 2b00a35e5..a7d151314 100644
--- a/hicn-light/src/core/forwarder.c
+++ b/hicn-light/src/core/forwarder.c
@@ -197,7 +197,7 @@ Forwarder *forwarder_Create(Logger *logger) {
dispatcher_StartSignalEvent(forwarder->dispatcher, forwarder->signal_usr1);
#endif
-#if !defined(__APPLE__) && !defined(_WIN32)
+#if !defined(__APPLE__) && !defined(_WIN32) && defined(PUNTING)
forwarder->hicnSocketHelper = hicn_create();
if (forwarder->hicnSocketHelper == NULL) return NULL;
#endif /* __APPLE__ */
@@ -237,7 +237,8 @@ void forwarder_Destroy(Forwarder **ptr) {
parcAssertNotNull(ptr, "Parameter must be non-null double pointer");
parcAssertNotNull(*ptr, "Parameter must dereference to non-null pointer");
Forwarder *forwarder = *ptr;
-#if !defined(__APPLE__) && !defined(__ANDROID__) && !defined(_WIN32)
+#if !defined(__APPLE__) && !defined(__ANDROID__) && !defined(_WIN32) && \
+ defined(PUNTING)
hicn_destroy();
#endif
parcEventTimer_Destroy(&(forwarder->keepalive_event));
diff --git a/hicn-plugin/src/cli.c b/hicn-plugin/src/cli.c
index c8c0be4ff..b03d6a29c 100644
--- a/hicn-plugin/src/cli.c
+++ b/hicn-plugin/src/cli.c
@@ -86,9 +86,12 @@ hicn_cli_node_ctl_start_set_command_fn (vlib_main_t * vm,
ret = hicn_infra_plugin_enable_disable (1 /* enable */ ,
node_ctl_params.pit_max_size,
- node_ctl_params.pit_dflt_lifetime_sec,
- node_ctl_params.pit_min_lifetime_sec,
- node_ctl_params.pit_max_lifetime_sec,
+ node_ctl_params.
+ pit_dflt_lifetime_sec,
+ node_ctl_params.
+ pit_min_lifetime_sec,
+ node_ctl_params.
+ pit_max_lifetime_sec,
node_ctl_params.cs_max_size,
node_ctl_params.cs_reserved_app);
@@ -131,9 +134,12 @@ hicn_cli_node_ctl_stop_set_command_fn (vlib_main_t * vm,
}
ret = hicn_infra_plugin_enable_disable (0 /* !enable */ ,
node_ctl_params.pit_max_size,
- node_ctl_params.pit_dflt_lifetime_sec,
- node_ctl_params.pit_min_lifetime_sec,
- node_ctl_params.pit_max_lifetime_sec,
+ node_ctl_params.
+ pit_dflt_lifetime_sec,
+ node_ctl_params.
+ pit_min_lifetime_sec,
+ node_ctl_params.
+ pit_max_lifetime_sec,
node_ctl_params.cs_max_size,
node_ctl_params.cs_reserved_app);
@@ -877,8 +883,8 @@ hicn_cli_pgen_client_set_command_fn (vlib_main_t * vm,
{
/* Add data node to the vpp graph */
u32 next_hit_node = vlib_node_add_next (vm,
- hicn_punt_glb.
- hicn_node_info.ip4_inacl_node_index,
+ hicn_punt_glb.hicn_node_info.
+ ip4_inacl_node_index,
hicn_pg_data_node.index);
/* Add pgen_client node to the vpp graph */
@@ -915,8 +921,8 @@ hicn_cli_pgen_client_set_command_fn (vlib_main_t * vm,
{
/* Add node to the vpp graph */
u32 next_hit_node = vlib_node_add_next (vm,
- hicn_punt_glb.hicn_node_info.
- ip6_inacl_node_index,
+ hicn_punt_glb.
+ hicn_node_info.ip6_inacl_node_index,
hicn_pg_data_node.index);
/* Add pgen_client node to the vpp graph */
@@ -1086,8 +1092,8 @@ hicn_cli_pgen_server_set_command_fn (vlib_main_t * vm,
{
/* Add node to the vpp graph */
u32 next_hit_node = vlib_node_add_next (vm,
- hicn_punt_glb.
- hicn_node_info.ip4_inacl_node_index,
+ hicn_punt_glb.hicn_node_info.
+ ip4_inacl_node_index,
hicn_pg_server_node.index);
/* Create the punting table if it does not exist */
@@ -1113,8 +1119,8 @@ hicn_cli_pgen_server_set_command_fn (vlib_main_t * vm,
{
/* Add node to the vpp graph */
u32 next_hit_node = vlib_node_add_next (vm,
- hicn_punt_glb.hicn_node_info.
- ip6_inacl_node_index,
+ hicn_punt_glb.
+ hicn_node_info.ip6_inacl_node_index,
hicn_pg_server_node.index);
/* Create the punting table if it does not exist */
@@ -1210,7 +1216,7 @@ VLIB_CLI_COMMAND(hicn_cli_show_command, static)=
VLIB_CLI_COMMAND(hicn_cli_punting_command, static)=
{
.path = "hicn punting",
- .short_help = "hicn punting {add|delete} prefix <ip_address/mask> intfc <interface> type <ip/udp>",
+ .short_help = "hicn punting {add|delete} prefix <ip_address/mask> intfc <interface> {type ip | type <udp4|udp6> src_port <port> dst_port <port>}",
.function = hicn_cli_punting_command_fn,
};
diff --git a/hicn-plugin/src/data_fwd.h b/hicn-plugin/src/data_fwd.h
index df74e9150..d5cf3cae4 100644
--- a/hicn-plugin/src/data_fwd.h
+++ b/hicn-plugin/src/data_fwd.h
@@ -73,7 +73,7 @@ vlib_buffer_clone_256_2 (vlib_main_t * vm, u32 src_buffer, u32 * buffers,
ASSERT (n_buffers);
ASSERT (n_buffers <= 256);
- if (s->current_length <= CLIB_CACHE_LINE_BYTES * 2)
+ if (s->current_length <= head_end_offset + CLIB_CACHE_LINE_BYTES * 2)
{
for (i = 0; i < n_buffers; i++)
{
@@ -107,6 +107,7 @@ vlib_buffer_clone_256_2 (vlib_main_t * vm, u32 src_buffer, u32 * buffers,
}
d->flags = s->flags | VLIB_BUFFER_NEXT_PRESENT;
d->flags &= ~VLIB_BUFFER_EXT_HDR_VALID;
+ d->trace_index = s->trace_index;
clib_memcpy (d->opaque, s->opaque, sizeof (s->opaque));
clib_memcpy (d->opaque2, s->opaque2, sizeof (s->opaque2));
clib_memcpy (vlib_buffer_get_current (d), vlib_buffer_get_current (s),
diff --git a/hicn-plugin/src/data_fwd_node.c b/hicn-plugin/src/data_fwd_node.c
index 1d37fdbcc..19181ac03 100644
--- a/hicn-plugin/src/data_fwd_node.c
+++ b/hicn-plugin/src/data_fwd_node.c
@@ -50,7 +50,7 @@ clone_data_to_cs (vlib_main_t * vm, hicn_pit_cs_t * pitcs,
hicn_hash_node_t * nodep, vlib_buffer_t * b0,
hicn_hash_entry_t * hash_entry, u64 name_hash,
hicn_buffer_t * hicnb, const hicn_dpo_vft_t * dpo_vft,
- dpo_id_t * hicn_dpo_id);
+ dpo_id_t * hicn_dpo_id, hicn_lifetime_t dmsg_lifetime);
/* packet trace format function */
@@ -173,6 +173,19 @@ 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);
stats.pit_expired_count++;
+
+ if (PREDICT_FALSE ((node->flags & VLIB_NODE_FLAG_TRACE) &&
+ (b0->flags & VLIB_BUFFER_IS_TRACED)))
+ {
+ hicn_data_fwd_trace_t *t =
+ vlib_add_trace (vm, node, b0, sizeof (*t));
+ t->pkt_type = HICN_PKT_TYPE_CONTENT;
+ t->sw_if_index = vnet_buffer (b0)->sw_if_index[VLIB_RX];
+ t->next_index = next0;
+ clib_memcpy (t->packet_data,
+ vlib_buffer_get_current (b0),
+ sizeof (t->packet_data));
+ }
}
else
{
@@ -208,24 +221,69 @@ hicn_data_node_fn (vlib_main_t * vm, vlib_node_runtime_t * node,
pitp->u.pit.pe_txnh);
#if HICN_FEATURE_CS
- /*
- * Clone data packet in the content store and
- * convert the PIT entry into a CS entry
- */
- clone_data_to_cs (vm, pitcs, pitp, hicn0, tnow, node0,
- b0, hash_entry0, hicnb0->name_hash, hicnb0,
- dpo_vft0, &hicn_dpo_id0);
+ hicn_lifetime_t dmsg_lifetime;
- hicn_pcs_remove_lock (pitcs, &pitp, &node0, vm,
- hash_entry0, NULL, NULL);
+ hicn_type_t type = hicnb0->type;
+ hicn_ops_vft[type.l1]->get_lifetime (type, &hicn0->protocol,
+ &dmsg_lifetime);
+
+ if (dmsg_lifetime)
+ {
+ /*
+ * Clone data packet in the content store and
+ * convert the PIT entry into a CS entry
+ */
+ clone_data_to_cs (vm, pitcs, pitp, hicn0, tnow, node0,
+ b0, hash_entry0, hicnb0->name_hash,
+ hicnb0, dpo_vft0, &hicn_dpo_id0,
+ dmsg_lifetime);
+
+ hicn_pcs_remove_lock (pitcs, &pitp, &node0, vm,
+ hash_entry0, NULL, NULL);
+ }
+ else
+ {
+ /*
+ * If the packet is copied and not cloned, we need to free the vlib_buffer
+ */
+ if (hicnb0->flags & HICN_BUFFER_FLAGS_PKT_LESS_TWO_CL)
+ {
+ vlib_buffer_free_one (vm, bi0);
+ }
+ else
+ {
+ /*
+ * Remove one reference as the buffer is no
+ * longer in any frame. The vlib_buffer will be freed when
+ * all its cloned vlib_buffer will be freed.
+ */
+ b0->n_add_refs--;
+ }
+
+ /* Delete the PIT entry */
+ hicn_pcs_pit_delete (pitcs, &pitp, &node0, vm,
+ hash_entry0, dpo_vft0, &hicn_dpo_id0);
+ }
#else
ASSERT (pitp == hicn_pit_get_data (node0));
/*
- * Remove one reference as the buffer is no
- * longer in any frame
+ * If the packet is copied and not cloned, we need to free the vlib_buffer
*/
- b0->n_add_refs--;
- /* If not enabled, delete the PIT entry */
+ if (hicnb0->flags & HICN_BUFFER_FLAGS_PKT_LESS_TWO_CL)
+ {
+ vlib_buffer_free_one (vm, bi0);
+ }
+ else
+ {
+ /*
+ * Remove one reference as the buffer is no
+ * longer in any frame. The vlib_buffer will be freed when
+ * all its cloned vlib_buffer will be freed.
+ */
+ b0->n_add_refs--;
+ }
+
+ /* Delete the PIT entry */
hicn_pcs_pit_delete (pitcs, &pitp, &node0, vm,
hash_entry0, dpo_vft0, &hicn_dpo_id0);
#endif
@@ -284,8 +342,7 @@ hicn_satisfy_faces (vlib_main_t * vm, u32 bi0,
u32 n_left_from = 0;
u32 next0 = HICN_DATA_FWD_NEXT_ERROR_DROP, next1 =
HICN_DATA_FWD_NEXT_ERROR_DROP;
- u16 buffer_advance = isv6 ? sizeof (ip6_header_t) + sizeof (tcp_header_t) :
- sizeof (ip4_header_t) + sizeof (tcp_header_t);
+ word buffer_advance = CLIB_CACHE_LINE_BYTES * 2;
/*
* We have a hard limit on the number of vlib_buffer that we can
@@ -307,7 +364,7 @@ hicn_satisfy_faces (vlib_main_t * vm, u32 bi0,
* Mark the buffer as smaller than TWO_CL. It will be stored as is in the CS, without excluding
* the hicn_header. Cloning is not possible, it will be copied.
*/
- if (b0->current_length <= buffer_advance + CLIB_CACHE_LINE_BYTES * 2)
+ if (b0->current_length < (buffer_advance + (CLIB_CACHE_LINE_BYTES * 2)))
{
/* In this case the packet is copied. We don't need to add a reference as no buffer are
* chained to it.
@@ -478,9 +535,8 @@ clone_data_to_cs (vlib_main_t * vm, hicn_pit_cs_t * pitcs,
hicn_hash_node_t * nodep, vlib_buffer_t * b0,
hicn_hash_entry_t * hash_entry, u64 name_hash,
hicn_buffer_t * hicnb, const hicn_dpo_vft_t * dpo_vft,
- dpo_id_t * hicn_dpo_id)
+ dpo_id_t * hicn_dpo_id, hicn_lifetime_t dmsg_lifetime)
{
- hicn_lifetime_t dmsg_lifetime;
/*
* At this point we think we're safe to proceed. Store the CS buf in
* the PIT/CS hashtable entry
@@ -498,10 +554,6 @@ clone_data_to_cs (vlib_main_t * vm, hicn_pit_cs_t * pitcs,
pitp->shared.create_time = tnow;
- hicn_type_t type = hicnb0->type;
- hicn_ops_vft[type.l1]->get_lifetime (type, &hicn0->protocol,
- &dmsg_lifetime);
-
if (dmsg_lifetime < HICN_PARAM_CS_LIFETIME_MIN
|| dmsg_lifetime > HICN_PARAM_CS_LIFETIME_MAX)
{
diff --git a/hicn-plugin/src/data_push_node.c b/hicn-plugin/src/data_push_node.c
index a4a25e29b..b955a765d 100644
--- a/hicn-plugin/src/data_push_node.c
+++ b/hicn-plugin/src/data_push_node.c
@@ -22,6 +22,7 @@
#include "infra.h"
#include "mgmt.h"
#include "pcs.h"
+#include "state.h"
/*
* Node context data (to be used in all the strategy nodes); we think this is
@@ -42,6 +43,7 @@ static char *hicn_data_push_error_strings[] = {
typedef enum
{
+ HICN_DATA_PUSH_NEXT_FWD,
HICN_DATA_PUSH_NEXT_ERROR_DROP,
HICN_DATA_PUSH_N_NEXT,
} hicn_data_push_next_t;
@@ -60,64 +62,82 @@ vlib_node_registration_t hicn_data_push_node;
always_inline void
prep_buffer_for_cs (vlib_main_t * vm, vlib_buffer_t * b0, u8 isv6)
{
- if (isv6)
+ word buffer_advance = CLIB_CACHE_LINE_BYTES * 2;
+ hicn_buffer_t *hicnb = hicn_get_buffer (b0);
+
+ if (PREDICT_TRUE (b0->next_buffer == 0))
{
- /* Advance the vlib buffer to the beginning of the TCP header */
- vlib_buffer_advance (b0, sizeof (ip6_header_t) + sizeof (tcp_header_t));
b0->total_length_not_including_first_buffer = 0;
+ b0->flags &= ~VLIB_BUFFER_NEXT_PRESENT;
+ }
+
+ /*
+ * Mark the buffer as smaller than TWO_CL. It will be stored as is in the CS, without excluding
+ * the hicn_header. Cloning is not possible, it will be copied.
+ */
+ if (b0->current_length < (buffer_advance + (CLIB_CACHE_LINE_BYTES * 2)))
+ {
+ /* In this case the packet is copied. We don't need to add a reference as no buffer are
+ * chained to it.
+ */
+ hicnb->flags |= HICN_BUFFER_FLAGS_PKT_LESS_TWO_CL;
}
else
{
- /* Advance the vlib buffer to the beginning of the TCP header */
- vlib_buffer_advance (b0, sizeof (ip4_header_t) + sizeof (tcp_header_t));
- b0->total_length_not_including_first_buffer = 0;
+ vlib_buffer_advance (b0, buffer_advance);
}
}
always_inline int
hicn_new_data (vlib_main_t * vm, hicn_data_push_runtime_t * rt,
- vlib_buffer_t * b0, u32 * next, f64 tnow, u8 * nameptr,
- u16 namelen, u8 isv6)
+ vlib_buffer_t * b0, u32 ** to_forward, u32 * n_to_forward,
+ f64 tnow, u8 * nameptr, u16 namelen, u8 isv6)
{
int ret;
+ u32 bi0 = vlib_get_buffer_index (vm, b0);
hicn_hash_node_t *nodep;
hicn_pcs_entry_t *pitp;
- hicn_header_t *hicn0;
+ hicn_header_t *hicn0 = vlib_buffer_get_current (b0);
hicn_buffer_t *hicnb0 = hicn_get_buffer (b0);
u32 node_id0 = 0;
- u8 dpo_ctx_id0 = 0;
- u8 vft_id0 = 0;
- u8 is_cs0 = 0;
+ u8 dpo_ctx_id0 = ~0;
+ u8 vft_id0 = default_dpo.hicn_dpo_get_type ();
+ u8 is_cs0 = 1;
u8 hash_entry_id = 0;
u32 bucket_id = ~0;
u8 bucket_is_overflow = 0;
hicn_lifetime_t dmsg_lifetime;
+ hicnb0 = hicn_get_buffer (b0);
+ hicn_type_t type = hicnb0->type;
+ hicn_ops_vft[type.l1]->get_lifetime (type, &hicn0->protocol,
+ &dmsg_lifetime);
+
+ if (!dmsg_lifetime)
+ {
+ vlib_buffer_free_one (vm, bi0);
+ return HICN_ERROR_NONE;
+ }
+
/* Create PIT node and init PIT entry */
nodep = hicn_hashtb_alloc_node (rt->pitcs->pcs_table);
if (PREDICT_FALSE (nodep == NULL))
{
+ vlib_buffer_free_one (vm, bi0);
/* Nothing we can do - no mem */
- *next = HICN_DATA_PUSH_NEXT_ERROR_DROP;
return HICN_ERROR_HASHTB_NOMEM;
}
+
pitp = hicn_pit_get_data (nodep);
hicn_pit_init_data (pitp);
pitp->shared.create_time = tnow;
- hicn0 = vlib_buffer_get_current (b0);
-
- hicn_type_t type = hicnb0->type;
- hicn_ops_vft[type.l1]->get_lifetime (type, &hicn0->protocol,
- &dmsg_lifetime);
-
if (dmsg_lifetime < HICN_PARAM_CS_LIFETIME_MIN
|| dmsg_lifetime > HICN_PARAM_CS_LIFETIME_MAX)
{
dmsg_lifetime = HICN_PARAM_CS_LIFETIME_DFLT;
}
pitp->shared.expire_time = hicn_pcs_get_exp_time (tnow, dmsg_lifetime);
- prep_buffer_for_cs (vm, b0, isv6);
/* Store the original packet buffer in the CS node */
pitp->u.cs.cs_pkt_buf = vlib_get_buffer_index (vm, b0);
@@ -138,11 +158,31 @@ hicn_new_data (vlib_main_t * vm, hicn_data_push_runtime_t * rt,
&vft_id0, &is_cs0, &hash_entry_id, &bucket_id,
&bucket_is_overflow);
- hash_entry->he_flags |= HICN_HASH_ENTRY_FLAG_CS_ENTRY;
if (ret != HICN_ERROR_NONE)
{
hicn_hashtb_free_node (rt->pitcs->pcs_table, nodep);
}
+
+ if (ret != HICN_ERROR_HASHTB_NOMEM)
+ {
+ if (!is_cs0)
+ {
+ ASSERT (ret != HICN_ERROR_NONE);
+ hicn_store_internal_state (b0, hicnb0->name_hash, node_id0,
+ dpo_ctx_id0, vft_id0, hash_entry_id,
+ bucket_id, bucket_is_overflow);
+
+ (*to_forward)[0] = bi0;
+ *to_forward += 1;
+ *n_to_forward += 1;
+ }
+ else
+ {
+ hash_entry->he_flags |= HICN_HASH_ENTRY_FLAG_CS_ENTRY;
+ prep_buffer_for_cs (vm, b0, isv6);
+ }
+ }
+
return (ret);
}
@@ -161,144 +201,76 @@ hicn_data_push_fn (vlib_main_t * vm,
hicn_data_push_runtime_t *rt;
vl_api_hicn_api_node_stats_get_reply_t stats = { 0 };
f64 tnow;
+ u32 *to_forward = NULL, *header = NULL, n_to_forward = 0;
from = vlib_frame_vector_args (frame);
n_left_from = frame->n_vectors;
next_index = (hicn_data_push_next_t) node->cached_next_index;
rt = vlib_node_get_runtime_data (vm, hicn_data_push_node.index);
rt->pitcs = &hicn_main.pitcs;
+
+ vec_alloc (to_forward, n_left_from);
+ header = to_forward;
/* Capture time in vpp terms */
tnow = vlib_time_now (vm);
while (n_left_from > 0)
{
- vlib_get_next_frame (vm, node, next_index, to_next, n_left_to_next);
-
- /* Dual loop, X2 */
- while (n_left_from >= 4 && n_left_to_next >= 2)
+ u8 isv6;
+ u8 *nameptr;
+ u16 namelen;
+ hicn_name_t name;
+ hicn_header_t *hicn0;
+ vlib_buffer_t *b0;
+ u32 bi0;
+ int ret0;
+
+ /* Prefetch for next iteration. */
+ if (n_left_from > 1)
{
- u8 isv6_0, isv6_1;
- u8 *nameptr0, *nameptr1;
- u16 namelen0, namelen1;
- hicn_name_t name0, name1;
- hicn_header_t *hicn0, *hicn1;
- vlib_buffer_t *b0, *b1;
- u32 bi0, bi1;
- u32 next0 = next_index, next1 = next_index;
- int ret0, ret1;
-
- /* Prefetch for next iteration. */
- {
- vlib_buffer_t *b2, *b3;
- b2 = vlib_get_buffer (vm, from[2]);
- b3 = vlib_get_buffer (vm, from[3]);
- CLIB_PREFETCH (b2, 2 * CLIB_CACHE_LINE_BYTES, LOAD);
- CLIB_PREFETCH (b3, 2 * CLIB_CACHE_LINE_BYTES, LOAD);
- CLIB_PREFETCH (b2->data, CLIB_CACHE_LINE_BYTES, STORE);
- CLIB_PREFETCH (b3->data, CLIB_CACHE_LINE_BYTES, STORE);
- }
-
- /* Dequeue a packet buffer */
- bi0 = from[0];
- bi1 = from[1];
- from += 2;
- n_left_from -= 2;
- /* to_next[0] = bi0; */
- /* to_next[1] = bi1; */
- /* to_next += 2; */
- /* n_left_to_next -= 2; */
-
- b0 = vlib_get_buffer (vm, bi0);
- b1 = vlib_get_buffer (vm, bi1);
- next0 = next1 = HICN_DATA_PUSH_NEXT_ERROR_DROP;
-
- ret0 = hicn_data_parse_pkt (b0, &name0, &namelen0, &hicn0, &isv6_0);
- ret1 = hicn_data_parse_pkt (b1, &name1, &namelen1, &hicn1, &isv6_1);
-
- nameptr0 = (u8 *) (&name0);
- nameptr1 = (u8 *) (&name1);
- if (PREDICT_TRUE (ret0 == HICN_ERROR_NONE))
- hicn_new_data (vm, rt, b0, &next0, tnow, nameptr0, namelen0,
- isv6_0);
-
- if (PREDICT_TRUE (ret1 == HICN_ERROR_NONE))
- hicn_new_data (vm, rt, b1, &next1, tnow, nameptr1, namelen1,
- isv6_1);
- stats.pkts_data_count += 2;
-
- /* Maybe trace */
- if (PREDICT_FALSE ((node->flags & VLIB_NODE_FLAG_TRACE) &&
- (b0->flags & VLIB_BUFFER_IS_TRACED)))
- {
- hicn_data_push_trace_t *t =
- vlib_add_trace (vm, node, b0, sizeof (*t));
- t->pkt_type = HICN_PKT_TYPE_CONTENT;
- t->sw_if_index = vnet_buffer (b0)->sw_if_index[VLIB_RX];;
- t->next_index = next0;
- }
- if (PREDICT_FALSE ((node->flags & VLIB_NODE_FLAG_TRACE) &&
- (b1->flags & VLIB_BUFFER_IS_TRACED)))
- {
- hicn_data_push_trace_t *t =
- vlib_add_trace (vm, node, b1, sizeof (*t));
- t->pkt_type = HICN_PKT_TYPE_CONTENT;
- t->sw_if_index = vnet_buffer (b1)->sw_if_index[VLIB_RX];;
- t->next_index = next0;
- }
+ vlib_buffer_t *b1;
+ //hicn_buffer_t * hicnb1;
+ b1 = vlib_get_buffer (vm, from[1]);
+ CLIB_PREFETCH (b1, CLIB_CACHE_LINE_BYTES, LOAD);
+ CLIB_PREFETCH (b1->data, CLIB_CACHE_LINE_BYTES, STORE);
}
+ /* Dequeue a packet buffer */
+ bi0 = from[0];
+ from += 1;
+ n_left_from -= 1;
+
+ b0 = vlib_get_buffer (vm, bi0);
- /* Dual loop, X1 */
- while (n_left_from > 0 && n_left_to_next > 0)
+ ret0 = hicn_data_parse_pkt (b0, &name, &namelen, &hicn0, &isv6);
+ nameptr = (u8 *) (&name);
+
+ if (PREDICT_TRUE (ret0 == HICN_ERROR_NONE))
{
- u8 isv6;
- u8 *nameptr;
- u16 namelen;
- hicn_name_t name;
- hicn_header_t *hicn0;
- vlib_buffer_t *b0;
- u32 bi0;
- u32 next0 = next_index;
- int ret0;
-
- /* Prefetch for next iteration. */
- if (n_left_from > 1)
- {
- vlib_buffer_t *b1;
- //hicn_buffer_t * hicnb1;
- b1 = vlib_get_buffer (vm, from[1]);
- CLIB_PREFETCH (b1, CLIB_CACHE_LINE_BYTES, LOAD);
- CLIB_PREFETCH (b1->data, CLIB_CACHE_LINE_BYTES, STORE);
- }
- /* Dequeue a packet buffer */
- bi0 = from[0];
- from += 1;
- n_left_from -= 1;
-
- b0 = vlib_get_buffer (vm, bi0);
- next0 = HICN_DATA_PUSH_NEXT_ERROR_DROP;
-
- ret0 = hicn_data_parse_pkt (b0, &name, &namelen, &hicn0, &isv6);
- nameptr = (u8 *) (&name);
-
- if (PREDICT_TRUE (ret0 == HICN_ERROR_NONE))
- hicn_new_data (vm, rt, b0, &next0, tnow, nameptr, namelen, isv6);
+ hicn_new_data (vm, rt, b0, &to_forward, &n_to_forward, tnow,
+ nameptr, namelen, isv6);
stats.pkts_data_count++;
-
- /* Maybe trace */
- if (PREDICT_FALSE ((node->flags & VLIB_NODE_FLAG_TRACE) &&
- (b0->flags & VLIB_BUFFER_IS_TRACED)))
- {
- hicn_data_push_trace_t *t =
- vlib_add_trace (vm, node, b0, sizeof (*t));
- t->pkt_type = HICN_PKT_TYPE_CONTENT;
- t->sw_if_index = vnet_buffer (b0)->sw_if_index[VLIB_RX];;
- t->next_index = next0;
- }
}
+ }
+ to_forward -= n_to_forward;
+ next_index = HICN_DATA_PUSH_NEXT_FWD;
+
+ while (n_to_forward > 0)
+ {
+ vlib_get_next_frame (vm, node, next_index, to_next, n_left_to_next);
+ while (n_to_forward > 0 && n_left_to_next > 0)
+ {
+ to_next[0] = to_forward[0];
+ to_forward++;
+ n_to_forward--;
+ to_next++;
+ n_left_to_next--;
+ }
vlib_put_next_frame (vm, node, next_index, n_left_to_next);
}
+ vec_free (header);
+
vlib_node_increment_counter (vm, hicn_data_push_node.index,
HICNFWD_ERROR_CACHED, stats.pkts_data_count);
@@ -326,19 +298,19 @@ hicn_data_push_format_trace (u8 * s, va_list * args)
/* *INDENT-OFF* */
VLIB_REGISTER_NODE(hicn_data_push_node) =
{
- .function = hicn_data_push_fn,
- .name = "hicn-data-push",
- .vector_size = sizeof(u32),
- .runtime_data_bytes = sizeof(hicn_data_push_runtime_t),
- .format_trace = hicn_data_push_format_trace,
- .type = VLIB_NODE_TYPE_INTERNAL,
- .n_errors = ARRAY_LEN(hicn_data_push_error_strings),
- .error_strings = hicn_data_push_error_strings,
- .n_next_nodes = HICN_DATA_PUSH_N_NEXT,
- /* edit / add dispositions here */
- .next_nodes = {
- [HICN_DATA_PUSH_NEXT_ERROR_DROP] = "error-drop",
- },
+ .function = hicn_data_push_fn,
+ .name = "hicn-data-push",
+ .vector_size = sizeof(u32),
+ .runtime_data_bytes = sizeof(hicn_data_push_runtime_t),
+ .format_trace = hicn_data_push_format_trace,
+ .type = VLIB_NODE_TYPE_INTERNAL,
+ .n_errors = ARRAY_LEN(hicn_data_push_error_strings),
+ .error_strings = hicn_data_push_error_strings,
+ .n_next_nodes = HICN_DATA_PUSH_N_NEXT,
+ .next_nodes = {
+ [HICN_DATA_PUSH_NEXT_FWD] = "hicn-data-fwd",
+ [HICN_DATA_PUSH_NEXT_ERROR_DROP] = "error-drop",
+ },
};
/* *INDENT-ON* */
diff --git a/hicn-plugin/src/faces/app/face_prod.c b/hicn-plugin/src/faces/app/face_prod.c
index d06fe2ff3..834b35da9 100644
--- a/hicn-plugin/src/faces/app/face_prod.c
+++ b/hicn-plugin/src/faces/app/face_prod.c
@@ -144,6 +144,12 @@ hicn_face_prod_add (hicn_prefix_t * prefix, u32 sw_if, u32 * cs_reserved,
if_flags |= VNET_SW_INTERFACE_FLAG_ADMIN_UP;
vnet_sw_interface_set_flags (vnm, sw_if, if_flags);
+ u8 *s0;
+ s0 = format (0, "Prefix %U/%u", format_ip6_address,
+ &prefix->name, prefix->len);
+
+ vlib_cli_output (vm, "Received request for %s, swif %d\n", s0, sw_if);
+
if (ip46_address_is_zero (&prefix->name))
{
return HICN_ERROR_APPFACE_PROD_PREFIX_NULL;
@@ -204,19 +210,20 @@ hicn_face_prod_add (hicn_prefix_t * prefix, u32 sw_if, u32 * cs_reserved,
ip4_address_t app_ip4 = get_ip4_address ();
ip4_add_del_interface_address (vm,
sw_if,
- &app_ip4,
- ADDR_MGR_IP4_CONS_LEN,
- 0 /* is_del */ );
+ &app_ip4, 32, 0 /* is_del */ );
app_ip = to_ip46 ( /* isv6 */ 0, app_ip4.as_u8);
}
else
{
ip6_address_t app_ip6 = get_ip6_address ();
+ u8 *s0;
+ s0 = format (0, "Prefix %U", format_ip6_address, &app_ip6);
+
+ vlib_cli_output (vm, "Setting ip address %s\n", s0);
+
ip6_add_del_interface_address (vm,
sw_if,
- &app_ip6,
- ADDR_MGR_IP6_CONS_LEN,
- 0 /* is_del */ );
+ &app_ip6, 128, 0 /* is_del */ );
app_ip = to_ip46 ( /* isv6 */ 1, app_ip6.as_u8);
}
diff --git a/hicn-plugin/src/faces/face.c b/hicn-plugin/src/faces/face.c
index f0559bb98..26dcf960b 100644
--- a/hicn-plugin/src/faces/face.c
+++ b/hicn-plugin/src/faces/face.c
@@ -72,7 +72,7 @@ void
hicn_face_module_init (vlib_main_t * vm)
{
pool_validate (hicn_dpoi_face_pool);
-
+ pool_alloc (hicn_dpoi_face_pool, 1024);
hicn_face_ip_init (vm);
hicn_iface_ip_init (vm);
hicn_face_udp_init (vm);
diff --git a/hicn-plugin/src/faces/ip/dpo_ip.h b/hicn-plugin/src/faces/ip/dpo_ip.h
index 426d5a146..164931a06 100644
--- a/hicn-plugin/src/faces/ip/dpo_ip.h
+++ b/hicn-plugin/src/faces/ip/dpo_ip.h
@@ -120,6 +120,10 @@ hicn_dpo_ip4_add_and_lock_from_remote (dpo_id_t * dpo,
const ip4_address_t * remote_addr,
u32 sw_if, u32 node_index)
{
+ dpo->dpoi_type = DPO_FIRST;
+ dpo->dpoi_proto = DPO_PROTO_NONE;
+ dpo->dpoi_index = INDEX_INVALID;
+ dpo->dpoi_next_node = 0;
/*All (complete) faces are indexed by remote addess as well */
hicn_face_t *face =
hicn_face_ip4_get (remote_addr, sw_if, &hicn_face_ip_remote_hashtb);
diff --git a/hicn-plugin/src/faces/ip/face_ip.c b/hicn-plugin/src/faces/ip/face_ip.c
index c7f6a1ba1..c1e264e44 100644
--- a/hicn-plugin/src/faces/ip/face_ip.c
+++ b/hicn-plugin/src/faces/ip/face_ip.c
@@ -40,21 +40,17 @@ hicn_face_ip_init (vlib_main_t * vm)
/* Default Strategy has index 0 and it always exists */
strategy_face_ip4_vlib_edge = vlib_node_add_next (vm,
hicn_dpo_get_strategy_vft
- (default_dpo.
- hicn_dpo_get_type ())->
- get_strategy_node_index
+ (default_dpo.hicn_dpo_get_type
+ ())->get_strategy_node_index
(),
- hicn_face_ip4_output_node.
- index);
+ hicn_face_ip4_output_node.index);
strategy_face_ip6_vlib_edge = vlib_node_add_next (vm,
hicn_dpo_get_strategy_vft
- (default_dpo.
- hicn_dpo_get_type ())->
- get_strategy_node_index
+ (default_dpo.hicn_dpo_get_type
+ ())->get_strategy_node_index
(),
- hicn_face_ip6_output_node.
- index);
+ hicn_face_ip6_output_node.index);
/*
* Create and edge between al the other strategy nodes
* and the ip_encap nodes.
@@ -73,6 +69,17 @@ hicn_face_ip_init (vlib_main_t * vm)
ASSERT (temp_index6 == strategy_face_ip6_vlib_edge);
}
+ u32 temp_index4 = vlib_node_add_next (vm,
+ hicn_interest_hitpit_node.index,
+ hicn_face_ip4_output_node.index);
+ u32 temp_index6 = vlib_node_add_next (vm,
+ hicn_interest_hitpit_node.index,
+ hicn_face_ip6_output_node.index);
+
+ ASSERT (temp_index4 == strategy_face_ip4_vlib_edge);
+ ASSERT (temp_index6 == strategy_face_ip6_vlib_edge);
+
+
hicn_dpo_ip_module_init ();
register_face_type (hicn_face_ip_type, &ip_vft, "ip");
@@ -224,8 +231,7 @@ hicn_face_ip_add (const ip46_address_t * local_addr,
}
retx_t *retx = vlib_process_signal_event_data (vlib_get_main (),
- hicn_mapme_eventmgr_process_node.
- index,
+ hicn_mapme_eventmgr_process_node.index,
HICN_MAPME_EVENT_FACE_ADD, 1,
sizeof (retx_t));
*retx = (retx_t)
@@ -305,8 +311,8 @@ hicn_face_ip_get_dpo (hicn_face_t * face, dpo_id_t * dpo)
hicn_face_ip_t *face_ip = (hicn_face_ip_t *) face->data;
return hicn_dpo_ip_create_from_face (face, dpo,
- ip46_address_is_ip4 (&face_ip->
- remote_addr) ?
+ ip46_address_is_ip4
+ (&face_ip->remote_addr) ?
strategy_face_ip4_vlib_edge :
strategy_face_ip6_vlib_edge);
}
diff --git a/hicn-plugin/src/faces/ip/face_ip_node.c b/hicn-plugin/src/faces/ip/face_ip_node.c
index b3577f65f..7b32f7355 100644
--- a/hicn-plugin/src/faces/ip/face_ip_node.c
+++ b/hicn-plugin/src/faces/ip/face_ip_node.c
@@ -56,7 +56,9 @@ typedef struct
u32 next_index;
u32 sw_if_index;
u8 pkt_type;
-} hicn_face_ip4_input_trace_t;
+ u8 packet_data[60];
+}
+hicn_face_ip4_input_trace_t;
typedef enum
{
@@ -72,7 +74,9 @@ typedef struct
u32 next_index;
u32 sw_if_index;
u8 pkt_type;
-} hicn_face_ip6_input_trace_t;
+ u8 packet_data[60];
+}
+hicn_face_ip6_input_trace_t;
typedef enum
{
@@ -157,6 +161,9 @@ typedef enum
t->pkt_type = HICN_PKT_TYPE_INTEREST; \
t->sw_if_index = vnet_buffer (b0)->sw_if_index[VLIB_RX]; \
t->next_index = next0; \
+ clib_memcpy_fast (t->packet_data, \
+ vlib_buffer_get_current (b0), \
+ sizeof (t->packet_data)); \
} \
\
\
@@ -245,6 +252,9 @@ typedef enum
t->pkt_type = HICN_PKT_TYPE_INTEREST; \
t->sw_if_index = vnet_buffer (b0)->sw_if_index[VLIB_RX]; \
t->next_index = next0; \
+ clib_memcpy_fast (t->packet_data, \
+ vlib_buffer_get_current (b0), \
+ sizeof (t->packet_data)); \
} \
\
if (PREDICT_FALSE ((node->flags & VLIB_NODE_FLAG_TRACE) && \
@@ -255,6 +265,9 @@ typedef enum
t->pkt_type = HICN_PKT_TYPE_INTEREST; \
t->sw_if_index = vnet_buffer (b1)->sw_if_index[VLIB_RX]; \
t->next_index = next1; \
+ clib_memcpy_fast (t->packet_data, \
+ vlib_buffer_get_current (b1), \
+ sizeof (t->packet_data)); \
} \
\
\
@@ -310,8 +323,9 @@ hicn_face_ip4_input_format_trace (u8 * s, va_list * args)
hicn_face_ip4_input_trace_t *t =
va_arg (*args, hicn_face_ip4_input_trace_t *);
- s = format (s, "FACE_IP4_INPUT: pkt: %d, sw_if_index %d, next index %d",
- (int) t->pkt_type, t->sw_if_index, t->next_index);
+ s = format (s, "FACE_IP4_INPUT: pkt: %d, sw_if_index %d, next index %d\n%U",
+ (int) t->pkt_type, t->sw_if_index, t->next_index,
+ format_ip4_header, t->packet_data, sizeof (t->packet_data));
return (s);
}
@@ -389,8 +403,9 @@ hicn_face_ip6_input_format_trace (u8 * s, va_list * args)
hicn_face_ip6_input_trace_t *t =
va_arg (*args, hicn_face_ip6_input_trace_t *);
- s = format (s, "FACE_IP6_INPUT: pkt: %d, sw_if_index %d, next index %d",
- (int) t->pkt_type, t->sw_if_index, t->next_index);
+ s = format (s, "FACE_IP6_INPUT: pkt: %d, sw_if_index %d, next index %d\n%U",
+ (int) t->pkt_type, t->sw_if_index, t->next_index,
+ format_ip6_header, t->packet_data, sizeof (t->packet_data));
return (s);
}
@@ -468,7 +483,9 @@ typedef struct
u32 next_index;
u32 sw_if_index;
u8 pkt_type;
-} hicn_face_ip4_output_trace_t;
+ u8 packet_data[60];
+}
+hicn_face_ip4_output_trace_t;
/* Trace context struct */
typedef struct
@@ -476,7 +493,9 @@ typedef struct
u32 next_index;
u32 sw_if_index;
u8 pkt_type;
-} hicn_face_ip6_output_trace_t;
+ u8 packet_data[60];
+}
+hicn_face_ip6_output_trace_t;
#define TRACE_OUTPUT_PKT_IP4 hicn_face_ip4_output_trace_t
#define TRACE_OUTPUT_PKT_IP6 hicn_face_ip6_output_trace_t
@@ -524,6 +543,9 @@ typedef struct
t->pkt_type = HICN_PKT_TYPE_INTEREST; \
t->sw_if_index = vnet_buffer (b0)->sw_if_index[VLIB_RX]; \
t->next_index = next0; \
+ clib_memcpy_fast (t->packet_data, \
+ vlib_buffer_get_current (b0), \
+ sizeof (t->packet_data)); \
} \
\
\
@@ -591,6 +613,9 @@ typedef struct
t->pkt_type = HICN_PKT_TYPE_INTEREST; \
t->sw_if_index = vnet_buffer (b0)->sw_if_index[VLIB_RX]; \
t->next_index = next0; \
+ clib_memcpy_fast (t->packet_data, \
+ vlib_buffer_get_current (b0), \
+ sizeof (t->packet_data)); \
} \
\
if (PREDICT_FALSE ((node->flags & VLIB_NODE_FLAG_TRACE) && \
@@ -601,6 +626,9 @@ typedef struct
t->pkt_type = HICN_PKT_TYPE_INTEREST; \
t->sw_if_index = vnet_buffer (b1)->sw_if_index[VLIB_RX]; \
t->next_index = next1; \
+ clib_memcpy_fast (t->packet_data, \
+ vlib_buffer_get_current (b1), \
+ sizeof (t->packet_data)); \
} \
\
\
@@ -657,8 +685,10 @@ hicn_face_ip4_output_format_trace (u8 * s, va_list * args)
hicn_face_ip4_output_trace_t *t =
va_arg (*args, hicn_face_ip4_output_trace_t *);
- s = format (s, "FACE_IP4_OUTPUT: pkt: %d, sw_if_index %d, next index %d",
- (int) t->pkt_type, t->sw_if_index, t->next_index);
+ s =
+ format (s, "FACE_IP4_OUTPUT: pkt: %d, sw_if_index %d, next index %d\n%U",
+ (int) t->pkt_type, t->sw_if_index, t->next_index,
+ format_ip4_header, t->packet_data, sizeof (t->packet_data));
return (s);
}
@@ -728,8 +758,10 @@ hicn_face_ip6_output_format_trace (u8 * s, va_list * args)
hicn_face_ip6_output_trace_t *t =
va_arg (*args, hicn_face_ip6_output_trace_t *);
- s = format (s, "FACE_IP6_OUTPUT: pkt: %d, sw_if_index %d, next index %d",
- (int) t->pkt_type, t->sw_if_index, t->next_index);
+ s =
+ format (s, "FACE_IP6_OUTPUT: pkt: %d, sw_if_index %d, next index %d\n%U",
+ (int) t->pkt_type, t->sw_if_index, t->next_index,
+ format_ip6_header, t->packet_data, sizeof (t->packet_data));
return (s);
}
diff --git a/hicn-plugin/src/faces/ip/iface_ip_node.c b/hicn-plugin/src/faces/ip/iface_ip_node.c
index 9ca00d7bf..fcf43ebd7 100644
--- a/hicn-plugin/src/faces/ip/iface_ip_node.c
+++ b/hicn-plugin/src/faces/ip/iface_ip_node.c
@@ -77,6 +77,7 @@ typedef struct
u32 next_index;
u32 sw_if_index;
u8 pkt_type;
+ u8 packet_data[60];
} hicn_iface_ip4_input_trace_t;
typedef enum
@@ -93,6 +94,7 @@ typedef struct
u32 next_index;
u32 sw_if_index;
u8 pkt_type;
+ u8 packet_data[60];
} hicn_iface_ip6_input_trace_t;
typedef enum
@@ -185,6 +187,10 @@ typedef enum
t->pkt_type = HICN_PKT_TYPE_INTEREST; \
t->sw_if_index = vnet_buffer (b0)->sw_if_index[VLIB_RX]; \
t->next_index = next0; \
+ clib_memcpy_fast (t->packet_data, \
+ vlib_buffer_get_current (b0), \
+ sizeof (t->packet_data)); \
+ \
} \
\
\
@@ -270,6 +276,9 @@ typedef enum
t->pkt_type = HICN_PKT_TYPE_INTEREST; \
t->sw_if_index = vnet_buffer (b0)->sw_if_index[VLIB_RX]; \
t->next_index = next0; \
+ clib_memcpy_fast (t->packet_data, \
+ vlib_buffer_get_current (b0), \
+ sizeof (t->packet_data)); \
} \
\
if (PREDICT_FALSE ((node->flags & VLIB_NODE_FLAG_TRACE) && \
@@ -280,6 +289,9 @@ typedef enum
t->pkt_type = HICN_PKT_TYPE_INTEREST; \
t->sw_if_index = vnet_buffer (b1)->sw_if_index[VLIB_RX]; \
t->next_index = next1; \
+ clib_memcpy_fast (t->packet_data, \
+ vlib_buffer_get_current (b1), \
+ sizeof (t->packet_data)); \
} \
\
/* Verify speculative enqueue, maybe switch current next frame */ \
@@ -335,8 +347,8 @@ hicn_iface_ip4_input_format_trace (u8 * s, va_list * args)
hicn_iface_ip4_input_trace_t *t =
va_arg (*args, hicn_iface_ip4_input_trace_t *);
- s = format (s, "IFACE_IP4_INPUT: pkt: %d, sw_if_index %d, next index %d",
- (int) t->pkt_type, t->sw_if_index, t->next_index);
+ s = format (s, "IFACE_IP4_INPUT: pkt: %d, sw_if_index %d, next index %d\n%U",
+ (int) t->pkt_type, t->sw_if_index, t->next_index, format_ip4_header, t->packet_data, sizeof (t->packet_data));
return (s);
}
@@ -412,8 +424,8 @@ hicn_iface_ip6_input_format_trace (u8 * s, va_list * args)
hicn_iface_ip6_input_trace_t *t =
va_arg (*args, hicn_iface_ip6_input_trace_t *);
- s = format (s, "IFACE_IP6_INPUT: pkt: %d, sw_if_index %d, next index %d",
- (int) t->pkt_type, t->sw_if_index, t->next_index);
+ s = format (s, "IFACE_IP6_INPUT: pkt: %d, sw_if_index %d, next index %d\n%U",
+ (int) t->pkt_type, t->sw_if_index, t->next_index, format_ip6_header, t->packet_data, sizeof (t->packet_data));
return (s);
}
@@ -518,6 +530,7 @@ typedef struct
u32 next_index;
u32 sw_if_index;
u8 pkt_type;
+ u8 packet_data[60];
} hicn_iface_ip4_output_trace_t;
typedef enum
@@ -533,6 +546,7 @@ typedef struct
u32 next_index;
u32 sw_if_index;
u8 pkt_type;
+ u8 packet_data[60];
} hicn_iface_ip6_output_trace_t;
typedef enum
@@ -598,6 +612,9 @@ typedef enum
t->pkt_type = HICN_PKT_TYPE_INTEREST; \
t->sw_if_index = vnet_buffer (b0)->sw_if_index[VLIB_RX]; \
t->next_index = next0; \
+ clib_memcpy_fast (t->packet_data, \
+ vlib_buffer_get_current (b0), \
+ sizeof (t->packet_data)); \
} \
\
\
@@ -669,6 +686,9 @@ typedef enum
t->pkt_type = HICN_PKT_TYPE_INTEREST; \
t->sw_if_index = vnet_buffer (b0)->sw_if_index[VLIB_RX]; \
t->next_index = next0; \
+ clib_memcpy_fast (t->packet_data, \
+ vlib_buffer_get_current (b0), \
+ sizeof (t->packet_data)); \
} \
\
if (PREDICT_FALSE ((node->flags & VLIB_NODE_FLAG_TRACE) && \
@@ -679,6 +699,9 @@ typedef enum
t->pkt_type = HICN_PKT_TYPE_INTEREST; \
t->sw_if_index = vnet_buffer (b1)->sw_if_index[VLIB_RX]; \
t->next_index = next1; \
+ clib_memcpy_fast (t->packet_data, \
+ vlib_buffer_get_current (b1), \
+ sizeof (t->packet_data)); \
} \
\
\
@@ -735,8 +758,8 @@ hicn_iface_ip4_output_format_trace (u8 * s, va_list * args)
hicn_iface_ip4_output_trace_t *t =
va_arg (*args, hicn_iface_ip4_output_trace_t *);
- s = format (s, "IFACE_IP4_OUTPUT: pkt: %d, sw_if_index %d, next index %d",
- (int) t->pkt_type, t->sw_if_index, t->next_index);
+ s = format (s, "IFACE_IP4_OUTPUT: pkt: %d, sw_if_index %d, next index %d\n%U",
+ (int) t->pkt_type, t->sw_if_index, t->next_index, format_ip4_header, t->packet_data, sizeof (t->packet_data));
return (s);
}
@@ -808,8 +831,8 @@ hicn_iface_ip6_output_format_trace (u8 * s, va_list * args)
hicn_iface_ip6_output_trace_t *t =
va_arg (*args, hicn_iface_ip6_output_trace_t *);
- s = format (s, "IFACE_IP6_OUTPUT: pkt: %d, sw_if_index %d, next index %d",
- (int) t->pkt_type, t->sw_if_index, t->next_index);
+ s = format (s, "IFACE_IP6_OUTPUT: pkt: %d, sw_if_index %d, next index %d\n%U",
+ (int) t->pkt_type, t->sw_if_index, t->next_index, format_ip6_header, t->packet_data, sizeof (t->packet_data));
return (s);
}
diff --git a/hicn-plugin/src/faces/udp/dpo_udp.h b/hicn-plugin/src/faces/udp/dpo_udp.h
index 33e4b5d46..cc71a8d44 100644
--- a/hicn-plugin/src/faces/udp/dpo_udp.h
+++ b/hicn-plugin/src/faces/udp/dpo_udp.h
@@ -75,6 +75,11 @@ hicn_dpo_udp4_lock (dpo_id_t * dpo,
const ip4_address_t * remote_addr,
u16 local_port, u16 remote_port, u8 * hicnb_flags)
{
+ dpo->dpoi_type = DPO_FIRST;
+ dpo->dpoi_proto = DPO_PROTO_NONE;
+ dpo->dpoi_index = INDEX_INVALID;
+ dpo->dpoi_next_node = 0;
+
hicn_face_t *face =
hicn_face_udp4_get (local_addr, remote_addr, local_port, remote_port);
@@ -112,6 +117,11 @@ hicn_dpo_udp4_add_and_lock (dpo_id_t * dpo,
u16 local_port, u16 remote_port,
u32 node_index, u8 * hicnb_flags)
{
+ dpo->dpoi_type = DPO_FIRST;
+ dpo->dpoi_proto = DPO_PROTO_NONE;
+ dpo->dpoi_index = INDEX_INVALID;
+ dpo->dpoi_next_node = 0;
+
hicn_face_t *face =
hicn_face_udp4_get (local_addr, remote_addr, local_port, remote_port);
@@ -207,6 +217,11 @@ hicn_dpo_udp6_lock (dpo_id_t * dpo,
const ip6_address_t * remote_addr,
u16 local_port, u16 remote_port, u8 * hicnb_flags)
{
+ dpo->dpoi_type = DPO_FIRST;
+ dpo->dpoi_proto = DPO_PROTO_NONE;
+ dpo->dpoi_index = INDEX_INVALID;
+ dpo->dpoi_next_node = 0;
+
hicn_face_t *face =
hicn_face_udp6_get (local_addr, remote_addr, local_port, remote_port);
@@ -244,6 +259,11 @@ hicn_dpo_udp6_add_and_lock (dpo_id_t * dpo,
u16 local_port, u16 remote_port,
u32 node_index, u8 * hicnb_flags)
{
+ dpo->dpoi_type = DPO_FIRST;
+ dpo->dpoi_proto = DPO_PROTO_NONE;
+ dpo->dpoi_index = INDEX_INVALID;
+ dpo->dpoi_next_node = 0;
+
hicn_face_t *face =
hicn_face_udp6_get (local_addr, remote_addr, local_port, remote_port);
diff --git a/hicn-plugin/src/faces/udp/face_udp.c b/hicn-plugin/src/faces/udp/face_udp.c
index 9d3eedd83..ea16c85fe 100644
--- a/hicn-plugin/src/faces/udp/face_udp.c
+++ b/hicn-plugin/src/faces/udp/face_udp.c
@@ -20,6 +20,7 @@
#include "face_udp_node.h"
#include "dpo_udp.h"
#include "../face.h"
+#include "../../infra.h"
#include "../../strategy.h"
#include "../../strategy_dpo_manager.h"
#include "../../hicn.h"
@@ -78,17 +79,15 @@ hicn_face_udp_init (vlib_main_t * vm)
/* Default Strategy has index 0 and it always exists */
strategy_face_udp4_vlib_edge = vlib_node_add_next (vm,
hicn_dpo_get_strategy_vft
- (default_dpo.
- hicn_dpo_get_type ())->
- get_strategy_node_index
+ (default_dpo.hicn_dpo_get_type
+ ())->get_strategy_node_index
(),
- hicn_face_udp4_output_node.
- index);
+ hicn_face_udp4_output_node.index);
strategy_face_udp6_vlib_edge =
vlib_node_add_next (vm,
- hicn_dpo_get_strategy_vft (default_dpo.
- hicn_dpo_get_type ())->
- get_strategy_node_index (),
+ hicn_dpo_get_strategy_vft
+ (default_dpo.hicn_dpo_get_type
+ ())->get_strategy_node_index (),
hicn_face_udp6_output_node.index);
/*
@@ -109,6 +108,16 @@ hicn_face_udp_init (vlib_main_t * vm)
ASSERT (temp_index6 == strategy_face_udp6_vlib_edge);
}
+ u32 temp_index4 = vlib_node_add_next (vm,
+ hicn_interest_hitpit_node.index,
+ hicn_face_udp4_output_node.index);
+ u32 temp_index6 = vlib_node_add_next (vm,
+ hicn_interest_hitpit_node.index,
+ hicn_face_udp6_output_node.index);
+
+ ASSERT (temp_index4 == strategy_face_udp4_vlib_edge);
+ ASSERT (temp_index6 == strategy_face_udp6_vlib_edge);
+
hicn_dpo_udp_module_init ();
register_face_type (hicn_face_udp_type, &udp_vft, "udp");;
@@ -119,8 +128,6 @@ hicn_face_udp_add (const ip46_address_t * local_addr,
const ip46_address_t * remote_addr, u16 local_port,
u16 remote_port, u32 swif, hicn_face_id_t * pfaceid)
{
- fib_protocol_t fib_type;
- vnet_link_t link_type;
adj_index_t ip_adj;
int ret = HICN_ERROR_NONE;
dpo_proto_t dpo_proto;
@@ -131,9 +138,20 @@ hicn_face_udp_add (const ip46_address_t * local_addr,
if (ip46_address_is_ip4 (local_addr) && ip46_address_is_ip4 (remote_addr))
{
- link_type = VNET_LINK_IP4;
- fib_type = FIB_PROTOCOL_IP4;
- ip_adj = adj_nbr_add_or_lock (fib_type, link_type, remote_addr, swif);
+ fib_prefix_t fib_pfx;
+ fib_node_index_t fib_entry_index;
+ fib_prefix_from_ip46_addr (remote_addr, &fib_pfx);
+ fib_pfx.fp_len = 32;
+
+ u32 fib_index = fib_table_find_or_create_and_lock (fib_pfx.fp_proto,
+ HICN_FIB_TABLE,
+ FIB_SOURCE_PLUGIN_HI);
+ fib_entry_index = fib_table_lookup (fib_index, &fib_pfx);
+
+ ip_adj = fib_entry_get_adj (fib_entry_index);
+
+ if (ip_adj == ~0)
+ return HICN_ERROR_FACE_IP_ADJ_NOT_FOUND;
hicn_face_t *face =
hicn_face_udp4_get (&local_addr->ip4, &remote_addr->ip4, local_port,
@@ -181,13 +199,25 @@ hicn_face_udp_add (const ip46_address_t * local_addr,
*pfaceid = hicn_dpoi_get_index (face);
dpo_proto = DPO_PROTO_IP4;
+ fib_table_unlock (fib_index, fib_pfx.fp_proto, FIB_SOURCE_PLUGIN_HI);
}
else if (!ip46_address_is_ip4 (local_addr)
&& !ip46_address_is_ip4 (remote_addr))
{
- link_type = VNET_LINK_IP6;
- fib_type = FIB_PROTOCOL_IP6;
- ip_adj = adj_nbr_add_or_lock (fib_type, link_type, remote_addr, swif);
+ fib_prefix_t fib_pfx;
+ fib_node_index_t fib_entry_index;
+ fib_prefix_from_ip46_addr (remote_addr, &fib_pfx);
+ fib_pfx.fp_len = 128;
+
+ u32 fib_index = fib_table_find_or_create_and_lock (fib_pfx.fp_proto,
+ HICN_FIB_TABLE,
+ FIB_SOURCE_PLUGIN_HI);
+ fib_entry_index = fib_table_lookup (fib_index, &fib_pfx);
+
+ ip_adj = fib_entry_get_adj (fib_entry_index);
+
+ if (ip_adj == ~0)
+ return HICN_ERROR_FACE_IP_ADJ_NOT_FOUND;
hicn_face_t *face =
hicn_face_udp6_get (&local_addr->ip6, &remote_addr->ip6, local_port,
@@ -226,6 +256,7 @@ hicn_face_udp_add (const ip46_address_t * local_addr,
*pfaceid = hicn_dpoi_get_index (face);
dpo_proto = DPO_PROTO_IP6;
+ fib_table_unlock (fib_index, fib_pfx.fp_proto, FIB_SOURCE_PLUGIN_HI);
}
else
{
@@ -233,8 +264,7 @@ hicn_face_udp_add (const ip46_address_t * local_addr,
}
retx_t *retx = vlib_process_signal_event_data (vlib_get_main (),
- hicn_mapme_eventmgr_process_node.
- index,
+ hicn_mapme_eventmgr_process_node.index,
HICN_MAPME_EVENT_FACE_ADD, 1,
sizeof (retx_t));
*retx = (retx_t)
@@ -283,6 +313,7 @@ format_hicn_face_udp (u8 * s, va_list * args)
s =
format (s, "remote %U|%u ", format_ip4_address,
&udp_face->hdrs.ip4.ip.dst_address,
+
clib_net_to_host_u16 (udp_face->hdrs.ip4.udp.dst_port));
s = format (s, "%U", format_vnet_link, adj->ia_link);
s = format (s, " dev %U", format_vnet_sw_interface_name, vnm,
diff --git a/hicn-plugin/src/faces/udp/face_udp_node.c b/hicn-plugin/src/faces/udp/face_udp_node.c
index ac7a63731..5f19eb0af 100644
--- a/hicn-plugin/src/faces/udp/face_udp_node.c
+++ b/hicn-plugin/src/faces/udp/face_udp_node.c
@@ -54,7 +54,9 @@ typedef struct
u32 next_index;
u32 sw_if_index;
u8 pkt_type;
-} hicn_face_udp4_input_trace_t;
+ u8 packet_data[60];
+}
+hicn_face_udp4_input_trace_t;
typedef enum
{
@@ -70,7 +72,9 @@ typedef struct
u32 next_index;
u32 sw_if_index;
u8 pkt_type;
-} hicn_face_udp6_input_trace_t;
+ u8 packet_data[60];
+}
+hicn_face_udp6_input_trace_t;
typedef enum
{
@@ -97,6 +101,10 @@ typedef enum
#define TRACE_INPUT_PKT_UDP4 hicn_face_udp4_input_trace_t
#define TRACE_INPUT_PKT_UDP6 hicn_face_udp6_input_trace_t
+#define SIZE_HICN_HEADER4 sizeof(ip4_header_t) + sizeof(udp_header_t)
+#define SIZE_HICN_HEADER6 sizeof(ip6_header_t) + sizeof(udp_header_t)
+
+
#define face_input_x1(ipv) \
do { \
int ret; \
@@ -163,7 +171,10 @@ typedef enum
t->pkt_type = HICN_PKT_TYPE_CONTENT; \
t->sw_if_index = vnet_buffer (b0)->sw_if_index[VLIB_RX]; \
t->next_index = next0; \
- } \
+ clib_memcpy_fast (t->packet_data, \
+ vlib_buffer_get_current (b0), \
+ sizeof (t->packet_data)); \
+ } \
\
\
/* Verify speculative enqueue, maybe switch current next frame */ \
@@ -279,6 +290,9 @@ typedef enum
t->pkt_type = HICN_PKT_TYPE_CONTENT; \
t->sw_if_index = vnet_buffer (b0)->sw_if_index[VLIB_RX]; \
t->next_index = next0; \
+ clib_memcpy_fast (t->packet_data, \
+ vlib_buffer_get_current (b0), \
+ sizeof (t->packet_data)); \
} \
\
if (PREDICT_FALSE ((node->flags & VLIB_NODE_FLAG_TRACE) && \
@@ -289,6 +303,9 @@ typedef enum
t->pkt_type = HICN_PKT_TYPE_CONTENT; \
t->sw_if_index = vnet_buffer (b1)->sw_if_index[VLIB_RX]; \
t->next_index = next1; \
+ clib_memcpy_fast (t->packet_data, \
+ vlib_buffer_get_current (b1), \
+ sizeof (t->packet_data)); \
} \
\
\
@@ -343,8 +360,11 @@ hicn_face_udp4_input_format_trace (u8 * s, va_list * args)
hicn_face_udp4_input_trace_t *t =
va_arg (*args, hicn_face_udp4_input_trace_t *);
- s = format (s, "FACE_UDP4_INPUT: pkt: %d, sw_if_index %d, next index %d",
- (int) t->pkt_type, t->sw_if_index, t->next_index);
+ s =
+ format (s, "FACE_UDP4_INPUT: pkt: %d, sw_if_index %d, next index %d\n%U",
+ (int) t->pkt_type, t->sw_if_index, t->next_index,
+ (t->packet_data[0] & 0xf0) == 0x40 ? format_ip4_header : format_ip6_header,
+ t->packet_data, sizeof (t->packet_data));
return (s);
}
@@ -421,8 +441,11 @@ hicn_face_udp6_input_format_trace (u8 * s, va_list * args)
hicn_face_udp6_input_trace_t *t =
va_arg (*args, hicn_face_udp6_input_trace_t *);
- s = format (s, "FACE_UDP6_INPUT: pkt: %d, sw_if_index %d, next index %d",
- (int) t->pkt_type, t->sw_if_index, t->next_index);
+ s =
+ format (s, "FACE_UDP6_INPUT: pkt: %d, sw_if_index %d, next index %d\n%U",
+ (int) t->pkt_type, t->sw_if_index, t->next_index,
+ (t->packet_data[0] & 0xf0) == 0x40 ? format_ip4_header : format_ip6_header,
+ t->packet_data, sizeof (t->packet_data));
return (s);
}
@@ -551,7 +574,9 @@ typedef struct
u32 next_index;
u32 sw_if_index;
u8 pkt_type;
-} hicn_face_udp4_output_trace_t;
+ u8 packet_data[60];
+}
+hicn_face_udp4_output_trace_t;
/* Trace context struct */
typedef struct
@@ -559,7 +584,9 @@ typedef struct
u32 next_index;
u32 sw_if_index;
u8 pkt_type;
-} hicn_face_udp6_output_trace_t;
+ u8 packet_data[60];
+}
+hicn_face_udp6_output_trace_t;
#define HICN_FACE_UDP_ENCAP_IP4 hicn_face_udp4_encap
#define HICN_FACE_UDP_ENCAP_IP6 hicn_face_udp6_encap
@@ -615,6 +642,10 @@ typedef struct
t->pkt_type = HICN_PKT_TYPE_INTEREST; \
t->sw_if_index = vnet_buffer (b0)->sw_if_index[VLIB_RX]; \
t->next_index = next0; \
+ clib_memcpy_fast (t->packet_data, \
+ vlib_buffer_get_current (b0) + \
+ SIZE_HICN_HEADER##ipv, \
+ sizeof (t->packet_data)); \
} \
\
to_next[0] = bi0; \
@@ -699,8 +730,26 @@ typedef struct
t->pkt_type = HICN_PKT_TYPE_INTEREST; \
t->sw_if_index = vnet_buffer (b0)->sw_if_index[VLIB_RX]; \
t->next_index = next0; \
+ clib_memcpy_fast (t->packet_data, \
+ vlib_buffer_get_current (b0) + \
+ SIZE_HICN_HEADER##ipv, \
+ sizeof (t->packet_data)); \
} \
\
+ \
+ if (PREDICT_FALSE ((node->flags & VLIB_NODE_FLAG_TRACE) && \
+ (b1->flags & VLIB_BUFFER_IS_TRACED))) \
+ { \
+ TRACE_OUTPUT_PKT_UDP##ipv *t = \
+ vlib_add_trace (vm, node, b0, sizeof (*t)); \
+ t->pkt_type = HICN_PKT_TYPE_INTEREST; \
+ t->sw_if_index = vnet_buffer (b1)->sw_if_index[VLIB_RX]; \
+ t->next_index = next1; \
+ clib_memcpy_fast (t->packet_data, \
+ vlib_buffer_get_current (b1) + \
+ SIZE_HICN_HEADER##ipv, \
+ sizeof (t->packet_data)); \
+ } \
/* Verify speculative enqueue, maybe switch current next frame */ \
vlib_validate_buffer_enqueue_x2 (vm, node, next_index, \
to_next, n_left_to_next, \
@@ -755,8 +804,11 @@ hicn_face_udp4_output_format_trace (u8 * s, va_list * args)
hicn_face_udp4_output_trace_t *t =
va_arg (*args, hicn_face_udp4_output_trace_t *);
- s = format (s, "FACE_UDP4_OUTPUT: pkt: %d, sw_if_index %d, next index %d",
- (int) t->pkt_type, t->sw_if_index, t->next_index);
+ s =
+ format (s, "FACE_UDP4_OUTPUT: pkt: %d, sw_if_index %d, next index %d\n%U",
+ (int) t->pkt_type, t->sw_if_index, t->next_index,
+ (t->packet_data[0] & 0xf0) == 0x40 ? format_ip4_header : format_ip6_header,
+ t->packet_data, sizeof (t->packet_data));
return (s);
}
@@ -828,8 +880,11 @@ hicn_face_udp6_output_format_trace (u8 * s, va_list * args)
hicn_face_udp6_output_trace_t *t =
va_arg (*args, hicn_face_udp6_output_trace_t *);
- s = format (s, "FACE_UDP6_OUTPUT: pkt: %d, sw_if_index %d, next index %d",
- (int) t->pkt_type, t->sw_if_index, t->next_index);
+ s =
+ format (s, "FACE_UDP6_OUTPUT: pkt: %d, sw_if_index %d, next index %d\n%u",
+ (int) t->pkt_type, t->sw_if_index, t->next_index,
+ (t->packet_data[0] & 0xf0) == 0x40 ? format_ip4_header : format_ip6_header,
+ t->packet_data, sizeof (t->packet_data));
return (s);
}
diff --git a/hicn-plugin/src/faces/udp/iface_udp_node.c b/hicn-plugin/src/faces/udp/iface_udp_node.c
index 1f6dbd4ab..c71616b77 100644
--- a/hicn-plugin/src/faces/udp/iface_udp_node.c
+++ b/hicn-plugin/src/faces/udp/iface_udp_node.c
@@ -39,13 +39,11 @@ hicn_iface_udp_init (vlib_main_t * vm)
{
data_fwd_face_udp4_vlib_edge = vlib_node_add_next (vm,
hicn_data_fwd_node.index,
- hicn_iface_udp4_output_node.
- index);
+ hicn_iface_udp4_output_node.index);
data_fwd_face_udp6_vlib_edge = vlib_node_add_next (vm,
hicn_data_fwd_node.index,
- hicn_iface_udp6_output_node.
- index);
+ hicn_iface_udp6_output_node.index);
u32 temp_index4 = vlib_node_add_next (vm,
hicn_interest_hitcs_node.index,
@@ -88,7 +86,9 @@ typedef struct
u32 next_index;
u32 sw_if_index;
u8 pkt_type;
-} hicn_iface_udp4_input_trace_t;
+ u8 packet_data[60];
+}
+hicn_iface_udp4_input_trace_t;
typedef enum
{
@@ -104,7 +104,9 @@ typedef struct
u32 next_index;
u32 sw_if_index;
u8 pkt_type;
-} hicn_iface_udp6_input_trace_t;
+ u8 packet_data[60];
+}
+hicn_iface_udp6_input_trace_t;
typedef enum
{
@@ -135,7 +137,7 @@ typedef enum
#define TRACE_INPUT_PKT_UDP4 hicn_iface_udp4_input_trace_t
#define TRACE_INPUT_PKT_UDP6 hicn_iface_udp6_input_trace_t
-#define iface_input_x1(ipv) \
+#define iface_input_x1(ipv) \
do { \
vlib_buffer_t *b0; \
u32 bi0; \
@@ -196,6 +198,9 @@ typedef enum
t->pkt_type = HICN_PKT_TYPE_INTEREST; \
t->sw_if_index = vnet_buffer (b0)->sw_if_index[VLIB_RX]; \
t->next_index = next0; \
+ clib_memcpy_fast (t->packet_data, \
+ vlib_buffer_get_current (b0), \
+ sizeof (t->packet_data)); \
} \
\
\
@@ -297,6 +302,9 @@ typedef enum
t->pkt_type = HICN_PKT_TYPE_INTEREST; \
t->sw_if_index = vnet_buffer (b0)->sw_if_index[VLIB_RX]; \
t->next_index = next0; \
+ clib_memcpy_fast (t->packet_data, \
+ vlib_buffer_get_current (b0), \
+ sizeof (t->packet_data)); \
} \
\
\
@@ -308,6 +316,9 @@ typedef enum
t->pkt_type = HICN_PKT_TYPE_INTEREST; \
t->sw_if_index = vnet_buffer (b1)->sw_if_index[VLIB_RX]; \
t->next_index = next1; \
+ clib_memcpy_fast (t->packet_data, \
+ vlib_buffer_get_current (b1), \
+ sizeof (t->packet_data)); \
} \
\
\
@@ -365,8 +376,11 @@ hicn_iface_udp4_input_format_trace (u8 * s, va_list * args)
hicn_iface_udp4_input_trace_t *t =
va_arg (*args, hicn_iface_udp4_input_trace_t *);
- s = format (s, "IFACE_UDP4_INPUT: pkt: %d, sw_if_index %d, next index %d",
- (int) t->pkt_type, t->sw_if_index, t->next_index);
+ s =
+ format (s, "IFACE_UDP4_INPUT: pkt: %d, sw_if_index %d, next index %d\n%U",
+ (int) t->pkt_type, t->sw_if_index, t->next_index,
+ (t->packet_data[0] & 0xf0) == 0x40 ? format_ip4_header : format_ip6_header,
+ t->packet_data, sizeof (t->packet_data));
return (s);
}
@@ -443,8 +457,11 @@ hicn_iface_udp6_input_format_trace (u8 * s, va_list * args)
hicn_iface_udp6_input_trace_t *t =
va_arg (*args, hicn_iface_udp6_input_trace_t *);
- s = format (s, "IFACE_UDP6_INPUT: pkt: %d, sw_if_index %d, next index %d",
- (int) t->pkt_type, t->sw_if_index, t->next_index);
+ s =
+ format (s, "IFACE_UDP6_INPUT: pkt: %d, sw_if_index %d, next index %d\n%U",
+ (int) t->pkt_type, t->sw_if_index, t->next_index,
+ (t->packet_data[0] & 0xf0) == 0x40 ? format_ip4_header : format_ip6_header,
+ t->packet_data, sizeof (t->packet_data));
return (s);
}
@@ -485,9 +502,8 @@ hicn_iface_udp4_encap (vlib_main_t * vm,
/* Adjust vlib buffers */
/* Set the right length on the header buffer */
/* Move the next buffer current data pointer back to the ip+tcp header (hicn header) */
- int offset = sizeof (ip4_header_t) + sizeof (udp_header_t);
- b0->current_data -= offset;
- b0->current_length += offset;
+ word offset = sizeof (ip4_header_t) + sizeof (udp_header_t);
+ vlib_buffer_advance (b0, -offset);
/* ip */
ip0 = vlib_buffer_get_current (b0);
@@ -517,9 +533,8 @@ hicn_iface_udp6_encap (vlib_main_t * vm,
hicn_face_udp_t *face_udp = (hicn_face_udp_t *) face->data;
/* Adjust vlib buffer */
- int offset = sizeof (ip6_header_t) + sizeof (udp_header_t);
- b0->current_data -= offset;
- b0->current_length += offset;
+ word offset = sizeof (ip6_header_t) + sizeof (udp_header_t);
+ vlib_buffer_advance (b0, -offset);
/* ip */
ip0 = vlib_buffer_get_current (b0);
@@ -561,7 +576,9 @@ typedef struct
u32 next_index;
u32 sw_if_index;
u8 pkt_type;
-} hicn_iface_udp4_output_trace_t;
+ u8 packet_data[60];
+}
+hicn_iface_udp4_output_trace_t;
typedef enum
{
@@ -576,7 +593,9 @@ typedef struct
u32 next_index;
u32 sw_if_index;
u8 pkt_type;
-} hicn_iface_udp6_output_trace_t;
+ u8 packet_data[60];
+}
+hicn_iface_udp6_output_trace_t;
typedef enum
{
@@ -603,6 +622,9 @@ typedef enum
#define TRACE_OUTPUT_PKT_UDP4 hicn_iface_udp4_output_trace_t
#define TRACE_OUTPUT_PKT_UDP6 hicn_iface_udp6_output_trace_t
+#define SIZE_HICN_HEADER4 sizeof(ip4_header_t) + sizeof(udp_header_t)
+#define SIZE_HICN_HEADER6 sizeof(ip6_header_t) + sizeof(udp_header_t)
+
#define iface_output_x1(ipv) \
do { \
vlib_buffer_t *b0; \
@@ -633,7 +655,7 @@ typedef enum
\
if (PREDICT_TRUE(face != NULL)) \
{ \
- HICN_FACE_UDP_ENCAP_IP##ipv \
+ HICN_FACE_UDP_ENCAP_IP##ipv \
(vm, b0, face); \
next0 = NEXT_LOOKUP_UDP##ipv; \
stats.pkts_data_count += 1; \
@@ -647,6 +669,10 @@ typedef enum
t->pkt_type = HICN_PKT_TYPE_INTEREST; \
t->sw_if_index = vnet_buffer (b0)->sw_if_index[VLIB_RX]; \
t->next_index = next0; \
+ clib_memcpy_fast (t->packet_data, \
+ vlib_buffer_get_current (b0) + \
+ SIZE_HICN_HEADER##ipv, \
+ sizeof (t->packet_data)); \
} \
\
\
@@ -656,7 +682,7 @@ typedef enum
bi0, next0); \
} while(0)
-#define iface_output_x2(ipv) \
+#define iface_output_x2(ipv) \
do { \
vlib_buffer_t *b0, *b1; \
u32 bi0, bi1; \
@@ -690,7 +716,7 @@ typedef enum
face0 = \
hicn_dpoi_get_from_idx(vnet_buffer (b0)->ip.adj_index[VLIB_TX]); \
face1 = \
- hicn_dpoi_get_from_idx(vnet_buffer (b0)->ip.adj_index[VLIB_TX]); \
+ hicn_dpoi_get_from_idx(vnet_buffer (b1)->ip.adj_index[VLIB_TX]); \
\
if (PREDICT_TRUE(face0 != NULL)) \
{ \
@@ -704,7 +730,7 @@ typedef enum
{ \
HICN_FACE_UDP_ENCAP_IP##ipv \
(vm, b1, face1); \
- next0 = NEXT_LOOKUP_UDP##ipv; \
+ next1 = NEXT_LOOKUP_UDP##ipv; \
stats.pkts_data_count += 1; \
} \
\
@@ -716,6 +742,10 @@ typedef enum
t->pkt_type = HICN_PKT_TYPE_INTEREST; \
t->sw_if_index = vnet_buffer (b0)->sw_if_index[VLIB_RX]; \
t->next_index = next0; \
+ clib_memcpy_fast (t->packet_data, \
+ vlib_buffer_get_current (b0) + \
+ SIZE_HICN_HEADER##ipv, \
+ sizeof (t->packet_data)); \
} \
\
if (PREDICT_FALSE ((node->flags & VLIB_NODE_FLAG_TRACE) && \
@@ -726,6 +756,10 @@ typedef enum
t->pkt_type = HICN_PKT_TYPE_INTEREST; \
t->sw_if_index = vnet_buffer (b1)->sw_if_index[VLIB_RX]; \
t->next_index = next1; \
+ clib_memcpy_fast (t->packet_data, \
+ vlib_buffer_get_current (b1) + \
+ SIZE_HICN_HEADER##ipv, \
+ sizeof (t->packet_data)); \
} \
\
\
@@ -781,8 +815,12 @@ hicn_iface_udp4_output_format_trace (u8 * s, va_list * args)
hicn_iface_udp4_output_trace_t *t =
va_arg (*args, hicn_iface_udp4_output_trace_t *);
- s = format (s, "IFACE_UDP4_OUTPUT: pkt: %d, sw_if_index %d, next index %d",
- (int) t->pkt_type, t->sw_if_index, t->next_index);
+ s =
+ format (s,
+ "IFACE_UDP4_OUTPUT: pkt: %d, out face %d, next index %d\n%U",
+ (int) t->pkt_type, t->sw_if_index, t->next_index,
+ (t->packet_data[0] & 0xf0) == 0x40 ? format_ip4_header : format_ip6_header,
+ t->packet_data, sizeof (t->packet_data));
return (s);
}
@@ -857,8 +895,12 @@ hicn_iface_udp6_output_format_trace (u8 * s, va_list * args)
hicn_iface_udp6_output_trace_t *t =
va_arg (*args, hicn_iface_udp6_output_trace_t *);
- s = format (s, "IFACE_UDP6_OUTPUT: pkt: %d, sw_if_index %d, next index %d",
- (int) t->pkt_type, t->sw_if_index, t->next_index);
+ s =
+ format (s,
+ "IFACE_UDP6_OUTPUT: pkt: %d, out face %d, next index %d\n%U",
+ (int) t->pkt_type, t->sw_if_index, t->next_index,
+ (t->packet_data[0] & 0xf0) == 0x40 ? format_ip4_header : format_ip6_header,
+ t->packet_data, sizeof (t->packet_data));
return (s);
}
diff --git a/hicn-plugin/src/interest_hitcs_node.c b/hicn-plugin/src/interest_hitcs_node.c
index 1d2255fcd..97879b328 100644
--- a/hicn-plugin/src/interest_hitcs_node.c
+++ b/hicn-plugin/src/interest_hitcs_node.c
@@ -45,17 +45,15 @@ clone_from_cs (vlib_main_t * vm, u32 * bi0_cs, vlib_buffer_t * dest, u8 isv6)
/* Retrieve the buffer to clone */
vlib_buffer_t *cs_buf = vlib_get_buffer (vm, *bi0_cs);
hicn_buffer_t *hicnb = hicn_get_buffer (cs_buf);
- u16 buffer_advance = isv6 ? sizeof (ip6_header_t) + sizeof (tcp_header_t) :
- sizeof (ip4_header_t) + sizeof (tcp_header_t);
-
+ word buffer_advance = CLIB_CACHE_LINE_BYTES * 2;
if (hicnb->flags & HICN_BUFFER_FLAGS_PKT_LESS_TWO_CL)
{
clib_memcpy_fast (vlib_buffer_get_current (dest),
vlib_buffer_get_current (cs_buf),
- cs_buf->current_length);
+ dest->current_length);
clib_memcpy_fast (dest->opaque2, cs_buf->opaque2,
sizeof (cs_buf->opaque2));
- dest->current_data = cs_buf->current_data;
+
dest->current_length = cs_buf->current_length;
dest->total_length_not_including_first_buffer = 0;
}
@@ -71,18 +69,16 @@ clone_from_cs (vlib_main_t * vm, u32 * bi0_cs, vlib_buffer_t * dest, u8 isv6)
cs_buf = cs_buf2;
}
- clib_memcpy (vlib_buffer_get_current (dest),
- vlib_buffer_get_current (cs_buf), buffer_advance);
+ clib_memcpy_fast (vlib_buffer_get_current (dest),
+ vlib_buffer_get_current (cs_buf), buffer_advance);
+ clib_memcpy_fast (dest->opaque2, cs_buf->opaque2,
+ sizeof (cs_buf->opaque2));
dest->current_length = buffer_advance;
vlib_buffer_advance (cs_buf, buffer_advance);
vlib_buffer_attach_clone (vm, dest, cs_buf);
}
}
-/*
- * ICN forwarder node for interests: handling of Interests delivered based on
- * ACL. - 1 packet at a time - ipv4/tcp ipv6/tcp
- */
static uword
hicn_interest_hitcs_node_fn (vlib_main_t * vm, vlib_node_runtime_t * node,
vlib_frame_t * frame)
@@ -190,8 +186,6 @@ hicn_interest_hitcs_node_fn (vlib_main_t * vm, vlib_node_runtime_t * node,
* Retrieve the incoming iface and forward
* the data through it
*/
- ASSERT (hicnb0->face_dpo_id.dpoi_index <
- HICN_PARAM_PIT_ENTRY_PHOPS_MAX);
next0 = hicnb0->face_dpo_id.dpoi_next_node;
vnet_buffer (b0)->ip.adj_index[VLIB_TX] =
hicnb0->face_dpo_id.dpoi_index;
diff --git a/hicn-plugin/src/params.h b/hicn-plugin/src/params.h
index 5adafd7e6..f3af714ec 100644
--- a/hicn-plugin/src/params.h
+++ b/hicn-plugin/src/params.h
@@ -80,7 +80,7 @@ STATIC_ASSERT ((HICN_PARAM_PIT_ENTRY_PHOPS_MAX <= HICN_PARAM_FACES_MAX),
#define HICN_PARAM_CS_LRU_DEFAULT (16 * 1024)
/* CS lifetime defines, in mseconds, integer type */
-#define HICN_PARAM_CS_LIFETIME_MIN 100
+#define HICN_PARAM_CS_LIFETIME_MIN 0
#define HICN_PARAM_CS_LIFETIME_DFLT (5 * 60 * 1000) // 300 seconds
#define HICN_PARAM_CS_LIFETIME_MAX (24 * 3600 * 1000) //24 hours...
diff --git a/hicn-plugin/src/pcs.h b/hicn-plugin/src/pcs.h
index 3ce40c9a3..549edae01 100644
--- a/hicn-plugin/src/pcs.h
+++ b/hicn-plugin/src/pcs.h
@@ -581,7 +581,7 @@ hicn_pcs_cs_insert_update (vlib_main_t * vm, hicn_pit_cs_t * pitcs,
bucket_is_overflow);
/* A content already exists in CS with the same name */
- if (ret == HICN_ERROR_HASHTB_EXIST)
+ if (ret == HICN_ERROR_HASHTB_EXIST && *is_cs)
{
/* Update the entry */
hicn_hash_node_t *existing_node =
diff --git a/hicn-plugin/src/strategies/dpo_mw.c b/hicn-plugin/src/strategies/dpo_mw.c
index 882368e6e..80cbcf2ee 100644
--- a/hicn-plugin/src/strategies/dpo_mw.c
+++ b/hicn-plugin/src/strategies/dpo_mw.c
@@ -95,21 +95,27 @@ hicn_dpo_strategy_mw_get_type (void)
void
hicn_strategy_mw_ctx_lock (dpo_id_t * dpo)
{
- hicn_strategy_mw_ctx_t *hicn_strategy_mw_ctx =
- (hicn_strategy_mw_ctx_t *) hicn_strategy_mw_ctx_get (dpo->dpoi_index);
- hicn_strategy_mw_ctx->default_ctx.locks++;
+ if (dpo->dpoi_index != 0)
+ {
+ hicn_strategy_mw_ctx_t *hicn_strategy_mw_ctx =
+ (hicn_strategy_mw_ctx_t *) hicn_strategy_mw_ctx_get (dpo->dpoi_index);
+ hicn_strategy_mw_ctx->default_ctx.locks++;
+ }
}
void
hicn_strategy_mw_ctx_unlock (dpo_id_t * dpo)
{
- hicn_strategy_mw_ctx_t *hicn_strategy_mw_ctx =
- (hicn_strategy_mw_ctx_t *) hicn_strategy_mw_ctx_get (dpo->dpoi_index);
- hicn_strategy_mw_ctx->default_ctx.locks--;
-
- if (0 == hicn_strategy_mw_ctx->default_ctx.locks)
+ if (dpo->dpoi_index != 0)
{
- pool_put (hicn_strategy_mw_ctx_pool, hicn_strategy_mw_ctx);
+ hicn_strategy_mw_ctx_t *hicn_strategy_mw_ctx =
+ (hicn_strategy_mw_ctx_t *) hicn_strategy_mw_ctx_get (dpo->dpoi_index);
+ hicn_strategy_mw_ctx->default_ctx.locks--;
+
+ if (0 == hicn_strategy_mw_ctx->default_ctx.locks)
+ {
+ pool_put (hicn_strategy_mw_ctx_pool, hicn_strategy_mw_ctx);
+ }
}
}
@@ -213,8 +219,8 @@ hicn_strategy_mw_ctx_add_nh (const dpo_id_t * nh, index_t dpo_idx)
{
/* If face is marked as deleted, ignore it */
hicn_face_t *face =
- hicn_dpoi_get_from_idx (hicn_strategy_mw_ctx->
- default_ctx.next_hops[i].dpoi_index);
+ hicn_dpoi_get_from_idx (hicn_strategy_mw_ctx->default_ctx.
+ next_hops[i].dpoi_index);
if (face->shared.flags & HICN_FACE_FLAGS_DELETED)
{
continue;
@@ -259,8 +265,8 @@ hicn_strategy_mw_ctx_del_nh (hicn_face_id_t face_id, index_t dpo_idx,
face_id)
{
nh_id = i;
- hicn_face_unlock (&hicn_strategy_mw_ctx->default_ctx.
- next_hops[i]);
+ hicn_face_unlock (&hicn_strategy_mw_ctx->
+ default_ctx.next_hops[i]);
hicn_strategy_mw_ctx->default_ctx.next_hops[i] = invalid;
hicn_strategy_mw_ctx->default_ctx.entry_count--;
}
diff --git a/hicn-plugin/src/strategies/strategy_mw.c b/hicn-plugin/src/strategies/strategy_mw.c
index fc7ef47fc..77a7d16a8 100644
--- a/hicn-plugin/src/strategies/strategy_mw.c
+++ b/hicn-plugin/src/strategies/strategy_mw.c
@@ -91,8 +91,8 @@ hicn_select_next_hop_mw (index_t dpo_idx, int *nh_idx, dpo_id_t ** outface)
return HICN_ERROR_MW_STRATEGY_NH_NOT_FOUND;
*outface =
- (dpo_id_t *) & hicn_strategy_mw_ctx->default_ctx.
- next_hops[next_hop_index];
+ (dpo_id_t *) & hicn_strategy_mw_ctx->
+ default_ctx.next_hops[next_hop_index];
return HICN_ERROR_NONE;
}
@@ -158,7 +158,9 @@ VLIB_REGISTER_NODE (hicn_mw_strategy_node) =
.n_next_nodes = HICN_STRATEGY_N_NEXT,
.next_nodes = {
[HICN_STRATEGY_NEXT_INTEREST_HITPIT] = "hicn-interest-hitpit",
+ [HICN_STRATEGY_NEXT_INTEREST_HITCS] = "hicn-interest-hitcs",
[HICN_STRATEGY_NEXT_ERROR_DROP] = "error-drop",
+ [HICN_STRATEGY_NEXT_EMPTY] = "ip4-lookup",
},
};
/* *INDENT-ON* */
diff --git a/hicn-plugin/src/strategy.c b/hicn-plugin/src/strategy.c
index 247de9d07..747e155b1 100644
--- a/hicn-plugin/src/strategy.c
+++ b/hicn-plugin/src/strategy.c
@@ -118,7 +118,9 @@ hicn_new_interest (hicn_strategy_runtime_t * rt, vlib_buffer_t * b0,
hicn_store_internal_state (b0, hicnb0->name_hash, node_id0,
dpo_ctx_id0, vft_id0, hash_entry_id,
bucket_id, bucket_is_overflow);
- *next = HICN_STRATEGY_NEXT_INTEREST_HITPIT;
+ *next =
+ is_cs0 ? HICN_STRATEGY_NEXT_INTEREST_HITCS :
+ HICN_STRATEGY_NEXT_INTEREST_HITPIT;
}
else
{
@@ -199,7 +201,6 @@ hicn_forward_interest_fn (vlib_main_t * vm,
next0 = HICN_STRATEGY_NEXT_ERROR_DROP;
ret = hicn_interest_parse_pkt (b0, &name, &namelen, &hicn0, &isv6);
-
stats.pkts_processed++;
/* Select next hop */
/*
@@ -209,9 +210,8 @@ 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))
{
diff --git a/hicn-plugin/src/strategy.h b/hicn-plugin/src/strategy.h
index a0100a4da..19eee72c5 100644
--- a/hicn-plugin/src/strategy.h
+++ b/hicn-plugin/src/strategy.h
@@ -70,7 +70,9 @@ typedef struct
typedef enum
{
HICN_STRATEGY_NEXT_INTEREST_HITPIT,
+ HICN_STRATEGY_NEXT_INTEREST_HITCS,
HICN_STRATEGY_NEXT_ERROR_DROP,
+ HICN_STRATEGY_NEXT_EMPTY,
HICN_STRATEGY_N_NEXT,
} hicn_strategy_next_t;
diff --git a/libtransport/src/hicn/transport/core/memif_connector.cc b/libtransport/src/hicn/transport/core/memif_connector.cc
index c69a87fb7..a4756d136 100644
--- a/libtransport/src/hicn/transport/core/memif_connector.cc
+++ b/libtransport/src/hicn/transport/core/memif_connector.cc
@@ -136,8 +136,7 @@ int MemifConnector::createMemif(uint32_t index, uint8_t mode, char *s) {
args.buffer_size = MEMIF_BUF_SIZE;
args.num_s2m_rings = 1;
args.num_m2s_rings = 1;
- strncpy((char *)args.interface_name, IF_NAME, strlen(IF_NAME));
- // strncpy((char *) args.instance_name, APP_NAME, strlen(APP_NAME));
+ strncpy((char *)args.interface_name, IF_NAME, strlen(IF_NAME) + 1);
args.mode = memif_interface_mode_t::MEMIF_INTERFACE_MODE_IP;
args.socket_filename = (uint8_t *)socket_filename_.c_str();
@@ -333,7 +332,7 @@ int MemifConnector::onDisconnect(memif_conn_handle_t conn, void *private_ctx) {
return 0;
}
-void MemifConnector::threadMain() { event_reactor_.runEventLoop(1); }
+void MemifConnector::threadMain() { event_reactor_.runEventLoop(1000); }
int MemifConnector::onInterrupt(memif_conn_handle_t conn, void *private_ctx,
uint16_t qid) {
@@ -509,4 +508,4 @@ void MemifConnector::send(const uint8_t *packet, std::size_t len,
} // end namespace transport
-#endif // __vpp__ \ No newline at end of file
+#endif // __vpp__
diff --git a/libtransport/src/hicn/transport/core/name.cc b/libtransport/src/hicn/transport/core/name.cc
index ba3e9e825..867d3a755 100644
--- a/libtransport/src/hicn/transport/core/name.cc
+++ b/libtransport/src/hicn/transport/core/name.cc
@@ -67,7 +67,7 @@ Name::Name(const std::string &uri) {
try {
seq_number = tokenizer.nextToken();
- } catch (errors::TokenizerException) {
+ } catch (errors::TokenizerException &) {
seq_number = "0";
}
diff --git a/libtransport/src/hicn/transport/core/vpp_forwarder_interface.cc b/libtransport/src/hicn/transport/core/vpp_forwarder_interface.cc
index 8dc607295..0d622f9a3 100644
--- a/libtransport/src/hicn/transport/core/vpp_forwarder_interface.cc
+++ b/libtransport/src/hicn/transport/core/vpp_forwarder_interface.cc
@@ -208,20 +208,21 @@ void VPPForwarderInterface::registerRoute(Prefix &prefix) {
}
void VPPForwarderInterface::closeConnection() {
- if (sw_if_index_ != uint32_t(~0) && VPPForwarderInterface::memif_api_) {
- int ret = memif_binary_api_delete_memif(VPPForwarderInterface::memif_api_,
- sw_if_index_);
+ if (VPPForwarderInterface::api_) {
+ if (sw_if_index_ != uint32_t(~0)) {
+ int ret = memif_binary_api_delete_memif(VPPForwarderInterface::memif_api_,
+ sw_if_index_);
- if (ret < 0) {
- TRANSPORT_LOGE("Error deleting memif with sw idx %u.", sw_if_index_);
+ if (ret < 0) {
+ TRANSPORT_LOGE("Error deleting memif with sw idx %u.", sw_if_index_);
+ }
}
- }
- if (VPPForwarderInterface::api_) {
vpp_binary_api_destroy(VPPForwarderInterface::api_);
- }
+ connector_.close();
- connector_.close();
+ VPPForwarderInterface::api_ = nullptr;
+ }
}
} // namespace core
diff --git a/libtransport/src/hicn/transport/utils/epoll_event_reactor.h b/libtransport/src/hicn/transport/utils/epoll_event_reactor.h
index bb4db3ee7..dbb87c6c5 100644
--- a/libtransport/src/hicn/transport/utils/epoll_event_reactor.h
+++ b/libtransport/src/hicn/transport/utils/epoll_event_reactor.h
@@ -18,6 +18,7 @@
#include <hicn/transport/utils/event_reactor.h>
#include <sys/epoll.h>
+#include <atomic>
#include <cstddef>
#include <functional>
#include <mutex>
@@ -57,7 +58,7 @@ class EpollEventReactor : public EventReactor {
int addFileDescriptor(int fd, uint32_t events);
int epoll_fd_;
- volatile bool run_event_loop_;
+ std::atomic_bool run_event_loop_;
EventCallbackMap event_callback_map_;
std::mutex event_callback_map_mutex_;
};
diff --git a/pom.xml b/pom.xml
new file mode 100644
index 000000000..63d26cc80
--- /dev/null
+++ b/pom.xml
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright (c) 2019 Cisco and/or its affiliates.
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at:
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+--><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+
+ <parent>
+ <groupId>io.fd.hicn.common</groupId>
+ <artifactId>hicn-parent</artifactId>
+ <version>1.19.01-SNAPSHOT</version>
+ <relativePath>common/hicn-parent</relativePath>
+ </parent>
+
+ <groupId>io.fd.hicn</groupId>
+ <artifactId>hicn-aggregator</artifactId>
+ <version>1.19.01-SNAPSHOT</version>
+ <name>hicn</name>
+ <packaging>pom</packaging>
+ <modelVersion>4.0.0</modelVersion>
+
+ <description>hicn project root aggregator</description>
+
+ <scm>
+ <url>https://git.fd.io/hicn/tree/</url>
+ </scm>
+
+ <modules>
+ <module>lib</module>
+ <module>hicn-light</module>
+ <module>hicn-plugin</module>
+ <module>libtransport</module>
+ </modules>
+</project> \ No newline at end of file
diff --git a/utils/src/hiperf.cc b/utils/src/hiperf.cc
index bbef2d27e..f2387b57c 100644
--- a/utils/src/hiperf.cc
+++ b/utils/src/hiperf.cc
@@ -754,8 +754,6 @@ int main(int argc, char *argv[]) {
return EXIT_FAILURE;
}
- std::cout << "Bye bye" << std::endl;
-
#ifdef _WIN32
WSACleanup();
#endif
diff --git a/utils/src/ping_server.cc b/utils/src/ping_server.cc
index 3a20dffd1..8e3c6a0ed 100644
--- a/utils/src/ping_server.cc
+++ b/utils/src/ping_server.cc
@@ -44,7 +44,7 @@ class CallbackContainer {
public:
CallbackContainer(const Name &prefix, uint32_t object_size, bool verbose,
bool dump, bool quite, bool flags, bool reset, uint8_t ttl,
- utils::Identity *identity, bool sign)
+ utils::Identity *identity, bool sign, uint32_t lifetime)
: buffer_(object_size, 'X'),
content_objects_((std::uint32_t)(1 << log2_content_object_buffer_size)),
mask_((std::uint16_t)(1 << log2_content_object_buffer_size) - 1),
@@ -74,12 +74,11 @@ class CallbackContainer {
for (int i = 0; i < (1 << log2_content_object_buffer_size); i++) {
content_objects_[i] = std::make_shared<ContentObject>(
prefix, format, (const uint8_t *)buffer_.data(), buffer_.size());
- content_objects_[i]->setLifetime(
- default_values::content_object_expiry_time);
+ content_objects_[i]->setLifetime(lifetime);
}
}
- void processInterest(ProducerSocket &p, const Interest &interest) {
+ void processInterest(ProducerSocket &p, const Interest &interest, uint32_t lifetime) {
if (verbose_) {
std::cout << "<<< received interest " << interest.getName()
<< " src port: " << interest.getSrcPort()
@@ -102,7 +101,7 @@ class CallbackContainer {
auto &content_object = content_objects_[content_objects_index_++ & mask_];
content_object->setName(interest.getName());
- content_object->setLifetime(default_values::content_object_expiry_time);
+ content_object->setLifetime(lifetime);
content_object->setLocator(interest.getLocator());
content_object->setSrcPort(interest.getDstPort());
content_object->setDstPort(interest.getSrcPort());
@@ -173,6 +172,7 @@ void help() {
std::cout << "-f set tcp flags according to the flag received "
"(default false)"
<< std::endl;
+ std::cout << "-l data lifetime" << std::endl;
std::cout << "-r always reply with a reset flag (default false)"
<< std::endl;
std::cout << "-t set ttl (default 64)" << std::endl;
@@ -208,12 +208,13 @@ int main(int argc, char **argv) {
std::string keystore_path = "./rsa_crypto_material.p12";
std::string keystore_password = "cisco";
bool sign = false;
+ uint32_t data_lifetime = default_values::content_object_expiry_time;
int opt;
#ifndef _WIN32
- while ((opt = getopt(argc, argv, "s:n:t:qfrVDdHk:p:")) != -1) {
+ while ((opt = getopt(argc, argv, "s:n:t:l:qfrVDdHk:p:")) != -1) {
#else
- while ((opt = getopt(argc, argv, "s:n:t:qfrVDHk:p:")) != -1) {
+ while ((opt = getopt(argc, argv, "s:n:t:l:qfrVDHk:p:")) != -1) {
#endif
switch (opt) {
case 's':
@@ -225,6 +226,9 @@ int main(int argc, char **argv) {
case 't':
ttl = (uint8_t)std::stoi(optarg);
break;
+ case 'l':
+ data_lifetime = std::stoi(optarg);
+ break;
case 'V':
verbose = true;
break;
@@ -281,11 +285,11 @@ int main(int argc, char **argv) {
if (sign) {
stubs = new CallbackContainer(n, object_size, verbose, dump, quite, flags,
- reset, ttl, &identity, sign);
+ reset, ttl, &identity, sign, data_lifetime);
} else {
utils::Identity *identity = nullptr;
stubs = new CallbackContainer(n, object_size, verbose, dump, quite, flags,
- reset, ttl, identity, sign);
+ reset, ttl, identity, sign, data_lifetime);
}
ProducerSocket p;
@@ -295,7 +299,7 @@ int main(int argc, char **argv) {
p.setSocketOption(ProducerCallbacksOptions::CACHE_MISS,
(ProducerInterestCallback)bind(
&CallbackContainer::processInterest, stubs,
- std::placeholders::_1, std::placeholders::_2));
+ std::placeholders::_1, std::placeholders::_2, data_lifetime));
p.connect();