summaryrefslogtreecommitdiffstats
path: root/hicn-plugin
diff options
context:
space:
mode:
authorAlberto Compagno <acompagn+fdio@cisco.com>2019-02-19 18:46:36 +0100
committerAlberto Compagno <acompagn+fdio@cisco.com>2019-02-20 18:03:16 +0100
commit1c5106f66a6749266cb1d228eda98413c80cbf1f (patch)
tree40bd4c7c42eaabd3fd038caa8f9e2fe432f9a434 /hicn-plugin
parent286fd55fc0cf620747209570a32b79d97d50d9b4 (diff)
[HICN-71]
- Handling the case in which a pushed data hit an existing pit entry (created after the data has gone through the data_pcslookup_node). In this case the data packet is forwarded to the data_fwd_node - Handling the case in which the hash table (in pcs) is full and it is not possible to allocate another bucket. In this case the packet is dropped. - Copying packets whose length is less than 128B. VPP prevents to create a chain of vlib_buffer where the first, or middle, vlib_buffer are holding less then 128B. [HICN-72] - Assign a /128 subnet to the producer app face. Change-Id: I6c19d6d127774a7f59ac69ac965d4bcd6a72becc Signed-off-by: Alberto Compagno <acompagn+fdio@cisco.com>
Diffstat (limited to 'hicn-plugin')
-rw-r--r--hicn-plugin/src/data_fwd.h3
-rw-r--r--hicn-plugin/src/data_fwd_node.c18
-rw-r--r--hicn-plugin/src/data_push_node.c256
-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.c66
-rw-r--r--hicn-plugin/src/faces/udp/face_udp_node.c74
-rw-r--r--hicn-plugin/src/faces/udp/iface_udp_node.c88
-rw-r--r--hicn-plugin/src/interest_hitcs_node.c20
-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
19 files changed, 469 insertions, 282 deletions
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..b25c9e0ac 100644
--- a/hicn-plugin/src/data_fwd_node.c
+++ b/hicn-plugin/src/data_fwd_node.c
@@ -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
{
@@ -284,8 +297,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 +319,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.
diff --git a/hicn-plugin/src/data_push_node.c b/hicn-plugin/src/data_push_node.c
index a4a25e29b..d530173bc 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,34 +62,47 @@ 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_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;
@@ -97,10 +112,11 @@ hicn_new_data (vlib_main_t * vm, hicn_data_push_runtime_t * rt,
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;
@@ -117,7 +133,6 @@ hicn_new_data (vlib_main_t * vm, hicn_data_push_runtime_t * rt,
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 +153,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 +196,73 @@ 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);
+
+ ret0 = hicn_data_parse_pkt (b0, &name, &namelen, &hicn0, &isv6);
+ nameptr = (u8 *) (&name);
+ if (PREDICT_TRUE (ret0 == HICN_ERROR_NONE))
+ hicn_new_data (vm, rt, b0, &to_forward, &n_to_forward, tnow, nameptr,
+ namelen, isv6);
+ stats.pkts_data_count++;
+ }
- /* Dual loop, X1 */
- while (n_left_from > 0 && n_left_to_next > 0)
+ 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)
{
- 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);
- 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_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 +290,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..f0408860e 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[128 - 1 * sizeof (u32)];
+}
+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[128 - 1 * sizeof (u32)];
+}
+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[128 - 1 * sizeof (u32)];
+}
+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[128 - 1 * sizeof (u32)];
+}
+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..a0baa7d8c 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[128 - 1 * sizeof (u32)];
} 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[128 - 1 * sizeof (u32)];
} 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[128 - 1 * sizeof (u32)];
} 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[128 - 1 * sizeof (u32)];
} 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..ae1fd89c7 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)
diff --git a/hicn-plugin/src/faces/udp/face_udp_node.c b/hicn-plugin/src/faces/udp/face_udp_node.c
index ac7a63731..a8851ad79 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[128 - 1 * sizeof (u32)];
+}
+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[128 - 1 * sizeof (u32)];
+}
+hicn_face_udp6_input_trace_t;
typedef enum
{
@@ -163,7 +167,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 +286,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 +299,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 +356,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] == 4 ? format_ip4_header : format_ip6_header,
+ t->packet_data, sizeof (t->packet_data));
return (s);
}
@@ -421,8 +437,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] == 4 ? format_ip4_header : format_ip6_header,
+ t->packet_data, sizeof (t->packet_data));
return (s);
}
@@ -551,7 +570,9 @@ typedef struct
u32 next_index;
u32 sw_if_index;
u8 pkt_type;
-} hicn_face_udp4_output_trace_t;
+ u8 packet_data[128 - 1 * sizeof (u32)];
+}
+hicn_face_udp4_output_trace_t;
/* Trace context struct */
typedef struct
@@ -559,7 +580,9 @@ typedef struct
u32 next_index;
u32 sw_if_index;
u8 pkt_type;
-} hicn_face_udp6_output_trace_t;
+ u8 packet_data[128 - 1 * sizeof (u32)];
+}
+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 +638,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)); \
} \
\
to_next[0] = bi0; \
@@ -699,8 +725,24 @@ 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) && \
+ (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), \
+ 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 +797,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] == 4 ? format_ip4_header : format_ip6_header,
+ t->packet_data, sizeof (t->packet_data));
return (s);
}
@@ -828,8 +873,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] == 4 ? 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..7b36c4e1e 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[128 - 1 * sizeof (u32)];
+}
+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[128 - 1 * sizeof (u32)];
+}
+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] == 4 ? 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] == 4 ? 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[128 - 1 * sizeof (u32)];
+}
+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[128 - 1 * sizeof (u32)];
+}
+hicn_iface_udp6_output_trace_t;
typedef enum
{
@@ -633,7 +652,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 +666,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)); \
} \
\
\
@@ -656,7 +678,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 +712,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)) \
{ \
@@ -716,6 +738,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) && \
@@ -726,6 +751,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)); \
} \
\
\
@@ -781,8 +809,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, sw_if_index %d, next index %d\n%U",
+ (int) t->pkt_type, t->sw_if_index, t->next_index,
+ t->packet_data[0] == 4 ? format_ip4_header : format_ip6_header,
+ t->packet_data, sizeof (t->packet_data));
return (s);
}
@@ -857,8 +889,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, sw_if_index %d, next index %d\n%U",
+ (int) t->pkt_type, t->sw_if_index, t->next_index,
+ t->packet_data[0] == 4 ? 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/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;