aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/udp/udp.c
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2022-10-24 18:59:06 -0700
committerDave Barach <openvpp@barachs.net>2022-10-25 17:19:03 +0000
commit4c89b189b2c712894764837a78e0a532bfe7e12f (patch)
tree77b1a6dec9032e2a826f09e3a3a2df075ff720cb /src/vnet/udp/udp.c
parent1c29dfb7bbdddc3cdf8e2ed42c9d33f568466f7a (diff)
udp: use new wrk context for connections
Type: improvement Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: I9c4050f96c310f1e6eb2cae8d908c44968526c3c
Diffstat (limited to 'src/vnet/udp/udp.c')
-rw-r--r--src/vnet/udp/udp.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/vnet/udp/udp.c b/src/vnet/udp/udp.c
index 5e4b29f25f6..e6ee9d8b37d 100644
--- a/src/vnet/udp/udp.c
+++ b/src/vnet/udp/udp.c
@@ -92,14 +92,13 @@ udp_connection_share_port (u16 lcl_port, u8 is_ip4)
udp_connection_t *
udp_connection_alloc (u32 thread_index)
{
- udp_main_t *um = &udp_main;
+ udp_worker_t *wrk = udp_worker_get (thread_index);
udp_connection_t *uc;
- pool_get_aligned_safe (um->connections[thread_index], uc,
- CLIB_CACHE_LINE_BYTES);
+ pool_get_aligned_safe (wrk->connections, uc, CLIB_CACHE_LINE_BYTES);
clib_memset (uc, 0, sizeof (*uc));
- uc->c_c_index = uc - um->connections[thread_index];
+ uc->c_c_index = uc - wrk->connections;
uc->c_thread_index = thread_index;
uc->c_proto = TRANSPORT_PROTO_UDP;
return uc;
@@ -108,11 +107,12 @@ udp_connection_alloc (u32 thread_index)
void
udp_connection_free (udp_connection_t * uc)
{
- u32 thread_index = uc->c_thread_index;
+ udp_worker_t *wrk = udp_worker_get (uc->c_thread_index);
+
clib_spinlock_free (&uc->rx_lock);
if (CLIB_DEBUG)
clib_memset (uc, 0xFA, sizeof (*uc));
- pool_put (udp_main.connections[thread_index], uc);
+ pool_put (wrk->connections, uc);
}
static void
@@ -548,7 +548,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->wrk, num_threads - 1);
um->local_to_input_edge[UDP_IP4] =