Code Review
/
vpp.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
VCL-LDPRELOAD: add sendfile/sendfile64 implementation.
[vpp.git]
/
src
/
vnet
/
replication.c
diff --git
a/src/vnet/replication.c
b/src/vnet/replication.c
index
86d922b
..
5a8a0fe
100644
(file)
--- a/
src/vnet/replication.c
+++ b/
src/vnet/replication.c
@@
-31,24
+31,25
@@
replication_prep (vlib_main_t * vm,
{
replication_main_t *rm = &replication_main;
replication_context_t *ctx;
{
replication_main_t *rm = &replication_main;
replication_context_t *ctx;
- uword
cpu_number = vm->cpu
_index;
+ uword
thread_index = vm->thread
_index;
ip4_header_t *ip;
u32 ctx_id;
/* Allocate a context, reserve context 0 */
ip4_header_t *ip;
u32 ctx_id;
/* Allocate a context, reserve context 0 */
- if (PREDICT_FALSE (rm->contexts[
cpu_number
] == 0))
- pool_get_aligned (rm->contexts[
cpu_number
], ctx, CLIB_CACHE_LINE_BYTES);
+ if (PREDICT_FALSE (rm->contexts[
thread_index
] == 0))
+ pool_get_aligned (rm->contexts[
thread_index
], ctx, CLIB_CACHE_LINE_BYTES);
- pool_get_aligned (rm->contexts[
cpu_number
], ctx, CLIB_CACHE_LINE_BYTES);
- ctx_id = ctx - rm->contexts[
cpu_number
];
+ pool_get_aligned (rm->contexts[
thread_index
], ctx, CLIB_CACHE_LINE_BYTES);
+ ctx_id = ctx - rm->contexts[
thread_index
];
/* Save state from vlib buffer */
/* Save state from vlib buffer */
- ctx->saved_free_list_index =
b0->free_list_index
;
+ ctx->saved_free_list_index =
vlib_buffer_get_free_list_index (b0)
;
ctx->current_data = b0->current_data;
ctx->current_data = b0->current_data;
+ ctx->flags = b0->flags & VNET_BUFFER_FLAGS_VLAN_BITS;
/* Set up vlib buffer hooks */
b0->recycle_count = ctx_id;
/* Set up vlib buffer hooks */
b0->recycle_count = ctx_id;
-
b0->free_list_index = rm->recycle_list_index
;
+
vlib_buffer_set_free_list_index (b0, rm->recycle_list_index)
;
b0->flags |= VLIB_BUFFER_RECYCLE;
/* Save feature state */
b0->flags |= VLIB_BUFFER_RECYCLE;
/* Save feature state */
@@
-94,16
+95,20
@@
replication_recycle (vlib_main_t * vm, vlib_buffer_t * b0, u32 is_last)
{
replication_main_t *rm = &replication_main;
replication_context_t *ctx;
{
replication_main_t *rm = &replication_main;
replication_context_t *ctx;
- uword
cpu_number = vm->cpu
_index;
+ uword
thread_index = vm->thread
_index;
ip4_header_t *ip;
/* Get access to the replication context */
ip4_header_t *ip;
/* Get access to the replication context */
- ctx = pool_elt_at_index (rm->contexts[
cpu_number
], b0->recycle_count);
+ ctx = pool_elt_at_index (rm->contexts[
thread_index
], b0->recycle_count);
/* Restore vnet buffer state */
clib_memcpy (vnet_buffer (b0), ctx->vnet_buffer,
sizeof (vnet_buffer_opaque_t));
/* Restore vnet buffer state */
clib_memcpy (vnet_buffer (b0), ctx->vnet_buffer,
sizeof (vnet_buffer_opaque_t));
+ /* Restore the vlan flags */
+ b0->flags &= ~VNET_BUFFER_FLAGS_VLAN_BITS;
+ b0->flags |= ctx->flags;
+
/* Restore the packet start (current_data) and length */
vlib_buffer_advance (b0, ctx->current_data - b0->current_data);
/* Restore the packet start (current_data) and length */
vlib_buffer_advance (b0, ctx->current_data - b0->current_data);
@@
-129,11
+134,11
@@
replication_recycle (vlib_main_t * vm, vlib_buffer_t * b0, u32 is_last)
* This is the last replication in the list.
* Restore original buffer free functionality.
*/
* This is the last replication in the list.
* Restore original buffer free functionality.
*/
-
b0->free_list_index = ctx->saved_free_list_index
;
+
vlib_buffer_set_free_list_index (b0, ctx->saved_free_list_index)
;
b0->flags &= ~VLIB_BUFFER_RECYCLE;
/* Free context back to its pool */
b0->flags &= ~VLIB_BUFFER_RECYCLE;
/* Free context back to its pool */
- pool_put (rm->contexts[
cpu_number
], ctx);
+ pool_put (rm->contexts[
thread_index
], ctx);
}
return ctx;
}
return ctx;
@@
-160,7
+165,7
@@
replication_recycle_callback (vlib_main_t * vm, vlib_buffer_free_list_t * fl)
replication_main_t *rm = &replication_main;
replication_context_t *ctx;
u32 feature_node_index = 0;
replication_main_t *rm = &replication_main;
replication_context_t *ctx;
u32 feature_node_index = 0;
- uword
cpu_number = vm->cpu
_index;
+ uword
thread_index = vm->thread
_index;
/*
* All buffers in the list are destined to the same recycle node.
/*
* All buffers in the list are destined to the same recycle node.
@@
-172,7
+177,7
@@
replication_recycle_callback (vlib_main_t * vm, vlib_buffer_free_list_t * fl)
{
bi0 = fl->buffers[0];
b0 = vlib_get_buffer (vm, bi0);
{
bi0 = fl->buffers[0];
b0 = vlib_get_buffer (vm, bi0);
- ctx = pool_elt_at_index (rm->contexts[
cpu_number
], b0->recycle_count);
+ ctx = pool_elt_at_index (rm->contexts[
thread_index
], b0->recycle_count);
feature_node_index = ctx->recycle_node_index;
}
feature_node_index = ctx->recycle_node_index;
}
@@
-214,7
+219,7
@@
replication_recycle_callback (vlib_main_t * vm, vlib_buffer_free_list_t * fl)
b0->flags |= VLIB_BUFFER_IS_RECYCLED;
#if (CLIB_DEBUG > 0)
b0->flags |= VLIB_BUFFER_IS_RECYCLED;
#if (CLIB_DEBUG > 0)
- if (vm->buffer_main->
extern_buffer_mgmt
== 0)
+ if (vm->buffer_main->
callbacks_registered
== 0)
vlib_buffer_set_known_state (vm, bi0,
VLIB_BUFFER_KNOWN_ALLOCATED);
#endif
vlib_buffer_set_known_state (vm, bi0,
VLIB_BUFFER_KNOWN_ALLOCATED);
#endif