From 7dcc339ad4a4a7f7e1f039a8b2950c35665bd5c3 Mon Sep 17 00:00:00 2001 From: Florin Coras Date: Fri, 14 May 2021 09:22:20 -0700 Subject: tcp: remove ho lock Half-open sessions are allocated by main thread and cleaned up on main with timers. Type: improvement Signed-off-by: Florin Coras Change-Id: I37f000920a45908b62b5501ae9d54a88a9e4c609 --- src/vnet/tcp/tcp.c | 9 --------- src/vnet/tcp/tcp.h | 2 -- src/vnet/tcp/tcp_inlines.h | 2 -- 3 files changed, 13 deletions(-) diff --git a/src/vnet/tcp/tcp.c b/src/vnet/tcp/tcp.c index 16bf9451709..acb3868f419 100644 --- a/src/vnet/tcp/tcp.c +++ b/src/vnet/tcp/tcp.c @@ -189,11 +189,9 @@ static void tcp_half_open_connection_free (tcp_connection_t * tc) { tcp_main_t *tm = vnet_get_tcp_main (); - clib_spinlock_lock_if_init (&tm->half_open_lock); if (CLIB_DEBUG) clib_memset (tc, 0xFA, sizeof (*tc)); pool_put (tm->half_open_connections, tc); - clib_spinlock_unlock_if_init (&tm->half_open_lock); } /** @@ -818,7 +816,6 @@ tcp_session_open (transport_endpoint_cfg_t * rmt) /* * Create connection and send SYN */ - clib_spinlock_lock_if_init (&tm->half_open_lock); tc = tcp_half_open_connection_new (); ip_copy (&tc->c_rmt_ip, &rmt->ip, rmt->is_ip4); ip_copy (&tc->c_lcl_ip, &lcl_addr, rmt->is_ip4); @@ -836,7 +833,6 @@ tcp_session_open (transport_endpoint_cfg_t * rmt) tc->state = TCP_STATE_SYN_SENT; tcp_init_snd_vars (tc); tcp_send_syn (tc); - clib_spinlock_unlock_if_init (&tm->half_open_lock); return tc->c_c_index; } @@ -1526,11 +1522,6 @@ tcp_main_enable (vlib_main_t * vm) pool_init_fixed (tm->half_open_connections, tcp_cfg.preallocated_half_open_connections); - if (num_threads > 1) - { - clib_spinlock_init (&tm->half_open_lock); - } - tcp_initialize_iss_seed (tm); tm->bytes_per_buffer = vlib_buffer_get_default_data_size (vm); diff --git a/src/vnet/tcp/tcp.h b/src/vnet/tcp/tcp.h index a02a295e72b..2561e439794 100644 --- a/src/vnet/tcp/tcp.h +++ b/src/vnet/tcp/tcp.h @@ -221,8 +221,6 @@ typedef struct _tcp_main /** Dispatch table by state and flags */ tcp_lookup_dispatch_t dispatch_table[TCP_N_STATES][64]; - clib_spinlock_t half_open_lock; - /** Pool of half-open connections on which we've sent a SYN */ tcp_connection_t *half_open_connections; diff --git a/src/vnet/tcp/tcp_inlines.h b/src/vnet/tcp/tcp_inlines.h index a0121308008..68eb4b147fa 100644 --- a/src/vnet/tcp/tcp_inlines.h +++ b/src/vnet/tcp/tcp_inlines.h @@ -67,10 +67,8 @@ always_inline tcp_connection_t * tcp_half_open_connection_get (u32 conn_index) { tcp_connection_t *tc = 0; - clib_spinlock_lock_if_init (&tcp_main.half_open_lock); if (!pool_is_free_index (tcp_main.half_open_connections, conn_index)) tc = pool_elt_at_index (tcp_main.half_open_connections, conn_index); - clib_spinlock_unlock_if_init (&tcp_main.half_open_lock); return tc; } -- cgit 1.2.3-korg