aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlberto Compagno <acompagn+fdio@cisco.com>2019-01-19 17:28:57 +0100
committerAlberto Compagno <acompagn+fdio@cisco.com>2019-01-19 17:35:54 +0100
commitc7f942175b8c25c77ddc21561b52e3e6b5620b80 (patch)
treed9cecc4574ae9ed2f4a9e041010c8794e6001363
parentd13d37534d9449dd54277af664310d5f957dc44a (diff)
Improved performance on data-fwd node:
- Removed full pit entry initialization in favor of a lighter initialization on few fields - Squeezed pit entry size in order to store only the number of incomplete faces (as set in HICN_PARAM_PIT_ENTRY_PHOPS_MAX). The bitmap size is now determined by HICN_PARAM_FACES_MAX and optimized to do a fast lookup Replaced the field is_appface with the field flags in the hicn_buffer_t: - is_appface is now a flag with value 0x01 (HICN_BUFFER_FLAGS_FACE_IS_APP) - Added flag HICN_BUFFER_FLAGS_PKT_LESS_TWO_CL (0x02) to handle the copy of pkt with length < than 2*CACHE_LINES (in this case cloning is prevented by the cloning function in vpp). Such flag is initialized by the incoming face of the pkt. Change-Id: Ia956fd5719a28ee29f7fa2fd23d283964743efd8 Signed-off-by: Alberto Compagno <acompagn+fdio@cisco.com>
-rwxr-xr-xhicn-plugin/src/data_fwd.h5
-rwxr-xr-xhicn-plugin/src/data_fwd_node.c36
-rwxr-xr-xhicn-plugin/src/data_pcslookup_node.c6
-rwxr-xr-xhicn-plugin/src/face_db.h11
-rwxr-xr-xhicn-plugin/src/faces/face.h23
-rwxr-xr-xhicn-plugin/src/faces/ip/dpo_ip.c13
-rwxr-xr-xhicn-plugin/src/faces/ip/dpo_ip.h44
-rwxr-xr-xhicn-plugin/src/faces/ip/face_ip_node.c6
-rwxr-xr-xhicn-plugin/src/faces/ip/iface_ip_node.c8
-rwxr-xr-xhicn-plugin/src/faces/udp/dpo_udp.c8
-rwxr-xr-xhicn-plugin/src/faces/udp/dpo_udp.h30
-rwxr-xr-xhicn-plugin/src/faces/udp/face_udp_node.c6
-rwxr-xr-xhicn-plugin/src/faces/udp/iface_udp_node.c6
-rwxr-xr-xhicn-plugin/src/hashtb.c8
-rwxr-xr-xhicn-plugin/src/hashtb.h16
-rwxr-xr-xhicn-plugin/src/hicn.h9
-rwxr-xr-xhicn-plugin/src/interest_hitcs_node.c38
-rwxr-xr-xhicn-plugin/src/params.h12
-rwxr-xr-xhicn-plugin/src/pcs.h6
-rwxr-xr-xhicn-plugin/src/strategies/strategy_mw.c1
-rwxr-xr-xhicn-plugin/src/strategy.c11
-rwxr-xr-xhicn-plugin/src/strategy.h1
22 files changed, 188 insertions, 116 deletions
diff --git a/hicn-plugin/src/data_fwd.h b/hicn-plugin/src/data_fwd.h
index 7390382ef..df74e9150 100755
--- a/hicn-plugin/src/data_fwd.h
+++ b/hicn-plugin/src/data_fwd.h
@@ -79,13 +79,10 @@ vlib_buffer_clone_256_2 (vlib_main_t * vm, u32 src_buffer, u32 * buffers,
{
vlib_buffer_t *d;
d = vlib_buffer_copy (vm, s);
- clib_memcpy (d->opaque2, s->opaque2, sizeof (s->opaque2));
if (d == 0)
return i;
buffers[i] = vlib_get_buffer_index (vm, d);
}
- s->current_data += head_end_offset;
- s->current_length -= head_end_offset;
return n_buffers;
}
n_buffers = vlib_buffer_alloc_from_free_list (vm, buffers, n_buffers,
@@ -145,8 +142,6 @@ always_inline u16
vlib_buffer_clone2 (vlib_main_t * vm, u32 src_buffer, u32 * buffers,
u16 n_buffers, u16 head_end_offset)
{
- ASSERT (head_end_offset >= VLIB_BUFFER_MIN_CHAIN_SEG_SIZE);
-
vlib_buffer_t *s = vlib_get_buffer (vm, src_buffer);
/*
diff --git a/hicn-plugin/src/data_fwd_node.c b/hicn-plugin/src/data_fwd_node.c
index 088683fe0..1d37fdbcc 100755
--- a/hicn-plugin/src/data_fwd_node.c
+++ b/hicn-plugin/src/data_fwd_node.c
@@ -112,10 +112,6 @@ hicn_data_node_fn (vlib_main_t * vm, vlib_node_runtime_t * node,
b1 = vlib_get_buffer (vm, from[1]);
CLIB_PREFETCH (b1, 2 * CLIB_CACHE_LINE_BYTES, STORE);
CLIB_PREFETCH (b1->data, CLIB_CACHE_LINE_BYTES, STORE);
-
- /* HICN PREFETCH */
- hicn_buffer_t *hicnb1 = hicn_get_buffer (b1);
- hicn_prefetch_pcs_entry (hicnb1, pitcs);
}
/* Dequeue a packet buffer */
/*
@@ -288,6 +284,8 @@ 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);
/*
* We have a hard limit on the number of vlib_buffer that we can
@@ -304,11 +302,32 @@ hicn_satisfy_faces (vlib_main_t * vm, u32 bi0,
/* Clone bi0 */
vlib_buffer_t *b0 = vlib_get_buffer (vm, bi0);
- /* Add one reference to maintain the buffer in the CS */
- b0->n_add_refs++;
+ hicn_buffer_t *hicnb = hicn_get_buffer (b0);
+ /*
+ * 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
+ {
+ /* Add one reference to maintain the buffer in the CS.
+ * b0->n_add_refs == 0 has two meaning: it has 1 buffer or no buffer chained to it.
+ * vlib_buffer_clone2 add a number of reference equalt to pitp->u.pit.faces.n_faces - 1
+ * as vlib_buffer_clone does. So after all the packet are forwarded the buffer stored in
+ * the CS will have n_add_refs == 0;
+ */
+ b0->n_add_refs++;
+ }
+
found = n_left_from =
vlib_buffer_clone2 (vm, bi0, clones, pitp->u.pit.faces.n_faces,
- VLIB_BUFFER_MIN_CHAIN_SEG_SIZE);
+ buffer_advance);
ASSERT (n_left_from == pitp->u.pit.faces.n_faces);
@@ -474,7 +493,8 @@ clone_data_to_cs (vlib_main_t * vm, hicn_pit_cs_t * pitcs,
*/
hicn_buffer_t *hicnb0 = hicn_get_buffer (b0);
hicn_pit_to_cs (vm, pitcs, pitp, hash_entry, nodep, dpo_vft, hicn_dpo_id,
- &hicnb->face_dpo_id, hicnb0->is_appface);
+ &hicnb->face_dpo_id,
+ hicnb0->flags & HICN_BUFFER_FLAGS_FACE_IS_APP);
pitp->shared.create_time = tnow;
diff --git a/hicn-plugin/src/data_pcslookup_node.c b/hicn-plugin/src/data_pcslookup_node.c
index 222545106..231d8557e 100755
--- a/hicn-plugin/src/data_pcslookup_node.c
+++ b/hicn-plugin/src/data_pcslookup_node.c
@@ -127,7 +127,9 @@ hicn_data_pcslookup_node_fn (vlib_main_t * vm, vlib_node_runtime_t * node,
int res =
hicn_hashtb_lookup_node (rt->pitcs->pcs_table, nameptr,
namelen, name_hash,
- !(hb0->is_appface) /* take lock */ ,
+ !(hb0->flags &
+ HICN_BUFFER_FLAGS_FACE_IS_APP)
+ /* take lock */ ,
&node_id0, &dpo_ctx_id0, &vft_id0,
&is_cs0,
&hash_entry_id, &bucket_id,
@@ -137,7 +139,7 @@ hicn_data_pcslookup_node_fn (vlib_main_t * vm, vlib_node_runtime_t * node,
if ((res == HICN_ERROR_HASHTB_HASH_NOT_FOUND
|| (res == HICN_ERROR_NONE && is_cs0))
- && (hb0->is_appface))
+ && (hb0->flags & HICN_BUFFER_FLAGS_FACE_IS_APP))
{
next0 = HICN_DATA_PCSLOOKUP_NEXT_STORE_DATA;
}
diff --git a/hicn-plugin/src/face_db.h b/hicn-plugin/src/face_db.h
index 7b8a08879..5c95be334 100755
--- a/hicn-plugin/src/face_db.h
+++ b/hicn-plugin/src/face_db.h
@@ -30,14 +30,11 @@
/* Must be power of two */
#define HICN_FACE_DB_INLINE_FACES 4
-#define HICN_PIT_N_HOP_BITMAP_SIZE HICN_PARAM_PIT_ENTRY_PHOPS_MAX
+#define HICN_PIT_BITMAP_SIZE_BYTE (HICN_PARAM_FACES_MAX / 8)
+#define HICN_PIT_N_HOP_BITMAP_SIZE HICN_PARAM_FACES_MAX
#define HICN_PIT_N_HOP_BUCKET (HICN_PARAM_PIT_ENTRY_PHOPS_MAX - HICN_FACE_DB_INLINE_FACES)
-STATIC_ASSERT ((HICN_PIT_N_HOP_BUCKET & (HICN_PIT_N_HOP_BUCKET - 1)) == 0,
- "HICN_PARAM_PIT_ENTRY_PHOP_MAX must be a power of 2 + 4");
-
-/* Takes 2 cache lines */
typedef struct __attribute__ ((packed)) hicn_face_bucket_s
{
/* Array of indexes of virtual faces */
@@ -46,7 +43,7 @@ typedef struct __attribute__ ((packed)) hicn_face_bucket_s
CLIB_CACHE_LINE_ALIGN_MARK (cache_line1);
/* Used to check if interests are retransmission */
- u8 bitmap[HICN_PIT_N_HOP_BITMAP_SIZE];
+ u8 bitmap[HICN_PIT_BITMAP_SIZE_BYTE];
} hicn_face_bucket_t;
@@ -138,7 +135,7 @@ hicn_faces_flush (hicn_face_db_t * face_db)
{
hicn_face_bucket_t *faces_bkt =
pool_elt_at_index (hicn_face_bucket_pool, face_db->next_bucket);
- clib_memset_u64 (&(faces_bkt->bitmap), 0, HICN_PIT_N_HOP_BITMAP_SIZE / 8);
+ clib_memset_u8 (&(faces_bkt->bitmap), 0, HICN_PIT_BITMAP_SIZE_BYTE);
face_db->n_faces = 0;
pool_put_index (hicn_face_bucket_pool, face_db->next_bucket);
}
diff --git a/hicn-plugin/src/faces/face.h b/hicn-plugin/src/faces/face.h
index 2774d9a2e..b24fe8648 100755
--- a/hicn-plugin/src/faces/face.h
+++ b/hicn-plugin/src/faces/face.h
@@ -21,6 +21,8 @@
#include <vnet/dpo/dpo.h>
#include <vnet/adj/adj_types.h>
+#include "../hicn.h"
+
typedef u8 hicn_face_flags_t;
typedef index_t hicn_face_id_t;
typedef dpo_type_t hicn_face_type_t;
@@ -101,6 +103,27 @@ extern hicn_face_t *hicn_dpoi_face_pool;
#define HICN_FACE_NULL (hicn_face_id_t) ~0
+#define HICN_FACE_FLAGS_APPFACE_PROD_BIT 2
+#define HICN_FACE_FLAGS_APPFACE_CONS_BIT 3
+
+STATIC_ASSERT ((1 << HICN_FACE_FLAGS_APPFACE_PROD_BIT) ==
+ HICN_FACE_FLAGS_APPFACE_PROD,
+ "HICN_FACE_FLAGS_APPFACE_PROD_BIT and HICN_FACE_FLAGS_APPFACE_PROD must correspond");
+
+STATIC_ASSERT ((1 << HICN_FACE_FLAGS_APPFACE_CONS_BIT) ==
+ HICN_FACE_FLAGS_APPFACE_CONS,
+ "HICN_FACE_FLAGS_APPFACE_CONS_BIT and HICN_FACE_FLAGS_APPFACE_CONS must correspond");
+
+STATIC_ASSERT ((HICN_FACE_FLAGS_APPFACE_PROD >>
+ HICN_FACE_FLAGS_APPFACE_PROD_BIT) ==
+ HICN_BUFFER_FLAGS_FACE_IS_APP,
+ "hicn buffer app flag does not correspond to HICN_FACE_FLAGS_APPFACE_PROD");
+
+STATIC_ASSERT ((HICN_FACE_FLAGS_APPFACE_CONS >>
+ HICN_FACE_FLAGS_APPFACE_CONS_BIT) ==
+ HICN_BUFFER_FLAGS_FACE_IS_APP,
+ "hicn buffer app flag does not correspond to HICN_FACE_FLAGS_APPFACE_PROD");
+
/**
* @brief Definition of the virtual functin table for an hICN FACE DPO.
*
diff --git a/hicn-plugin/src/faces/ip/dpo_ip.c b/hicn-plugin/src/faces/ip/dpo_ip.c
index 1b2dbcff9..de71f1b01 100755
--- a/hicn-plugin/src/faces/ip/dpo_ip.c
+++ b/hicn-plugin/src/faces/ip/dpo_ip.c
@@ -78,7 +78,7 @@ hicn_dpo_ip4_create (dpo_id_t * dpo,
/* If local matches the dpoi is a face */
hicn_face_t *face =
hicn_face_ip4_get (local_addr, sw_if, &hicn_face_ip_local_hashtb);
- u8 is_appface;
+ u8 hicnb_flags;
if (face != NULL)
return HICN_ERROR_FACE_ALREADY_CREATED;
@@ -87,7 +87,7 @@ hicn_dpo_ip4_create (dpo_id_t * dpo,
if (face == NULL)
{
- hicn_dpo_ip4_add_and_lock_from_remote (dpo, &is_appface, local_addr,
+ hicn_dpo_ip4_add_and_lock_from_remote (dpo, &hicnb_flags, local_addr,
remote_addr, sw_if, node_index);
*face_id = (hicn_face_id_t) dpo->dpoi_index;
face = hicn_dpoi_get_from_idx (*face_id);
@@ -127,7 +127,7 @@ hicn_dpo_ip6_create (dpo_id_t * dpo,
hicn_face_t *face =
hicn_face_ip6_get (local_addr, sw_if, &hicn_face_ip_local_hashtb);
- u8 is_appface;
+ u8 hicnb_flags;
if (face != NULL)
return HICN_ERROR_FACE_ALREADY_CREATED;
@@ -137,7 +137,7 @@ hicn_dpo_ip6_create (dpo_id_t * dpo,
/* If remote matches the dpoi is a iface */
if (face == NULL)
{
- hicn_dpo_ip6_add_and_lock_from_remote (dpo, &is_appface, local_addr,
+ hicn_dpo_ip6_add_and_lock_from_remote (dpo, &hicnb_flags, local_addr,
remote_addr, sw_if, node_index);
*face_id = (hicn_face_id_t) dpo->dpoi_index;
face = hicn_dpoi_get_from_idx (*face_id);
@@ -172,9 +172,8 @@ hicn_dpo_ip_create_from_face (hicn_face_t * face, dpo_id_t * dpo,
hicn_face_id_t face_dpoi_id = hicn_dpoi_get_index (face);
hicn_face_ip_t *ip_face = (hicn_face_ip_t *) face->data;
dpo_set (dpo, face->shared.face_type,
- ip46_address_is_ip4 (&ip_face->
- local_addr) ? DPO_PROTO_IP4 : DPO_PROTO_IP6,
- face_dpoi_id);
+ ip46_address_is_ip4 (&ip_face->local_addr) ? DPO_PROTO_IP4 :
+ DPO_PROTO_IP6, face_dpoi_id);
dpo->dpoi_next_node = dpoi_next_node;
}
diff --git a/hicn-plugin/src/faces/ip/dpo_ip.h b/hicn-plugin/src/faces/ip/dpo_ip.h
index 675443277..426d5a146 100755
--- a/hicn-plugin/src/faces/ip/dpo_ip.h
+++ b/hicn-plugin/src/faces/ip/dpo_ip.h
@@ -33,7 +33,7 @@ void hicn_dpo_ip_module_init (void);
* method adds a lock on the face state.
*
* @param dpo: Result of the lookup. If the face doesn't exist dpo = NULL
- * @param is_appface: Boolean that indicates whether the face is an application
+ * @param hicnb_flags: Flags that indicate whether the face is an application
* face or not
* @param local_addr: Ip v4 local address of the face
* @param sw_if: software interface id of the face
@@ -42,7 +42,7 @@ void hicn_dpo_ip_module_init (void);
*/
always_inline int
hicn_dpo_ip4_lock_from_local (dpo_id_t * dpo,
- u8 * is_appface,
+ u8 * hicnb_flags,
const ip4_address_t * local_addr, u32 sw_if)
{
hicn_face_t *face =
@@ -51,7 +51,10 @@ hicn_dpo_ip4_lock_from_local (dpo_id_t * dpo,
if (PREDICT_FALSE (face == NULL))
return HICN_ERROR_FACE_NOT_FOUND;
- *is_appface = face->shared.flags & HICN_FACE_FLAGS_APPFACE_PROD;
+ *hicnb_flags = HICN_BUFFER_FLAGS_DEFAULT;
+ *hicnb_flags |=
+ (face->shared.flags & HICN_FACE_FLAGS_APPFACE_PROD) >>
+ HICN_FACE_FLAGS_APPFACE_PROD_BIT;
hicn_face_id_t dpoi_index = hicn_dpoi_get_index (face);
dpo_set (dpo, hicn_face_ip_type, DPO_PROTO_IP4, dpoi_index);
@@ -66,7 +69,7 @@ hicn_dpo_ip4_lock_from_local (dpo_id_t * dpo,
* method adds a lock on the face state.
*
* @param dpo: Result of the lookup. If the face doesn't exist dpo = NULL
- * @param is_appface: Boolean that indicates whether the face is an application
+ * @param hicnb_flags: Flags that indicate whether the face is an application
* face or not
* @param local_addr: Ip v6 local address of the face
* @param sw_if: software interface id of the face
@@ -75,7 +78,7 @@ hicn_dpo_ip4_lock_from_local (dpo_id_t * dpo,
*/
always_inline int
hicn_dpo_ip6_lock_from_local (dpo_id_t * dpo,
- u8 * is_appface,
+ u8 * hicnb_flags,
const ip6_address_t * local_addr, u32 sw_if)
{
hicn_face_t *face =
@@ -84,7 +87,10 @@ hicn_dpo_ip6_lock_from_local (dpo_id_t * dpo,
if (PREDICT_FALSE (face == NULL))
return HICN_ERROR_FACE_NOT_FOUND;
- *is_appface = face->shared.flags & HICN_FACE_FLAGS_APPFACE_PROD;
+ *hicnb_flags = HICN_BUFFER_FLAGS_DEFAULT;
+ *hicnb_flags |=
+ (face->shared.flags & HICN_FACE_FLAGS_APPFACE_PROD) >>
+ HICN_FACE_FLAGS_APPFACE_PROD_BIT;
hicn_face_id_t dpoi_index = hicn_dpoi_get_index (face);
dpo_set (dpo, hicn_face_ip_type, DPO_PROTO_IP6, dpoi_index);
@@ -100,7 +106,7 @@ hicn_dpo_ip6_lock_from_local (dpo_id_t * dpo,
* address and returns its dpo. This method adds a lock on the face state.
*
* @param dpo: Result of the lookup
- * @param is_appface: Boolean that indicates whether the face is an application
+ * @param hicnb_flags: Flags that indicate whether the face is an application
* face or not
* @param local_addr: Ip v4 local address of the face
* @param remote_addr: Ip v4 remote address of the face
@@ -109,7 +115,7 @@ hicn_dpo_ip6_lock_from_local (dpo_id_t * dpo,
*/
always_inline void
hicn_dpo_ip4_add_and_lock_from_remote (dpo_id_t * dpo,
- u8 * is_appface,
+ u8 * hicnb_flags,
const ip4_address_t * local_addr,
const ip4_address_t * remote_addr,
u32 sw_if, u32 node_index)
@@ -125,7 +131,7 @@ hicn_dpo_ip4_add_and_lock_from_remote (dpo_id_t * dpo,
ip46_address_t remote_addr46 = to_ip46 (0, (u8 *) remote_addr);
hicn_iface_ip_add (&local_addr46, &remote_addr46, sw_if, &dpoi_index);
- *is_appface = 0;
+ *hicnb_flags = HICN_BUFFER_FLAGS_DEFAULT;
dpo_set (dpo, hicn_face_ip_type, DPO_PROTO_IP4, dpoi_index);
dpo->dpoi_next_node = node_index;
@@ -135,7 +141,10 @@ hicn_dpo_ip4_add_and_lock_from_remote (dpo_id_t * dpo,
}
/* Code replicated on purpose */
- *is_appface = face->shared.flags & HICN_FACE_FLAGS_APPFACE_PROD;
+ *hicnb_flags = HICN_BUFFER_FLAGS_DEFAULT;
+ *hicnb_flags |=
+ (face->shared.flags & HICN_FACE_FLAGS_APPFACE_PROD) >>
+ HICN_FACE_FLAGS_APPFACE_PROD_BIT;
hicn_face_id_t dpoi_index = hicn_dpoi_get_index (face);
dpo_set (dpo, hicn_face_ip_type, DPO_PROTO_IP4, dpoi_index);
@@ -148,7 +157,7 @@ hicn_dpo_ip4_add_and_lock_from_remote (dpo_id_t * dpo,
* address and returns its dpo. This method adds a lock on the face state.
*
* @param dpo: Result of the lookup
- * @param is_appface: Boolean that indicates whether the face is an application
+ * @param hicnb_flags: Flags that indicate whether the face is an application
* face or not
* @param local_addr: Ip v6 local address of the face
* @param remote_addr: Ip v6 remote address of the face
@@ -157,11 +166,15 @@ hicn_dpo_ip4_add_and_lock_from_remote (dpo_id_t * dpo,
*/
always_inline void
hicn_dpo_ip6_add_and_lock_from_remote (dpo_id_t * dpo,
- u8 * is_appface,
+ u8 * hicnb_flags,
const ip6_address_t * local_addr,
const ip6_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_ip6_get (remote_addr, sw_if, &hicn_face_ip_remote_hashtb);
@@ -172,7 +185,7 @@ hicn_dpo_ip6_add_and_lock_from_remote (dpo_id_t * dpo,
hicn_iface_ip_add ((ip46_address_t *) local_addr,
(ip46_address_t *) remote_addr, sw_if, &dpoi_index);
- *is_appface = 0;
+ *hicnb_flags = HICN_BUFFER_FLAGS_DEFAULT;
dpo_set (dpo, hicn_face_ip_type, DPO_PROTO_IP4, dpoi_index);
dpo->dpoi_next_node = node_index;
@@ -181,7 +194,10 @@ hicn_dpo_ip6_add_and_lock_from_remote (dpo_id_t * dpo,
return;
}
/* Code replicated on purpose */
- *is_appface = face->shared.flags & HICN_FACE_FLAGS_APPFACE_PROD;
+ *hicnb_flags = HICN_BUFFER_FLAGS_DEFAULT;
+ *hicnb_flags |=
+ (face->shared.flags & HICN_FACE_FLAGS_APPFACE_PROD) >>
+ HICN_FACE_FLAGS_APPFACE_PROD_BIT;
index_t dpoi_index = hicn_dpoi_get_index (face);
dpo_set (dpo, hicn_face_ip_type, DPO_PROTO_IP6, dpoi_index);
diff --git a/hicn-plugin/src/faces/ip/face_ip_node.c b/hicn-plugin/src/faces/ip/face_ip_node.c
index 6081e4737..b3577f65f 100755
--- a/hicn-plugin/src/faces/ip/face_ip_node.c
+++ b/hicn-plugin/src/faces/ip/face_ip_node.c
@@ -140,7 +140,7 @@ typedef enum
\
ret = LOCK_FROM_LOCAL_IP##ipv \
(&(hicnb0->face_dpo_id), \
- &hicnb0->is_appface, \
+ &hicnb0->flags, \
&(ip_hdr->dst_address), \
vnet_buffer (b0)->sw_if_index[VLIB_RX]); \
\
@@ -217,13 +217,13 @@ typedef enum
\
ret0 = LOCK_FROM_LOCAL_IP##ipv \
(&(hicnb0->face_dpo_id), \
- &hicnb0->is_appface, \
+ &hicnb0->flags, \
&(ip_hdr0->dst_address), \
vnet_buffer (b0)->sw_if_index[VLIB_RX]); \
\
ret1 = LOCK_FROM_LOCAL_IP##ipv \
(&(hicnb1->face_dpo_id), \
- &hicnb1->is_appface, \
+ &hicnb1->flags, \
&(ip_hdr1->dst_address), \
vnet_buffer (b1)->sw_if_index[VLIB_RX]); \
\
diff --git a/hicn-plugin/src/faces/ip/iface_ip_node.c b/hicn-plugin/src/faces/ip/iface_ip_node.c
index 8df0467f0..9ca00d7bf 100755
--- a/hicn-plugin/src/faces/ip/iface_ip_node.c
+++ b/hicn-plugin/src/faces/ip/iface_ip_node.c
@@ -143,7 +143,7 @@ typedef enum
{ \
vlib_buffer_t *b1; \
b1 = vlib_get_buffer (vm, from[1]); \
- CLIB_PREFETCH (b1, 2*CLIB_CACHE_LINE_BYTES, STORE); \
+ CLIB_PREFETCH (b1, 2*CLIB_CACHE_LINE_BYTES, STORE); \
CLIB_PREFETCH (b1->data, CLIB_CACHE_LINE_BYTES , LOAD); \
} \
/* Dequeue a packet buffer */ \
@@ -171,7 +171,7 @@ typedef enum
\
DPO_ADD_LOCK_IP##ipv \
(&(hicnb0->face_dpo_id), \
- &hicnb0->is_appface, \
+ &hicnb0->flags, \
local_address, \
&(ip_hdr->src_address), \
vnet_buffer(b0)->sw_if_index[VLIB_RX], \
@@ -248,7 +248,7 @@ typedef enum
\
DPO_ADD_LOCK_IP##ipv \
(&(hicnb0->face_dpo_id), \
- &hicnb0->is_appface, \
+ &hicnb0->flags, \
local_address0, \
&(ip_hdr0->src_address), \
vnet_buffer(b0)->sw_if_index[VLIB_RX], \
@@ -256,7 +256,7 @@ typedef enum
\
DPO_ADD_LOCK_IP##ipv \
(&(hicnb1->face_dpo_id), \
- &hicnb1->is_appface, \
+ &hicnb1->flags, \
local_address1, \
&(ip_hdr1->src_address), \
vnet_buffer(b1)->sw_if_index[VLIB_RX], \
diff --git a/hicn-plugin/src/faces/udp/dpo_udp.c b/hicn-plugin/src/faces/udp/dpo_udp.c
index e58fc9788..eadcb6abd 100755
--- a/hicn-plugin/src/faces/udp/dpo_udp.c
+++ b/hicn-plugin/src/faces/udp/dpo_udp.c
@@ -79,14 +79,14 @@ hicn_dpo_udp4_create (dpo_id_t * dpo,
u16 net_dst_port = clib_host_to_net_u16 (dst_port);
hicn_face_t *face = hicn_face_udp4_get (src_ip, dst_ip, src_port, dst_port);
- u8 is_appface;
+ u8 hicnb_flags;
/* ip_csum_t sum0; */
if (face != NULL)
return HICN_ERROR_FACE_ALREADY_CREATED;
hicn_dpo_udp4_add_and_lock (dpo, src_ip, dst_ip, net_src_port, net_dst_port,
- node_index, &is_appface);
+ node_index, &hicnb_flags);
face = hicn_dpoi_get_from_idx (dpo->dpoi_index);
@@ -118,13 +118,13 @@ hicn_dpo_udp6_create (dpo_id_t * dpo,
u16 net_dst_port = clib_host_to_net_u16 (dst_port);
hicn_face_t *face =
hicn_face_udp6_get (src_ip, dst_ip, net_src_port, net_dst_port);
- u8 is_appface;
+ u8 hicnb_flags;
if (face != NULL)
return HICN_ERROR_FACE_ALREADY_CREATED;
hicn_dpo_udp6_add_and_lock (dpo, src_ip, dst_ip, net_src_port, net_dst_port,
- node_index, &is_appface);
+ node_index, &hicnb_flags);
face = hicn_dpoi_get_from_idx (dpo->dpoi_index);
diff --git a/hicn-plugin/src/faces/udp/dpo_udp.h b/hicn-plugin/src/faces/udp/dpo_udp.h
index fdde4192b..33e4b5d46 100755
--- a/hicn-plugin/src/faces/udp/dpo_udp.h
+++ b/hicn-plugin/src/faces/udp/dpo_udp.h
@@ -64,8 +64,8 @@ hicn_dpo_udp4_create (dpo_id_t * dpo,
* @param remote_addr: Remote address of the UDP tunnel
* @param local_port: Local port of the UDP tunnel
* @param remote_port: Remote port of the UDP tunnel
- * @param is_appface: Boolean that indicates whether the face is an application
- * face or not. (Currently only IP faces can be appface)
+ * @param hicnb_flags: Flags that indicate whether the face is an application
+ * face or not in the hicn_buffer. (Currently only IP faces can be appface)
*
* @result HICN_ERROR_FACE_NOT_FOUND if the face does not exist, otherwise HICN_ERROR_NONE.
*/
@@ -73,7 +73,7 @@ always_inline int
hicn_dpo_udp4_lock (dpo_id_t * dpo,
const ip4_address_t * local_addr,
const ip4_address_t * remote_addr,
- u16 local_port, u16 remote_port, u8 * is_appface)
+ u16 local_port, u16 remote_port, u8 * hicnb_flags)
{
hicn_face_t *face =
hicn_face_udp4_get (local_addr, remote_addr, local_port, remote_port);
@@ -86,7 +86,7 @@ hicn_dpo_udp4_lock (dpo_id_t * dpo,
dpo->dpoi_next_node = ~0;
dpo_lock (dpo);
- *is_appface = 0;
+ *hicnb_flags = HICN_BUFFER_FLAGS_DEFAULT;
return HICN_ERROR_NONE;
}
@@ -101,7 +101,7 @@ hicn_dpo_udp4_lock (dpo_id_t * dpo,
* @param remote_addr: Remote address of the UDP tunnel
* @param local_port: Local port of the UDP tunnel
* @param remote_port: Remote port of the UDP tunnel
- * @param is_appface: Boolean that indicates whether the face is an application
+ * @param hicnb_flags: Flags that indicate whether the face is an application
* face or not. (Currently only IP faces can be appface)
* @param node_index: vlib edge index to use in the packet processing
*/
@@ -110,7 +110,7 @@ hicn_dpo_udp4_add_and_lock (dpo_id_t * dpo,
const ip4_address_t * local_addr,
const ip4_address_t * remote_addr,
u16 local_port, u16 remote_port,
- u32 node_index, u8 * is_appface)
+ u32 node_index, u8 * hicnb_flags)
{
hicn_face_t *face =
hicn_face_udp4_get (local_addr, remote_addr, local_port, remote_port);
@@ -145,7 +145,7 @@ hicn_dpo_udp4_add_and_lock (dpo_id_t * dpo,
mhash_set_mem (&hicn_face_udp_hashtb, &key, (uword *) & dpoi_index, 0);
face = face;
- *is_appface = 0;
+ *hicnb_flags = HICN_BUFFER_FLAGS_DEFAULT;
dpo_set (dpo, hicn_face_udp_type, DPO_PROTO_IP4, dpoi_index);
dpo->dpoi_next_node = node_index;
dpo_lock (dpo);
@@ -153,7 +153,7 @@ hicn_dpo_udp4_add_and_lock (dpo_id_t * dpo,
return;
}
- *is_appface = 0;
+ *hicnb_flags = HICN_BUFFER_FLAGS_DEFAULT;
hicn_face_id_t dpoi_index = hicn_dpoi_get_index (face);
dpo_set (dpo, hicn_face_udp_type, DPO_PROTO_IP4, dpoi_index);
@@ -196,7 +196,7 @@ hicn_dpo_udp6_create (dpo_id_t * dpo,
* @param remote_addr: Remote address of the UDP tunnel
* @param local_port: Local port of the UDP tunnel
* @param remote_port: Remote port of the UDP tunnel
- * @param is_appface: Boolean that indicates whether the face is an application
+ * @param hicnb_flags: Flags that indicate whether the face is an application
* face or not. (Currently only IP faces can be appface)
*
* @result HICN_ERROR_FACE_NOT_FOUND if the face does not exist, otherwise HICN_ERROR_NONE.
@@ -205,7 +205,7 @@ always_inline int
hicn_dpo_udp6_lock (dpo_id_t * dpo,
const ip6_address_t * local_addr,
const ip6_address_t * remote_addr,
- u16 local_port, u16 remote_port, u8 * is_appface)
+ u16 local_port, u16 remote_port, u8 * hicnb_flags)
{
hicn_face_t *face =
hicn_face_udp6_get (local_addr, remote_addr, local_port, remote_port);
@@ -218,7 +218,7 @@ hicn_dpo_udp6_lock (dpo_id_t * dpo,
dpo_set (dpo, hicn_face_udp_type, DPO_PROTO_IP4, dpoi_index);
dpo->dpoi_next_node = ~0;
dpo_lock (dpo);
- *is_appface = 0;
+ *hicnb_flags = HICN_BUFFER_FLAGS_DEFAULT;
return HICN_ERROR_NONE;
}
@@ -233,7 +233,7 @@ hicn_dpo_udp6_lock (dpo_id_t * dpo,
* @param remote_addr: Remote address of the UDP tunnel
* @param local_port: Local port of the UDP tunnel
* @param remote_port: Remote port of the UDP tunnel
- * @param is_appface: Boolean that indicates whether the face is an application
+ * @param hicnb_flags: Flags that indicate whether the face is an application
* face or not. (Currently only IP faces can be appface)
* @param node_index: vlib edge index to use in the packet processing
*/
@@ -242,7 +242,7 @@ hicn_dpo_udp6_add_and_lock (dpo_id_t * dpo,
const ip6_address_t * local_addr,
const ip6_address_t * remote_addr,
u16 local_port, u16 remote_port,
- u32 node_index, u8 * is_appface)
+ u32 node_index, u8 * hicnb_flags)
{
hicn_face_t *face =
hicn_face_udp6_get (local_addr, remote_addr, local_port, remote_port);
@@ -276,7 +276,7 @@ hicn_dpo_udp6_add_and_lock (dpo_id_t * dpo,
mhash_set_mem (&hicn_face_udp_hashtb, &key, (uword *) & dpoi_index, 0);
- *is_appface = 0;
+ *hicnb_flags = HICN_BUFFER_FLAGS_DEFAULT;
dpo_set (dpo, hicn_face_udp_type, DPO_PROTO_IP6, dpoi_index);
dpo->dpoi_next_node = node_index;
dpo_lock (dpo);
@@ -284,7 +284,7 @@ hicn_dpo_udp6_add_and_lock (dpo_id_t * dpo,
return;
}
- *is_appface = 0;
+ *hicnb_flags = HICN_BUFFER_FLAGS_DEFAULT;
hicn_face_id_t dpoi_index = hicn_dpoi_get_index (face);
dpo_set (dpo, hicn_face_udp_type, DPO_PROTO_IP6, dpoi_index);
diff --git a/hicn-plugin/src/faces/udp/face_udp_node.c b/hicn-plugin/src/faces/udp/face_udp_node.c
index 74d0b1864..ac7a63731 100755
--- a/hicn-plugin/src/faces/udp/face_udp_node.c
+++ b/hicn-plugin/src/faces/udp/face_udp_node.c
@@ -139,7 +139,7 @@ typedef enum
&(ip_hdr->src_address), \
(udp_hdr->dst_port), \
(udp_hdr->src_port), \
- &hicnb0->is_appface); \
+ &hicnb0->flags); \
\
if ( PREDICT_FALSE(ret != HICN_ERROR_NONE) ) \
{ \
@@ -233,7 +233,7 @@ typedef enum
&(ip_hdr0->src_address), \
(udp_hdr0->dst_port), \
(udp_hdr0->src_port), \
- &hicnb0->is_appface); \
+ &hicnb0->flags); \
\
ret1 = HICN_DPO_UDP_LOCK_IP##ipv \
(&(hicnb1->face_dpo_id), \
@@ -241,7 +241,7 @@ typedef enum
&(ip_hdr1->src_address), \
(udp_hdr1->dst_port), \
(udp_hdr1->src_port), \
- &hicnb1->is_appface); \
+ &hicnb1->flags); \
\
if ( PREDICT_FALSE(ret0 != HICN_ERROR_NONE) ) \
{ \
diff --git a/hicn-plugin/src/faces/udp/iface_udp_node.c b/hicn-plugin/src/faces/udp/iface_udp_node.c
index ddea31b4c..1f6dbd4ab 100755
--- a/hicn-plugin/src/faces/udp/iface_udp_node.c
+++ b/hicn-plugin/src/faces/udp/iface_udp_node.c
@@ -183,7 +183,7 @@ typedef enum
udp_hdr->src_port, \
GET_FACE_UDP##ipv \
(), \
- &hicnb0->is_appface); \
+ &hicnb0->flags); \
\
vlib_buffer_advance(b0, sizeof(IP_HEADER_##ipv) + \
sizeof(udp_header_t)); \
@@ -270,7 +270,7 @@ typedef enum
udp_hdr0->src_port, \
GET_FACE_UDP##ipv \
(), \
- &hicnb0->is_appface); \
+ &hicnb0->flags); \
\
\
HICN_IFACE_UDP_ADD_LOCK_IP##ipv \
@@ -281,7 +281,7 @@ typedef enum
udp_hdr1->src_port, \
GET_FACE_UDP##ipv \
(), \
- &hicnb1->is_appface); \
+ &hicnb1->flags); \
\
vlib_buffer_advance(b0, sizeof(IP_HEADER_##ipv) + \
sizeof(udp_header_t)); \
diff --git a/hicn-plugin/src/hashtb.c b/hicn-plugin/src/hashtb.c
index 332da350d..0bdb91c0d 100755
--- a/hicn-plugin/src/hashtb.c
+++ b/hicn-plugin/src/hashtb.c
@@ -409,6 +409,8 @@ hicn_hashtb_init_entry (hicn_hash_entry_t * entry, u32 nodeidx,
/* Clear out some other fields in the entry */
entry->he_flags = 0;
entry->locks = locks;
+ entry->vft_id = 0;
+ entry->dpo_ctx_id = 0;
}
/*
@@ -506,6 +508,8 @@ loop_buckets:
node->bucket_id = current_bucket_id;
node->entry_idx = i;
+ (*hash_entry)->vft_id = *vft_id;
+ (*hash_entry)->dpo_ctx_id = *dpo_ctx_id;
if (is_overflow)
node->hn_flags |= HICN_HASH_NODE_OVERFLOW_BUCKET;
@@ -590,6 +594,8 @@ loop_buckets:
node->bucket_id = (newbkt - h->ht_overflow_buckets);
node->entry_idx = 1;
node->hn_flags |= HICN_HASH_NODE_OVERFLOW_BUCKET;
+ (*hash_entry)->vft_id = *vft_id;
+ (*hash_entry)->dpo_ctx_id = *dpo_ctx_id;
}
else
{
@@ -600,6 +606,8 @@ loop_buckets:
node->bucket_id = (newbkt - h->ht_overflow_buckets);
node->entry_idx = 0;
node->hn_flags |= HICN_HASH_NODE_OVERFLOW_BUCKET;
+ (*hash_entry)->vft_id = *vft_id;
+ (*hash_entry)->dpo_ctx_id = *dpo_ctx_id;
}
}
diff --git a/hicn-plugin/src/hashtb.h b/hicn-plugin/src/hashtb.h
index 1690419a1..b74e972b2 100755
--- a/hicn-plugin/src/hashtb.h
+++ b/hicn-plugin/src/hashtb.h
@@ -125,19 +125,15 @@ typedef struct
* bucket. the node contains an embedded key; long keys are stored as chains
* of keys.
*
- * The memory block for a node includes space for client data, additional memory
- * located off the end of the htnode data structure. Size of client-supplied
- * data is fixed, so we can use vpp pools. The PIT and FIB need to ensure
- * that they fit within the available data area, or change the size to
- * accomodate their needs.
+ * The memory block for a node includes space for storing outgoing faces for
+ * interests, additional memory located off the end of the htnode data structure.
*
- * NOTE: app_data_size currently applies to all apps, i.e. bigger FIB nodes
- * means (leads to, requires) bigger PCS nodes
*/
-/* Size this so that we can offer 64B aligned on 64-bits to the applications */
-/* New PIT entry syze 62B */
-#define HICN_HASH_NODE_APP_DATA_SIZE 4184 //to support 512 entry //96 //190 to support 50 faces
+/* Size this so that we can offer 64B aligned on 64-bits for storing outgoing
+ * faces information
+ */
+#define HICN_HASH_NODE_APP_DATA_SIZE 64
/* How to align in the right way */
typedef struct __attribute__ ((packed)) hicn_hash_node_s
diff --git a/hicn-plugin/src/hicn.h b/hicn-plugin/src/hicn.h
index 02a3dfa52..c0de65de4 100755
--- a/hicn-plugin/src/hicn.h
+++ b/hicn-plugin/src/hicn.h
@@ -42,6 +42,12 @@ typedef u8 weight_t;
#define VLIB_BUFFER_MIN_CHAIN_SEG_SIZE (128)
#endif
+#define HICN_BUFFER_FLAGS_DEFAULT 0x00
+#define HICN_BUFFER_FLAGS_FACE_IS_APP 0x01
+/* vlib_buffer cloning utilities impose that current_lentgh is more that 2*CLIB_CACHE_LINE_BYTES. */
+/* This flag is used to mark packets whose lenght is less that 2*CLIB_CACHE_LINE_BYTES. */
+#define HICN_BUFFER_FLAGS_PKT_LESS_TWO_CL 0x02
+
/* The following is stored in the opaque2 field in the vlib_buffer_t */
typedef struct
{
@@ -54,8 +60,7 @@ typedef struct
u8 hash_entry_id;
u8 hash_bucket_flags;
- u8 is_appface; /* 1 the incoming face is an
- * application face, 0 otherwise */
+ u8 flags;
u8 dpo_ctx_id; /* used for data path */
u8 vft_id; /* " */
diff --git a/hicn-plugin/src/interest_hitcs_node.c b/hicn-plugin/src/interest_hitcs_node.c
index f9c8c4898..1d2255fcd 100755
--- a/hicn-plugin/src/interest_hitcs_node.c
+++ b/hicn-plugin/src/interest_hitcs_node.c
@@ -40,43 +40,41 @@ vlib_node_registration_t hicn_interest_hitcs_node;
always_inline void drop_packet (u32 * next0);
always_inline void
-clone_from_cs (vlib_main_t * vm, u32 * bi0_cs, vlib_buffer_t * dest)
+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);
- if (cs_buf->current_data >= VLIB_BUFFER_MIN_CHAIN_SEG_SIZE
- && ((i16) cs_buf->current_length) < (i16) 0)
+ if (hicnb->flags & HICN_BUFFER_FLAGS_PKT_LESS_TWO_CL)
{
- vlib_buffer_advance (cs_buf,
- -(((i16) cs_buf->current_length) +
- VLIB_BUFFER_MIN_CHAIN_SEG_SIZE));
-
- clib_memcpy (vlib_buffer_get_current (dest),
- vlib_buffer_get_current (cs_buf), cs_buf->current_length);
- clib_memcpy (dest->opaque2, cs_buf->opaque2, sizeof (cs_buf->opaque2));
+ clib_memcpy_fast (vlib_buffer_get_current (dest),
+ vlib_buffer_get_current (cs_buf),
+ cs_buf->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;
- cs_buf->current_data += VLIB_BUFFER_MIN_CHAIN_SEG_SIZE;
- cs_buf->current_length -= VLIB_BUFFER_MIN_CHAIN_SEG_SIZE;
}
else
{
- vlib_buffer_advance (cs_buf, -VLIB_BUFFER_MIN_CHAIN_SEG_SIZE);
-
+ vlib_buffer_advance (cs_buf, -buffer_advance);
if (PREDICT_FALSE (cs_buf->n_add_refs == 255))
{
vlib_buffer_t *cs_buf2 = vlib_buffer_copy (vm, cs_buf);
- vlib_buffer_advance (cs_buf, VLIB_BUFFER_MIN_CHAIN_SEG_SIZE);
+ vlib_buffer_advance (cs_buf, buffer_advance);
+ *bi0_cs = vlib_get_buffer_index (vm, cs_buf2);
+ cs_buf->n_add_refs--;
cs_buf = cs_buf2;
}
clib_memcpy (vlib_buffer_get_current (dest),
- vlib_buffer_get_current (cs_buf),
- VLIB_BUFFER_MIN_CHAIN_SEG_SIZE);
- dest->current_length = VLIB_BUFFER_MIN_CHAIN_SEG_SIZE;
- vlib_buffer_advance (cs_buf, VLIB_BUFFER_MIN_CHAIN_SEG_SIZE);
+ vlib_buffer_get_current (cs_buf), buffer_advance);
+ dest->current_length = buffer_advance;
+ vlib_buffer_advance (cs_buf, buffer_advance);
vlib_buffer_attach_clone (vm, dest, cs_buf);
}
}
@@ -198,7 +196,7 @@ hicn_interest_hitcs_node_fn (vlib_main_t * vm, vlib_node_runtime_t * node,
vnet_buffer (b0)->ip.adj_index[VLIB_TX] =
hicnb0->face_dpo_id.dpoi_index;
- clone_from_cs (vm, &pitp->u.cs.cs_pkt_buf, b0);
+ clone_from_cs (vm, &pitp->u.cs.cs_pkt_buf, b0, isv6);
stats.pkts_from_cache_count++;
stats.pkts_data_count++;
diff --git a/hicn-plugin/src/params.h b/hicn-plugin/src/params.h
index fc890f602..9e6ef5dbd 100755
--- a/hicn-plugin/src/params.h
+++ b/hicn-plugin/src/params.h
@@ -24,7 +24,10 @@
/*
* Face compile-time parameters
*/
-#define HICN_PARAM_FACES_MAX 64
+#define HICN_PARAM_FACES_MAX 512
+
+STATIC_ASSERT ((HICN_PARAM_FACES_MAX & (HICN_PARAM_FACES_MAX - 1)) == 0,
+ "HICN_PARAM_FACES_MAX must be a power of 2");
/*
* Max length for hICN names
@@ -46,7 +49,12 @@
#define HICN_PARAM_PIT_ENTRIES_MAX 2 * 1024 * 1024
// aggregation limit(interest previous hops)
-#define HICN_PARAM_PIT_ENTRY_PHOPS_MAX 516
+// Supported up to 516. For more than 4 faces this param must
+// satisfy the equation (HICN_PARAM_PIT_ENTRY_PHOPS_MAX - 4) % 2 = 0
+#define HICN_PARAM_PIT_ENTRY_PHOPS_MAX 20
+
+STATIC_ASSERT ((HICN_PARAM_PIT_ENTRY_PHOPS_MAX <= HICN_PARAM_FACES_MAX),
+ "HICN_PARAM_PIT_ENTRY_PHOP_MAX must be <= than HICN_PARAM_FACES_MAX");
// PIT lifetime limits on API override this(in seconds, long -float type)
#define HICN_PARAM_PIT_LIFETIME_BOUND_MIN_SEC 0.100L
diff --git a/hicn-plugin/src/pcs.h b/hicn-plugin/src/pcs.h
index 375a7d537..3ce40c9a3 100755
--- a/hicn-plugin/src/pcs.h
+++ b/hicn-plugin/src/pcs.h
@@ -247,7 +247,9 @@ hicn_pit_get_data (hicn_hash_node_t * node)
static inline void
hicn_pit_init_data (hicn_pcs_entry_t * p)
{
- memset (p, 0, sizeof (hicn_pcs_entry_t));
+ p->shared.entry_flags = 0;
+ p->u.pit.faces.n_faces = 0;
+ p->u.pit.faces.is_overflow = 0;
hicn_face_bucket_t *face_bkt;
pool_get (hicn_face_bucket_pool, face_bkt);
@@ -363,7 +365,6 @@ hicn_pcs_delete_internal (hicn_pit_cs_t * pitcs,
}
hicn_hashtb_delete (pitcs->pcs_table, node, hash_entry->he_msb64);
- memset (*pcs_entryp, 0, sizeof (hicn_pcs_entry_t));
*pcs_entryp = NULL;
}
@@ -386,7 +387,6 @@ hicn_pit_to_cs (vlib_main_t * vm, hicn_pit_cs_t * pitcs,
dpo_vft->hicn_dpo_unlock_dpo_ctx (hicn_dpo_id);
/* Flush faces */
hicn_faces_flush (&(pcs_entry->u.pit.faces));
- memset (&(pcs_entry->u.cs), ~0, sizeof (hicn_cs_entry_t));
hash_entry->he_flags |= HICN_HASH_ENTRY_FLAG_CS_ENTRY;
node->hn_flags |= HICN_HASH_NODE_CS_FLAGS;
diff --git a/hicn-plugin/src/strategies/strategy_mw.c b/hicn-plugin/src/strategies/strategy_mw.c
index 144dd145e..fc7ef47fc 100755
--- a/hicn-plugin/src/strategies/strategy_mw.c
+++ b/hicn-plugin/src/strategies/strategy_mw.c
@@ -102,6 +102,7 @@ hicn_mw_strategy_node_fn (vlib_main_t * vm,
vlib_node_runtime_t * node, vlib_frame_t * frame)
{
return hicn_forward_interest_fn (vm, node, frame, &hicn_strategy_mw_vft,
+ hicn_dpo_strategy_mw_get_type (),
&hicn_mw_strategy_node);
}
diff --git a/hicn-plugin/src/strategy.c b/hicn-plugin/src/strategy.c
index 56de34e6b..247de9d07 100755
--- a/hicn-plugin/src/strategy.c
+++ b/hicn-plugin/src/strategy.c
@@ -41,7 +41,8 @@ hicn_new_interest (hicn_strategy_runtime_t * rt, vlib_buffer_t * b0,
u32 * next, f64 tnow, u8 * nameptr,
u16 namelen, dpo_id_t * outface, int nh_idx,
index_t hicn_dpo_idx, hicn_strategy_vft_t * strategy,
- u8 isv6, vl_api_hicn_api_node_stats_get_reply_t * stats)
+ dpo_type_t dpo_type, u8 isv6,
+ vl_api_hicn_api_node_stats_get_reply_t * stats)
{
int ret;
hicn_hash_node_t *nodep;
@@ -50,8 +51,8 @@ hicn_new_interest (hicn_strategy_runtime_t * rt, vlib_buffer_t * b0,
hicn_main_t *sm = &hicn_main;
hicn_buffer_t *hicnb0 = hicn_get_buffer (b0);
u32 node_id0 = 0;
- u8 dpo_ctx_id0 = 0;
- u8 vft_id0 = 0;
+ u8 dpo_ctx_id0 = vnet_buffer (b0)->ip.adj_index[VLIB_TX];
+ u8 vft_id0 = dpo_type;
u8 is_cs0 = 0;
u8 hash_entry_id = 0;
u8 bucket_is_overflow = 0;
@@ -92,6 +93,7 @@ hicn_new_interest (hicn_strategy_runtime_t * rt, vlib_buffer_t * b0,
hicnb0->name_hash, &node_id0, &dpo_ctx_id0, &vft_id0,
&is_cs0, &hash_entry_id, &bucket_id,
&bucket_is_overflow);
+
if (ret == HICN_ERROR_NONE)
{
strategy->hicn_add_interest (vnet_buffer (b0)->ip.adj_index[VLIB_TX],
@@ -140,6 +142,7 @@ hicn_forward_interest_fn (vlib_main_t * vm,
vlib_node_runtime_t * node,
vlib_frame_t * frame,
hicn_strategy_vft_t * strategy,
+ dpo_type_t dpo_type,
vlib_node_registration_t * hicn_strategy_node)
{
@@ -221,7 +224,7 @@ hicn_forward_interest_fn (vlib_main_t * vm,
hicn_new_interest (rt, b0, &next0, tnow, nameptr, namelen,
outface, nh_idx,
vnet_buffer (b0)->ip.adj_index[VLIB_TX],
- strategy, isv6, &stats);
+ strategy, dpo_type, isv6, &stats);
}
/* Maybe trace */
if (PREDICT_FALSE ((node->flags & VLIB_NODE_FLAG_TRACE) &&
diff --git a/hicn-plugin/src/strategy.h b/hicn-plugin/src/strategy.h
index 6b06a6ce9..a0100a4da 100755
--- a/hicn-plugin/src/strategy.h
+++ b/hicn-plugin/src/strategy.h
@@ -56,6 +56,7 @@ hicn_forward_interest_fn (vlib_main_t * vm,
vlib_node_runtime_t * node,
vlib_frame_t * frame,
hicn_strategy_vft_t * strategy,
+ dpo_type_t dpo_type,
vlib_node_registration_t * hicn_strategy_node);
/* Trace context struct */