aboutsummaryrefslogtreecommitdiffstats
path: root/hicn-plugin/src
diff options
context:
space:
mode:
Diffstat (limited to 'hicn-plugin/src')
-rw-r--r--hicn-plugin/src/data_fwd_node.c243
-rw-r--r--hicn-plugin/src/faces/app/face_prod.c216
-rw-r--r--hicn-plugin/src/faces/face.c133
-rw-r--r--hicn-plugin/src/faces/face_cli.c180
-rw-r--r--hicn-plugin/src/hicn_api.c408
-rw-r--r--hicn-plugin/src/interest_hitcs_node.c64
-rw-r--r--hicn-plugin/src/interest_hitpit_node.c46
-rw-r--r--hicn-plugin/src/mapme_eventmgr.c213
-rw-r--r--hicn-plugin/src/pcs.h364
-rw-r--r--hicn-plugin/src/strategies/strategy_mw.c43
-rw-r--r--hicn-plugin/src/strategies/strategy_rr.c40
11 files changed, 919 insertions, 1031 deletions
diff --git a/hicn-plugin/src/data_fwd_node.c b/hicn-plugin/src/data_fwd_node.c
index c65b62454..a91439662 100644
--- a/hicn-plugin/src/data_fwd_node.c
+++ b/hicn-plugin/src/data_fwd_node.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017-2020 Cisco and/or its affiliates.
+ * Copyright (c) 2017-2021 Cisco and/or its affiliates.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
@@ -32,29 +32,26 @@ static char *hicn_data_fwd_error_strings[] = {
};
/* Declarations */
-always_inline void
-drop_packet (vlib_main_t * vm, u32 bi0,
- u32 * n_left_to_next, u32 * next0, u32 ** to_next,
- u32 * next_index, vlib_node_runtime_t * node);
+always_inline void drop_packet (vlib_main_t *vm, u32 bi0, u32 *n_left_to_next,
+ u32 *next0, u32 **to_next, u32 *next_index,
+ vlib_node_runtime_t *node);
always_inline int
-hicn_satisfy_faces (vlib_main_t * vm, u32 b0,
- hicn_pcs_entry_t * pitp, u32 * n_left_to_next,
- u32 ** to_next, u32 * next_index,
- vlib_node_runtime_t * node, u8 isv6,
- vl_api_hicn_api_node_stats_get_reply_t * stats);
+hicn_satisfy_faces (vlib_main_t *vm, u32 b0, hicn_pcs_entry_t *pitp,
+ u32 *n_left_to_next, u32 **to_next, u32 *next_index,
+ vlib_node_runtime_t *node, u8 isv6,
+ vl_api_hicn_api_node_stats_get_reply_t *stats);
always_inline void
-clone_data_to_cs (vlib_main_t * vm, hicn_pit_cs_t * pitcs,
- hicn_pcs_entry_t * pitp, hicn_header_t * hicn0, f64 tnow,
- hicn_hash_node_t * nodep, vlib_buffer_t * b0,
- hicn_hash_entry_t * hash_entry, u64 name_hash,
- hicn_buffer_t * hicnb, const hicn_dpo_vft_t * dpo_vft,
- dpo_id_t * hicn_dpo_id, hicn_lifetime_t dmsg_lifetime);
-
+clone_data_to_cs (vlib_main_t *vm, hicn_pit_cs_t *pitcs,
+ hicn_pcs_entry_t *pitp, hicn_header_t *hicn0, f64 tnow,
+ hicn_hash_node_t *nodep, vlib_buffer_t *b0,
+ hicn_hash_entry_t *hash_entry, u64 name_hash,
+ hicn_buffer_t *hicnb, const hicn_dpo_vft_t *dpo_vft,
+ dpo_id_t *hicn_dpo_id, hicn_lifetime_t dmsg_lifetime);
/* packet trace format function */
-always_inline u8 *hicn_data_fwd_format_trace (u8 * s, va_list * args);
+always_inline u8 *hicn_data_fwd_format_trace (u8 *s, va_list *args);
vlib_node_registration_t hicn_data_fwd_node;
@@ -63,8 +60,8 @@ vlib_node_registration_t hicn_data_fwd_node;
* - 1 packet at a time - ipv4/tcp ipv6/tcp
*/
static uword
-hicn_data_node_fn (vlib_main_t * vm, vlib_node_runtime_t * node,
- vlib_frame_t * frame)
+hicn_data_node_fn (vlib_main_t *vm, vlib_node_runtime_t *node,
+ vlib_frame_t *frame)
{
u32 n_left_from, *from, *to_next;
@@ -134,20 +131,22 @@ hicn_data_node_fn (vlib_main_t * vm, vlib_node_runtime_t * node,
pitp = hicn_pit_get_data (node0);
nameptr = (u8 *) (&name);
- if (PREDICT_FALSE
- (ret != HICN_ERROR_NONE
- || !hicn_node_compare (nameptr, namelen, node0)
- || (hash_entry0->he_flags & HICN_HASH_ENTRY_FLAG_CS_ENTRY)))
+ if (PREDICT_FALSE (
+ ret != HICN_ERROR_NONE ||
+ !hicn_node_compare (nameptr, namelen, node0) ||
+ (hash_entry0->he_flags & HICN_HASH_ENTRY_FLAG_CS_ENTRY)))
{
/*
* Remove the lock acquired from
* data_pcslookup node
*/
- dpo_id_t hicn_dpo_id0 = { dpo_vft0->hicn_dpo_get_type (), 0, 0,
- dpo_ctx_id0
- };
- hicn_pcs_remove_lock (pitcs, &pitp, &node0, vm,
- hash_entry0, dpo_vft0, &hicn_dpo_id0);
+ dpo_id_t hicn_dpo_id0 = { .dpoi_type =
+ dpo_vft0->hicn_dpo_get_type (),
+ .dpoi_proto = 0,
+ .dpoi_next_node = 0,
+ .dpoi_index = dpo_ctx_id0 };
+ hicn_pcs_remove_lock (pitcs, &pitp, &node0, vm, hash_entry0,
+ dpo_vft0, &hicn_dpo_id0);
drop_packet (vm, bi0, &n_left_to_next, &next0, &to_next,
&next_index, node);
@@ -163,16 +162,19 @@ hicn_data_node_fn (vlib_main_t * vm, vlib_node_runtime_t * node,
* not changed from the lookup.
*/
- if (tnow > pitp->shared.expire_time
- || (hash_entry0->he_flags & HICN_HASH_ENTRY_FLAG_DELETED))
+ if (tnow > pitp->shared.expire_time ||
+ (hash_entry0->he_flags & HICN_HASH_ENTRY_FLAG_DELETED))
{
- dpo_id_t hicn_dpo_id0 =
- { dpo_vft0->hicn_dpo_get_type (), 0, 0, dpo_ctx_id0 };
- hicn_pcs_delete (pitcs, &pitp, &node0, vm, hash_entry0,
- dpo_vft0, &hicn_dpo_id0);
+ dpo_id_t hicn_dpo_id0 = { .dpoi_type =
+ dpo_vft0->hicn_dpo_get_type (),
+ .dpoi_proto = 0,
+ .dpoi_next_node = 0,
+ .dpoi_index = dpo_ctx_id0 };
+ hicn_pcs_delete (pitcs, &pitp, &node0, vm, hash_entry0, dpo_vft0,
+ &hicn_dpo_id0);
- drop_packet (vm, bi0, &n_left_to_next, &next0, &to_next,
- &next_index, 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) &&
@@ -183,15 +185,14 @@ hicn_data_node_fn (vlib_main_t * vm, vlib_node_runtime_t * node,
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),
+ clib_memcpy (t->packet_data, vlib_buffer_get_current (b0),
sizeof (t->packet_data));
}
}
else
{
- ASSERT ((hash_entry0->he_flags & HICN_HASH_ENTRY_FLAG_DELETED)
- == 0);
+ ASSERT ((hash_entry0->he_flags & HICN_HASH_ENTRY_FLAG_DELETED) ==
+ 0);
data_received++;
/*
@@ -200,18 +201,20 @@ hicn_data_node_fn (vlib_main_t * vm, vlib_node_runtime_t * node,
*/
/* Prepare the buffer for the cloning */
- ret = hicn_satisfy_faces (vm, bi0, pitp, &n_left_to_next,
- &to_next, &next_index, node,
- isv6, &stats);
+ ret =
+ hicn_satisfy_faces (vm, bi0, pitp, &n_left_to_next, &to_next,
+ &next_index, node, isv6, &stats);
- dpo_id_t hicn_dpo_id0 = { dpo_vft0->hicn_dpo_get_type (), 0, 0,
- dpo_ctx_id0
- };
+ dpo_id_t hicn_dpo_id0 = { .dpoi_type =
+ dpo_vft0->hicn_dpo_get_type (),
+ .dpoi_proto = 0,
+ .dpoi_next_node = 0,
+ .dpoi_index = dpo_ctx_id0 };
if (PREDICT_FALSE (ret != HICN_ERROR_NONE))
{
- hicn_pcs_pit_delete (pitcs, &pitp, &node0, vm,
- hash_entry0, dpo_vft0, &hicn_dpo_id0);
+ hicn_pcs_pit_delete (pitcs, &pitp, &node0, vm, hash_entry0,
+ dpo_vft0, &hicn_dpo_id0);
continue;
}
/*
@@ -234,18 +237,18 @@ hicn_data_node_fn (vlib_main_t * vm, vlib_node_runtime_t * node,
* Clone data packet in the content store and
* convert the PIT entry into a CS entry
*/
- clone_data_to_cs (vm, pitcs, pitp, hicn0, tnow, node0,
- b0, hash_entry0, hicnb0->name_hash,
- hicnb0, dpo_vft0, &hicn_dpo_id0,
- dmsg_lifetime);
+ clone_data_to_cs (vm, pitcs, pitp, hicn0, tnow, node0, b0,
+ hash_entry0, hicnb0->name_hash, hicnb0,
+ dpo_vft0, &hicn_dpo_id0, dmsg_lifetime);
- hicn_pcs_remove_lock (pitcs, &pitp, &node0, vm,
- hash_entry0, NULL, NULL);
+ hicn_pcs_remove_lock (pitcs, &pitp, &node0, vm, hash_entry0,
+ NULL, NULL);
}
else
{
/*
- * If the packet is copied and not cloned, we need to free the vlib_buffer
+ * If the packet is copied and not cloned, we need to free
+ * the vlib_buffer
*/
if (hicnb0->flags & HICN_BUFFER_FLAGS_PKT_LESS_TWO_CL)
{
@@ -255,20 +258,21 @@ hicn_data_node_fn (vlib_main_t * vm, vlib_node_runtime_t * node,
{
/*
* Remove one reference as the buffer is no
- * longer in any frame. The vlib_buffer will be freed when
- * all its cloned vlib_buffer will be freed.
+ * longer in any frame. The vlib_buffer will be freed
+ * when all its cloned vlib_buffer will be freed.
*/
b0->ref_count--;
}
/* Delete the PIT entry */
- hicn_pcs_pit_delete (pitcs, &pitp, &node0, vm,
- hash_entry0, dpo_vft0, &hicn_dpo_id0);
+ hicn_pcs_pit_delete (pitcs, &pitp, &node0, vm, hash_entry0,
+ dpo_vft0, &hicn_dpo_id0);
}
#else
ASSERT (pitp == hicn_pit_get_data (node0));
/*
- * If the packet is copied and not cloned, we need to free the vlib_buffer
+ * If the packet is copied and not cloned, we need to free the
+ * vlib_buffer
*/
if (hicnb0->flags & HICN_BUFFER_FLAGS_PKT_LESS_TWO_CL)
{
@@ -285,8 +289,8 @@ hicn_data_node_fn (vlib_main_t * vm, vlib_node_runtime_t * node,
}
/* Delete the PIT entry */
- hicn_pcs_pit_delete (pitcs, &pitp, &node0, vm,
- hash_entry0, dpo_vft0, &hicn_dpo_id0);
+ hicn_pcs_pit_delete (pitcs, &pitp, &node0, vm, hash_entry0,
+ dpo_vft0, &hicn_dpo_id0);
#endif
}
end_processing:
@@ -303,11 +307,10 @@ hicn_data_node_fn (vlib_main_t * vm, vlib_node_runtime_t * node,
vlib_node_increment_counter (vm, hicn_data_fwd_node.index,
HICNFWD_ERROR_DATAS, stats.pkts_data_count);
-
- update_node_counter (vm, hicn_data_fwd_node.index,
- HICNFWD_ERROR_INT_COUNT, pit_int_count);
- update_node_counter (vm, hicn_data_fwd_node.index,
- HICNFWD_ERROR_CS_COUNT, pit_cs_count);
+ update_node_counter (vm, hicn_data_fwd_node.index, HICNFWD_ERROR_INT_COUNT,
+ pit_int_count);
+ update_node_counter (vm, hicn_data_fwd_node.index, HICNFWD_ERROR_CS_COUNT,
+ pit_cs_count);
update_node_counter (vm, hicn_data_fwd_node.index,
HICNFWD_ERROR_INTEREST_AGG_ENTRY,
stats.pkts_data_count / data_received);
@@ -316,9 +319,8 @@ hicn_data_node_fn (vlib_main_t * vm, vlib_node_runtime_t * node,
}
always_inline void
-drop_packet (vlib_main_t * vm, u32 bi0,
- u32 * n_left_to_next, u32 * next0, u32 ** to_next,
- u32 * next_index, vlib_node_runtime_t * node)
+drop_packet (vlib_main_t *vm, u32 bi0, u32 *n_left_to_next, u32 *next0,
+ u32 **to_next, u32 *next_index, vlib_node_runtime_t *node)
{
*next0 = HICN_DATA_FWD_NEXT_ERROR_DROP;
@@ -326,23 +328,22 @@ drop_packet (vlib_main_t * vm, u32 bi0,
*to_next += 1;
*n_left_to_next -= 1;
- vlib_validate_buffer_enqueue_x1 (vm, node, *next_index,
- *to_next, *n_left_to_next, bi0, *next0);
+ vlib_validate_buffer_enqueue_x1 (vm, node, *next_index, *to_next,
+ *n_left_to_next, bi0, *next0);
}
always_inline int
-hicn_satisfy_faces (vlib_main_t * vm, u32 bi0,
- hicn_pcs_entry_t * pitp, u32 * n_left_to_next,
- u32 ** to_next, u32 * next_index,
- vlib_node_runtime_t * node, u8 isv6,
- vl_api_hicn_api_node_stats_get_reply_t * stats)
+hicn_satisfy_faces (vlib_main_t *vm, u32 bi0, hicn_pcs_entry_t *pitp,
+ u32 *n_left_to_next, u32 **to_next, u32 *next_index,
+ vlib_node_runtime_t *node, u8 isv6,
+ vl_api_hicn_api_node_stats_get_reply_t *stats)
{
int found = 0;
int ret = HICN_ERROR_NONE;
u32 *clones = NULL, *header = NULL;
u32 n_left_from = 0;
- u32 next0 = HICN_DATA_FWD_NEXT_ERROR_DROP, next1 =
- HICN_DATA_FWD_NEXT_ERROR_DROP;
+ u32 next0 = HICN_DATA_FWD_NEXT_ERROR_DROP,
+ next1 = HICN_DATA_FWD_NEXT_ERROR_DROP;
word buffer_advance = CLIB_CACHE_LINE_BYTES * 2;
/*
@@ -363,30 +364,31 @@ hicn_satisfy_faces (vlib_main_t * vm, u32 bi0,
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.
+ * 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.
+ /* 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->ref_count == 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 ref_count == 0;
+ * b0->ref_count == 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
+ * ref_count == 0;
*/
b0->ref_count++;
}
- found = n_left_from =
- vlib_buffer_clone2 (vm, bi0, clones, pitp->u.pit.faces.n_faces,
- buffer_advance);
+ found = n_left_from = vlib_buffer_clone2 (
+ vm, bi0, clones, pitp->u.pit.faces.n_faces, buffer_advance);
ASSERT (n_left_from == pitp->u.pit.faces.n_faces);
@@ -396,7 +398,7 @@ hicn_satisfy_faces (vlib_main_t * vm, u32 bi0,
while (n_left_from > 0)
{
- //Dual loop, X2
+ // Dual loop, X2
while (n_left_from >= 4 && *n_left_to_next >= 2)
{
vlib_buffer_t *h0, *h1;
@@ -426,11 +428,11 @@ hicn_satisfy_faces (vlib_main_t * vm, u32 bi0,
clones += 2;
next0 = isv6 ? HICN_DATA_FWD_NEXT_IFACE6_OUT :
- HICN_DATA_FWD_NEXT_IFACE4_OUT;
+ HICN_DATA_FWD_NEXT_IFACE4_OUT;
next1 = isv6 ? HICN_DATA_FWD_NEXT_IFACE6_OUT :
- HICN_DATA_FWD_NEXT_IFACE4_OUT;
+ HICN_DATA_FWD_NEXT_IFACE4_OUT;
- vnet_buffer (h0)->ip.adj_index[VLIB_TX] = face0;
+ vnet_buffer (h0)->ip.adj_index[VLIB_TX] = face0;
vnet_buffer (h1)->ip.adj_index[VLIB_TX] = face1;
stats->pkts_data_count += 2;
@@ -443,8 +445,7 @@ hicn_satisfy_faces (vlib_main_t * vm, u32 bi0,
t->pkt_type = HICN_PKT_TYPE_CONTENT;
t->sw_if_index = vnet_buffer (h0)->sw_if_index[VLIB_RX];
t->next_index = next0;
- clib_memcpy (t->packet_data,
- vlib_buffer_get_current (h0),
+ clib_memcpy (t->packet_data, vlib_buffer_get_current (h0),
sizeof (t->packet_data));
}
if (PREDICT_FALSE ((node->flags & VLIB_NODE_FLAG_TRACE) &&
@@ -455,16 +456,14 @@ hicn_satisfy_faces (vlib_main_t * vm, u32 bi0,
t->pkt_type = HICN_PKT_TYPE_CONTENT;
t->sw_if_index = vnet_buffer (h1)->sw_if_index[VLIB_RX];
t->next_index = next1;
- clib_memcpy (t->packet_data,
- vlib_buffer_get_current (h1),
+ clib_memcpy (t->packet_data, vlib_buffer_get_current (h1),
sizeof (t->packet_data));
}
- vlib_validate_buffer_enqueue_x2 (vm, node, *next_index,
- (*to_next), *n_left_to_next,
- hi0, hi1, next0, next1);
+ vlib_validate_buffer_enqueue_x2 (vm, node, *next_index, (*to_next),
+ *n_left_to_next, hi0, hi1, next0,
+ next1);
}
-
while (n_left_from > 0 && *n_left_to_next > 0)
{
vlib_buffer_t *h0;
@@ -482,7 +481,7 @@ hicn_satisfy_faces (vlib_main_t * vm, u32 bi0,
clones += 1;
next0 = isv6 ? HICN_DATA_FWD_NEXT_IFACE6_OUT :
- HICN_DATA_FWD_NEXT_IFACE4_OUT;
+ HICN_DATA_FWD_NEXT_IFACE4_OUT;
vnet_buffer (h0)->ip.adj_index[VLIB_TX] = face0;
stats->pkts_data_count++;
@@ -495,8 +494,7 @@ hicn_satisfy_faces (vlib_main_t * vm, u32 bi0,
t->pkt_type = HICN_PKT_TYPE_CONTENT;
t->sw_if_index = vnet_buffer (h0)->sw_if_index[VLIB_RX];
t->next_index = next0;
- clib_memcpy (t->packet_data,
- vlib_buffer_get_current (h0),
+ clib_memcpy (t->packet_data, vlib_buffer_get_current (h0),
sizeof (t->packet_data));
}
/*
@@ -507,10 +505,8 @@ hicn_satisfy_faces (vlib_main_t * vm, u32 bi0,
* Fix in case of a wrong speculation. Needed to
* clone the data in the right frame
*/
- vlib_validate_buffer_enqueue_x1 (vm, node, *next_index,
- *to_next, *n_left_to_next,
- hi0, next0);
-
+ vlib_validate_buffer_enqueue_x1 (vm, node, *next_index, *to_next,
+ *n_left_to_next, hi0, next0);
}
/* Ensure that there is space for the next clone (if any) */
@@ -528,20 +524,19 @@ hicn_satisfy_faces (vlib_main_t * vm, u32 bi0,
if (PREDICT_FALSE (!found))
{
ASSERT (0);
- drop_packet (vm, bi0, n_left_to_next, &next0, to_next, next_index,
- node);
+ drop_packet (vm, bi0, n_left_to_next, &next0, to_next, next_index, node);
ret = HICN_ERROR_FACE_NOT_FOUND;
}
return ret;
}
always_inline void
-clone_data_to_cs (vlib_main_t * vm, hicn_pit_cs_t * pitcs,
- hicn_pcs_entry_t * pitp, hicn_header_t * hicn0, f64 tnow,
- hicn_hash_node_t * nodep, vlib_buffer_t * b0,
- hicn_hash_entry_t * hash_entry, u64 name_hash,
- hicn_buffer_t * hicnb, const hicn_dpo_vft_t * dpo_vft,
- dpo_id_t * hicn_dpo_id, hicn_lifetime_t dmsg_lifetime)
+clone_data_to_cs (vlib_main_t *vm, hicn_pit_cs_t *pitcs,
+ hicn_pcs_entry_t *pitp, hicn_header_t *hicn0, f64 tnow,
+ hicn_hash_node_t *nodep, vlib_buffer_t *b0,
+ hicn_hash_entry_t *hash_entry, u64 name_hash,
+ hicn_buffer_t *hicnb, const hicn_dpo_vft_t *dpo_vft,
+ dpo_id_t *hicn_dpo_id, hicn_lifetime_t dmsg_lifetime)
{
/*
* At this point we think we're safe to proceed. Store the CS buf in
@@ -560,8 +555,8 @@ clone_data_to_cs (vlib_main_t * vm, hicn_pit_cs_t * pitcs,
pitp->shared.create_time = tnow;
- if (dmsg_lifetime < HICN_PARAM_CS_LIFETIME_MIN
- || dmsg_lifetime > HICN_PARAM_CS_LIFETIME_MAX)
+ if (dmsg_lifetime < HICN_PARAM_CS_LIFETIME_MIN ||
+ dmsg_lifetime > HICN_PARAM_CS_LIFETIME_MAX)
{
dmsg_lifetime = HICN_PARAM_CS_LIFETIME_DFLT;
}
@@ -573,7 +568,7 @@ clone_data_to_cs (vlib_main_t * vm, hicn_pit_cs_t * pitcs,
/* packet trace format function */
always_inline u8 *
-hicn_data_fwd_format_trace (u8 * s, va_list * args)
+hicn_data_fwd_format_trace (u8 *s, va_list *args)
{
CLIB_UNUSED (vlib_main_t * vm) = va_arg (*args, vlib_main_t *);
CLIB_UNUSED (vlib_node_t * node) = va_arg (*args, vlib_node_t *);
@@ -583,15 +578,14 @@ hicn_data_fwd_format_trace (u8 * s, va_list * args)
s = format (s, "DATAFWD: pkt: %d, sw_if_index %d, next index %d\n",
(int) t->pkt_type, t->sw_if_index, t->next_index);
- s = format (s, "%U%U", format_white_space, indent,
- format_ip6_header, t->packet_data, sizeof (t->packet_data));
+ s = format (s, "%U%U", format_white_space, indent, format_ip6_header,
+ t->packet_data, sizeof (t->packet_data));
return (s);
}
/*
* Node registration for the data forwarder node
*/
-/* *INDENT-OFF* */
VLIB_REGISTER_NODE(hicn_data_fwd_node) =
{
.function = hicn_data_node_fn,
@@ -611,7 +605,6 @@ VLIB_REGISTER_NODE(hicn_data_fwd_node) =
[HICN_DATA_FWD_NEXT_ERROR_DROP] = "error-drop",
},
};
-/* *INDENT-ON* */
/*
* fd.io coding-style-patch-verification: ON
diff --git a/hicn-plugin/src/faces/app/face_prod.c b/hicn-plugin/src/faces/app/face_prod.c
index 645154325..16b6e6158 100644
--- a/hicn-plugin/src/faces/app/face_prod.c
+++ b/hicn-plugin/src/faces/app/face_prod.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017-2020 Cisco and/or its affiliates.
+ * Copyright (c) 2017-2021 Cisco and/or its affiliates.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
@@ -30,28 +30,23 @@ hicn_face_prod_state_t *face_state_vec;
u32 *face_state_pool;
static int
-hicn_app_state_create (u32 swif, fib_prefix_t * prefix)
+hicn_app_state_create (u32 swif, fib_prefix_t *prefix)
{
/* Make sure that the pool is not empty */
pool_validate_index (face_state_pool, 0);
u32 *swif_app;
u8 found = 0;
- /* *INDENT-OFF* */
- pool_foreach (swif_app, face_state_pool,{
- if (*swif_app == swif)
- {
- found = 1;
- }
- }
- );
- /* *INDENT-ON* */
+ pool_foreach (swif_app, face_state_pool)
+ if (*swif_app == swif)
+ {
+ found = 1;
+ }
if (found)
return HICN_ERROR_APPFACE_ALREADY_ENABLED;
-
/* Create the appif and store in the vector */
vec_validate (face_state_vec, swif);
clib_memcpy (&(face_state_vec[swif].prefix), prefix, sizeof (fib_prefix_t));
@@ -63,15 +58,13 @@ hicn_app_state_create (u32 swif, fib_prefix_t * prefix)
int ret = HICN_ERROR_NONE;
if (ip46_address_is_ip4 (&(prefix->fp_addr)))
{
- ret =
- vnet_feature_enable_disable ("ip4-unicast", "hicn-face-prod-input",
- swif, 1, 0, 0);
+ ret = vnet_feature_enable_disable ("ip4-unicast", "hicn-face-prod-input",
+ swif, 1, 0, 0);
}
else
{
- ret =
- vnet_feature_enable_disable ("ip6-unicast", "hicn-face-prod-input",
- swif, 1, 0, 0);
+ ret = vnet_feature_enable_disable ("ip6-unicast", "hicn-face-prod-input",
+ swif, 1, 0, 0);
}
return ret == 0 ? HICN_ERROR_NONE : HICN_ERROR_APPFACE_FEATURE;
@@ -87,16 +80,12 @@ hicn_app_state_del (u32 swif)
u32 *swif_app = NULL;
u8 found = 0;
fib_prefix_t *prefix;
- /* *INDENT-OFF* */
- pool_foreach (temp, face_state_pool,{
- if (*temp == swif)
- {
- found = 1;
- swif_app = temp;
- }
- }
- );
- /* *INDENT-ON* */
+ pool_foreach (temp, face_state_pool)
+ if (*temp == swif)
+ {
+ found = 1;
+ swif_app = temp;
+ }
if (!found)
return HICN_ERROR_APPFACE_NOT_FOUND;
@@ -106,15 +95,13 @@ hicn_app_state_del (u32 swif)
int ret = HICN_ERROR_NONE;
if (ip46_address_is_ip4 (&prefix->fp_addr))
{
- ret =
- vnet_feature_enable_disable ("ip4-unicast", "hicn-face-prod-input",
- swif, 0, 0, 0);
+ ret = vnet_feature_enable_disable ("ip4-unicast", "hicn-face-prod-input",
+ swif, 0, 0, 0);
}
else
{
- ret =
- vnet_feature_enable_disable ("ip6-unicast", "hicn-face-prod-input",
- swif, 0, 0, 0);
+ ret = vnet_feature_enable_disable ("ip6-unicast", "hicn-face-prod-input",
+ swif, 0, 0, 0);
}
pool_put (face_state_pool, swif_app);
@@ -124,8 +111,8 @@ hicn_app_state_del (u32 swif)
}
int
-hicn_face_prod_add (fib_prefix_t * prefix, u32 sw_if, u32 * cs_reserved,
- ip46_address_t * prod_addr, hicn_face_id_t * faceid)
+hicn_face_prod_add (fib_prefix_t *prefix, u32 sw_if, u32 *cs_reserved,
+ ip46_address_t *prod_addr, hicn_face_id_t *faceid)
{
vlib_main_t *vm = vlib_get_main ();
vnet_main_t *vnm = vnet_get_main ();
@@ -133,7 +120,7 @@ hicn_face_prod_add (fib_prefix_t * prefix, u32 sw_if, u32 * cs_reserved,
hicn_main_t *hm = &hicn_main;
ip46_address_t local_app_ip;
- CLIB_UNUSED(ip46_address_t remote_app_ip);
+ CLIB_UNUSED (ip46_address_t remote_app_ip);
u32 if_flags = 0;
if (!hm->is_enabled)
@@ -162,15 +149,17 @@ hicn_face_prod_add (fib_prefix_t * prefix, u32 sw_if, u32 * cs_reserved,
return HICN_ERROR_APPFACE_PROD_PREFIX_NULL;
}
- u8 isv6 = ip46_address_is_ip4(prod_addr);
- index_t adj_index = adj_nbr_find(isv6 ? FIB_PROTOCOL_IP6 : FIB_PROTOCOL_IP4, isv6 ? VNET_LINK_IP6 : VNET_LINK_IP4, prod_addr, sw_if);
+ u8 isv6 = ip46_address_is_ip4 (prod_addr);
+ index_t adj_index =
+ adj_nbr_find (isv6 ? FIB_PROTOCOL_IP6 : FIB_PROTOCOL_IP4,
+ isv6 ? VNET_LINK_IP6 : VNET_LINK_IP4, prod_addr, sw_if);
/*
* Check if a producer face is already existing for the same prefix
* and sw_if
*/
- face = hicn_face_get (&(prefix->fp_addr), sw_if,
- &hicn_face_hashtb, adj_index);
+ face =
+ hicn_face_get (&(prefix->fp_addr), sw_if, &hicn_face_hashtb, adj_index);
if (face != NULL)
{
@@ -207,13 +196,13 @@ hicn_face_prod_add (fib_prefix_t * prefix, u32 sw_if, u32 * cs_reserved,
ip4_address_t local_app_ip4;
ip4_address_t remote_app_ip4;
get_two_ip4_addresses (&local_app_ip4, &remote_app_ip4);
- ip4_add_del_interface_address (vm,
- sw_if,
- &local_app_ip4, 31, 0 /* is_del */ );
- local_app_ip = to_ip46 ( /* isv6 */ 0, local_app_ip4.as_u8);
- remote_app_ip = to_ip46 ( /* isv6 */ 0, remote_app_ip4.as_u8);
+ ip4_add_del_interface_address (vm, sw_if, &local_app_ip4, 31,
+ 0 /* is_del */);
+ local_app_ip = to_ip46 (/* isv6 */ 0, local_app_ip4.as_u8);
+ remote_app_ip = to_ip46 (/* isv6 */ 0, remote_app_ip4.as_u8);
- vnet_build_rewrite_for_sw_interface(vnm, sw_if, VNET_LINK_IP4, &remote_app_ip4);
+ vnet_build_rewrite_for_sw_interface (vnm, sw_if, VNET_LINK_IP4,
+ &remote_app_ip4);
}
else
{
@@ -225,74 +214,75 @@ hicn_face_prod_add (fib_prefix_t * prefix, u32 sw_if, u32 * cs_reserved,
vlib_cli_output (vm, "Setting ip address %s\n", s0);
- ip6_add_del_interface_address (vm,
- sw_if,
- &local_app_ip6, 127,
- 0 /* is_del */ );
- local_app_ip = to_ip46 ( /* isv6 */ 1, local_app_ip6.as_u8);
- remote_app_ip = to_ip46 ( /* isv6 */ 1, remote_app_ip6.as_u8);
+ ip6_add_del_interface_address (vm, sw_if, &local_app_ip6, 127,
+ 0 /* is_del */);
+ local_app_ip = to_ip46 (/* isv6 */ 1, local_app_ip6.as_u8);
+ remote_app_ip = to_ip46 (/* isv6 */ 1, remote_app_ip6.as_u8);
}
}
if (ret == HICN_ERROR_NONE)
- // && hicn_face_prod_set_lru_max (*faceid, cs_reserved) == HICN_ERROR_NONE)
+ // && hicn_face_prod_set_lru_max (*faceid, cs_reserved) ==
+ // HICN_ERROR_NONE)
{
- fib_route_path_t rpath = {0};
- fib_route_path_t * rpaths = NULL;
-
- if (ip46_address_is_ip4(&(prefix->fp_addr)))
- {
- ip4_address_t mask;
- ip4_preflen_to_mask (prefix->fp_len, &mask);
- prefix->fp_addr.ip4.as_u32 = prefix->fp_addr.ip4.as_u32 & mask.as_u32;
- prefix->fp_proto = FIB_PROTOCOL_IP4;
-
- rpath.frp_weight = 1;
- rpath.frp_sw_if_index = ~0;
- rpath.frp_addr.ip4.as_u32 = remote_app_ip.ip4.as_u32;
- rpath.frp_sw_if_index = sw_if;
- rpath.frp_proto = DPO_PROTO_IP4;
-
- vec_add1 (rpaths, rpath);
- }
+ fib_route_path_t rpath = { 0 };
+ fib_route_path_t *rpaths = NULL;
+
+ if (ip46_address_is_ip4 (&(prefix->fp_addr)))
+ {
+ ip4_address_t mask;
+ ip4_preflen_to_mask (prefix->fp_len, &mask);
+ prefix->fp_addr.ip4.as_u32 =
+ prefix->fp_addr.ip4.as_u32 & mask.as_u32;
+ prefix->fp_proto = FIB_PROTOCOL_IP4;
+
+ rpath.frp_weight = 1;
+ rpath.frp_sw_if_index = ~0;
+ rpath.frp_addr.ip4.as_u32 = remote_app_ip.ip4.as_u32;
+ rpath.frp_sw_if_index = sw_if;
+ rpath.frp_proto = DPO_PROTO_IP4;
+
+ vec_add1 (rpaths, rpath);
+ }
else
- {
- ip6_address_t mask;
- ip6_preflen_to_mask (prefix->fp_len, &mask);
- prefix->fp_addr.ip6.as_u64[0] =
- prefix->fp_addr.ip6.as_u64[0] & mask.as_u64[0];
- prefix->fp_addr.ip6.as_u64[1] =
- prefix->fp_addr.ip6.as_u64[1] & mask.as_u64[1];
- prefix->fp_proto = FIB_PROTOCOL_IP6;
-
- rpath.frp_weight = 1;
- rpath.frp_sw_if_index = ~0;
- rpath.frp_addr.ip6.as_u64[0] = remote_app_ip.ip6.as_u64[0];
- rpath.frp_addr.ip6.as_u64[1] = remote_app_ip.ip6.as_u64[1];
- rpath.frp_sw_if_index = sw_if;
- rpath.frp_proto = DPO_PROTO_IP6;
-
- vec_add1 (rpaths, rpath);
- }
+ {
+ ip6_address_t mask;
+ ip6_preflen_to_mask (prefix->fp_len, &mask);
+ prefix->fp_addr.ip6.as_u64[0] =
+ prefix->fp_addr.ip6.as_u64[0] & mask.as_u64[0];
+ prefix->fp_addr.ip6.as_u64[1] =
+ prefix->fp_addr.ip6.as_u64[1] & mask.as_u64[1];
+ prefix->fp_proto = FIB_PROTOCOL_IP6;
+
+ rpath.frp_weight = 1;
+ rpath.frp_sw_if_index = ~0;
+ rpath.frp_addr.ip6.as_u64[0] = remote_app_ip.ip6.as_u64[0];
+ rpath.frp_addr.ip6.as_u64[1] = remote_app_ip.ip6.as_u64[1];
+ rpath.frp_sw_if_index = sw_if;
+ rpath.frp_proto = DPO_PROTO_IP6;
+
+ vec_add1 (rpaths, rpath);
+ }
u32 fib_index = fib_table_find (prefix->fp_proto, 0);
- fib_table_entry_path_add2 (fib_index,
- prefix,
- FIB_SOURCE_CLI,
- FIB_ENTRY_FLAG_NONE, rpaths);
+ fib_table_entry_path_add2 (fib_index, prefix, FIB_SOURCE_CLI,
+ FIB_ENTRY_FLAG_NONE, rpaths);
- hicn_route_enable(prefix);
+ hicn_route_enable (prefix);
hicn_app_state_create (sw_if, prefix);
}
- adj_index = adj_nbr_find(isv6 ? FIB_PROTOCOL_IP6 : FIB_PROTOCOL_IP4, isv6 ? VNET_LINK_IP6 : VNET_LINK_IP4, prod_addr, sw_if);
- face = hicn_face_get(&local_app_ip, sw_if, &hicn_face_hashtb, adj_index);//HICN_FACE_FLAGS_APPFACE_PROD);
+ adj_index =
+ adj_nbr_find (isv6 ? FIB_PROTOCOL_IP6 : FIB_PROTOCOL_IP4,
+ isv6 ? VNET_LINK_IP6 : VNET_LINK_IP4, prod_addr, sw_if);
+ face = hicn_face_get (&local_app_ip, sw_if, &hicn_face_hashtb,
+ adj_index); // HICN_FACE_FLAGS_APPFACE_PROD);
*faceid = hicn_dpoi_get_index (face);
face->flags |= HICN_FACE_FLAGS_APPFACE_PROD;
- hicn_face_unlock_with_id(*faceid);
+ hicn_face_unlock_with_id (*faceid);
*prod_addr = local_app_ip;
@@ -315,13 +305,13 @@ hicn_face_prod_del (hicn_face_id_t face_id)
if (face->flags & HICN_FACE_FLAGS_APPFACE_PROD)
{
/* Remove the face from the fib */
- hicn_route_disable(&(face_state_vec[face->sw_if].prefix));
- //hicn_route_del_nhop (&(face_state_vec[face->sw_if].prefix),
- // face_id);
+ hicn_route_disable (&(face_state_vec[face->sw_if].prefix));
+ // hicn_route_del_nhop (&(face_state_vec[face->sw_if].prefix),
+ // face_id);
- //int ret = hicn_face_del (face_id);
+ // int ret = hicn_face_del (face_id);
return hicn_app_state_del (face->sw_if);
- //ret == HICN_ERROR_NONE ? hicn_app_state_del (face->sw_if) : ret;
+ // ret == HICN_ERROR_NONE ? hicn_app_state_del (face->sw_if) : ret;
}
else
{
@@ -332,35 +322,27 @@ hicn_face_prod_del (hicn_face_id_t face_id)
}
u8 *
-format_hicn_face_prod (u8 * s, va_list * args)
+format_hicn_face_prod (u8 *s, va_list *args)
{
CLIB_UNUSED (index_t index) = va_arg (*args, index_t);
CLIB_UNUSED (u32 indent) = va_arg (*args, u32);
- s =
- format (s, " (producer)");
+ s = format (s, " (producer)");
return s;
}
-/* *INDENT-OFF* */
-VNET_FEATURE_INIT(hicn_prod_app_input_ip6, static)=
-{
+VNET_FEATURE_INIT (hicn_prod_app_input_ip6, static) = {
.arc_name = "ip6-unicast",
.node_name = "hicn-face-prod-input",
- .runs_before = VNET_FEATURES("ip6-inacl"),
+ .runs_before = VNET_FEATURES ("ip6-inacl"),
};
-/* *INDENT-ON* */
-/* *INDENT-OFF* */
-VNET_FEATURE_INIT(hicn_prod_app_input_ip4, static)=
-{
+VNET_FEATURE_INIT (hicn_prod_app_input_ip4, static) = {
.arc_name = "ip4-unicast",
.node_name = "hicn-face-prod-input",
- .runs_before = VNET_FEATURES("ip4-inacl"),
+ .runs_before = VNET_FEATURES ("ip4-inacl"),
};
-/* *INDENT-ON* */
-
/*
* fd.io coding-style-patch-verification: ON
diff --git a/hicn-plugin/src/faces/face.c b/hicn-plugin/src/faces/face.c
index b495d18b0..7ddf38910 100644
--- a/hicn-plugin/src/faces/face.c
+++ b/hicn-plugin/src/faces/face.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017-2020 Cisco and/or its affiliates.
+ * Copyright (c) 2017-2021 Cisco and/or its affiliates.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
@@ -36,26 +36,24 @@ dpo_type_t hicn_face_type;
fib_node_type_t hicn_face_fib_node_type;
const char *HICN_FACE_CTRX_STRING[] = {
-#define _(a,b,c) c,
+#define _(a, b, c) c,
foreach_hicn_face_counter
#undef _
};
u8 *
-face_show (u8 * s, int face_id, u32 indent)
+face_show (u8 *s, int face_id, u32 indent)
{
s = format (s, "%U Faces:\n", format_white_space, indent);
indent += 4;
int i;
vec_foreach_index (i, face_dpo_vec)
- {
- s =
- format (s, "%U", face_vft_vec[i].format_face,
- face_dpo_vec[face_id].dpoi_index, indent);
- }
+ {
+ s = format (s, "%U", face_vft_vec[i].format_face,
+ face_dpo_vec[face_id].dpoi_index, indent);
+ }
return (s);
-
}
mhash_t hicn_face_vec_hashtb;
@@ -64,21 +62,23 @@ mhash_t hicn_face_hashtb;
hicn_face_vec_t *hicn_vec_pool;
const static char *const hicn_face6_nodes[] = {
- "hicn6-face-output", // this is the name you give your node in VLIB_REGISTER_NODE
- "hicn6-iface-output", // this is the name you give your node in VLIB_REGISTER_NODE
+ "hicn6-face-output", // this is the name you give your node in
+ // VLIB_REGISTER_NODE
+ "hicn6-iface-output", // this is the name you give your node in
+ // VLIB_REGISTER_NODE
NULL,
};
const static char *const hicn_face4_nodes[] = {
- "hicn4-face-output", // this is the name you give your node in VLIB_REGISTER_NODE
- "hicn4-iface-output", // this is the name you give your node in VLIB_REGISTER_NODE
+ "hicn4-face-output", // this is the name you give your node in
+ // VLIB_REGISTER_NODE
+ "hicn4-iface-output", // this is the name you give your node in
+ // VLIB_REGISTER_NODE
NULL,
};
-
const static char *const *const hicn_face_nodes[DPO_PROTO_NUM] = {
- [DPO_PROTO_IP4] = hicn_face4_nodes,
- [DPO_PROTO_IP6] = hicn_face6_nodes
+ [DPO_PROTO_IP4] = hicn_face4_nodes, [DPO_PROTO_IP6] = hicn_face6_nodes
};
const static dpo_vft_t hicn_face_dpo_vft = {
@@ -98,19 +98,19 @@ hicn_face_node_get (fib_node_index_t index)
}
static void
-hicn_face_last_lock_gone (fib_node_t * node)
+hicn_face_last_lock_gone (fib_node_t *node)
{
}
static hicn_face_t *
-hicn_face_from_fib_node (fib_node_t * node)
+hicn_face_from_fib_node (fib_node_t *node)
{
return ((hicn_face_t *) (((char *) node) -
STRUCT_OFFSET_OF (hicn_face_t, fib_node)));
}
static fib_node_back_walk_rc_t
-hicn_face_back_walk_notify (fib_node_t * node, fib_node_back_walk_ctx_t * ctx)
+hicn_face_back_walk_notify (fib_node_t *node, fib_node_back_walk_ctx_t *ctx)
{
hicn_face_t *face = hicn_face_from_fib_node (node);
@@ -133,7 +133,8 @@ hicn_face_back_walk_notify (fib_node_t * node, fib_node_back_walk_ctx_t * ctx)
/* } */
/* else */
/* { */
- /* dpo_stack(hicn_face_type, face->dpo.dpoi_proto, &face->dpo, dpo); */
+ /* dpo_stack(hicn_face_type, face->dpo.dpoi_proto, &face->dpo, dpo);
+ */
/* } */
/* } */
@@ -145,7 +146,6 @@ hicn_face_show_memory (void)
{
}
-
static const fib_node_vft_t hicn_face_fib_node_vft = {
.fnv_get = hicn_face_node_get,
.fnv_last_lock = hicn_face_last_lock_gone,
@@ -155,19 +155,18 @@ static const fib_node_vft_t hicn_face_fib_node_vft = {
// Make this more flexible for future types face
void
-hicn_face_module_init (vlib_main_t * vm)
+hicn_face_module_init (vlib_main_t *vm)
{
pool_validate (hicn_dpoi_face_pool);
pool_alloc (hicn_dpoi_face_pool, 1024);
- counters =
- vec_new (vlib_combined_counter_main_t,
- HICN_PARAM_FACES_MAX * HICN_N_COUNTER);
+ counters = vec_new (vlib_combined_counter_main_t,
+ HICN_PARAM_FACES_MAX * HICN_N_COUNTER);
mhash_init (&hicn_face_vec_hashtb,
- sizeof (hicn_face_input_faces_t) /* value */ ,
- sizeof (hicn_face_key_t) /* key */ );
- mhash_init (&hicn_face_hashtb, sizeof (hicn_face_id_t) /* value */ ,
- sizeof (hicn_face_key_t) /* key */ );
+ sizeof (hicn_face_input_faces_t) /* value */,
+ sizeof (hicn_face_key_t) /* key */);
+ mhash_init (&hicn_face_hashtb, sizeof (hicn_face_id_t) /* value */,
+ sizeof (hicn_face_key_t) /* key */);
pool_alloc (hicn_vec_pool, 100);
@@ -175,19 +174,18 @@ hicn_face_module_init (vlib_main_t * vm)
* How much useful is the following registration?
* So far it seems that we need it only for setting the dpo_type.
*/
- hicn_face_type =
- dpo_register_new_type (&hicn_face_dpo_vft, hicn_face_nodes);
+ hicn_face_type = dpo_register_new_type (&hicn_face_dpo_vft, hicn_face_nodes);
/*
- * We register a new node type to get informed when the adjacency corresponding
- * to a face is updated
+ * We register a new node type to get informed when the adjacency
+ * corresponding to a face is updated
*/
hicn_face_fib_node_type =
fib_node_register_new_type (&hicn_face_fib_node_vft);
}
u8 *
-format_hicn_face (u8 * s, va_list * args)
+format_hicn_face (u8 *s, va_list *args)
{
index_t index = va_arg (*args, index_t);
u32 indent = va_arg (*args, u32);
@@ -211,9 +209,8 @@ format_hicn_face (u8 * s, va_list * args)
if ((face->flags & HICN_FACE_FLAGS_DELETED))
s = format (s, " (deleted)");
- s = format (s, "\n%U%U",
- format_white_space, indent + 2,
- format_dpo_id, &face->dpo, indent + 3);
+ s = format (s, "\n%U%U", format_white_space, indent + 2, format_dpo_id,
+ &face->dpo, indent + 3);
}
else
{
@@ -235,9 +232,8 @@ format_hicn_face (u8 * s, va_list * args)
return s;
}
-
u8 *
-format_hicn_face_all (u8 * s, int n, ...)
+format_hicn_face_all (u8 *s, int n, ...)
{
va_list ap;
va_start (ap, n);
@@ -247,12 +243,11 @@ format_hicn_face_all (u8 * s, int n, ...)
hicn_face_t *face;
- /* *INDENT-OFF* */
- pool_foreach ( face, hicn_dpoi_face_pool,
- {
- s = format(s, "%U\n", format_hicn_face, hicn_dpoi_get_index(face), indent);
- });
- /* *INDENT-ON* */
+ pool_foreach (face, hicn_dpoi_face_pool)
+ {
+ s = format (s, "%U\n", format_hicn_face, hicn_dpoi_get_index (face),
+ indent);
+ }
return s;
}
@@ -267,8 +262,7 @@ hicn_face_del (hicn_face_id_t face_id)
hicn_face_get_key (&(face->nat_addr), face->sw_if, &(face->dpo), &key);
hicn_face_input_faces_t *in_faces_vec =
- hicn_face_get_vec (&(face->nat_addr),
- &hicn_face_vec_hashtb);
+ hicn_face_get_vec (&(face->nat_addr), &hicn_face_vec_hashtb);
if (in_faces_vec != NULL)
{
hicn_face_vec_t *vec =
@@ -279,7 +273,7 @@ hicn_face_del (hicn_face_id_t face_id)
if (vec_len (*vec) == 0)
{
pool_put_index (hicn_vec_pool, in_faces_vec->vec_id);
- mhash_unset (&hicn_face_vec_hashtb, &key, (uword *) & old_key);
+ mhash_unset (&hicn_face_vec_hashtb, &key, (uword *) &old_key);
vec_free (*vec);
}
else
@@ -292,7 +286,7 @@ hicn_face_del (hicn_face_id_t face_id)
}
}
- mhash_unset (&hicn_face_hashtb, &key, (uword *) & old_key2);
+ mhash_unset (&hicn_face_hashtb, &key, (uword *) &old_key2);
}
int ret = HICN_ERROR_NONE;
@@ -309,12 +303,11 @@ hicn_face_del (hicn_face_id_t face_id)
else
ret = HICN_ERROR_FACE_NOT_FOUND;
-
return ret;
}
static void
-hicn_iface_to_face (hicn_face_t * face, const dpo_id_t * dpo)
+hicn_iface_to_face (hicn_face_t *face, const dpo_id_t *dpo)
{
dpo_stack (hicn_face_type, dpo->dpoi_proto, &face->dpo, dpo);
@@ -337,15 +330,11 @@ hicn_iface_to_face (hicn_face_t * face, const dpo_id_t * dpo)
{
fib_prefix_from_ip46_addr (nh, &prefix);
- u32 fib_index =
- fib_table_find (prefix.fp_proto, HICN_FIB_TABLE);
+ u32 fib_index = fib_table_find (prefix.fp_proto, HICN_FIB_TABLE);
- face->fib_entry_index = fib_entry_track (fib_index,
- &prefix,
- hicn_face_fib_node_type,
- hicn_dpoi_get_index
- (face),
- &face->fib_sibling);
+ face->fib_entry_index = fib_entry_track (
+ fib_index, &prefix, hicn_face_fib_node_type,
+ hicn_dpoi_get_index (face), &face->fib_sibling);
}
}
}
@@ -356,8 +345,8 @@ hicn_iface_to_face (hicn_face_t * face, const dpo_id_t * dpo)
* the ip_adjacency has already been set up.
*/
int
-hicn_face_add (const dpo_id_t * dpo_nh, ip46_address_t * nat_address,
- int sw_if, hicn_face_id_t * pfaceid, u8 is_app_prod)
+hicn_face_add (const dpo_id_t *dpo_nh, ip46_address_t *nat_address, int sw_if,
+ hicn_face_id_t *pfaceid, u8 is_app_prod)
{
hicn_face_flags_t flags = (hicn_face_flags_t) 0;
@@ -422,8 +411,7 @@ hicn_face_add (const dpo_id_t * dpo_nh, ip46_address_t * nat_address,
hicn_face_get_key (nat_address, 0, &temp_dpo, &key);
- mhash_set_mem (&hicn_face_vec_hashtb, &key,
- (uword *) & in_faces_temp, 0);
+ mhash_set_mem (&hicn_face_vec_hashtb, &key, (uword *) &in_faces_temp, 0);
}
else
{
@@ -442,30 +430,27 @@ hicn_face_add (const dpo_id_t * dpo_nh, ip46_address_t * nat_address,
mhash_set_mem (&hicn_face_vec_hashtb, &key, (uword *) in_faces, 0);
- /* If the face is an application producer face, we set it as the preferred incoming face. */
- /* This is required to handle the CS separation, and the push api in a lightway */
+ /* If the face is an application producer face, we set it as the
+ * preferred incoming face. */
+ /* This is required to handle the CS separation, and the push api in a
+ * lightway */
if (is_app_prod)
{
in_faces->face_id = *pfaceid;
}
}
- retx_t *retx = vlib_process_signal_event_data (vlib_get_main (),
- hicn_mapme_eventmgr_process_node.
- index,
- HICN_MAPME_EVENT_FACE_ADD, 1,
- sizeof (retx_t));
+ retx_t *retx = vlib_process_signal_event_data (
+ vlib_get_main (), hicn_mapme_eventmgr_process_node.index,
+ HICN_MAPME_EVENT_FACE_ADD, 1, sizeof (retx_t));
- /* *INDENT-OFF* */
- *retx = (retx_t) {
+ *retx = (retx_t){
.face_id = *pfaceid,
};
- /* *INDENT-ON* */
return HICN_ERROR_NONE;
}
-
/*
* fd.io coding-style-patch-verification: ON
*
diff --git a/hicn-plugin/src/faces/face_cli.c b/hicn-plugin/src/faces/face_cli.c
index e9e516cc6..a4092e6f4 100644
--- a/hicn-plugin/src/faces/face_cli.c
+++ b/hicn-plugin/src/faces/face_cli.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017-2020 Cisco and/or its affiliates.
+ * Copyright (c) 2017-2021 Cisco and/or its affiliates.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
@@ -19,9 +19,8 @@
#include "../error.h"
static clib_error_t *
-hicn_face_cli_show_command_fn (vlib_main_t * vm,
- unformat_input_t * main_input,
- vlib_cli_command_t * cmd)
+hicn_face_cli_show_command_fn (vlib_main_t *vm, unformat_input_t *main_input,
+ vlib_cli_command_t *cmd)
{
hicn_face_id_t face_id = HICN_FACE_NULL;
@@ -46,9 +45,8 @@ hicn_face_cli_show_command_fn (vlib_main_t * vm,
deleted = 1;
else
{
- return clib_error_return (0, "%s",
- get_error_string
- (HICN_ERROR_CLI_INVAL));
+ return clib_error_return (
+ 0, "%s", get_error_string (HICN_ERROR_CLI_INVAL));
}
}
@@ -56,48 +54,43 @@ hicn_face_cli_show_command_fn (vlib_main_t * vm,
{
int idx = 0;
vec_foreach_index (idx, face_type_names_vec)
- {
- if (!strcmp (face_type_names_vec[idx], face_type_name))
- found = idx;
- }
+ {
+ if (!strcmp (face_type_names_vec[idx], face_type_name))
+ found = idx;
+ }
if (found == ~0)
return (clib_error_return (0, "Face type unknown"));
}
-
}
if (face_id != HICN_FACE_NULL)
{
if (!hicn_dpoi_idx_is_valid (face_id))
- return clib_error_return (0, "%s",
- get_error_string
- (HICN_ERROR_FACE_NOT_FOUND));
+ return clib_error_return (
+ 0, "%s", get_error_string (HICN_ERROR_FACE_NOT_FOUND));
hicn_face_t *face = hicn_dpoi_get_from_idx (face_id);
- vlib_cli_output (vm, "%U\n", format_hicn_face, face_id, 0 /*indent */ );
+ vlib_cli_output (vm, "%U\n", format_hicn_face, face_id, 0 /*indent */);
u32 indent = 3;
for (int i = 0; i < HICN_N_COUNTER; i++)
{
- vlib_get_combined_counter (&counters
- [hicn_dpoi_get_index (face) *
- HICN_N_COUNTER], i, &v);
- s =
- format (s, "%U%s", format_white_space, indent,
- HICN_FACE_CTRX_STRING[i]);
+ vlib_get_combined_counter (
+ &counters[hicn_dpoi_get_index (face) * HICN_N_COUNTER], i, &v);
+ s = format (s, "%U%s", format_white_space, indent,
+ HICN_FACE_CTRX_STRING[i]);
if (n)
_vec_len (n) = 0;
n = format (n, "packets");
- s =
- format (s, "%U%-16v%16Ld", format_white_space,
- 30 - strlen (HICN_FACE_CTRX_STRING[i]), n, v.packets);
+ s = format (s, "%U%-16v%16Ld", format_white_space,
+ 30 - strlen (HICN_FACE_CTRX_STRING[i]), n, v.packets);
_vec_len (n) = 0;
n = format (n, "bytes");
- s = format (s, "\n%U%-16v%16Ld\n",
- format_white_space, indent + 30, n, v.bytes);
+ s = format (s, "\n%U%-16v%16Ld\n", format_white_space, indent + 30,
+ n, v.bytes);
}
vlib_cli_output (vm, "%s\n", s);
}
@@ -106,69 +99,79 @@ hicn_face_cli_show_command_fn (vlib_main_t * vm,
if (found != ~0)
{
hicn_face_t *face;
- /* *INDENT-OFF* */
- pool_foreach(face, hicn_dpoi_face_pool,
- {
- if (!((face->flags & HICN_FACE_FLAGS_DELETED) && !deleted))
- {
- if (face->flags)
- {
- vlib_cli_output(vm, "%U\n", format_hicn_face, hicn_dpoi_get_index(face), 0);
- u8 * s = 0;
- u32 indent = 3;
-
- for (int i = 0; i < HICN_N_COUNTER; i++)
- {
- vlib_get_combined_counter (&counters[hicn_dpoi_get_index(face) * HICN_N_COUNTER], i, &v);
- s = format (s, "%U%s",format_white_space, indent, HICN_FACE_CTRX_STRING[i]);
-
- if (n)
- _vec_len (n) = 0;
- n = format (n, "packets");
- s = format (s, "%U%-16v%16Ld", format_white_space, 30-strlen(HICN_FACE_CTRX_STRING[i]), n, v.packets);
-
- _vec_len (n) = 0;
- n = format (n, "bytes");
- s = format (s, "\n%U%-16v%16Ld\n",
- format_white_space, indent+30, n, v.bytes);
- }
- vlib_cli_output (vm, "%s\n", s);
- }
- }
- });
- /* *INDENT-ON* */
+ pool_foreach (face, hicn_dpoi_face_pool)
+ {
+ if (!((face->flags & HICN_FACE_FLAGS_DELETED) && !deleted))
+ {
+ if (face->flags)
+ {
+ vlib_cli_output (vm, "%U\n", format_hicn_face,
+ hicn_dpoi_get_index (face), 0);
+ u8 *s = 0;
+ u32 indent = 3;
+
+ for (int i = 0; i < HICN_N_COUNTER; i++)
+ {
+ vlib_get_combined_counter (
+ &counters[hicn_dpoi_get_index (face) *
+ HICN_N_COUNTER],
+ i, &v);
+ s = format (s, "%U%s", format_white_space, indent,
+ HICN_FACE_CTRX_STRING[i]);
+
+ if (n)
+ _vec_len (n) = 0;
+ n = format (n, "packets");
+ s = format (s, "%U%-16v%16Ld", format_white_space,
+ 30 - strlen (HICN_FACE_CTRX_STRING[i]),
+ n, v.packets);
+
+ _vec_len (n) = 0;
+ n = format (n, "bytes");
+ s =
+ format (s, "\n%U%-16v%16Ld\n", format_white_space,
+ indent + 30, n, v.bytes);
+ }
+ vlib_cli_output (vm, "%s\n", s);
+ }
+ }
+ }
}
else
{
hicn_face_t *face;
- /* *INDENT-OFF* */
- pool_foreach(face, hicn_dpoi_face_pool,
- {
- if (!((face->flags & HICN_FACE_FLAGS_DELETED) && !deleted))
- {
- vlib_cli_output(vm, "%U\n", format_hicn_face, hicn_dpoi_get_index(face), 0);
- u32 indent = 3;
- u8 * s = 0;
-
- for (int i = 0; i < HICN_N_COUNTER; i++)
- {
- vlib_get_combined_counter (&counters[hicn_dpoi_get_index(face) * HICN_N_COUNTER], i, &v);
- s = format (s, "%U%s",format_white_space, indent, HICN_FACE_CTRX_STRING[i]);
-
- if (n)
- _vec_len (n) = 0;
- n = format (n, "packets");
- s = format (s, "%U%-16v%16Ld", format_white_space, 30-strlen(HICN_FACE_CTRX_STRING[i]), n, v.packets);
-
- _vec_len (n) = 0;
- n = format (n, "bytes");
- s = format (s, "\n%U%-16v%16Ld\n",
- format_white_space, indent+30, n, v.bytes);
- }
- vlib_cli_output (vm, "%s\n", s);
- }
- });
- /* *INDENT-ON* */
+ pool_foreach (face, hicn_dpoi_face_pool)
+ {
+ if (!((face->flags & HICN_FACE_FLAGS_DELETED) && !deleted))
+ {
+ vlib_cli_output (vm, "%U\n", format_hicn_face,
+ hicn_dpoi_get_index (face), 0);
+ u32 indent = 3;
+ u8 *s = 0;
+
+ for (int i = 0; i < HICN_N_COUNTER; i++)
+ {
+ vlib_get_combined_counter (
+ &counters[hicn_dpoi_get_index (face) * HICN_N_COUNTER],
+ i, &v);
+ s = format (s, "%U%s", format_white_space, indent,
+ HICN_FACE_CTRX_STRING[i]);
+
+ if (n)
+ _vec_len (n) = 0;
+ n = format (n, "packets");
+ s = format (s, "%U%-16v%16Ld", format_white_space,
+ 30 - strlen (HICN_FACE_CTRX_STRING[i]), n,
+ v.packets);
+
+ _vec_len (n) = 0;
+ n = format (n, "bytes");
+ s = format (s, "\n%U%-16v%16Ld\n", format_white_space,
+ indent + 30, n, v.bytes);
+ }
+ vlib_cli_output (vm, "%s\n", s);
+ }
+ }
}
}
@@ -176,14 +179,11 @@ hicn_face_cli_show_command_fn (vlib_main_t * vm,
}
/* cli declaration for 'show faces' */
-/* *INDENT-OFF* */
-VLIB_CLI_COMMAND (hicn_face_cli_show_command, static) =
-{
+VLIB_CLI_COMMAND (hicn_face_cli_show_command, static) = {
.path = "hicn face show",
.short_help = "hicn face show [<face_id>]",
.function = hicn_face_cli_show_command_fn,
};
-/* *INDENT-ON* */
/*
* fd.io coding-style-patch-verification: ON
diff --git a/hicn-plugin/src/hicn_api.c b/hicn-plugin/src/hicn_api.c
index e6050f96c..f26af1e82 100644
--- a/hicn-plugin/src/hicn_api.c
+++ b/hicn-plugin/src/hicn_api.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017-2020 Cisco and/or its affiliates.
+ * Copyright (c) 2017-2021 Cisco and/or its affiliates.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
@@ -57,19 +57,16 @@
* Convert a unix return code to a vnet_api return code. Currently stubby:
* should have more cases.
*/
-always_inline vnet_api_error_t
-hicn_face_api_entry_params_serialize (hicn_face_id_t faceid,
- vl_api_hicn_api_face_params_get_reply_t
- * reply);
-
+always_inline vnet_api_error_t hicn_face_api_entry_params_serialize (
+ hicn_face_id_t faceid, vl_api_hicn_api_face_params_get_reply_t *reply);
/****************** API MESSAGE HANDLERS ******************/
/****** NODE ******/
static void
-vl_api_hicn_api_node_params_set_t_handler (vl_api_hicn_api_node_params_set_t *
- mp)
+vl_api_hicn_api_node_params_set_t_handler (
+ vl_api_hicn_api_node_params_set_t *mp)
{
vl_api_hicn_api_node_params_set_reply_t *rmp;
int rv;
@@ -81,66 +78,58 @@ vl_api_hicn_api_node_params_set_t_handler (vl_api_hicn_api_node_params_set_t *
pit_max_size == -1 ? HICN_PARAM_PIT_ENTRIES_DFLT : pit_max_size;
f64 pit_max_lifetime_sec = mp->pit_max_lifetime_sec;
- pit_max_lifetime_sec =
- pit_max_lifetime_sec ==
- -1 ? HICN_PARAM_PIT_LIFETIME_DFLT_MAX_MS / SEC_MS : pit_max_lifetime_sec;
+ pit_max_lifetime_sec = pit_max_lifetime_sec == -1 ?
+ HICN_PARAM_PIT_LIFETIME_DFLT_MAX_MS / SEC_MS :
+ pit_max_lifetime_sec;
int cs_max_size = clib_net_to_host_i32 (mp->cs_max_size);
cs_max_size = cs_max_size == -1 ? HICN_PARAM_CS_ENTRIES_DFLT : cs_max_size;
- rv = hicn_infra_plugin_enable_disable ((int) (mp->enable_disable),
- pit_max_size,
- pit_max_lifetime_sec,
- cs_max_size,
- ~0);
+ rv =
+ hicn_infra_plugin_enable_disable ((int) (mp->enable_disable), pit_max_size,
+ pit_max_lifetime_sec, cs_max_size, ~0);
- REPLY_MACRO (VL_API_HICN_API_NODE_PARAMS_SET_REPLY /* , rmp, mp, rv */ );
+ REPLY_MACRO (VL_API_HICN_API_NODE_PARAMS_SET_REPLY /* , rmp, mp, rv */);
}
static void
-vl_api_hicn_api_node_params_get_t_handler (vl_api_hicn_api_node_params_get_t *
- mp)
+vl_api_hicn_api_node_params_get_t_handler (
+ vl_api_hicn_api_node_params_get_t *mp)
{
vl_api_hicn_api_node_params_get_reply_t *rmp;
int rv = HICN_ERROR_NONE;
hicn_main_t *sm = &hicn_main;
- /* *INDENT-OFF* */
- REPLY_MACRO2 (VL_API_HICN_API_NODE_PARAMS_GET_REPLY, (
- {
- rmp->is_enabled = sm->is_enabled;
- rmp->feature_cs = HICN_FEATURE_CS;
- rmp->pit_max_size = clib_host_to_net_u32 (hicn_infra_pit_size);
- rmp->pit_max_lifetime_sec = ((f64) sm->pit_lifetime_max_ms) / SEC_MS;
- rmp->cs_max_size = clib_host_to_net_u32 (hicn_infra_cs_size);
- rmp->retval = clib_host_to_net_i32 (rv);
- }));
- /* *INDENT-ON* */
+ REPLY_MACRO2 (VL_API_HICN_API_NODE_PARAMS_GET_REPLY, ({
+ rmp->is_enabled = sm->is_enabled;
+ rmp->feature_cs = HICN_FEATURE_CS;
+ rmp->pit_max_size =
+ clib_host_to_net_u32 (hicn_infra_pit_size);
+ rmp->pit_max_lifetime_sec =
+ ((f64) sm->pit_lifetime_max_ms) / SEC_MS;
+ rmp->cs_max_size = clib_host_to_net_u32 (hicn_infra_cs_size);
+ rmp->retval = clib_host_to_net_i32 (rv);
+ }));
}
static void
-vl_api_hicn_api_node_stats_get_t_handler (vl_api_hicn_api_node_stats_get_t *
- mp)
+vl_api_hicn_api_node_stats_get_t_handler (vl_api_hicn_api_node_stats_get_t *mp)
{
vl_api_hicn_api_node_stats_get_reply_t *rmp;
int rv = HICN_ERROR_NONE;
hicn_main_t *sm = &hicn_main;
- /* *INDENT-OFF* */
- REPLY_MACRO2 (VL_API_HICN_API_NODE_STATS_GET_REPLY, (
- {
- rv = hicn_mgmt_node_stats_get (rmp);
- rmp->retval =clib_host_to_net_i32 (rv);
- }));
- /* *INDENT-ON* */
+ REPLY_MACRO2 (VL_API_HICN_API_NODE_STATS_GET_REPLY, ({
+ rv = hicn_mgmt_node_stats_get (rmp);
+ rmp->retval = clib_host_to_net_i32 (rv);
+ }));
}
-
static void
- vl_api_hicn_api_face_params_get_t_handler
- (vl_api_hicn_api_face_params_get_t * mp)
+vl_api_hicn_api_face_params_get_t_handler (
+ vl_api_hicn_api_face_params_get_t *mp)
{
vl_api_hicn_api_face_params_get_reply_t *rmp;
int rv = 0;
@@ -149,17 +138,14 @@ static void
hicn_face_id_t faceid = clib_net_to_host_u32 (mp->faceid);
- /* *INDENT-OFF* */
- REPLY_MACRO2 (VL_API_HICN_API_FACE_PARAMS_GET_REPLY, (
- {
- rv = hicn_face_api_entry_params_serialize(faceid, rmp);
- rmp->retval = clib_host_to_net_u32(rv);
- }));
- /* *INDENT-ON* */
+ REPLY_MACRO2 (VL_API_HICN_API_FACE_PARAMS_GET_REPLY, ({
+ rv = hicn_face_api_entry_params_serialize (faceid, rmp);
+ rmp->retval = clib_host_to_net_u32 (rv);
+ }));
}
static void
-send_face_details (hicn_face_t * face, vl_api_hicn_face_t * mp)
+send_face_details (hicn_face_t *face, vl_api_hicn_face_t *mp)
{
vnet_main_t *vnm = vnet_get_main ();
@@ -178,8 +164,7 @@ send_face_details (hicn_face_t * face, vl_api_hicn_face_t * mp)
}
static void
-send_faces_details (vl_api_registration_t * reg,
- hicn_face_t * face, u32 context)
+send_faces_details (vl_api_registration_t *reg, hicn_face_t *face, u32 context)
{
vl_api_hicn_api_faces_details_t *mp;
hicn_main_t *hm = &hicn_main;
@@ -195,7 +180,7 @@ send_faces_details (vl_api_registration_t * reg,
}
static void
-vl_api_hicn_api_faces_dump_t_handler (vl_api_hicn_api_faces_dump_t * mp)
+vl_api_hicn_api_faces_dump_t_handler (vl_api_hicn_api_faces_dump_t *mp)
{
hicn_face_t *face;
vl_api_registration_t *reg;
@@ -204,16 +189,14 @@ vl_api_hicn_api_faces_dump_t_handler (vl_api_hicn_api_faces_dump_t * mp)
if (!reg)
return;
- /* *INDENT-OFF* */
- pool_foreach (face, hicn_dpoi_face_pool,
- ({
- send_faces_details (reg, face, mp->context);
- }));
- /* *INDENT-ON* */
+ pool_foreach (face, hicn_dpoi_face_pool)
+ {
+ send_faces_details (reg, face, mp->context);
+ }
}
static void
-vl_api_hicn_api_face_get_t_handler (vl_api_hicn_api_face_get_t * mp)
+vl_api_hicn_api_face_get_t_handler (vl_api_hicn_api_face_get_t *mp)
{
vl_api_hicn_api_face_get_reply_t *rmp;
int rv = 0;
@@ -222,28 +205,25 @@ vl_api_hicn_api_face_get_t_handler (vl_api_hicn_api_face_get_t * mp)
hicn_face_id_t faceid = clib_net_to_host_u32 (mp->faceid);
- /* *INDENT-OFF* */
- REPLY_MACRO2 (VL_API_HICN_API_FACE_GET_REPLY, (
- {
- rv = hicn_dpoi_idx_is_valid(faceid);
- if (rv)
- {
- hicn_face_t * face = hicn_dpoi_get_from_idx(faceid);
- send_face_details(face, &(rmp->face));
- rv = HICN_ERROR_NONE;
- }
- else
- {
- rv = HICN_ERROR_FACE_NOT_FOUND;
- }
- rmp->retval = clib_host_to_net_u32(rv);
- }));
- /* *INDENT-ON* */
+ REPLY_MACRO2 (VL_API_HICN_API_FACE_GET_REPLY, ({
+ rv = hicn_dpoi_idx_is_valid (faceid);
+ if (rv)
+ {
+ hicn_face_t *face = hicn_dpoi_get_from_idx (faceid);
+ send_face_details (face, &(rmp->face));
+ rv = HICN_ERROR_NONE;
+ }
+ else
+ {
+ rv = HICN_ERROR_FACE_NOT_FOUND;
+ }
+ rmp->retval = clib_host_to_net_u32 (rv);
+ }));
}
static void
-send_face_stats_details (vl_api_registration_t * reg,
- hicn_face_t * face, u32 context)
+send_face_stats_details (vl_api_registration_t *reg, hicn_face_t *face,
+ u32 context)
{
vl_api_hicn_api_face_stats_details_t *mp;
hicn_main_t *hm = &hicn_main;
@@ -256,27 +236,27 @@ send_face_stats_details (vl_api_registration_t * reg,
mp->faceid = htonl (hicn_dpoi_get_index (face));
vlib_counter_t v;
- vlib_get_combined_counter (&counters
- [hicn_dpoi_get_index (face) * HICN_N_COUNTER],
- HICN_FACE_COUNTERS_INTEREST_RX, &v);
+ vlib_get_combined_counter (
+ &counters[hicn_dpoi_get_index (face) * HICN_N_COUNTER],
+ HICN_FACE_COUNTERS_INTEREST_RX, &v);
mp->irx_packets = clib_net_to_host_u64 (v.packets);
mp->irx_bytes = clib_net_to_host_u64 (v.bytes);
- vlib_get_combined_counter (&counters
- [hicn_dpoi_get_index (face) * HICN_N_COUNTER],
- HICN_FACE_COUNTERS_INTEREST_TX, &v);
+ vlib_get_combined_counter (
+ &counters[hicn_dpoi_get_index (face) * HICN_N_COUNTER],
+ HICN_FACE_COUNTERS_INTEREST_TX, &v);
mp->itx_packets = clib_net_to_host_u64 (v.packets);
mp->itx_bytes = clib_net_to_host_u64 (v.bytes);
- vlib_get_combined_counter (&counters
- [hicn_dpoi_get_index (face) * HICN_N_COUNTER],
- HICN_FACE_COUNTERS_DATA_RX, &v);
+ vlib_get_combined_counter (
+ &counters[hicn_dpoi_get_index (face) * HICN_N_COUNTER],
+ HICN_FACE_COUNTERS_DATA_RX, &v);
mp->drx_packets = clib_net_to_host_u64 (v.packets);
mp->drx_bytes = clib_net_to_host_u64 (v.bytes);
- vlib_get_combined_counter (&counters
- [hicn_dpoi_get_index (face) * HICN_N_COUNTER],
- HICN_FACE_COUNTERS_DATA_TX, &v);
+ vlib_get_combined_counter (
+ &counters[hicn_dpoi_get_index (face) * HICN_N_COUNTER],
+ HICN_FACE_COUNTERS_DATA_TX, &v);
mp->dtx_packets = clib_net_to_host_u64 (v.packets);
mp->dtx_bytes = clib_net_to_host_u64 (v.bytes);
@@ -284,8 +264,8 @@ send_face_stats_details (vl_api_registration_t * reg,
}
static void
- vl_api_hicn_api_face_stats_dump_t_handler
- (vl_api_hicn_api_face_stats_dump_t * mp)
+vl_api_hicn_api_face_stats_dump_t_handler (
+ vl_api_hicn_api_face_stats_dump_t *mp)
{
hicn_face_t *face;
vl_api_registration_t *reg;
@@ -294,19 +274,16 @@ static void
if (!reg)
return;
- /* *INDENT-OFF* */
- pool_foreach (face, hicn_dpoi_face_pool,
- ({
- send_face_stats_details (reg, face, mp->context);
- }));
- /* *INDENT-ON* */
+ pool_foreach (face, hicn_dpoi_face_pool)
+ {
+ send_face_stats_details (reg, face, mp->context);
+ }
}
-
/****** ROUTE *******/
-static void vl_api_hicn_api_route_get_t_handler
- (vl_api_hicn_api_route_get_t * mp)
+static void
+vl_api_hicn_api_route_get_t_handler (vl_api_hicn_api_route_get_t *mp)
{
vl_api_hicn_api_route_get_reply_t *rmp;
int rv = HICN_ERROR_NONE;
@@ -321,24 +298,25 @@ static void vl_api_hicn_api_route_get_t_handler
rv = hicn_route_get_dpo (&prefix, &hicn_dpo_id, &fib_index);
- /* *INDENT-OFF* */
- REPLY_MACRO2 (VL_API_HICN_API_ROUTE_GET_REPLY, (
- {
+ REPLY_MACRO2 (
+ VL_API_HICN_API_ROUTE_GET_REPLY, ({
if (rv == HICN_ERROR_NONE)
{
- hicn_dpo_ctx = hicn_strategy_dpo_ctx_get(hicn_dpo_id->dpoi_index);
- for (int i = 0; hicn_dpo_ctx != NULL && i < hicn_dpo_ctx->entry_count; i++)
+ hicn_dpo_ctx = hicn_strategy_dpo_ctx_get (hicn_dpo_id->dpoi_index);
+ for (int i = 0;
+ hicn_dpo_ctx != NULL && i < hicn_dpo_ctx->entry_count; i++)
{
- rmp->faceids[i] = hicn_dpo_ctx->next_hops[i];
+ rmp->faceids[i] = hicn_dpo_ctx->next_hops[i];
}
- rmp->strategy_id = clib_host_to_net_u32(hicn_dpo_get_vft_id(hicn_dpo_id));}
+ rmp->strategy_id =
+ clib_host_to_net_u32 (hicn_dpo_get_vft_id (hicn_dpo_id));
+ }
}));
- /* *INDENT-ON* */
}
static void
-send_route_details (vl_api_registration_t * reg,
- const fib_prefix_t * pfx, u32 context)
+send_route_details (vl_api_registration_t *reg, const fib_prefix_t *pfx,
+ u32 context)
{
vl_api_hicn_api_routes_details_t *mp;
hicn_main_t *hm = &hicn_main;
@@ -363,10 +341,8 @@ send_route_details (vl_api_registration_t * reg,
for (int i = 0; hicn_dpo_ctx != NULL && i < hicn_dpo_ctx->entry_count;
i++)
{
- mp->faceids[i] =
- clib_host_to_net_u32 (hicn_dpo_ctx->
- next_hops[i]);
- mp->nfaces++;
+ mp->faceids[i] = clib_host_to_net_u32 (hicn_dpo_ctx->next_hops[i]);
+ mp->nfaces++;
}
mp->strategy_id =
clib_host_to_net_u32 (hicn_dpo_get_vft_id (hicn_dpo_id));
@@ -413,7 +389,7 @@ vl_api_hicn_api_route_dump_walk (fib_node_index_t fei, void *arg)
}
static void
-vl_api_hicn_api_routes_dump_t_handler (vl_api_hicn_api_routes_dump_t * mp)
+vl_api_hicn_api_routes_dump_t_handler (vl_api_hicn_api_routes_dump_t *mp)
{
vl_api_registration_t *reg;
fib_table_t *fib_table;
@@ -429,34 +405,29 @@ vl_api_hicn_api_routes_dump_t_handler (vl_api_hicn_api_routes_dump_t * mp)
if (!reg)
return;
- pool_foreach (fib_table, im->fibs, (
- {
- fib_table_walk (fib_table->ft_index,
- FIB_PROTOCOL_IP4,
- vl_api_hicn_api_route_dump_walk,
- &ctx);}
- ));
-
- pool_foreach (fib_table, im6->fibs, (
- {
- fib_table_walk (fib_table->ft_index,
- FIB_PROTOCOL_IP6,
- vl_api_hicn_api_route_dump_walk,
- &ctx);}
- ));
+ pool_foreach (fib_table, im->fibs)
+ {
+ fib_table_walk (fib_table->ft_index, FIB_PROTOCOL_IP4,
+ vl_api_hicn_api_route_dump_walk, &ctx);
+ }
+
+ pool_foreach (fib_table, im6->fibs)
+ {
+ fib_table_walk (fib_table->ft_index, FIB_PROTOCOL_IP6,
+ vl_api_hicn_api_route_dump_walk, &ctx);
+ }
vec_foreach (lfeip, ctx.feis)
- {
- pfx = fib_entry_get_prefix (*lfeip);
- send_route_details (reg, pfx, mp->context);
- }
+ {
+ pfx = fib_entry_get_prefix (*lfeip);
+ send_route_details (reg, pfx, mp->context);
+ }
vec_free (ctx.feis);
-
}
-static void vl_api_hicn_api_strategies_get_t_handler
- (vl_api_hicn_api_strategies_get_t * mp)
+static void
+vl_api_hicn_api_strategies_get_t_handler (vl_api_hicn_api_strategies_get_t *mp)
{
vl_api_hicn_api_strategies_get_reply_t *rmp;
int rv = HICN_ERROR_NONE;
@@ -465,23 +436,22 @@ static void vl_api_hicn_api_strategies_get_t_handler
int n_strategies = hicn_strategy_get_all_available ();
- /* *INDENT-OFF* */
- REPLY_MACRO2 (VL_API_HICN_API_STRATEGIES_GET_REPLY/* , rmp, mp, rv */ ,(
- {
- int j = 0;
- for (u32 i = 0; i < (u32) n_strategies; i++)
- {
- if (hicn_dpo_strategy_id_is_valid (i) == HICN_ERROR_NONE)
- {
- rmp->strategy_id[j] = clib_host_to_net_u32 (i); j++;}
- }
- rmp->n_strategies = n_strategies;
- }));
- /* *INDENT-ON* */
+ REPLY_MACRO2 (VL_API_HICN_API_STRATEGIES_GET_REPLY /* , rmp, mp, rv */, ({
+ int j = 0;
+ for (u32 i = 0; i < (u32) n_strategies; i++)
+ {
+ if (hicn_dpo_strategy_id_is_valid (i) == HICN_ERROR_NONE)
+ {
+ rmp->strategy_id[j] = clib_host_to_net_u32 (i);
+ j++;
+ }
+ }
+ rmp->n_strategies = n_strategies;
+ }));
}
-static void vl_api_hicn_api_strategy_get_t_handler
- (vl_api_hicn_api_strategy_get_t * mp)
+static void
+vl_api_hicn_api_strategy_get_t_handler (vl_api_hicn_api_strategy_get_t *mp)
{
vl_api_hicn_api_strategy_get_reply_t *rmp;
int rv = HICN_ERROR_NONE;
@@ -491,22 +461,22 @@ static void vl_api_hicn_api_strategy_get_t_handler
u32 strategy_id = clib_net_to_host_u32 (mp->strategy_id);
rv = hicn_dpo_strategy_id_is_valid (strategy_id);
- /* *INDENT-OFF* */
- REPLY_MACRO2 (VL_API_HICN_API_STRATEGY_GET_REPLY /* , rmp, mp, rv */ ,(
- {
- if (rv == HICN_ERROR_NONE)
- {
- const hicn_strategy_vft_t * hicn_strategy_vft =
- hicn_dpo_get_strategy_vft (strategy_id);
- hicn_strategy_vft->hicn_format_strategy (rmp->description, 0);}
- }));
- /* *INDENT-ON* */
+ REPLY_MACRO2 (VL_API_HICN_API_STRATEGY_GET_REPLY /* , rmp, mp, rv */, ({
+ if (rv == HICN_ERROR_NONE)
+ {
+ const hicn_strategy_vft_t *hicn_strategy_vft =
+ hicn_dpo_get_strategy_vft (strategy_id);
+ hicn_strategy_vft->hicn_format_strategy (
+ rmp->description, 0);
+ }
+ }));
}
/************* APP FACE ****************/
-static void vl_api_hicn_api_register_prod_app_t_handler
- (vl_api_hicn_api_register_prod_app_t * mp)
+static void
+vl_api_hicn_api_register_prod_app_t_handler (
+ vl_api_hicn_api_register_prod_app_t *mp)
{
vl_api_hicn_api_register_prod_app_reply_t *rmp;
int rv = HICN_ERROR_NONE;
@@ -523,18 +493,16 @@ static void vl_api_hicn_api_register_prod_app_t_handler
ip46_address_reset (&prod_addr);
rv = hicn_face_prod_add (&prefix, swif, &cs_reserved, &prod_addr, &faceid);
- /* *INDENT-OFF* */
- REPLY_MACRO2 (VL_API_HICN_API_REGISTER_PROD_APP_REPLY, (
- {
- ip_address_encode(&prod_addr, IP46_TYPE_ANY, &rmp->prod_addr);
- rmp->cs_reserved = clib_net_to_host_u32(cs_reserved);
- rmp->faceid = clib_net_to_host_u32(faceid);
- }));
- /* *INDENT-ON* */
+ REPLY_MACRO2 (VL_API_HICN_API_REGISTER_PROD_APP_REPLY, ({
+ ip_address_encode (&prod_addr, IP46_TYPE_ANY,
+ &rmp->prod_addr);
+ rmp->cs_reserved = clib_net_to_host_u32 (cs_reserved);
+ rmp->faceid = clib_net_to_host_u32 (faceid);
+ }));
}
static void
-vl_api_hicn_api_face_prod_del_t_handler (vl_api_hicn_api_face_prod_del_t * mp)
+vl_api_hicn_api_face_prod_del_t_handler (vl_api_hicn_api_face_prod_del_t *mp)
{
vl_api_hicn_api_face_prod_del_reply_t *rmp;
int rv = HICN_ERROR_FACE_NOT_FOUND;
@@ -544,11 +512,12 @@ vl_api_hicn_api_face_prod_del_t_handler (vl_api_hicn_api_face_prod_del_t * mp)
hicn_face_id_t faceid = clib_net_to_host_u32 (mp->faceid);
rv = hicn_face_prod_del (faceid);
- REPLY_MACRO (VL_API_HICN_API_FACE_PROD_DEL_REPLY /* , rmp, mp, rv */ );
+ REPLY_MACRO (VL_API_HICN_API_FACE_PROD_DEL_REPLY /* , rmp, mp, rv */);
}
-static void vl_api_hicn_api_register_cons_app_t_handler
- (vl_api_hicn_api_register_cons_app_t * mp)
+static void
+vl_api_hicn_api_register_cons_app_t_handler (
+ vl_api_hicn_api_register_cons_app_t *mp)
{
vl_api_hicn_api_register_cons_app_reply_t *rmp;
int rv = HICN_ERROR_NONE;
@@ -561,23 +530,20 @@ static void vl_api_hicn_api_register_cons_app_t_handler
u32 faceid1;
u32 faceid2;
- rv =
- hicn_face_cons_add (&src_addr4.ip4, &src_addr6.ip6, swif, &faceid1,
- &faceid2);
+ rv = hicn_face_cons_add (&src_addr4.ip4, &src_addr6.ip6, swif, &faceid1,
+ &faceid2);
- /* *INDENT-OFF* */
- REPLY_MACRO2 (VL_API_HICN_API_REGISTER_CONS_APP_REPLY, (
- {
- ip_address_encode(&src_addr4, IP46_TYPE_ANY, &rmp->src_addr4);
- ip_address_encode(&src_addr6, IP46_TYPE_ANY, &rmp->src_addr6);
- rmp->faceid1 = clib_net_to_host_u32(faceid1);
- rmp->faceid2 = clib_net_to_host_u32(faceid2);
+ REPLY_MACRO2 (
+ VL_API_HICN_API_REGISTER_CONS_APP_REPLY, ({
+ ip_address_encode (&src_addr4, IP46_TYPE_ANY, &rmp->src_addr4);
+ ip_address_encode (&src_addr6, IP46_TYPE_ANY, &rmp->src_addr6);
+ rmp->faceid1 = clib_net_to_host_u32 (faceid1);
+ rmp->faceid2 = clib_net_to_host_u32 (faceid2);
}));
- /* *INDENT-ON* */
}
static void
-vl_api_hicn_api_face_cons_del_t_handler (vl_api_hicn_api_face_cons_del_t * mp)
+vl_api_hicn_api_face_cons_del_t_handler (vl_api_hicn_api_face_cons_del_t *mp)
{
vl_api_hicn_api_face_cons_del_reply_t *rmp;
int rv = HICN_ERROR_FACE_NOT_FOUND;
@@ -587,11 +553,11 @@ vl_api_hicn_api_face_cons_del_t_handler (vl_api_hicn_api_face_cons_del_t * mp)
hicn_face_id_t faceid = clib_net_to_host_u32 (mp->faceid);
rv = hicn_face_cons_del (faceid);
- REPLY_MACRO (VL_API_HICN_API_FACE_CONS_DEL_REPLY /* , rmp, mp, rv */ );
+ REPLY_MACRO (VL_API_HICN_API_FACE_CONS_DEL_REPLY /* , rmp, mp, rv */);
}
-static void vl_api_hicn_api_enable_disable_t_handler
-(vl_api_hicn_api_enable_disable_t * mp)
+static void
+vl_api_hicn_api_enable_disable_t_handler (vl_api_hicn_api_enable_disable_t *mp)
{
vl_api_hicn_api_enable_disable_reply_t *rmp;
int rv = HICN_ERROR_NONE;
@@ -601,23 +567,25 @@ static void vl_api_hicn_api_enable_disable_t_handler
fib_prefix_t prefix;
ip_prefix_decode (&mp->prefix, &prefix);
- switch (clib_net_to_host_u32(mp->enable_disable))
+ switch (clib_net_to_host_u32 (mp->enable_disable))
{
case HICN_ENABLE:
- rv = hicn_route_enable(&prefix);
+ rv = hicn_route_enable (&prefix);
break;
case HICN_DISABLE:
- rv = hicn_route_disable(&prefix);
+ rv = hicn_route_disable (&prefix);
break;
}
- REPLY_MACRO (VL_API_HICN_API_ENABLE_DISABLE_REPLY/* , rmp, mp, rv */ );
+ REPLY_MACRO (VL_API_HICN_API_ENABLE_DISABLE_REPLY /* , rmp, mp, rv */);
}
-/*********************************** UDP TUNNELS ************************************/
+/*********************************** UDP TUNNELS
+ * ************************************/
-static void vl_api_hicn_api_udp_tunnel_add_del_t_handler
-(vl_api_hicn_api_udp_tunnel_add_del_t * mp)
+static void
+vl_api_hicn_api_udp_tunnel_add_del_t_handler (
+ vl_api_hicn_api_udp_tunnel_add_del_t *mp)
{
vl_api_hicn_api_udp_tunnel_add_del_reply_t *rmp;
int rv = HICN_ERROR_NONE;
@@ -637,35 +605,29 @@ static void vl_api_hicn_api_udp_tunnel_add_del_t_handler
goto done;
}
- src_port = clib_net_to_host_u16(mp->src_port);
- dst_port = clib_net_to_host_u16(mp->dst_port);
+ src_port = clib_net_to_host_u16 (mp->src_port);
+ dst_port = clib_net_to_host_u16 (mp->dst_port);
- fib_protocol_t proto = ip46_address_is_ip4(&src_addr) ? FIB_PROTOCOL_IP4 : FIB_PROTOCOL_IP6;
+ fib_protocol_t proto =
+ ip46_address_is_ip4 (&src_addr) ? FIB_PROTOCOL_IP4 : FIB_PROTOCOL_IP6;
index_t fib_index = fib_table_find (proto, HICN_FIB_TABLE);
if (mp->is_add)
{
- uei = udp_tunnel_add(proto,
- fib_index, &src_addr, &dst_addr, src_port, dst_port,
- UDP_ENCAP_FIXUP_NONE);
+ uei = udp_tunnel_add (proto, fib_index, &src_addr, &dst_addr, src_port,
+ dst_port, UDP_ENCAP_FIXUP_NONE);
}
else
{
- udp_tunnel_del(proto,
- fib_index, &src_addr, &dst_addr, src_port, dst_port,
- UDP_ENCAP_FIXUP_NONE);
+ udp_tunnel_del (proto, fib_index, &src_addr, &dst_addr, src_port,
+ dst_port, UDP_ENCAP_FIXUP_NONE);
}
+done:
- done:
-
- /* *INDENT-OFF* */
- REPLY_MACRO2 (VL_API_HICN_API_UDP_TUNNEL_ADD_DEL_REPLY, (
- {
- rmp->uei = clib_host_to_net_u32(uei);
- }));
- /* *INDENT-ON* */
+ REPLY_MACRO2 (VL_API_HICN_API_UDP_TUNNEL_ADD_DEL_REPLY,
+ ({ rmp->uei = clib_host_to_net_u32 (uei); }));
}
/************************************************************************************/
@@ -674,7 +636,7 @@ static void vl_api_hicn_api_udp_tunnel_add_del_t_handler
/* Set up the API message handling tables */
clib_error_t *
-hicn_api_plugin_hookup (vlib_main_t * vm)
+hicn_api_plugin_hookup (vlib_main_t *vm)
{
hicn_main_t *hm = &hicn_main;
@@ -682,8 +644,6 @@ hicn_api_plugin_hookup (vlib_main_t * vm)
return 0;
}
-
-
/******************* SUPPORTING FUNCTIONS *******************/
/*
@@ -691,9 +651,8 @@ hicn_api_plugin_hookup (vlib_main_t * vm)
* assuming only ip faces here. To be completed with othet types of faces
*/
vnet_api_error_t
-hicn_face_api_entry_params_serialize (hicn_face_id_t faceid,
- vl_api_hicn_api_face_params_get_reply_t
- * reply)
+hicn_face_api_entry_params_serialize (
+ hicn_face_id_t faceid, vl_api_hicn_api_face_params_get_reply_t *reply)
{
int rv = HICN_ERROR_NONE;
@@ -706,8 +665,7 @@ hicn_face_api_entry_params_serialize (hicn_face_id_t faceid,
if (face != NULL)
{
- ip_address_encode (&face->nat_addr, IP46_TYPE_ANY,
- &reply->nat_addr);
+ ip_address_encode (&face->nat_addr, IP46_TYPE_ANY, &reply->nat_addr);
reply->swif = clib_host_to_net_u32 (face->sw_if);
reply->flags = clib_host_to_net_u32 (face->flags);
diff --git a/hicn-plugin/src/interest_hitcs_node.c b/hicn-plugin/src/interest_hitcs_node.c
index f569fa897..c2240513c 100644
--- a/hicn-plugin/src/interest_hitcs_node.c
+++ b/hicn-plugin/src/interest_hitcs_node.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017-2020 Cisco and/or its affiliates.
+ * Copyright (c) 2017-2021 Cisco and/or its affiliates.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
@@ -25,8 +25,7 @@
#include "error.h"
/* packet trace format function */
-static u8 *hicn_interest_hitcs_format_trace (u8 * s, va_list * args);
-
+static u8 *hicn_interest_hitcs_format_trace (u8 *s, va_list *args);
/* Stats string values */
static char *hicn_interest_hitcs_error_strings[] = {
@@ -37,10 +36,10 @@ static char *hicn_interest_hitcs_error_strings[] = {
vlib_node_registration_t hicn_interest_hitcs_node;
-always_inline void drop_packet (u32 * next0);
+always_inline void drop_packet (u32 *next0);
always_inline void
-clone_from_cs (vlib_main_t * vm, u32 * bi0_cs, vlib_buffer_t * dest, u8 isv6)
+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);
@@ -80,8 +79,8 @@ clone_from_cs (vlib_main_t * vm, u32 * bi0_cs, vlib_buffer_t * dest, u8 isv6)
}
static uword
-hicn_interest_hitcs_node_fn (vlib_main_t * vm, vlib_node_runtime_t * node,
- vlib_frame_t * frame)
+hicn_interest_hitcs_node_fn (vlib_main_t *vm, vlib_node_runtime_t *node,
+ vlib_frame_t *frame)
{
u32 n_left_from, *from, *to_next;
hicn_interest_hitcs_next_t next_index;
@@ -152,12 +151,14 @@ hicn_interest_hitcs_node_fn (vlib_main_t * vm, vlib_node_runtime_t * node,
nameptr = (u8 *) (&name);
pitp = hicn_pit_get_data (node0);
- dpo_id_t hicn_dpo_id0 =
- { dpo_vft0->hicn_dpo_get_type (), 0, 0, dpo_ctx_id0 };
+ dpo_id_t hicn_dpo_id0 = { .dpoi_type =
+ dpo_vft0->hicn_dpo_get_type (),
+ .dpoi_proto = 0,
+ .dpoi_next_node = 0,
+ .dpoi_index = dpo_ctx_id0 };
- if (PREDICT_FALSE
- (ret != HICN_ERROR_NONE ||
- !hicn_node_compare (nameptr, namelen, node0)))
+ if (PREDICT_FALSE (ret != HICN_ERROR_NONE ||
+ !hicn_node_compare (nameptr, namelen, node0)))
{
/* Remove lock from the entry */
hicn_pcs_remove_lock (rt->pitcs, &pitp, &node0, vm, hash_entry0,
@@ -176,8 +177,8 @@ hicn_interest_hitcs_node_fn (vlib_main_t * vm, vlib_node_runtime_t * node,
}
else
{
- if (PREDICT_TRUE
- (!(hash_entry0->he_flags & HICN_HASH_ENTRY_FLAG_DELETED)))
+ if (PREDICT_TRUE (
+ !(hash_entry0->he_flags & HICN_HASH_ENTRY_FLAG_DELETED)))
hicn_pcs_cs_update (vm, rt->pitcs, pitp, pitp, node0);
/*
@@ -185,8 +186,8 @@ hicn_interest_hitcs_node_fn (vlib_main_t * vm, vlib_node_runtime_t * node,
* the data through it
*/
next0 = isv6 ? HICN_INTEREST_HITCS_NEXT_IFACE6_OUT :
- HICN_INTEREST_HITCS_NEXT_IFACE4_OUT;
- vnet_buffer (b0)->ip.adj_index[VLIB_TX] = hicnb0->face_id;
+ HICN_INTEREST_HITCS_NEXT_IFACE4_OUT;
+ vnet_buffer (b0)->ip.adj_index[VLIB_TX] = hicnb0->face_id;
clone_from_cs (vm, &pitp->u.cs.cs_pkt_buf, b0, isv6);
@@ -216,9 +217,8 @@ hicn_interest_hitcs_node_fn (vlib_main_t * vm, vlib_node_runtime_t * node,
* Verify speculative enqueue, maybe switch current
* next frame
*/
- vlib_validate_buffer_enqueue_x1 (vm, node, next_index,
- to_next, n_left_to_next,
- bi0, next0);
+ vlib_validate_buffer_enqueue_x1 (vm, node, next_index, to_next,
+ n_left_to_next, bi0, next0);
}
vlib_put_next_frame (vm, node, next_index, n_left_to_next);
}
@@ -239,14 +239,14 @@ hicn_interest_hitcs_node_fn (vlib_main_t * vm, vlib_node_runtime_t * node,
}
always_inline void
-drop_packet (u32 * next0)
+drop_packet (u32 *next0)
{
*next0 = HICN_INTEREST_HITCS_NEXT_ERROR_DROP;
}
/* packet trace format function */
static u8 *
-hicn_interest_hitcs_format_trace (u8 * s, va_list * args)
+hicn_interest_hitcs_format_trace (u8 *s, va_list *args)
{
CLIB_UNUSED (vlib_main_t * vm) = va_arg (*args, vlib_main_t *);
CLIB_UNUSED (vlib_node_t * node) = va_arg (*args, vlib_node_t *);
@@ -261,28 +261,22 @@ hicn_interest_hitcs_format_trace (u8 * s, va_list * args)
/*
* Node registration for the interest forwarder node
*/
-/* *INDENT-OFF* */
-VLIB_REGISTER_NODE(hicn_interest_hitcs_node) =
-{
+VLIB_REGISTER_NODE (hicn_interest_hitcs_node) = {
.function = hicn_interest_hitcs_node_fn,
.name = "hicn-interest-hitcs",
- .vector_size = sizeof(u32),
- .runtime_data_bytes = sizeof(hicn_interest_hitcs_runtime_t),
+ .vector_size = sizeof (u32),
+ .runtime_data_bytes = sizeof (hicn_interest_hitcs_runtime_t),
.format_trace = hicn_interest_hitcs_format_trace,
.type = VLIB_NODE_TYPE_INTERNAL,
- .n_errors = ARRAY_LEN(hicn_interest_hitcs_error_strings),
+ .n_errors = ARRAY_LEN (hicn_interest_hitcs_error_strings),
.error_strings = hicn_interest_hitcs_error_strings,
.n_next_nodes = HICN_INTEREST_HITCS_N_NEXT,
/* edit / add dispositions here */
- .next_nodes =
- {
- [HICN_INTEREST_HITCS_NEXT_STRATEGY] = "hicn-strategy",
- [HICN_INTEREST_HITCS_NEXT_IFACE4_OUT] = "hicn4-iface-output",
- [HICN_INTEREST_HITCS_NEXT_IFACE6_OUT] = "hicn6-iface-output",
- [HICN_INTEREST_HITCS_NEXT_ERROR_DROP] = "error-drop"
- },
+ .next_nodes = { [HICN_INTEREST_HITCS_NEXT_STRATEGY] = "hicn-strategy",
+ [HICN_INTEREST_HITCS_NEXT_IFACE4_OUT] = "hicn4-iface-output",
+ [HICN_INTEREST_HITCS_NEXT_IFACE6_OUT] = "hicn6-iface-output",
+ [HICN_INTEREST_HITCS_NEXT_ERROR_DROP] = "error-drop" },
};
-/* *INDENT-ON* */
/*
* fd.io coding-style-patch-verification: ON
diff --git a/hicn-plugin/src/interest_hitpit_node.c b/hicn-plugin/src/interest_hitpit_node.c
index 9ebf183c5..5367c71f8 100644
--- a/hicn-plugin/src/interest_hitpit_node.c
+++ b/hicn-plugin/src/interest_hitpit_node.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017-2020 Cisco and/or its affiliates.
+ * Copyright (c) 2017-2021 Cisco and/or its affiliates.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
@@ -28,7 +28,7 @@
#include "face_db.h"
/* packet trace format function */
-static u8 *hicn_interest_hitpit_format_trace (u8 * s, va_list * args);
+static u8 *hicn_interest_hitpit_format_trace (u8 *s, va_list *args);
/* Stats string values */
static char *hicn_interest_hitpit_error_strings[] = {
@@ -39,14 +39,14 @@ static char *hicn_interest_hitpit_error_strings[] = {
vlib_node_registration_t hicn_interest_hitpit_node;
-always_inline void drop_packet (u32 * next0);
+always_inline void drop_packet (u32 *next0);
/*
* hICN forwarder node for interests hitting the PIT
*/
static uword
-hicn_interest_hitpit_node_fn (vlib_main_t * vm, vlib_node_runtime_t * node,
- vlib_frame_t * frame)
+hicn_interest_hitpit_node_fn (vlib_main_t *vm, vlib_node_runtime_t *node,
+ vlib_frame_t *frame)
{
u32 n_left_from, *from, *to_next;
hicn_interest_hitpit_next_t next_index;
@@ -117,20 +117,21 @@ hicn_interest_hitpit_node_fn (vlib_main_t * vm, vlib_node_runtime_t * node,
hicn_get_internal_state (hicnb0, rt->pitcs, &node0, &strategy_vft0,
&dpo_vft0, &dpo_ctx_id0, &hash_entry0);
-
ret = hicn_interest_parse_pkt (b0, &name, &namelen, &hicn0, &isv6);
nameptr = (u8 *) (&name);
pitp = hicn_pit_get_data (node0);
- dpo_id_t hicn_dpo_id0 =
- { dpo_vft0->hicn_dpo_get_type (), 0, 0, dpo_ctx_id0 };
+ dpo_id_t hicn_dpo_id0 = { .dpoi_type =
+ dpo_vft0->hicn_dpo_get_type (),
+ .dpoi_proto = 0,
+ .dpoi_next_node = 0,
+ .dpoi_index = dpo_ctx_id0 };
/*
* Check if the hit is instead a collision in the
* hash table. Unlikely to happen.
*/
- if (PREDICT_FALSE
- (ret != HICN_ERROR_NONE
- || !hicn_node_compare (nameptr, namelen, node0)))
+ if (PREDICT_FALSE (ret != HICN_ERROR_NONE ||
+ !hicn_node_compare (nameptr, namelen, node0)))
{
stats.interests_hash_collision++;
/* Remove lock from the entry */
@@ -166,8 +167,7 @@ hicn_interest_hitpit_node_fn (vlib_main_t * vm, vlib_node_runtime_t * node,
*/
found =
- hicn_face_search (hicnb0->face_id,
- &(pitp->u.pit.faces));
+ hicn_face_search (hicnb0->face_id, &(pitp->u.pit.faces));
if (found)
{
@@ -179,9 +179,8 @@ hicn_interest_hitpit_node_fn (vlib_main_t * vm, vlib_node_runtime_t * node,
* forwarding
*/
next0 = isv6 ? HICN_INTEREST_HITPIT_NEXT_FACE6_OUTPUT :
- HICN_INTEREST_HITPIT_NEXT_FACE4_OUTPUT;
- vnet_buffer (b0)->ip.adj_index[VLIB_TX] =
- outface;
+ HICN_INTEREST_HITPIT_NEXT_FACE4_OUTPUT;
+ vnet_buffer (b0)->ip.adj_index[VLIB_TX] = outface;
/*
* Update the egress face in
@@ -193,7 +192,7 @@ hicn_interest_hitpit_node_fn (vlib_main_t * vm, vlib_node_runtime_t * node,
else
{
hicn_face_db_add_face (hicnb0->face_id,
- &pitp->u.pit.faces);
+ &pitp->u.pit.faces);
/* Aggregation */
drop_packet (&next0);
@@ -202,7 +201,6 @@ hicn_interest_hitpit_node_fn (vlib_main_t * vm, vlib_node_runtime_t * node,
/* Remove lock from the entry */
hicn_pcs_remove_lock (rt->pitcs, &pitp, &node0, vm,
hash_entry0, dpo_vft0, &hicn_dpo_id0);
-
}
}
end_processing:
@@ -224,15 +222,13 @@ hicn_interest_hitpit_node_fn (vlib_main_t * vm, vlib_node_runtime_t * node,
* Verify speculative enqueue, maybe switch current
* next frame
*/
- vlib_validate_buffer_enqueue_x1 (vm, node, next_index,
- to_next, n_left_to_next,
- bi0, next0);
+ vlib_validate_buffer_enqueue_x1 (vm, node, next_index, to_next,
+ n_left_to_next, bi0, next0);
}
vlib_put_next_frame (vm, node, next_index, n_left_to_next);
}
u32 pit_int_count = hicn_pit_get_int_count (rt->pitcs);
-
vlib_node_increment_counter (vm, hicn_interest_hitpit_node.index,
HICNFWD_ERROR_PROCESSED, stats.pkts_processed);
vlib_node_increment_counter (vm, hicn_interest_hitpit_node.index,
@@ -256,7 +252,7 @@ hicn_interest_hitpit_node_fn (vlib_main_t * vm, vlib_node_runtime_t * node,
/* packet trace format function */
static u8 *
-hicn_interest_hitpit_format_trace (u8 * s, va_list * args)
+hicn_interest_hitpit_format_trace (u8 *s, va_list *args)
{
CLIB_UNUSED (vlib_main_t * vm) = va_arg (*args, vlib_main_t *);
CLIB_UNUSED (vlib_node_t * node) = va_arg (*args, vlib_node_t *);
@@ -269,7 +265,7 @@ hicn_interest_hitpit_format_trace (u8 * s, va_list * args)
}
void
-drop_packet (u32 * next0)
+drop_packet (u32 *next0)
{
*next0 = HICN_INTEREST_HITPIT_NEXT_ERROR_DROP;
}
@@ -277,7 +273,6 @@ drop_packet (u32 * next0)
/*
* Node registration for the interest forwarder node
*/
-/* *INDENT-OFF* */
VLIB_REGISTER_NODE(hicn_interest_hitpit_node) =
{
.function = hicn_interest_hitpit_node_fn,
@@ -299,7 +294,6 @@ VLIB_REGISTER_NODE(hicn_interest_hitpit_node) =
[HICN_INTEREST_HITPIT_NEXT_ERROR_DROP] = "error-drop",
},
};
-/* *INDENT-ON* */
/*
* fd.io coding-style-patch-verification: ON
diff --git a/hicn-plugin/src/mapme_eventmgr.c b/hicn-plugin/src/mapme_eventmgr.c
index d8b7562f8..69740ba0a 100644
--- a/hicn-plugin/src/mapme_eventmgr.c
+++ b/hicn-plugin/src/mapme_eventmgr.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017-2020 Cisco and/or its affiliates.
+ * Copyright (c) 2017-2021 Cisco and/or its affiliates.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
@@ -22,7 +22,7 @@
#include <vnet/fib/ip4_fib.h>
#include <vnet/fib/ip6_fib.h>
-#define DEFAULT_TIMEOUT 1.0 /* s */
+#define DEFAULT_TIMEOUT 1.0 /* s */
hicn_mapme_main_t mapme_main;
@@ -30,7 +30,7 @@ hicn_prefix_t *retx_pool;
uword *retx_hash;
void
-hicn_mapme_init (vlib_main_t * vm)
+hicn_mapme_init (vlib_main_t *vm)
{
mapme_main.vm = vm;
mapme_main.log_class = vlib_log_register_class ("hicn_mapme", 0);
@@ -71,8 +71,8 @@ ip6_fib_table_show_walk (fib_node_index_t fib_entry_index, void *arg)
}
void
-hicn_mapme_process_fib_entry (vlib_main_t * vm, hicn_face_id_t face,
- const fib_node_index_t * fib_entry_index)
+hicn_mapme_process_fib_entry (vlib_main_t *vm, hicn_face_id_t face,
+ const fib_node_index_t *fib_entry_index)
{
const dpo_id_t *load_balance_dpo_id;
load_balance_t *lb;
@@ -103,42 +103,40 @@ hicn_mapme_process_fib_entry (vlib_main_t * vm, hicn_face_id_t face,
}
void
-hicn_mapme_process_ip4_fib (vlib_main_t * vm, hicn_face_id_t face)
+hicn_mapme_process_ip4_fib (vlib_main_t *vm, hicn_face_id_t face)
{
ip4_main_t *im4 = &ip4_main;
fib_table_t *fib_table;
int table_id = -1, fib_index = ~0;
- /* *INDENT-OFF* */
- pool_foreach (fib_table, im4->fibs,
- ({
- ip4_fib_t *fib = pool_elt_at_index(im4->v4_fibs, fib_table->ft_index);
+ pool_foreach (fib_table, im4->fibs)
+ {
+ ip4_fib_t *fib = pool_elt_at_index (im4->v4_fibs, fib_table->ft_index);
- if (table_id >= 0 && table_id != (int)fib->table_id)
- continue;
- if (fib_index != ~0 && fib_index != (int)fib->index)
- continue;
+ if (table_id >= 0 && table_id != (int) fib->table_id)
+ continue;
+ if (fib_index != ~0 && fib_index != (int) fib->index)
+ continue;
- fib_node_index_t *fib_entry_index;
- ip4_fib_show_walk_ctx_t ctx = {
- .ifsw_indicies = NULL,
- };
+ fib_node_index_t *fib_entry_index;
+ ip4_fib_show_walk_ctx_t ctx = {
+ .ifsw_indicies = NULL,
+ };
- ip4_fib_table_walk(fib, ip4_fib_show_walk_cb, &ctx);
- //vec_sort_with_function(ctx.ifsw_indicies, fib_entry_cmp_for_sort);
+ ip4_fib_table_walk (fib, ip4_fib_show_walk_cb, &ctx);
+ // vec_sort_with_function(ctx.ifsw_indicies, fib_entry_cmp_for_sort);
- vec_foreach(fib_entry_index, ctx.ifsw_indicies)
- {
- hicn_mapme_process_fib_entry(vm, face, fib_entry_index);
- }
+ vec_foreach (fib_entry_index, ctx.ifsw_indicies)
+ {
+ hicn_mapme_process_fib_entry (vm, face, fib_entry_index);
+ }
- vec_free(ctx.ifsw_indicies);
- }));
- /* *INDENT-ON* */
+ vec_free (ctx.ifsw_indicies);
+ }
}
void
-hicn_mapme_process_ip6_fib (vlib_main_t * vm, hicn_face_id_t face)
+hicn_mapme_process_ip6_fib (vlib_main_t *vm, hicn_face_id_t face)
{
/* Walk IPv6 FIB */
ip6_main_t *im6 = &ip6_main;
@@ -146,43 +144,39 @@ hicn_mapme_process_ip6_fib (vlib_main_t * vm, hicn_face_id_t face)
ip6_fib_t *fib;
int table_id = -1, fib_index = ~0;
- /* *INDENT-OFF* */
- pool_foreach (fib_table, im6->fibs,
- ({
- fib = pool_elt_at_index(im6->v6_fibs, fib_table->ft_index);
-
- if (table_id >= 0 && table_id != (int)fib->table_id)
- continue;
- if (fib_index != ~0 && fib_index != (int)fib->index)
- continue;
- if (fib_table->ft_flags & FIB_TABLE_FLAG_IP6_LL)
- continue;
+ pool_foreach (fib_table, im6->fibs)
+ {
+ fib = pool_elt_at_index (im6->v6_fibs, fib_table->ft_index);
- fib_node_index_t *fib_entry_index;
- ip6_fib_show_ctx_t ctx = {
- .entries = NULL,
- };
+ if (table_id >= 0 && table_id != (int) fib->table_id)
+ continue;
+ if (fib_index != ~0 && fib_index != (int) fib->index)
+ continue;
+ if (fib_table->ft_flags & FIB_TABLE_FLAG_IP6_LL)
+ continue;
- ip6_fib_table_walk(fib->index, ip6_fib_table_show_walk, &ctx);
- //vec_sort_with_function(ctx.entries, fib_entry_cmp_for_sort);
+ fib_node_index_t *fib_entry_index;
+ ip6_fib_show_ctx_t ctx = {
+ .entries = NULL,
+ };
- vec_foreach(fib_entry_index, ctx.entries)
- {
- hicn_mapme_process_fib_entry(vm, face, fib_entry_index);
- }
+ ip6_fib_table_walk (fib->index, ip6_fib_table_show_walk, &ctx);
+ // vec_sort_with_function(ctx.entries, fib_entry_cmp_for_sort);
- vec_free(ctx.entries);
+ vec_foreach (fib_entry_index, ctx.entries)
+ {
+ hicn_mapme_process_fib_entry (vm, face, fib_entry_index);
+ }
- }));
- /* *INDENT-ON* */
+ vec_free (ctx.entries);
+ }
}
-
/**
* Callback called everytime a new face is created (not including app faces)
*/
void
-hicn_mapme_on_face_added (vlib_main_t * vm, hicn_face_id_t face)
+hicn_mapme_on_face_added (vlib_main_t *vm, hicn_face_id_t face)
{
hicn_mapme_process_ip4_fib (vm, face);
hicn_mapme_process_ip6_fib (vm, face);
@@ -194,19 +188,19 @@ hicn_mapme_on_face_added (vlib_main_t * vm, hicn_face_id_t face)
* it.
*/
#define NUM_RETX_ENTRIES 100
-#define NUM_RETX_SLOT 2
-#define NEXT_SLOT(cur) (1-cur)
-#define CUR retx_array[cur]
-#define NXT retx_array[NEXT_SLOT(cur)]
-#define CURLEN retx_len[cur]
-#define NXTLEN retx_len[NEXT_SLOT(cur)]
+#define NUM_RETX_SLOT 2
+#define NEXT_SLOT(cur) (1 - cur)
+#define CUR retx_array[cur]
+#define NXT retx_array[NEXT_SLOT (cur)]
+#define CURLEN retx_len[cur]
+#define NXTLEN retx_len[NEXT_SLOT (cur)]
static_always_inline void *
-get_packet_buffer (vlib_main_t * vm, u32 node_index, u32 dpoi_index,
- ip46_address_t * addr, hicn_type_t type)
+get_packet_buffer (vlib_main_t *vm, u32 node_index, u32 dpoi_index,
+ ip46_address_t *addr, hicn_type_t type)
{
vlib_frame_t *f;
- vlib_buffer_t *b; // for newly created packet
+ vlib_buffer_t *b; // for newly created packet
u32 *to_next;
u32 bi;
u8 *buffer;
@@ -241,8 +235,8 @@ get_packet_buffer (vlib_main_t * vm, u32 node_index, u32 dpoi_index,
}
static_always_inline bool
-hicn_mapme_send_message (vlib_main_t * vm, const hicn_prefix_t * prefix,
- mapme_params_t * params, hicn_face_id_t face)
+hicn_mapme_send_message (vlib_main_t *vm, const hicn_prefix_t *prefix,
+ mapme_params_t *params, hicn_face_id_t face)
{
size_t n;
@@ -253,19 +247,17 @@ hicn_mapme_send_message (vlib_main_t * vm, const hicn_prefix_t * prefix,
char *node_name = hicn_mapme_get_dpo_face_node (face);
if (!node_name)
{
- clib_warning
- ("Could not determine next node for sending MAP-Me packet");
+ clib_warning ("Could not determine next node for sending MAP-Me packet");
return false;
}
vlib_node_t *node = vlib_get_node_by_name (vm, (u8 *) node_name);
u32 node_index = node->index;
- u8 *buffer = get_packet_buffer (vm, node_index, face,
- (ip46_address_t *) prefix,
- (params->protocol ==
- IPPROTO_IPV6) ? HICN_TYPE_IPV6_ICMP :
- HICN_TYPE_IPV4_ICMP);
+ u8 *buffer = get_packet_buffer (
+ vm, node_index, face, (ip46_address_t *) prefix,
+ (params->protocol == IPPROTO_IPV6) ? HICN_TYPE_IPV6_ICMP :
+ HICN_TYPE_IPV4_ICMP);
n = hicn_mapme_create_packet (buffer, prefix, params);
if (n <= 0)
{
@@ -277,8 +269,8 @@ hicn_mapme_send_message (vlib_main_t * vm, const hicn_prefix_t * prefix,
}
static_always_inline void
-hicn_mapme_send_updates (vlib_main_t * vm, hicn_prefix_t * prefix,
- dpo_id_t dpo, bool send_all)
+hicn_mapme_send_updates (vlib_main_t *vm, hicn_prefix_t *prefix, dpo_id_t dpo,
+ bool send_all)
{
hicn_mapme_tfib_t *tfib = TFIB (hicn_strategy_dpo_ctx_get (dpo.dpoi_index));
if (!tfib)
@@ -290,19 +282,17 @@ hicn_mapme_send_updates (vlib_main_t * vm, hicn_prefix_t * prefix,
u8 tfib_last_idx = HICN_PARAM_FIB_ENTRY_NHOPS_MAX - tfib->tfib_entry_count;
mapme_params_t params = {
- .protocol = ip46_address_is_ip4 (&prefix->name)
- ? IPPROTO_IP : IPPROTO_IPV6,
+ .protocol =
+ ip46_address_is_ip4 (&prefix->name) ? IPPROTO_IP : IPPROTO_IPV6,
.type = UPDATE,
.seq = tfib->seq,
};
if (send_all)
{
- for (u8 pos = tfib_last_idx; pos < HICN_PARAM_FIB_ENTRY_NHOPS_MAX;
- pos++)
+ for (u8 pos = tfib_last_idx; pos < HICN_PARAM_FIB_ENTRY_NHOPS_MAX; pos++)
{
- hicn_mapme_send_message (vm, prefix, &params,
- tfib->next_hops[pos]);
+ hicn_mapme_send_message (vm, prefix, &params, tfib->next_hops[pos]);
}
}
else
@@ -313,17 +303,17 @@ hicn_mapme_send_updates (vlib_main_t * vm, hicn_prefix_t * prefix,
}
static uword
-hicn_mapme_eventmgr_process (vlib_main_t * vm,
- vlib_node_runtime_t * rt, vlib_frame_t * f)
+hicn_mapme_eventmgr_process (vlib_main_t *vm, vlib_node_runtime_t *rt,
+ vlib_frame_t *f)
{
- f64 timeout = 0; /* By default, no timer is run */
+ f64 timeout = 0; /* By default, no timer is run */
f64 current_time, due_time;
u8 idle = 0;
retx_t retx_array[NUM_RETX_SLOT][NUM_RETX_ENTRIES];
memset (retx_array, 0, NUM_RETX_SLOT * NUM_RETX_ENTRIES);
u8 retx_len[NUM_RETX_SLOT] = { 0 };
- u8 cur = 0; /* current slot */
+ u8 cur = 0; /* current slot */
hicn_mapme_init (vm);
@@ -333,8 +323,8 @@ hicn_mapme_eventmgr_process (vlib_main_t * vm,
* instead of get_event, and we thus need to reimplement timeout
* management on top, as done elsewhere in VPP code.
*
- * The most probable event. For simplicity, for new faces, we pass the same retx_t with no
- * prefix
+ * The most probable event. For simplicity, for new faces, we pass the
+ * same retx_t with no prefix
*/
if (timeout != 0)
{
@@ -346,9 +336,8 @@ hicn_mapme_eventmgr_process (vlib_main_t * vm,
* management with no error correction accounting for elapsed time.
* Also, we only run a timer when there are pending retransmissions.
*/
- timeout =
- (due_time >
- current_time) ? due_time - current_time : DEFAULT_TIMEOUT;
+ timeout = (due_time > current_time) ? due_time - current_time :
+ DEFAULT_TIMEOUT;
due_time = current_time + timeout;
}
else
@@ -365,7 +354,8 @@ hicn_mapme_eventmgr_process (vlib_main_t * vm,
{
/*
* A face has been added:
- * - In case of a local app face, we need to advertise a new prefix
+ * - In case of a local app face, we need to advertise a new
+ * prefix
* - For another local face type, we need to advertise local
* prefixes and schedule retransmissions
*/
@@ -387,8 +377,8 @@ hicn_mapme_eventmgr_process (vlib_main_t * vm,
/*
* An hICN FIB entry has been modified. All operations so far
* have been procedded in the nodes. Here we need to track
- * retransmissions upon timeout: we mark the FIB entry as pending in
- * the second-to-next slot
+ * retransmissions upon timeout: we mark the FIB entry as pending
+ * in the second-to-next slot
*/
/* Mark FIB entry as pending for second-to-next slot */
@@ -413,7 +403,7 @@ hicn_mapme_eventmgr_process (vlib_main_t * vm,
* Since we retransmit to all prev hops, we can remove this
* (T)FIB entry for the check at the end of the current slot.
*/
- retx_t *retx = (retx_t *) & retx_events[i];
+ retx_t *retx = (retx_t *) &retx_events[i];
retx->rtx_count = 0;
/*
@@ -422,11 +412,12 @@ hicn_mapme_eventmgr_process (vlib_main_t * vm,
*/
hicn_mapme_send_updates (vm, &retx->prefix, retx->dpo, true);
- /* Delete entry_id from retransmissions in the current slot (if present) ... */
+ /* Delete entry_id from retransmissions in the current slot (if
+ * present) ... */
for (u8 j = 0; j < CURLEN; j++)
if (!dpo_cmp (&(CUR[j].dpo), &retx->dpo))
{
- CUR[j].dpo.dpoi_index = ~0; /* sufficient */
+ CUR[j].dpo.dpoi_index = ~0; /* sufficient */
}
/* ... and schedule it for next slot (if not already) */
@@ -434,7 +425,7 @@ hicn_mapme_eventmgr_process (vlib_main_t * vm,
for (j = 0; j < NXTLEN; j++)
if (!dpo_cmp (&NXT[j].dpo, &retx->dpo))
break;
- if (j == NXTLEN) /* not found */
+ if (j == NXTLEN) /* not found */
NXT[NXTLEN++] = *retx;
}
idle = 0;
@@ -447,9 +438,9 @@ hicn_mapme_eventmgr_process (vlib_main_t * vm,
* to the list of next hops, and eventually remove it from TFIB.
* This corresponds to the multipath case.
*
- * In all cases, we assume the propagation was already done when the first
- * interest with the same sequence number was received, so we stop here
- * No change in TFIB = no IU to send
+ * In all cases, we assume the propagation was already done when the
+ * first interest with the same sequence number was received, so we
+ * stop here No change in TFIB = no IU to send
*
* No change in timers.
*/
@@ -495,7 +486,7 @@ hicn_mapme_eventmgr_process (vlib_main_t * vm,
{
retx_t *retx = &CUR[pos];
- if (retx->dpo.dpoi_index == ~0) /* deleted entry */
+ if (retx->dpo.dpoi_index == ~0) /* deleted entry */
continue;
hicn_mapme_tfib_t *tfib =
@@ -510,12 +501,14 @@ hicn_mapme_eventmgr_process (vlib_main_t * vm,
hicn_mapme_send_updates (vm, &retx->prefix, retx->dpo, true);
retx->rtx_count++;
- // If we exceed the numver of retransmittion it means that all tfib entries have seens at least HICN_PARAM_RTX_MAX of retransmission
+ // If we exceed the numver of retransmittion it means that all
+ // tfib entries have seens at least HICN_PARAM_RTX_MAX of
+ // retransmission
if (retx->rtx_count < HICN_PARAM_RTX_MAX)
{
/*
- * We did some retransmissions, so let's reschedule a check in the
- * next slot
+ * We did some retransmissions, so let's reschedule a check
+ * in the next slot
*/
NXT[NXTLEN++] = CUR[pos];
idle = 0;
@@ -541,7 +534,6 @@ hicn_mapme_eventmgr_process (vlib_main_t * vm,
timeout = (idle > 1) ? 0 : DEFAULT_TIMEOUT;
// if (vlib_process_suspend_time_is_zero (timeout)) { ... }
-
}
/* NOTREACHED */
@@ -549,14 +541,13 @@ hicn_mapme_eventmgr_process (vlib_main_t * vm,
}
/* Not static as we need to access it from hicn_face */
-/* *INDENT-OFF* */
-VLIB_REGISTER_NODE (hicn_mapme_eventmgr_process_node) = { //,static) = {
- .function = hicn_mapme_eventmgr_process,
- .type = VLIB_NODE_TYPE_PROCESS,
- .name = "mapme-eventmgr-process",
- .process_log2_n_stack_bytes = 16,
+VLIB_REGISTER_NODE (hicn_mapme_eventmgr_process_node) = {
+ //,static) = {
+ .function = hicn_mapme_eventmgr_process,
+ .type = VLIB_NODE_TYPE_PROCESS,
+ .name = "mapme-eventmgr-process",
+ .process_log2_n_stack_bytes = 16,
};
-/* *INDENT-ON* */
/*
* fd.io coding-style-patch-verification: ON
diff --git a/hicn-plugin/src/pcs.h b/hicn-plugin/src/pcs.h
index a9e1ae5a0..083efa901 100644
--- a/hicn-plugin/src/pcs.h
+++ b/hicn-plugin/src/pcs.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017-2020 Cisco and/or its affiliates.
+ * Copyright (c) 2017-2021 Cisco and/or its affiliates.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
@@ -36,21 +36,22 @@
/* The PIT and CS are stored as a union */
#define HICN_PIT_NULL_TYPE 0
-#define HICN_PIT_TYPE 1
-#define HICN_CS_TYPE 2
+#define HICN_PIT_TYPE 1
+#define HICN_CS_TYPE 2
/*
* Definitions and Forward refs for the time counters we're trying out.
* Counters are maintained by the background process. TODO.
*/
-#define SEC_MS 1000
+#define SEC_MS 1000
#define HICN_INFRA_FAST_TIMER_SECS 1
#define HICN_INFRA_FAST_TIMER_MSECS (HICN_INFRA_FAST_TIMER_SECS * SEC_MS)
#define HICN_INFRA_SLOW_TIMER_SECS 60
#define HICN_INFRA_SLOW_TIMER_MSECS (HICN_INFRA_SLOW_TIMER_SECS * SEC_MS)
/*
- * Note that changing this may change alignment within the PIT struct, so be careful.
+ * Note that changing this may change alignment within the PIT struct, so be
+ * careful.
*/
typedef struct __attribute__ ((packed)) hicn_pcs_shared_s
{
@@ -117,7 +118,6 @@ typedef struct __attribute__ ((packed)) hicn_cs_entry_s
/* 36B + (64 - 36)B = 64B */
u8 opaque[HICN_CS_ENTRY_OPAQUE_SIZE];
-
} __attribute__ ((packed)) hicn_cs_entry_t;
/*
@@ -137,7 +137,6 @@ typedef struct hicn_pcs_entry_s
} u;
} hicn_pcs_entry_t;
-
/*
* Overall PIT/CS table, based on the common hashtable
*/
@@ -161,90 +160,92 @@ typedef struct hicn_pit_cs_s
} hicn_pit_cs_t;
/* Functions declarations */
-int hicn_pit_create (hicn_pit_cs_t * p, u32 num_elems);
-
-always_inline void
-hicn_pit_to_cs (vlib_main_t * vm, hicn_pit_cs_t * pitcs,
- hicn_pcs_entry_t * pcs_entry, hicn_hash_entry_t * hash_entry,
- hicn_hash_node_t * node, const hicn_dpo_vft_t * dpo_vft,
- dpo_id_t * hicn_dpo_id, hicn_face_id_t inface_id, u8 is_appface);
-
-always_inline void
-hicn_pcs_cs_update (vlib_main_t * vm, hicn_pit_cs_t * pitcs,
- hicn_pcs_entry_t * old_entry, hicn_pcs_entry_t * entry,
- hicn_hash_node_t * node);
-
-always_inline void
-hicn_pcs_cs_delete (vlib_main_t * vm, hicn_pit_cs_t * pitcs,
- hicn_pcs_entry_t ** pcs_entry, hicn_hash_node_t ** node,
- hicn_hash_entry_t * hash_entry,
- const hicn_dpo_vft_t * dpo_vft, dpo_id_t * hicn_dpo_id);
-
-always_inline int
-hicn_pcs_cs_insert (vlib_main_t * vm, hicn_pit_cs_t * pitcs,
- hicn_pcs_entry_t * entry, hicn_hash_node_t * node,
- hicn_hash_entry_t ** hash_entry, u64 hashval,
- u32 * node_id, index_t * dpo_ctx_id, u8 * vft_id,
- u8 * is_cs, u8 * hash_entry_id, u32 * bucket_id,
- u8 * bucket_is_overflow);
+int hicn_pit_create (hicn_pit_cs_t *p, u32 num_elems);
+
+always_inline void hicn_pit_to_cs (vlib_main_t *vm, hicn_pit_cs_t *pitcs,
+ hicn_pcs_entry_t *pcs_entry,
+ hicn_hash_entry_t *hash_entry,
+ hicn_hash_node_t *node,
+ const hicn_dpo_vft_t *dpo_vft,
+ dpo_id_t *hicn_dpo_id,
+ hicn_face_id_t inface_id, u8 is_appface);
+
+always_inline void hicn_pcs_cs_update (vlib_main_t *vm, hicn_pit_cs_t *pitcs,
+ hicn_pcs_entry_t *old_entry,
+ hicn_pcs_entry_t *entry,
+ hicn_hash_node_t *node);
+
+always_inline void hicn_pcs_cs_delete (vlib_main_t *vm, hicn_pit_cs_t *pitcs,
+ hicn_pcs_entry_t **pcs_entry,
+ hicn_hash_node_t **node,
+ hicn_hash_entry_t *hash_entry,
+ const hicn_dpo_vft_t *dpo_vft,
+ dpo_id_t *hicn_dpo_id);
always_inline int
-hicn_pcs_cs_insert_update (vlib_main_t * vm, hicn_pit_cs_t * pitcs,
- hicn_pcs_entry_t * entry, hicn_hash_node_t * node,
- hicn_hash_entry_t ** hash_entry, u64 hashval,
- u32 * node_id, index_t * dpo_ctx_id, u8 * vft_id,
- u8 * is_cs, u8 * hash_entry_id, u32 * bucket_id,
- u8 * bucket_is_overflow, hicn_face_id_t inface);
+hicn_pcs_cs_insert (vlib_main_t *vm, hicn_pit_cs_t *pitcs,
+ hicn_pcs_entry_t *entry, hicn_hash_node_t *node,
+ hicn_hash_entry_t **hash_entry, u64 hashval, u32 *node_id,
+ index_t *dpo_ctx_id, u8 *vft_id, u8 *is_cs,
+ u8 *hash_entry_id, u32 *bucket_id, u8 *bucket_is_overflow);
+
+always_inline int hicn_pcs_cs_insert_update (
+ vlib_main_t *vm, hicn_pit_cs_t *pitcs, hicn_pcs_entry_t *entry,
+ hicn_hash_node_t *node, hicn_hash_entry_t **hash_entry, u64 hashval,
+ u32 *node_id, index_t *dpo_ctx_id, u8 *vft_id, u8 *is_cs, u8 *hash_entry_id,
+ u32 *bucket_id, u8 *bucket_is_overflow, hicn_face_id_t inface);
always_inline int
-hicn_pcs_pit_insert (hicn_pit_cs_t * pitcs, hicn_pcs_entry_t * entry,
- hicn_hash_node_t * node, hicn_hash_entry_t ** hash_entry,
- u64 hashval, u32 * node_id, index_t * dpo_ctx_id,
- u8 * vft_id, u8 * is_cs, u8 * hash_entry_id,
- u32 * bucket_id, u8 * bucket_is_overflow);
+hicn_pcs_pit_insert (hicn_pit_cs_t *pitcs, hicn_pcs_entry_t *entry,
+ hicn_hash_node_t *node, hicn_hash_entry_t **hash_entry,
+ u64 hashval, u32 *node_id, index_t *dpo_ctx_id,
+ u8 *vft_id, u8 *is_cs, u8 *hash_entry_id, u32 *bucket_id,
+ u8 *bucket_is_overflow);
always_inline void
-hicn_pcs_pit_delete (hicn_pit_cs_t * pitcs, hicn_pcs_entry_t ** pcs_entryp,
- hicn_hash_node_t ** node, vlib_main_t * vm,
- hicn_hash_entry_t * hash_entry,
- const hicn_dpo_vft_t * dpo_vft, dpo_id_t * hicn_dpo_id);
-
-always_inline int
-hicn_pcs_insert (vlib_main_t * vm, hicn_pit_cs_t * pitcs,
- hicn_pcs_entry_t * entry, hicn_hash_node_t * node,
- hicn_hash_entry_t ** hash_entry, u64 hashval, u32 * node_id,
- index_t * dpo_ctx_id, u8 * vft_id, u8 * is_cs,
- u8 * hash_entry_id, u32 * bucket_id,
- u8 * bucket_is_overflow);
+hicn_pcs_pit_delete (hicn_pit_cs_t *pitcs, hicn_pcs_entry_t **pcs_entryp,
+ hicn_hash_node_t **node, vlib_main_t *vm,
+ hicn_hash_entry_t *hash_entry,
+ const hicn_dpo_vft_t *dpo_vft, dpo_id_t *hicn_dpo_id);
+
+always_inline int hicn_pcs_insert (vlib_main_t *vm, hicn_pit_cs_t *pitcs,
+ hicn_pcs_entry_t *entry,
+ hicn_hash_node_t *node,
+ hicn_hash_entry_t **hash_entry, u64 hashval,
+ u32 *node_id, index_t *dpo_ctx_id,
+ u8 *vft_id, u8 *is_cs, u8 *hash_entry_id,
+ u32 *bucket_id, u8 *bucket_is_overflow);
+
+always_inline void hicn_pcs_delete (hicn_pit_cs_t *pitcs,
+ hicn_pcs_entry_t **pcs_entryp,
+ hicn_hash_node_t **node, vlib_main_t *vm,
+ hicn_hash_entry_t *hash_entry,
+ const hicn_dpo_vft_t *dpo_vft,
+ dpo_id_t *hicn_dpo_id);
always_inline void
-hicn_pcs_delete (hicn_pit_cs_t * pitcs, hicn_pcs_entry_t ** pcs_entryp,
- hicn_hash_node_t ** node, vlib_main_t * vm,
- hicn_hash_entry_t * hash_entry,
- const hicn_dpo_vft_t * dpo_vft, dpo_id_t * hicn_dpo_id);
+hicn_pcs_remove_lock (hicn_pit_cs_t *pitcs, hicn_pcs_entry_t **pcs_entryp,
+ hicn_hash_node_t **node, vlib_main_t *vm,
+ hicn_hash_entry_t *hash_entry,
+ const hicn_dpo_vft_t *dpo_vft, dpo_id_t *hicn_dpo_id);
-always_inline void
-hicn_pcs_remove_lock (hicn_pit_cs_t * pitcs, hicn_pcs_entry_t ** pcs_entryp,
- hicn_hash_node_t ** node, vlib_main_t * vm,
- hicn_hash_entry_t * hash_entry,
- const hicn_dpo_vft_t * dpo_vft, dpo_id_t * hicn_dpo_id);
-
-always_inline void
-hicn_cs_delete_trimmed (hicn_pit_cs_t * pitcs, hicn_pcs_entry_t ** pcs_entryp,
- hicn_hash_entry_t * hash_entry,
- hicn_hash_node_t ** node, vlib_main_t * vm);
+always_inline void hicn_cs_delete_trimmed (hicn_pit_cs_t *pitcs,
+ hicn_pcs_entry_t **pcs_entryp,
+ hicn_hash_entry_t *hash_entry,
+ hicn_hash_node_t **node,
+ vlib_main_t *vm);
/* Function implementation */
/* Accessor for pit/cs data inside hash table node */
static inline hicn_pcs_entry_t *
-hicn_pit_get_data (hicn_hash_node_t * node)
+hicn_pit_get_data (hicn_hash_node_t *node)
{
return (hicn_pcs_entry_t *) (hicn_hashtb_node_data (node));
}
/* Init pit/cs data block (usually inside hash table node) */
static inline void
-hicn_pit_init_data (hicn_pcs_entry_t * p)
+hicn_pit_init_data (hicn_pcs_entry_t *p)
{
p->shared.entry_flags = 0;
p->u.pit.faces.n_faces = 0;
@@ -257,14 +258,13 @@ hicn_pit_init_data (hicn_pcs_entry_t * p)
/* Init pit/cs data block (usually inside hash table node) */
static inline void
-hicn_cs_init_data (hicn_pcs_entry_t * p)
+hicn_cs_init_data (hicn_pcs_entry_t *p)
{
p->shared.entry_flags = 0;
p->u.pit.faces.n_faces = 0;
p->u.pit.faces.is_overflow = 0;
}
-
static inline f64
hicn_pcs_get_exp_time (f64 cur_time_sec, u64 lifetime_msec)
{
@@ -276,7 +276,7 @@ hicn_pcs_get_exp_time (f64 cur_time_sec, u64 lifetime_msec)
* good choice.
*/
static inline void
-hicn_pit_set_lru_max (hicn_pit_cs_t * p, u32 limit)
+hicn_pit_set_lru_max (hicn_pit_cs_t *p, u32 limit)
{
p->policy_state.max = limit;
}
@@ -285,7 +285,7 @@ hicn_pit_set_lru_max (hicn_pit_cs_t * p, u32 limit)
* Accessor for PIT interest counter.
*/
static inline u32
-hicn_pit_get_int_count (const hicn_pit_cs_t * pitcs)
+hicn_pit_get_int_count (const hicn_pit_cs_t *pitcs)
{
return (pitcs->pcs_pit_count);
}
@@ -294,25 +294,25 @@ hicn_pit_get_int_count (const hicn_pit_cs_t * pitcs)
* Accessor for PIT cs entries counter.
*/
static inline u32
-hicn_pit_get_cs_count (const hicn_pit_cs_t * pitcs)
+hicn_pit_get_cs_count (const hicn_pit_cs_t *pitcs)
{
return (pitcs->pcs_cs_count);
}
static inline u32
-hicn_pcs_get_ntw_count (const hicn_pit_cs_t * pitcs)
+hicn_pcs_get_ntw_count (const hicn_pit_cs_t *pitcs)
{
return (pitcs->policy_state.count);
}
static inline u32
-hicn_pit_get_htb_bucket_count (const hicn_pit_cs_t * pitcs)
+hicn_pit_get_htb_bucket_count (const hicn_pit_cs_t *pitcs)
{
return (pitcs->pcs_table->ht_overflow_buckets_used);
}
static inline int
-hicn_cs_enabled (hicn_pit_cs_t * pit)
+hicn_cs_enabled (hicn_pit_cs_t *pit)
{
switch (HICN_FEATURE_CS)
{
@@ -331,12 +331,10 @@ hicn_cs_enabled (hicn_pit_cs_t * pit)
* maintain the per-PIT stats.
*/
always_inline void
-hicn_pcs_delete_internal (hicn_pit_cs_t * pitcs,
- hicn_pcs_entry_t ** pcs_entryp,
- hicn_hash_entry_t * hash_entry,
- hicn_hash_node_t ** node, vlib_main_t * vm,
- const hicn_dpo_vft_t * dpo_vft,
- dpo_id_t * hicn_dpo_id)
+hicn_pcs_delete_internal (hicn_pit_cs_t *pitcs, hicn_pcs_entry_t **pcs_entryp,
+ hicn_hash_entry_t *hash_entry,
+ hicn_hash_node_t **node, vlib_main_t *vm,
+ const hicn_dpo_vft_t *dpo_vft, dpo_id_t *hicn_dpo_id)
{
hicn_pcs_entry_t *pcs = *pcs_entryp;
@@ -348,8 +346,8 @@ hicn_pcs_delete_internal (hicn_pit_cs_t * pitcs,
/* Free any associated packet buffer */
vlib_buffer_free_one (vm, pcs->u.cs.cs_pkt_buf);
pcs->u.cs.cs_pkt_buf = ~0;
- ASSERT ((pcs->u.cs.cs_lru_prev == 0)
- && (pcs->u.cs.cs_lru_prev == pcs->u.cs.cs_lru_next));
+ ASSERT ((pcs->u.cs.cs_lru_prev == 0) &&
+ (pcs->u.cs.cs_lru_prev == pcs->u.cs.cs_lru_next));
}
else
{
@@ -369,10 +367,10 @@ hicn_pcs_delete_internal (hicn_pit_cs_t * pitcs,
* the hashtable.) This is primarily here to maintain the internal counters.
*/
always_inline void
-hicn_pit_to_cs (vlib_main_t * vm, hicn_pit_cs_t * pitcs,
- hicn_pcs_entry_t * pcs_entry, hicn_hash_entry_t * hash_entry,
- hicn_hash_node_t * node, const hicn_dpo_vft_t * dpo_vft,
- dpo_id_t * hicn_dpo_id, hicn_face_id_t inface_id, u8 is_appface)
+hicn_pit_to_cs (vlib_main_t *vm, hicn_pit_cs_t *pitcs,
+ hicn_pcs_entry_t *pcs_entry, hicn_hash_entry_t *hash_entry,
+ hicn_hash_node_t *node, const hicn_dpo_vft_t *dpo_vft,
+ dpo_id_t *hicn_dpo_id, hicn_face_id_t inface_id, u8 is_appface)
{
/*
@@ -405,9 +403,8 @@ hicn_pit_to_cs (vlib_main_t * vm, hicn_pit_cs_t * pitcs,
hicn_hash_node_t *node;
hicn_pcs_entry_t *pcs_entry;
hicn_hash_entry_t *hash_entry;
- policy_vft->hicn_cs_delete_get (pitcs, policy_state,
- &node, &pcs_entry, &hash_entry);
-
+ policy_vft->hicn_cs_delete_get (pitcs, policy_state, &node, &pcs_entry,
+ &hash_entry);
/*
* We don't have to decrease the lock (therefore we cannot
@@ -425,9 +422,9 @@ hicn_pit_to_cs (vlib_main_t * vm, hicn_pit_cs_t * pitcs,
/* Functions specific for PIT or CS */
always_inline void
-hicn_pcs_cs_update (vlib_main_t * vm, hicn_pit_cs_t * pitcs,
- hicn_pcs_entry_t * old_entry, hicn_pcs_entry_t * entry,
- hicn_hash_node_t * node)
+hicn_pcs_cs_update (vlib_main_t *vm, hicn_pit_cs_t *pitcs,
+ hicn_pcs_entry_t *old_entry, hicn_pcs_entry_t *entry,
+ hicn_hash_node_t *node)
{
hicn_cs_policy_t *policy_state;
hicn_cs_policy_vft_t *policy_vft;
@@ -451,8 +448,8 @@ hicn_pcs_cs_update (vlib_main_t * vm, hicn_pit_cs_t * pitcs,
hicn_hash_node_t *node;
hicn_pcs_entry_t *pcs_entry;
hicn_hash_entry_t *hash_entry;
- policy_vft->hicn_cs_delete_get (pitcs, policy_state,
- &node, &pcs_entry, &hash_entry);
+ policy_vft->hicn_cs_delete_get (pitcs, policy_state, &node,
+ &pcs_entry, &hash_entry);
/*
* We don't have to decrease the lock (therefore we cannot
@@ -472,10 +469,10 @@ hicn_pcs_cs_update (vlib_main_t * vm, hicn_pit_cs_t * pitcs,
}
always_inline void
-hicn_pcs_cs_delete (vlib_main_t * vm, hicn_pit_cs_t * pitcs,
- hicn_pcs_entry_t ** pcs_entryp, hicn_hash_node_t ** nodep,
- hicn_hash_entry_t * hash_entry,
- const hicn_dpo_vft_t * dpo_vft, dpo_id_t * hicn_dpo_id)
+hicn_pcs_cs_delete (vlib_main_t *vm, hicn_pit_cs_t *pitcs,
+ hicn_pcs_entry_t **pcs_entryp, hicn_hash_node_t **nodep,
+ hicn_hash_entry_t *hash_entry,
+ const hicn_dpo_vft_t *dpo_vft, dpo_id_t *hicn_dpo_id)
{
if (!(hash_entry->he_flags & HICN_HASH_ENTRY_FLAG_DELETED))
{
@@ -492,12 +489,13 @@ hicn_pcs_cs_delete (vlib_main_t * vm, hicn_pit_cs_t * pitcs,
pitcs->pcs_cs_count--;
}
- /* A data could have been inserted in the CS through a push. In this case locks == 0 */
+ /* A data could have been inserted in the CS through a push. In this case
+ * locks == 0 */
hash_entry->locks--;
if (hash_entry->locks == 0)
{
- hicn_pcs_delete_internal
- (pitcs, pcs_entryp, hash_entry, nodep, vm, dpo_vft, hicn_dpo_id);
+ hicn_pcs_delete_internal (pitcs, pcs_entryp, hash_entry, nodep, vm,
+ dpo_vft, hicn_dpo_id);
}
else
{
@@ -506,19 +504,17 @@ hicn_pcs_cs_delete (vlib_main_t * vm, hicn_pit_cs_t * pitcs,
}
always_inline int
-hicn_pcs_cs_insert (vlib_main_t * vm, hicn_pit_cs_t * pitcs,
- hicn_pcs_entry_t * entry, hicn_hash_node_t * node,
- hicn_hash_entry_t ** hash_entry, u64 hashval,
- u32 * node_id, index_t * dpo_ctx_id, u8 * vft_id,
- u8 * is_cs, u8 * hash_entry_id, u32 * bucket_id,
- u8 * bucket_is_overflow)
+hicn_pcs_cs_insert (vlib_main_t *vm, hicn_pit_cs_t *pitcs,
+ hicn_pcs_entry_t *entry, hicn_hash_node_t *node,
+ hicn_hash_entry_t **hash_entry, u64 hashval, u32 *node_id,
+ index_t *dpo_ctx_id, u8 *vft_id, u8 *is_cs,
+ u8 *hash_entry_id, u32 *bucket_id, u8 *bucket_is_overflow)
{
ASSERT (entry == hicn_hashtb_node_data (node));
- int ret =
- hicn_hashtb_insert (pitcs->pcs_table, node, hash_entry, hashval, node_id,
- dpo_ctx_id, vft_id, is_cs, hash_entry_id, bucket_id,
- bucket_is_overflow);
+ int ret = hicn_hashtb_insert (pitcs->pcs_table, node, hash_entry, hashval,
+ node_id, dpo_ctx_id, vft_id, is_cs,
+ hash_entry_id, bucket_id, bucket_is_overflow);
if (PREDICT_TRUE (ret == HICN_ERROR_NONE))
{
@@ -541,8 +537,8 @@ hicn_pcs_cs_insert (vlib_main_t * vm, hicn_pit_cs_t * pitcs,
hicn_hash_node_t *node;
hicn_pcs_entry_t *pcs_entry;
hicn_hash_entry_t *hash_entry;
- policy_vft->hicn_cs_delete_get (pitcs, policy_state,
- &node, &pcs_entry, &hash_entry);
+ policy_vft->hicn_cs_delete_get (pitcs, policy_state, &node,
+ &pcs_entry, &hash_entry);
/*
* We don't have to decrease the lock (therefore we cannot
@@ -564,22 +560,21 @@ hicn_pcs_cs_insert (vlib_main_t * vm, hicn_pit_cs_t * pitcs,
* helping maintain the per-PIT stats.
*/
always_inline int
-hicn_pcs_cs_insert_update (vlib_main_t * vm, hicn_pit_cs_t * pitcs,
- hicn_pcs_entry_t * entry, hicn_hash_node_t * node,
- hicn_hash_entry_t ** hash_entry, u64 hashval,
- u32 * node_id, index_t * dpo_ctx_id, u8 * vft_id,
- u8 * is_cs, u8 * hash_entry_id, u32 * bucket_id,
- u8 * bucket_is_overflow, hicn_face_id_t inface)
+hicn_pcs_cs_insert_update (vlib_main_t *vm, hicn_pit_cs_t *pitcs,
+ hicn_pcs_entry_t *entry, hicn_hash_node_t *node,
+ hicn_hash_entry_t **hash_entry, u64 hashval,
+ u32 *node_id, index_t *dpo_ctx_id, u8 *vft_id,
+ u8 *is_cs, u8 *hash_entry_id, u32 *bucket_id,
+ u8 *bucket_is_overflow, hicn_face_id_t inface)
{
int ret;
ASSERT (entry == hicn_hashtb_node_data (node));
entry->u.cs.cs_rxface = inface;
- ret =
- hicn_pcs_cs_insert (vm, pitcs, entry, node, hash_entry, hashval, node_id,
- dpo_ctx_id, vft_id, is_cs, hash_entry_id, bucket_id,
- bucket_is_overflow);
+ ret = hicn_pcs_cs_insert (vm, pitcs, entry, node, hash_entry, hashval,
+ node_id, dpo_ctx_id, vft_id, is_cs, hash_entry_id,
+ bucket_id, bucket_is_overflow);
/* A content already exists in CS with the same name */
if (ret == HICN_ERROR_HASHTB_EXIST && *is_cs)
@@ -608,18 +603,17 @@ hicn_pcs_cs_insert_update (vlib_main_t * vm, hicn_pit_cs_t * pitcs,
* helping maintain the per-PIT stats.
*/
always_inline int
-hicn_pcs_pit_insert (hicn_pit_cs_t * pitcs, hicn_pcs_entry_t * entry,
- hicn_hash_node_t * node, hicn_hash_entry_t ** hash_entry,
- u64 hashval, u32 * node_id, index_t * dpo_ctx_id,
- u8 * vft_id, u8 * is_cs, u8 * hash_entry_id,
- u32 * bucket_id, u8 * bucket_is_overflow)
+hicn_pcs_pit_insert (hicn_pit_cs_t *pitcs, hicn_pcs_entry_t *entry,
+ hicn_hash_node_t *node, hicn_hash_entry_t **hash_entry,
+ u64 hashval, u32 *node_id, index_t *dpo_ctx_id,
+ u8 *vft_id, u8 *is_cs, u8 *hash_entry_id, u32 *bucket_id,
+ u8 *bucket_is_overflow)
{
ASSERT (entry == hicn_hashtb_node_data (node));
- int ret =
- hicn_hashtb_insert (pitcs->pcs_table, node, hash_entry, hashval, node_id,
- dpo_ctx_id, vft_id, is_cs, hash_entry_id, bucket_id,
- bucket_is_overflow);
+ int ret = hicn_hashtb_insert (pitcs->pcs_table, node, hash_entry, hashval,
+ node_id, dpo_ctx_id, vft_id, is_cs,
+ hash_entry_id, bucket_id, bucket_is_overflow);
if (PREDICT_TRUE (ret == HICN_ERROR_NONE))
pitcs->pcs_pit_count++;
@@ -628,17 +622,17 @@ hicn_pcs_pit_insert (hicn_pit_cs_t * pitcs, hicn_pcs_entry_t * entry,
}
always_inline void
-hicn_pcs_pit_delete (hicn_pit_cs_t * pitcs, hicn_pcs_entry_t ** pcs_entryp,
- hicn_hash_node_t ** node, vlib_main_t * vm,
- hicn_hash_entry_t * hash_entry,
- const hicn_dpo_vft_t * dpo_vft, dpo_id_t * hicn_dpo_id)
+hicn_pcs_pit_delete (hicn_pit_cs_t *pitcs, hicn_pcs_entry_t **pcs_entryp,
+ hicn_hash_node_t **node, vlib_main_t *vm,
+ hicn_hash_entry_t *hash_entry,
+ const hicn_dpo_vft_t *dpo_vft, dpo_id_t *hicn_dpo_id)
{
hash_entry->locks--;
if (hash_entry->locks == 0)
{
pitcs->pcs_pit_count--;
- hicn_pcs_delete_internal
- (pitcs, pcs_entryp, hash_entry, node, vm, dpo_vft, hicn_dpo_id);
+ hicn_pcs_delete_internal (pitcs, pcs_entryp, hash_entry, node, vm,
+ dpo_vft, hicn_dpo_id);
}
else
{
@@ -646,7 +640,6 @@ hicn_pcs_pit_delete (hicn_pit_cs_t * pitcs, hicn_pcs_entry_t ** pcs_entryp,
}
}
-
/* Generic functions for PIT/CS */
/*
@@ -654,42 +647,39 @@ hicn_pcs_pit_delete (hicn_pit_cs_t * pitcs, hicn_pcs_entry_t ** pcs_entryp,
* helping maintain the per-PIT stats.
*/
always_inline int
-hicn_pcs_insert (vlib_main_t * vm, hicn_pit_cs_t * pitcs,
- hicn_pcs_entry_t * entry, hicn_hash_node_t * node,
- hicn_hash_entry_t ** hash_entry, u64 hashval, u32 * node_id,
- index_t * dpo_ctx_id, u8 * vft_id, u8 * is_cs,
- u8 * hash_entry_id, u32 * bucket_id, u8 * bucket_is_overflow)
+hicn_pcs_insert (vlib_main_t *vm, hicn_pit_cs_t *pitcs,
+ hicn_pcs_entry_t *entry, hicn_hash_node_t *node,
+ hicn_hash_entry_t **hash_entry, u64 hashval, u32 *node_id,
+ index_t *dpo_ctx_id, u8 *vft_id, u8 *is_cs, u8 *hash_entry_id,
+ u32 *bucket_id, u8 *bucket_is_overflow)
{
int ret;
if ((*hash_entry)->he_flags & HICN_HASH_ENTRY_FLAG_CS_ENTRY)
{
- ret =
- hicn_pcs_cs_insert (vm, pitcs, entry, node, hash_entry, hashval,
- node_id, dpo_ctx_id, vft_id, is_cs, hash_entry_id,
- bucket_id, bucket_is_overflow);
+ ret = hicn_pcs_cs_insert (vm, pitcs, entry, node, hash_entry, hashval,
+ node_id, dpo_ctx_id, vft_id, is_cs,
+ hash_entry_id, bucket_id, bucket_is_overflow);
}
else
{
- ret =
- hicn_pcs_pit_insert (pitcs, entry, node, hash_entry, hashval, node_id,
- dpo_ctx_id, vft_id, is_cs, hash_entry_id,
- bucket_id, bucket_is_overflow);
+ ret = hicn_pcs_pit_insert (pitcs, entry, node, hash_entry, hashval,
+ node_id, dpo_ctx_id, vft_id, is_cs,
+ hash_entry_id, bucket_id, bucket_is_overflow);
}
return (ret);
}
-
/*
* Delete entry if there are no pending lock on the entry, otherwise mark it
* as to delete.
*/
always_inline void
-hicn_pcs_delete (hicn_pit_cs_t * pitcs, hicn_pcs_entry_t ** pcs_entryp,
- hicn_hash_node_t ** nodep, vlib_main_t * vm,
- hicn_hash_entry_t * hash_entry,
- const hicn_dpo_vft_t * dpo_vft, dpo_id_t * hicn_dpo_id)
+hicn_pcs_delete (hicn_pit_cs_t *pitcs, hicn_pcs_entry_t **pcs_entryp,
+ hicn_hash_node_t **nodep, vlib_main_t *vm,
+ hicn_hash_entry_t *hash_entry, const hicn_dpo_vft_t *dpo_vft,
+ dpo_id_t *hicn_dpo_id)
{
/*
* If the entry has already been marked as deleted, it has already
@@ -697,13 +687,13 @@ hicn_pcs_delete (hicn_pit_cs_t * pitcs, hicn_pcs_entry_t ** pcs_entryp,
*/
if (hash_entry->he_flags & HICN_HASH_ENTRY_FLAG_CS_ENTRY)
{
- hicn_pcs_cs_delete (vm, pitcs, pcs_entryp, nodep, hash_entry,
- dpo_vft, hicn_dpo_id);
+ hicn_pcs_cs_delete (vm, pitcs, pcs_entryp, nodep, hash_entry, dpo_vft,
+ hicn_dpo_id);
}
else
{
- hicn_pcs_pit_delete (pitcs, pcs_entryp, nodep, vm,
- hash_entry, dpo_vft, hicn_dpo_id);
+ hicn_pcs_pit_delete (pitcs, pcs_entryp, nodep, vm, hash_entry, dpo_vft,
+ hicn_dpo_id);
}
}
@@ -712,17 +702,17 @@ hicn_pcs_delete (hicn_pit_cs_t * pitcs, hicn_pcs_entry_t ** pcs_entryp,
* the entry is marked as to be deleted
*/
always_inline void
-hicn_pcs_remove_lock (hicn_pit_cs_t * pitcs, hicn_pcs_entry_t ** pcs_entryp,
- hicn_hash_node_t ** node, vlib_main_t * vm,
- hicn_hash_entry_t * hash_entry,
- const hicn_dpo_vft_t * dpo_vft, dpo_id_t * hicn_dpo_id)
+hicn_pcs_remove_lock (hicn_pit_cs_t *pitcs, hicn_pcs_entry_t **pcs_entryp,
+ hicn_hash_node_t **node, vlib_main_t *vm,
+ hicn_hash_entry_t *hash_entry,
+ const hicn_dpo_vft_t *dpo_vft, dpo_id_t *hicn_dpo_id)
{
hash_entry->locks--;
- if (hash_entry->locks == 0
- && (hash_entry->he_flags & HICN_HASH_ENTRY_FLAG_DELETED))
+ if (hash_entry->locks == 0 &&
+ (hash_entry->he_flags & HICN_HASH_ENTRY_FLAG_DELETED))
{
- hicn_pcs_delete_internal
- (pitcs, pcs_entryp, hash_entry, node, vm, dpo_vft, hicn_dpo_id);
+ hicn_pcs_delete_internal (pitcs, pcs_entryp, hash_entry, node, vm,
+ dpo_vft, hicn_dpo_id);
}
}
@@ -730,20 +720,21 @@ hicn_pcs_remove_lock (hicn_pit_cs_t * pitcs, hicn_pcs_entry_t ** pcs_entryp,
* Delete entry which has already been bulk-removed from lru list
*/
always_inline void
-hicn_cs_delete_trimmed (hicn_pit_cs_t * pitcs, hicn_pcs_entry_t ** pcs_entryp,
- hicn_hash_entry_t * hash_entry,
- hicn_hash_node_t ** node, vlib_main_t * vm)
+hicn_cs_delete_trimmed (hicn_pit_cs_t *pitcs, hicn_pcs_entry_t **pcs_entryp,
+ hicn_hash_entry_t *hash_entry, hicn_hash_node_t **node,
+ vlib_main_t *vm)
{
-
if (hash_entry->locks == 0)
{
const hicn_dpo_vft_t *dpo_vft = hicn_dpo_get_vft (hash_entry->vft_id);
- dpo_id_t hicn_dpo_id =
- { dpo_vft->hicn_dpo_get_type (), 0, 0, hash_entry->dpo_ctx_id };
+ dpo_id_t hicn_dpo_id = { .dpoi_type = dpo_vft->hicn_dpo_get_type (),
+ .dpoi_proto = 0,
+ .dpoi_next_node = 0,
+ .dpoi_index = hash_entry->dpo_ctx_id };
- hicn_pcs_delete_internal
- (pitcs, pcs_entryp, hash_entry, node, vm, dpo_vft, &hicn_dpo_id);
+ hicn_pcs_delete_internal (pitcs, pcs_entryp, hash_entry, node, vm,
+ dpo_vft, &hicn_dpo_id);
}
else
{
@@ -796,16 +787,15 @@ hicn_infra_seq16_ge (u16 a, u16 b)
return (hicn_infra_seq16_cmp (a, b) >= 0);
}
-
-extern u16 hicn_infra_fast_timer; /* Counts at 1 second intervals */
-extern u16 hicn_infra_slow_timer; /* Counts at 1 minute intervals */
+extern u16 hicn_infra_fast_timer; /* Counts at 1 second intervals */
+extern u16 hicn_infra_slow_timer; /* Counts at 1 minute intervals */
/*
* Utilities to convert lifetime into expiry time based on compressed clock,
* suitable for the opportunistic hashtable entry timeout processing.
*/
-//convert time in msec to time in clicks
+// convert time in msec to time in clicks
always_inline u16
hicn_infra_ms2clicks (u64 time_ms, u64 ms_per_click)
{
diff --git a/hicn-plugin/src/strategies/strategy_mw.c b/hicn-plugin/src/strategies/strategy_mw.c
index fe4d5896a..594135c1e 100644
--- a/hicn-plugin/src/strategies/strategy_mw.c
+++ b/hicn-plugin/src/strategies/strategy_mw.c
@@ -22,14 +22,13 @@
/* Simple strategy that chooses the next hop with the maximum weight */
/* It does not require to exend the hicn_dpo */
void hicn_receive_data_mw (index_t dpo_idx, int nh_idx);
-void hicn_add_interest_mw (index_t dpo_idx, hicn_hash_entry_t * pit_entry);
+void hicn_add_interest_mw (index_t dpo_idx, hicn_hash_entry_t *pit_entry);
void hicn_on_interest_timeout_mw (index_t dpo_idx);
u32 hicn_select_next_hop_mw (index_t dpo_idx, int *nh_idx,
- hicn_face_id_t* outface);
+ hicn_face_id_t *outface);
u32 get_strategy_node_index_mw (void);
-u8 *hicn_strategy_format_trace_mw (u8 * s, hicn_strategy_trace_t * t);
-u8 *hicn_strategy_format_mw (u8 * s, va_list * ap);
-
+u8 *hicn_strategy_format_trace_mw (u8 *s, hicn_strategy_trace_t *t);
+u8 *hicn_strategy_format_mw (u8 *s, va_list *ap);
static hicn_strategy_vft_t hicn_strategy_mw_vft = {
.hicn_receive_data = &hicn_receive_data_mw,
@@ -49,9 +48,10 @@ hicn_mw_strategy_get_vft (void)
return &hicn_strategy_mw_vft;
}
-/* DPO should be give in input as it containes all the information to calculate the next hops*/
+/* DPO should be give in input as it containes all the information to calculate
+ * the next hops*/
u32
-hicn_select_next_hop_mw (index_t dpo_idx, int *nh_idx, hicn_face_id_t* outface)
+hicn_select_next_hop_mw (index_t dpo_idx, int *nh_idx, hicn_face_id_t *outface)
{
hicn_dpo_ctx_t *dpo_ctx = hicn_strategy_dpo_ctx_get (dpo_idx);
@@ -65,10 +65,10 @@ hicn_select_next_hop_mw (index_t dpo_idx, int *nh_idx, hicn_face_id_t* outface)
for (int i = 0; i < dpo_ctx->entry_count; i++)
{
if (hicn_strategy_mw_ctx->weight[next_hop_index] <
- hicn_strategy_mw_ctx->weight[i])
- {
- next_hop_index = i;
- }
+ hicn_strategy_mw_ctx->weight[i])
+ {
+ next_hop_index = i;
+ }
}
*outface = dpo_ctx->next_hops[next_hop_index];
@@ -77,11 +77,13 @@ hicn_select_next_hop_mw (index_t dpo_idx, int *nh_idx, hicn_face_id_t* outface)
}
void
-hicn_add_interest_mw (index_t dpo_ctx_idx, hicn_hash_entry_t * hash_entry)
+hicn_add_interest_mw (index_t dpo_ctx_idx, hicn_hash_entry_t *hash_entry)
{
hash_entry->dpo_ctx_id = dpo_ctx_idx;
- dpo_id_t hicn_dpo_id =
- { hicn_dpo_strategy_mw_get_type (), 0, 0, dpo_ctx_idx };
+ dpo_id_t hicn_dpo_id = { .dpoi_type = hicn_dpo_strategy_mw_get_type (),
+ .dpoi_proto = 0,
+ .dpoi_next_node = 0,
+ .dpoi_index = dpo_ctx_idx };
hicn_strategy_dpo_ctx_lock (&hicn_dpo_id);
hash_entry->vft_id = hicn_dpo_get_vft_id (&hicn_dpo_id);
}
@@ -97,10 +99,9 @@ hicn_receive_data_mw (index_t dpo_idx, int nh_idx)
{
}
-
/* packet trace format function */
u8 *
-hicn_strategy_format_trace_mw (u8 * s, hicn_strategy_trace_t * t)
+hicn_strategy_format_trace_mw (u8 *s, hicn_strategy_trace_t *t)
{
s = format (s, "Strategy_mw: pkt: %d, sw_if_index %d, next index %d",
(int) t->pkt_type, t->sw_if_index, t->next_index);
@@ -108,14 +109,14 @@ hicn_strategy_format_trace_mw (u8 * s, hicn_strategy_trace_t * t)
}
u8 *
-hicn_strategy_format_mw (u8 * s, va_list * ap)
+hicn_strategy_format_mw (u8 *s, va_list *ap)
{
u32 indent = va_arg (*ap, u32);
- s =
- format (s,
- "Static Weights: weights are updated by the control plane, next hop is the one with the maximum weight.\n",
- indent);
+ s = format (s,
+ "Static Weights: weights are updated by the control plane, next "
+ "hop is the one with the maximum weight.\n",
+ indent);
return (s);
}
diff --git a/hicn-plugin/src/strategies/strategy_rr.c b/hicn-plugin/src/strategies/strategy_rr.c
index 4c65ce52a..9995191b7 100644
--- a/hicn-plugin/src/strategies/strategy_rr.c
+++ b/hicn-plugin/src/strategies/strategy_rr.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017-2020 Cisco and/or its affiliates.
+ * Copyright (c) 2017-2021 Cisco and/or its affiliates.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
@@ -23,13 +23,12 @@
/* Simple strategy that chooses the next hop with the maximum weight */
/* It does not require to exend the hicn_dpo */
void hicn_receive_data_rr (index_t dpo_idx, int nh_idx);
-void hicn_add_interest_rr (index_t dpo_idx, hicn_hash_entry_t * pit_entry);
+void hicn_add_interest_rr (index_t dpo_idx, hicn_hash_entry_t *pit_entry);
void hicn_on_interest_timeout_rr (index_t dpo_idx);
u32 hicn_select_next_hop_rr (index_t dpo_idx, int *nh_idx,
- hicn_face_id_t* outface);
-u8 *hicn_strategy_format_trace_rr (u8 * s, hicn_strategy_trace_t * t);
-u8 *hicn_strategy_format_rr (u8 * s, va_list * ap);
-
+ hicn_face_id_t *outface);
+u8 *hicn_strategy_format_trace_rr (u8 *s, hicn_strategy_trace_t *t);
+u8 *hicn_strategy_format_rr (u8 *s, va_list *ap);
static hicn_strategy_vft_t hicn_strategy_rr_vft = {
.hicn_receive_data = &hicn_receive_data_rr,
@@ -49,9 +48,10 @@ hicn_rr_strategy_get_vft (void)
return &hicn_strategy_rr_vft;
}
-/* DPO should be give in input as it containes all the information to calculate the next hops*/
+/* DPO should be give in input as it containes all the information to calculate
+ * the next hops*/
u32
-hicn_select_next_hop_rr (index_t dpo_idx, int *nh_idx, hicn_face_id_t* outface)
+hicn_select_next_hop_rr (index_t dpo_idx, int *nh_idx, hicn_face_id_t *outface)
{
hicn_dpo_ctx_t *dpo_ctx = hicn_strategy_dpo_ctx_get (dpo_idx);
@@ -61,8 +61,7 @@ hicn_select_next_hop_rr (index_t dpo_idx, int *nh_idx, hicn_face_id_t* outface)
hicn_strategy_rr_ctx_t *hicn_strategy_rr_ctx =
(hicn_strategy_rr_ctx_t *) dpo_ctx->data;
- *outface =
- dpo_ctx->next_hops[hicn_strategy_rr_ctx->current_nhop];
+ *outface = dpo_ctx->next_hops[hicn_strategy_rr_ctx->current_nhop];
hicn_strategy_rr_ctx->current_nhop =
(hicn_strategy_rr_ctx->current_nhop + 1) % dpo_ctx->entry_count;
@@ -71,11 +70,13 @@ hicn_select_next_hop_rr (index_t dpo_idx, int *nh_idx, hicn_face_id_t* outface)
}
void
-hicn_add_interest_rr (index_t dpo_ctx_idx, hicn_hash_entry_t * hash_entry)
+hicn_add_interest_rr (index_t dpo_ctx_idx, hicn_hash_entry_t *hash_entry)
{
hash_entry->dpo_ctx_id = dpo_ctx_idx;
- dpo_id_t hicn_dpo_id =
- { hicn_dpo_strategy_rr_get_type (), 0, 0, dpo_ctx_idx };
+ dpo_id_t hicn_dpo_id = { .dpoi_type = hicn_dpo_strategy_rr_get_type (),
+ .dpoi_proto = 0,
+ .dpoi_next_node = 0,
+ .dpoi_index = dpo_ctx_idx };
hicn_strategy_dpo_ctx_lock (&hicn_dpo_id);
hash_entry->vft_id = hicn_dpo_get_vft_id (&hicn_dpo_id);
}
@@ -91,10 +92,9 @@ hicn_receive_data_rr (index_t dpo_idx, int nh_idx)
{
}
-
/* packet trace format function */
u8 *
-hicn_strategy_format_trace_rr (u8 * s, hicn_strategy_trace_t * t)
+hicn_strategy_format_trace_rr (u8 *s, hicn_strategy_trace_t *t)
{
s = format (s, "Strategy_rr: pkt: %d, sw_if_index %d, next index %d",
(int) t->pkt_type, t->sw_if_index, t->next_index);
@@ -102,14 +102,14 @@ hicn_strategy_format_trace_rr (u8 * s, hicn_strategy_trace_t * t)
}
u8 *
-hicn_strategy_format_rr (u8 * s, va_list * ap)
+hicn_strategy_format_rr (u8 *s, va_list *ap)
{
u32 indent = va_arg (*ap, u32);
- s =
- format (s,
- "Round Robin: next hop is chosen ciclying between all the available next hops, one after the other.\n",
- indent);
+ s = format (s,
+ "Round Robin: next hop is chosen ciclying between all the "
+ "available next hops, one after the other.\n",
+ indent);
return (s);
}