summaryrefslogtreecommitdiffstats
path: root/src/vnet/udp
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2021-03-03 08:06:12 -0800
committerDave Barach <openvpp@barachs.net>2021-03-03 18:52:31 +0000
commit0ac5782e600097b66e6b06e0b9edc79651f3a4bd (patch)
tree9b3a3f5c5fbcfc2441b703be6e08b11dcac2004c /src/vnet/udp
parent78289162cee246d88d792946558d9004d347fd39 (diff)
udp: allocate rx lock only for non-connected
Type: improvement Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: Ib5395a51fbfb2123549f7c96534fa763b4669243
Diffstat (limited to 'src/vnet/udp')
-rw-r--r--src/vnet/udp/udp.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/vnet/udp/udp.c b/src/vnet/udp/udp.c
index 00d9ec104dd..1878d2ed083 100644
--- a/src/vnet/udp/udp.c
+++ b/src/vnet/udp/udp.c
@@ -116,7 +116,6 @@ udp_connection_alloc (u32 thread_index)
uc->c_c_index = uc - um->connections[thread_index];
uc->c_thread_index = thread_index;
uc->c_proto = TRANSPORT_PROTO_UDP;
- clib_spinlock_init (&uc->rx_lock);
return uc;
}
@@ -390,9 +389,14 @@ conn_alloc:
uc->mss = rmt->mss ? rmt->mss : udp_default_mtu (um, uc->c_is_ip4);
uc->flags |= UDP_CONN_F_OWNS_PORT;
if (rmt->transport_flags & TRANSPORT_CFG_F_CONNECTED)
- uc->flags |= UDP_CONN_F_CONNECTED;
+ {
+ uc->flags |= UDP_CONN_F_CONNECTED;
+ }
else
- uc->c_flags |= TRANSPORT_CONNECTION_F_CLESS;
+ {
+ clib_spinlock_init (&uc->rx_lock);
+ uc->c_flags |= TRANSPORT_CONNECTION_F_CLESS;
+ }
return uc->c_c_index;
}