summaryrefslogtreecommitdiffstats
path: root/src/vnet/udp/udp.c
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2022-03-18 12:50:03 -0700
committerDamjan Marion <dmarion@me.com>2022-04-04 22:30:48 +0000
commita2b358b1faf6e762e1d29a931d83c7735ac9a77d (patch)
tree23e6c4feea3f1abd5aa26400eb90873978f328cd /src/vnet/udp/udp.c
parentb01873208bd6201e83f806699ad11dfb5ee2939e (diff)
udp: use pool safe reallocs
Type: improvement Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: I5bd0b300af07424d1ce4807fa0b17e375001f089
Diffstat (limited to 'src/vnet/udp/udp.c')
-rw-r--r--src/vnet/udp/udp.c29
1 files changed, 3 insertions, 26 deletions
diff --git a/src/vnet/udp/udp.c b/src/vnet/udp/udp.c
index d2a2b6323f0..43391f9f4e5 100644
--- a/src/vnet/udp/udp.c
+++ b/src/vnet/udp/udp.c
@@ -94,22 +94,10 @@ udp_connection_alloc (u32 thread_index)
{
udp_main_t *um = &udp_main;
udp_connection_t *uc;
- u32 will_expand = pool_get_will_expand (um->connections[thread_index]);
- if (PREDICT_FALSE (will_expand))
- {
- clib_spinlock_lock_if_init (&udp_main.peekers_write_locks
- [thread_index]);
- pool_get_aligned (udp_main.connections[thread_index], uc,
- CLIB_CACHE_LINE_BYTES);
- clib_spinlock_unlock_if_init (&udp_main.peekers_write_locks
- [thread_index]);
- }
- else
- {
- pool_get_aligned (um->connections[thread_index], uc,
- CLIB_CACHE_LINE_BYTES);
- }
+ pool_get_aligned_safe (um->connections[thread_index], uc,
+ CLIB_CACHE_LINE_BYTES);
+
clib_memset (uc, 0, sizeof (*uc));
uc->c_c_index = uc - um->connections[thread_index];
uc->c_thread_index = thread_index;
@@ -502,7 +490,6 @@ udp_init (vlib_main_t * vm)
vlib_thread_main_t *tm = vlib_get_thread_main ();
u32 num_threads;
ip_protocol_info_t *pi;
- int i;
/*
* Registrations
@@ -527,16 +514,6 @@ udp_init (vlib_main_t * vm)
num_threads = 1 /* main thread */ + tm->n_threads;
vec_validate (um->connections, num_threads - 1);
- vec_validate (um->connection_peekers, num_threads - 1);
- vec_validate (um->peekers_readers_locks, num_threads - 1);
- vec_validate (um->peekers_write_locks, num_threads - 1);
-
- if (num_threads > 1)
- for (i = 0; i < num_threads; i++)
- {
- clib_spinlock_init (&um->peekers_readers_locks[i]);
- clib_spinlock_init (&um->peekers_write_locks[i]);
- }
um->local_to_input_edge[UDP_IP4] =
vlib_node_add_next (vm, udp4_local_node.index, udp4_input_node.index);