vlib: copy trace_handle in vlib_buffer_copy/clone() functions
Since vlib_buffer_copy() and vlib_buffer_clone() both preserve VLIB_BUFFER_IS_TRACED bit in flags field, it should also copy trace_handle which would add minimal overhead. Thus, callers of these functions do not have to call vlib_buffer_copy_trace_flags() to copy trace_handle. Type: refactor Ticket: VPP-1745 Signed-off-by: John Lo <loj@cisco.com> Change-Id: Iff6a3f81660dd62b36a2966033eb380305340310 (cherry picked from commit 6631780422787166550b9871c46a94c160416324) Signed-off-by: John Lo <loj@cisco.com>
This commit is contained in:
@ -992,6 +992,7 @@ vlib_buffer_copy (vlib_main_t * vm, vlib_buffer_t * b)
|
||||
d->current_data = s->current_data;
|
||||
d->current_length = s->current_length;
|
||||
d->flags = s->flags & flag_mask;
|
||||
d->trace_handle = s->trace_handle;
|
||||
d->total_length_not_including_first_buffer =
|
||||
s->total_length_not_including_first_buffer;
|
||||
clib_memcpy_fast (d->opaque, s->opaque, sizeof (s->opaque));
|
||||
@ -1138,6 +1139,7 @@ vlib_buffer_clone_256 (vlib_main_t * vm, u32 src_buffer, u32 * buffers,
|
||||
}
|
||||
d->flags = (s->flags & VLIB_BUFFER_COPY_CLONE_FLAGS_MASK) |
|
||||
VLIB_BUFFER_NEXT_PRESENT;
|
||||
d->trace_handle = s->trace_handle;
|
||||
clib_memcpy_fast (d->opaque, s->opaque, sizeof (s->opaque));
|
||||
clib_memcpy_fast (d->opaque2, s->opaque2, sizeof (s->opaque2));
|
||||
clib_memcpy_fast (vlib_buffer_get_current (d),
|
||||
|
@ -109,10 +109,6 @@ punt_replicate (vlib_main_t * vm,
|
||||
punt_trace_t *t;
|
||||
|
||||
c0 = vlib_get_buffer (vm, ci0);
|
||||
|
||||
if (c0 != b0)
|
||||
vlib_buffer_copy_trace_flag (vm, b0, ci0);
|
||||
|
||||
t = vlib_add_trace (vm, node, c0, sizeof (*t));
|
||||
t->pt_reason = pr0;
|
||||
}
|
||||
|
@ -250,9 +250,6 @@ bier_lookup (vlib_main_t * vm,
|
||||
{
|
||||
bier_lookup_trace_t *tr;
|
||||
|
||||
if (c0 != b0)
|
||||
vlib_buffer_copy_trace_flag (vm, b0, ci0);
|
||||
|
||||
tr = vlib_add_trace (vm, node, c0, sizeof (*tr));
|
||||
tr->bt_index = bti0;
|
||||
tr->bfm_index = blm->blm_fmasks[thread_index][clone];
|
||||
|
@ -385,7 +385,6 @@ dhcp_proxy_to_server_input (vlib_main_t * vm,
|
||||
{
|
||||
dhcp_proxy_trace_t *tr;
|
||||
|
||||
vlib_buffer_copy_trace_flag (vm, b0, ci0);
|
||||
tr = vlib_add_trace (vm, node, c0, sizeof (*tr));
|
||||
tr->which = 0; /* to server */
|
||||
tr->error = error0;
|
||||
|
@ -460,7 +460,6 @@ dhcpv6_proxy_to_server_input (vlib_main_t * vm,
|
||||
{
|
||||
dhcpv6_proxy_trace_t *tr;
|
||||
|
||||
vlib_buffer_copy_trace_flag (vm, b0, ci0);
|
||||
tr = vlib_add_trace (vm, node, c0, sizeof (*tr));
|
||||
tr->which = 0; /* to server */
|
||||
tr->error = error0;
|
||||
|
@ -789,10 +789,7 @@ replicate_inline (vlib_main_t * vm,
|
||||
replicate_trace_t *t;
|
||||
|
||||
if (c0 != b0)
|
||||
{
|
||||
vlib_buffer_copy_trace_flag (vm, b0, ci0);
|
||||
VLIB_BUFFER_TRACE_TRAJECTORY_INIT (c0);
|
||||
}
|
||||
VLIB_BUFFER_TRACE_TRAJECTORY_INIT (c0);
|
||||
t = vlib_add_trace (vm, node, c0, sizeof (*t));
|
||||
t->rep_index = repi0;
|
||||
t->dpo = *dpo0;
|
||||
|
@ -250,9 +250,6 @@ VLIB_NODE_FN (l2flood_node) (vlib_main_t * vm,
|
||||
ethernet_header_t *h0;
|
||||
l2flood_trace_t *t;
|
||||
|
||||
if (c0 != b0)
|
||||
vlib_buffer_copy_trace_flag (vm, b0, ci0);
|
||||
|
||||
t = vlib_add_trace (vm, node, c0, sizeof (*t));
|
||||
h0 = vlib_buffer_get_current (c0);
|
||||
t->sw_if_index = sw_if_index0;
|
||||
@ -301,9 +298,6 @@ VLIB_NODE_FN (l2flood_node) (vlib_main_t * vm,
|
||||
ethernet_header_t *h0;
|
||||
l2flood_trace_t *t;
|
||||
|
||||
if (c0 != b0)
|
||||
vlib_buffer_copy_trace_flag (vm, b0, ci0);
|
||||
|
||||
t = vlib_add_trace (vm, node, c0, sizeof (*t));
|
||||
h0 = vlib_buffer_get_current (c0);
|
||||
t->sw_if_index = sw_if_index0;
|
||||
|
Reference in New Issue
Block a user