diff options
author | Damjan Marion <damarion@cisco.com> | 2022-03-17 18:59:46 +0100 |
---|---|---|
committer | Damjan Marion <dmarion@me.com> | 2022-03-18 13:16:36 +0000 |
commit | 66d4cb5a217d556aa7bd2471f02a39badb6d5cd2 (patch) | |
tree | 53d4333bed2cdfc16e5e1d5858e6a70fab9bc1ca /src/vnet | |
parent | 05563c9a904b6bb862ba783dc3519c8415bf9cf5 (diff) |
vppinfra: refactor *_will_expand() functions
Type: refactor
Change-Id: I3625eacf9e04542ca8778df5d46075a8654642c7
Signed-off-by: Damjan Marion <damarion@cisco.com>
Diffstat (limited to 'src/vnet')
-rw-r--r-- | src/vnet/adj/adj.c | 4 | ||||
-rw-r--r-- | src/vnet/crypto/crypto.c | 3 | ||||
-rw-r--r-- | src/vnet/dpo/dpo.h | 2 | ||||
-rw-r--r-- | src/vnet/dpo/load_balance.c | 4 | ||||
-rw-r--r-- | src/vnet/fib/fib_entry.c | 3 | ||||
-rw-r--r-- | src/vnet/fib/fib_urpf_list.c | 3 | ||||
-rw-r--r-- | src/vnet/ip/ip_path_mtu.c | 4 | ||||
-rw-r--r-- | src/vnet/session/session.c | 5 | ||||
-rw-r--r-- | src/vnet/tls/tls.c | 3 | ||||
-rw-r--r-- | src/vnet/udp/udp.c | 4 |
10 files changed, 12 insertions, 23 deletions
diff --git a/src/vnet/adj/adj.c b/src/vnet/adj/adj.c index 1f25870ea89..2cb9ec43c00 100644 --- a/src/vnet/adj/adj.c +++ b/src/vnet/adj/adj.c @@ -69,14 +69,12 @@ ip_adjacency_t * adj_alloc (fib_protocol_t proto) { ip_adjacency_t *adj; - u8 need_barrier_sync = 0; + u8 need_barrier_sync = pool_get_will_expand (adj_pool); vlib_main_t *vm; vm = vlib_get_main(); ASSERT (vm->thread_index == 0); - pool_get_aligned_will_expand (adj_pool, need_barrier_sync, - CLIB_CACHE_LINE_BYTES); /* If the adj_pool will expand, stop the parade. */ if (need_barrier_sync) vlib_worker_thread_barrier_sync (vm); diff --git a/src/vnet/crypto/crypto.c b/src/vnet/crypto/crypto.c index 93fd9742766..1c724a346c2 100644 --- a/src/vnet/crypto/crypto.c +++ b/src/vnet/crypto/crypto.c @@ -431,8 +431,7 @@ vnet_crypto_key_add (vlib_main_t * vm, vnet_crypto_alg_t alg, u8 * data, if (!vnet_crypto_key_len_check (alg, length)) return ~0; - pool_get_aligned_will_expand (cm->keys, need_barrier_sync, - CLIB_CACHE_LINE_BYTES); + need_barrier_sync = pool_get_will_expand (cm->keys); /* If the cm->keys will expand, stop the parade. */ if (need_barrier_sync) vlib_worker_thread_barrier_sync (vm); diff --git a/src/vnet/dpo/dpo.h b/src/vnet/dpo/dpo.h index e9976c2dd87..470359df95c 100644 --- a/src/vnet/dpo/dpo.h +++ b/src/vnet/dpo/dpo.h @@ -543,7 +543,7 @@ dpo_get_next_node_by_type_and_proto (dpo_type_t child_type, #define dpo_pool_barrier_sync(VM,P,YESNO) \ do { \ - pool_get_aligned_will_expand ((P), YESNO, CLIB_CACHE_LINE_BYTES); \ + YESNO = pool_get_will_expand (P); \ \ if (YESNO) \ { \ diff --git a/src/vnet/dpo/load_balance.c b/src/vnet/dpo/load_balance.c index a212532dffd..4666c9a7ca1 100644 --- a/src/vnet/dpo/load_balance.c +++ b/src/vnet/dpo/load_balance.c @@ -100,8 +100,8 @@ load_balance_alloc_i (void) vlib_main_t *vm = vlib_get_main(); ASSERT (vm->thread_index == 0); - pool_get_aligned_will_expand (load_balance_pool, need_barrier_sync, - CLIB_CACHE_LINE_BYTES); + need_barrier_sync = pool_get_will_expand (load_balance_pool); + if (need_barrier_sync) vlib_worker_thread_barrier_sync (vm); diff --git a/src/vnet/fib/fib_entry.c b/src/vnet/fib/fib_entry.c index 6f579696f29..b78346ce45a 100644 --- a/src/vnet/fib/fib_entry.c +++ b/src/vnet/fib/fib_entry.c @@ -537,11 +537,10 @@ fib_entry_alloc (u32 fib_index, { fib_entry_t *fib_entry; fib_prefix_t *fep; - u8 need_barrier_sync = 0; + u8 need_barrier_sync = pool_get_will_expand (fib_entry_pool); vlib_main_t *vm = vlib_get_main(); ASSERT (vm->thread_index == 0); - pool_get_will_expand (fib_entry_pool, need_barrier_sync ); if (need_barrier_sync) vlib_worker_thread_barrier_sync (vm); diff --git a/src/vnet/fib/fib_urpf_list.c b/src/vnet/fib/fib_urpf_list.c index f9790b59031..55f3b8a526b 100644 --- a/src/vnet/fib/fib_urpf_list.c +++ b/src/vnet/fib/fib_urpf_list.c @@ -55,11 +55,10 @@ index_t fib_urpf_list_alloc_and_lock (void) { fib_urpf_list_t *urpf; - u8 need_barrier_sync = 0; + u8 need_barrier_sync = pool_get_will_expand (fib_urpf_list_pool); vlib_main_t *vm = vlib_get_main(); ASSERT (vm->thread_index == 0); - pool_get_will_expand (fib_urpf_list_pool, need_barrier_sync ); if (need_barrier_sync) vlib_worker_thread_barrier_sync (vm); diff --git a/src/vnet/ip/ip_path_mtu.c b/src/vnet/ip/ip_path_mtu.c index 84dd625c225..ccb57e1e352 100644 --- a/src/vnet/ip/ip_path_mtu.c +++ b/src/vnet/ip/ip_path_mtu.c @@ -298,11 +298,9 @@ static ip_pmtu_dpo_t * ip_pmtu_dpo_alloc (void) { vlib_main_t *vm = vlib_get_main (); - u8 need_barrier_sync = 0; + u8 need_barrier_sync = pool_get_will_expand (ip_pmtu_dpo_pool); ip_pmtu_dpo_t *ipm; - pool_get_aligned_will_expand (ip_pmtu_dpo_pool, need_barrier_sync, - sizeof (ip_pmtu_dpo_t)); if (need_barrier_sync) vlib_worker_thread_barrier_sync (vm); diff --git a/src/vnet/session/session.c b/src/vnet/session/session.c index 108fa361d26..2a5d13d57c5 100644 --- a/src/vnet/session/session.c +++ b/src/vnet/session/session.c @@ -202,9 +202,8 @@ session_alloc (u32 thread_index) { session_worker_t *wrk = &session_main.wrk[thread_index]; session_t *s; - u8 will_expand = 0; - pool_get_aligned_will_expand (wrk->sessions, will_expand, - CLIB_CACHE_LINE_BYTES); + u8 will_expand = pool_get_will_expand (wrk->sessions); + /* If we have peekers, let them finish */ if (PREDICT_FALSE (will_expand && vlib_num_workers ())) { diff --git a/src/vnet/tls/tls.c b/src/vnet/tls/tls.c index 54bb739e11d..becd29f20e0 100644 --- a/src/vnet/tls/tls.c +++ b/src/vnet/tls/tls.c @@ -115,11 +115,10 @@ u32 tls_ctx_half_open_alloc (void) { tls_main_t *tm = &tls_main; - u8 will_expand = 0; + u8 will_expand = pool_get_will_expand (tm->half_open_ctx_pool); tls_ctx_t *ctx; u32 ctx_index; - pool_get_aligned_will_expand (tm->half_open_ctx_pool, will_expand, 0); if (PREDICT_FALSE (will_expand && vlib_num_workers ())) { clib_rwlock_writer_lock (&tm->half_open_rwlock); diff --git a/src/vnet/udp/udp.c b/src/vnet/udp/udp.c index 98164b12705..b36ef562169 100644 --- a/src/vnet/udp/udp.c +++ b/src/vnet/udp/udp.c @@ -94,9 +94,7 @@ udp_connection_alloc (u32 thread_index) { udp_main_t *um = &udp_main; udp_connection_t *uc; - u32 will_expand = 0; - pool_get_aligned_will_expand (um->connections[thread_index], will_expand, - CLIB_CACHE_LINE_BYTES); + u32 will_expand = pool_get_will_expand (um->connections[thread_index]); if (PREDICT_FALSE (will_expand)) { |