aboutsummaryrefslogtreecommitdiffstats
path: root/hicn-plugin/src
diff options
context:
space:
mode:
authorAlberto Compagno <acompagn+fdio@cisco.com>2019-04-19 11:38:49 +0200
committerAlberto Compagno <acompagn+fdio@cisco.com>2019-05-03 12:07:41 +0200
commit98b5448ee9b39f4e92d781d14a27819074e3c1da (patch)
treee443374985cf6fc499efb2674482334d0bec3f18 /hicn-plugin/src
parent305e7617be61d21ebd0dee043588c469bc28ad3b (diff)
[HICN-180] Updating plugin to run on vpp 19.04
Change-Id: I23d44747edf65b9cbf1cd7cb174541dce55152aa Signed-off-by: Alberto Compagno <acompagn+fdio@cisco.com>
Diffstat (limited to 'hicn-plugin/src')
-rw-r--r--hicn-plugin/src/data_fwd.h38
-rw-r--r--hicn-plugin/src/data_fwd_node.c11
-rw-r--r--hicn-plugin/src/interest_hitcs_node.c4
-rw-r--r--hicn-plugin/src/pg.c8
4 files changed, 21 insertions, 40 deletions
diff --git a/hicn-plugin/src/data_fwd.h b/hicn-plugin/src/data_fwd.h
index 4e37e6087..742bb2882 100644
--- a/hicn-plugin/src/data_fwd.h
+++ b/hicn-plugin/src/data_fwd.h
@@ -20,17 +20,6 @@
#include "pcs.h"
-/*
- * Node context data; we think this is per-thread/instance
- */
-typedef struct hicn_data_fwd_runtime_s
-{
- vlib_combined_counter_main_t repm_counters;
-
- /* per-cpu vector of cloned packets */
- u32 **clones;
-} hicn_data_fwd_runtime_t;
-
/* Trace context struct */
typedef struct
{
@@ -86,9 +75,8 @@ vlib_buffer_clone_256_2 (vlib_main_t * vm, u32 src_buffer, u32 * buffers,
}
return n_buffers;
}
- n_buffers = vlib_buffer_alloc_from_free_list (vm, buffers, n_buffers,
- vlib_buffer_get_free_list_index
- (s));
+ n_buffers = vlib_buffer_alloc_from_pool (vm, buffers, n_buffers,
+ s->buffer_pool_index);
for (i = 0; i < n_buffers; i++)
{
@@ -96,8 +84,6 @@ vlib_buffer_clone_256_2 (vlib_main_t * vm, u32 src_buffer, u32 * buffers,
d->current_data = s->current_data;
d->current_length = head_end_offset;
d->trace_index = s->trace_index;
- vlib_buffer_set_free_list_index (d,
- vlib_buffer_get_free_list_index (s));
d->total_length_not_including_first_buffer = s->current_length -
head_end_offset;
@@ -116,11 +102,11 @@ vlib_buffer_clone_256_2 (vlib_main_t * vm, u32 src_buffer, u32 * buffers,
d->next_buffer = src_buffer;
}
vlib_buffer_advance (s, head_end_offset);
- s->n_add_refs = n_buffers - 1;
+ s->ref_count = n_buffers - 1;
while (s->flags & VLIB_BUFFER_NEXT_PRESENT)
{
s = vlib_get_buffer (vm, s->next_buffer);
- s->n_add_refs = n_buffers - 1;
+ s->ref_count = n_buffers - 1;
}
return n_buffers;
@@ -129,7 +115,7 @@ vlib_buffer_clone_256_2 (vlib_main_t * vm, u32 src_buffer, u32 * buffers,
/**
* @brief Create multiple clones of buffer and store them
* in the supplied array. Unlike the function in the vlib library,
- * we allow src_buffer to have n_add_refs != 0.
+ * we allow src_buffer to have ref_count != 0.
*
* @param vm - (vlib_main_t *) vlib main data structure pointer
* @param src_buffer - (u32) source buffer index
@@ -154,13 +140,13 @@ vlib_buffer_clone2 (vlib_main_t * vm, u32 src_buffer, u32 * buffers,
s->total_length_not_including_first_buffer = 0;
u16 n_cloned = 0;
- u8 n_clone_src = 255 - s->n_add_refs;
+ u8 n_clone_src = 255 - s->ref_count;
/*
* We need to copy src for all the clones that cannot be chained in
* the src_buffer
*/
- /* MAX(n_add_refs) = 256 */
+ /* MAX(ref_count) = 256 */
if (n_buffers > n_clone_src)
{
vlib_buffer_t *copy;
@@ -174,25 +160,25 @@ vlib_buffer_clone2 (vlib_main_t * vm, u32 src_buffer, u32 * buffers,
n_buffers -= n_cloned;
}
/*
- * vlib_buffer_clone_256 check if n_add_refs is 0. We force it to be
+ * vlib_buffer_clone_256 check if ref_count is 0. We force it to be
* 0 before calling the function and we retore it to the right value
* after the function has been called
*/
- u8 tmp_n_add_refs = s->n_add_refs;
+ u8 tmp_ref_count = s->ref_count;
- s->n_add_refs = 0;
+ s->ref_count = 0;
/*
* The regular vlib_buffer_clone_256 does copy if we need to clone
* only one packet. While this is not a problem per se, it adds
* complexity to the code, especially because we need to add 1 to
- * n_add_refs when the packet is cloned.
+ * ref_count when the packet is cloned.
*/
n_cloned += vlib_buffer_clone_256_2 (vm,
src_buffer,
(buffers + n_cloned),
n_buffers, head_end_offset);
- s->n_add_refs += tmp_n_add_refs;
+ s->ref_count += tmp_ref_count;
return n_cloned;
}
diff --git a/hicn-plugin/src/data_fwd_node.c b/hicn-plugin/src/data_fwd_node.c
index efb98164d..0b8685ff2 100644
--- a/hicn-plugin/src/data_fwd_node.c
+++ b/hicn-plugin/src/data_fwd_node.c
@@ -271,7 +271,7 @@ hicn_data_node_fn (vlib_main_t * vm, vlib_node_runtime_t * node,
* longer in any frame. The vlib_buffer will be freed when
* all its cloned vlib_buffer will be freed.
*/
- b0->n_add_refs--;
+ b0->ref_count--;
}
/* Delete the PIT entry */
@@ -294,7 +294,7 @@ hicn_data_node_fn (vlib_main_t * vm, vlib_node_runtime_t * node,
* longer in any frame. The vlib_buffer will be freed when
* all its cloned vlib_buffer will be freed.
*/
- b0->n_add_refs--;
+ b0->ref_count--;
}
/* Delete the PIT entry */
@@ -403,12 +403,12 @@ hicn_satisfy_faces (vlib_main_t * vm, u32 bi0,
else
{
/* Add one reference to maintain the buffer in the CS.
- * b0->n_add_refs == 0 has two meaning: it has 1 buffer or no buffer chained to it.
+ * 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 n_add_refs == 0;
+ * the CS will have ref_count == 0;
*/
- b0->n_add_refs++;
+ b0->ref_count++;
}
found = n_left_from =
@@ -621,7 +621,6 @@ VLIB_REGISTER_NODE(hicn_data_fwd_node) =
.function = hicn_data_node_fn,
.name = "hicn-data-fwd",
.vector_size = sizeof(u32),
- .runtime_data_bytes = sizeof(hicn_data_fwd_runtime_t),
.format_trace = hicn_data_fwd_format_trace,
.type = VLIB_NODE_TYPE_INTERNAL,
.n_errors = ARRAY_LEN(hicn_data_fwd_error_strings),
diff --git a/hicn-plugin/src/interest_hitcs_node.c b/hicn-plugin/src/interest_hitcs_node.c
index 8ddd4f59e..aad7ed74e 100644
--- a/hicn-plugin/src/interest_hitcs_node.c
+++ b/hicn-plugin/src/interest_hitcs_node.c
@@ -60,12 +60,12 @@ clone_from_cs (vlib_main_t * vm, u32 * bi0_cs, vlib_buffer_t * dest, u8 isv6)
else
{
vlib_buffer_advance (cs_buf, -buffer_advance);
- if (PREDICT_FALSE (cs_buf->n_add_refs == 255))
+ if (PREDICT_FALSE (cs_buf->ref_count == 255))
{
vlib_buffer_t *cs_buf2 = vlib_buffer_copy (vm, cs_buf);
vlib_buffer_advance (cs_buf, buffer_advance);
*bi0_cs = vlib_get_buffer_index (vm, cs_buf2);
- cs_buf->n_add_refs--;
+ cs_buf->ref_count--;
cs_buf = cs_buf2;
}
diff --git a/hicn-plugin/src/pg.c b/hicn-plugin/src/pg.c
index 643aff2be..8181d865e 100644
--- a/hicn-plugin/src/pg.c
+++ b/hicn-plugin/src/pg.c
@@ -1056,9 +1056,7 @@ convert_interest_to_data_v4 (vlib_main_t * vm, vlib_buffer_t * b0,
bytes_to_copy = 1500 - pkt_len;
}
/* Add content to the data packet */
- vlib_buffer_add_data (vm,
- VLIB_BUFFER_DEFAULT_FREE_LIST_INDEX, &bi0,
- rb->data, bytes_to_copy);
+ vlib_buffer_add_data (vm, &bi0, rb->data, bytes_to_copy);
b0 = vlib_get_buffer (vm, bi0);
@@ -1094,9 +1092,7 @@ convert_interest_to_data_v6 (vlib_main_t * vm, vlib_buffer_t * b0,
bytes_to_copy = 1500 - pkt_len;
}
/* Add content to the data packet */
- vlib_buffer_add_data (vm,
- VLIB_BUFFER_DEFAULT_FREE_LIST_INDEX, &bi0,
- rb->data, bytes_to_copy);
+ vlib_buffer_add_data (vm, &bi0, rb->data, bytes_to_copy);
b0 = vlib_get_buffer (vm, bi0);