diff options
-rw-r--r-- | src/vnet/udp/udp.c | 2 | ||||
-rw-r--r-- | src/vnet/udp/udp.h | 2 | ||||
-rw-r--r-- | src/vnet/udp/udp_input.c | 6 |
3 files changed, 8 insertions, 2 deletions
diff --git a/src/vnet/udp/udp.c b/src/vnet/udp/udp.c index 1d05e02b2ab..00d9ec104dd 100644 --- a/src/vnet/udp/udp.c +++ b/src/vnet/udp/udp.c @@ -124,6 +124,7 @@ void udp_connection_free (udp_connection_t * uc) { u32 thread_index = 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); @@ -222,6 +223,7 @@ udp_session_unbind (u32 listener_index) listener = udp_listener_get (listener_index); udp_connection_unregister_port (clib_net_to_host_u16 (listener->c_lcl_port), listener->c_is_ip4); + clib_spinlock_free (&listener->rx_lock); pool_put (um->listener_pool, listener); return 0; } diff --git a/src/vnet/udp/udp.h b/src/vnet/udp/udp.h index 1494b33a8c3..d0e3bf3015d 100644 --- a/src/vnet/udp/udp.h +++ b/src/vnet/udp/udp.h @@ -218,6 +218,8 @@ udp_connection_clone_safe (u32 connection_index, u32 thread_index) new_c->c_thread_index = current_thread_index; new_c->c_c_index = udp_connection_index (new_c); new_c->c_fib_index = old_c->c_fib_index; + /* Assume cloned sessions don't need lock */ + new_c->rx_lock = 0; return new_c; } diff --git a/src/vnet/udp/udp_input.c b/src/vnet/udp/udp_input.c index 523ab029bd4..c76c1b796bd 100644 --- a/src/vnet/udp/udp_input.c +++ b/src/vnet/udp/udp_input.c @@ -134,7 +134,8 @@ udp_connection_enqueue (udp_connection_t * uc0, session_t * s0, { int wrote0; - clib_spinlock_lock (&uc0->rx_lock); + if (!(uc0->flags & UDP_CONN_F_CONNECTED)) + clib_spinlock_lock (&uc0->rx_lock); if (svm_fifo_max_enqueue_prod (s0->rx_fifo) < hdr0->data_length + sizeof (session_dgram_hdr_t)) @@ -163,7 +164,8 @@ udp_connection_enqueue (udp_connection_t * uc0, session_t * s0, unlock_rx_lock: - clib_spinlock_unlock (&uc0->rx_lock); + if (!(uc0->flags & UDP_CONN_F_CONNECTED)) + clib_spinlock_unlock (&uc0->rx_lock); } always_inline session_t * |