diff options
author | Damjan Marion <damarion@cisco.com> | 2018-09-03 15:41:45 +0200 |
---|---|---|
committer | Damjan Marion <dmarion@me.com> | 2018-09-03 18:41:13 +0000 |
commit | 8e71529ea86018ab05c8cb77081512cbd2e413a7 (patch) | |
tree | 8f7124d85db7a8eed7847b96e3228b6575bf548b /src/vlib/buffer.c | |
parent | d5c70d556283794b3d63808879c7230b5eebaf95 (diff) |
Deprecate old buffer replication scheme
Change-Id: I1f54b994425c58776e1445c8d9fe142e7a644d3d
Signed-off-by: Damjan Marion <damarion@cisco.com>
Diffstat (limited to 'src/vlib/buffer.c')
-rw-r--r-- | src/vlib/buffer.c | 63 |
1 files changed, 14 insertions, 49 deletions
diff --git a/src/vlib/buffer.c b/src/vlib/buffer.c index 3f90f5a0860..a704efb40f4 100644 --- a/src/vlib/buffer.c +++ b/src/vlib/buffer.c @@ -573,50 +573,26 @@ recycle_or_free (vlib_main_t * vm, vlib_buffer_main_t * bm, u32 bi, { vlib_buffer_free_list_t *fl; vlib_buffer_free_list_index_t fi; - fl = vlib_buffer_get_buffer_free_list (vm, b, &fi); + u32 flags, next; - /* The only current use of this callback: - * multicast recycle */ - if (PREDICT_FALSE (fl->buffers_added_to_freelist_function != 0)) - { - int j; + fl = vlib_buffer_get_buffer_free_list (vm, b, &fi); - vlib_buffer_add_to_free_list (vm, fl, bi, - (b->flags & VLIB_BUFFER_RECYCLE) == 0); - for (j = 0; j < vec_len (vm->buffer_announce_list); j++) - { - if (fl == vm->buffer_announce_list[j]) - goto already_announced; - } - vec_add1 (vm->buffer_announce_list, fl); - already_announced: - ; - } - else + do { - if (PREDICT_TRUE ((b->flags & VLIB_BUFFER_RECYCLE) == 0)) + vlib_buffer_t *nb = vlib_get_buffer (vm, bi); + flags = nb->flags; + next = nb->next_buffer; + if (nb->n_add_refs) + nb->n_add_refs--; + else { - u32 flags, next; - - do - { - vlib_buffer_t *nb = vlib_get_buffer (vm, bi); - flags = nb->flags; - next = nb->next_buffer; - if (nb->n_add_refs) - nb->n_add_refs--; - else - { - vlib_buffer_validate_alloc_free (vm, &bi, 1, - VLIB_BUFFER_KNOWN_ALLOCATED); - vlib_buffer_add_to_free_list (vm, fl, bi, 1); - } - bi = next; - } - while (follow_buffer_next && (flags & VLIB_BUFFER_NEXT_PRESENT)); - + vlib_buffer_validate_alloc_free (vm, &bi, 1, + VLIB_BUFFER_KNOWN_ALLOCATED); + vlib_buffer_add_to_free_list (vm, fl, bi, 1); } + bi = next; } + while (follow_buffer_next && (flags & VLIB_BUFFER_NEXT_PRESENT)); } static_always_inline void @@ -673,17 +649,6 @@ vlib_buffer_free_inline (vlib_main_t * vm, recycle_or_free (vm, bm, buffers[i], b0, follow_buffer_next); i++; } - - if (vec_len (vm->buffer_announce_list)) - { - vlib_buffer_free_list_t *fl; - for (i = 0; i < vec_len (vm->buffer_announce_list); i++) - { - fl = vm->buffer_announce_list[i]; - fl->buffers_added_to_freelist_function (vm, fl); - } - _vec_len (vm->buffer_announce_list) = 0; - } } static void |