summaryrefslogtreecommitdiffstats
path: root/src/vlib/buffer.c
diff options
context:
space:
mode:
authorDamjan Marion <damarion@cisco.com>2022-06-01 00:45:18 +0200
committerBeno�t Ganne <bganne@cisco.com>2022-06-01 11:34:03 +0000
commit321bd106a64bdd6c051579f58e111f71c2c7e7d6 (patch)
tree4e5cb606b19a533d404f8dc60325c620ff6d1951 /src/vlib/buffer.c
parentdd2f12ba6ab952d9d66f4d9ba89ffde6309b1ff2 (diff)
vlib: add VLIB_NUM_WORKERS_CHANGE_FN() handler
Allows features to update their data structures after change in number of worker threads. Type: improvement Change-Id: Icd4d197e28608f5bbb1edd13eb624cd98e33cafe Signed-off-by: Damjan Marion <damarion@cisco.com>
Diffstat (limited to 'src/vlib/buffer.c')
-rw-r--r--src/vlib/buffer.c14
1 files changed, 4 insertions, 10 deletions
diff --git a/src/vlib/buffer.c b/src/vlib/buffer.c
index fbded6e8300..304d1abd8ea 100644
--- a/src/vlib/buffer.c
+++ b/src/vlib/buffer.c
@@ -636,25 +636,19 @@ VLIB_CLI_COMMAND (show_buffers_command, static) = {
/* *INDENT-ON* */
clib_error_t *
-vlib_buffer_worker_init (vlib_main_t * vm)
+vlib_buffer_num_workers_change (vlib_main_t *vm)
{
vlib_buffer_main_t *bm = vm->buffer_main;
vlib_buffer_pool_t *bp;
- /* *INDENT-OFF* */
vec_foreach (bp, bm->buffer_pools)
- {
- clib_spinlock_lock (&bp->lock);
- vec_validate_aligned (bp->threads, vlib_get_n_threads () - 1,
- CLIB_CACHE_LINE_BYTES);
- clib_spinlock_unlock (&bp->lock);
- }
- /* *INDENT-ON* */
+ vec_validate_aligned (bp->threads, vlib_get_n_threads () - 1,
+ CLIB_CACHE_LINE_BYTES);
return 0;
}
-VLIB_WORKER_INIT_FUNCTION (vlib_buffer_worker_init);
+VLIB_NUM_WORKERS_CHANGE_FN (vlib_buffer_num_workers_change);
static clib_error_t *
vlib_buffer_main_init_numa_alloc (struct vlib_main_t *vm, u32 numa_node,