summaryrefslogtreecommitdiffstats
path: root/src/vnet
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2017-11-02 18:14:17 -0400
committerFlorin Coras <fcoras@cisco.com>2017-11-02 18:39:18 -0400
commit29ca16f582d7ca3613a01b91cf209776183ccdae (patch)
treea3971b9e226e46f457e170389bb52c8bc78cc77d /src/vnet
parent774169bd95e1bbe3e27e602acbba88650db44972 (diff)
session/udp: init rw locks
Change-Id: I68152d7338ce0d7805e50ccf9e9046de02cfd206 Signed-off-by: Florin Coras <fcoras@cisco.com>
Diffstat (limited to 'src/vnet')
-rw-r--r--src/vnet/session/session.c7
-rw-r--r--src/vnet/udp/udp.c8
2 files changed, 14 insertions, 1 deletions
diff --git a/src/vnet/session/session.c b/src/vnet/session/session.c
index c214b81042f..d995eeb04a5 100644
--- a/src/vnet/session/session.c
+++ b/src/vnet/session/session.c
@@ -147,7 +147,6 @@ session_alloc_for_connection (transport_connection_t * tc)
s = session_alloc (thread_index);
s->session_type = session_type_from_proto_and_ip (tc->proto, tc->is_ip4);
s->session_state = SESSION_STATE_CONNECTING;
- s->thread_index = thread_index;
/* Attach transport to session and vice versa */
s->connection_index = tc->c_index;
@@ -166,6 +165,7 @@ session_alloc_and_init (segment_manager_t * sm, transport_connection_t * tc,
if (alloc_fifos && (rv = session_alloc_fifos (sm, s)))
{
session_free (s);
+ *ret_s = 0;
return rv;
}
@@ -1084,6 +1084,11 @@ session_manager_main_enable (vlib_main_t * vm)
_vec_len (smm->pending_event_vector[i]) = 0;
vec_validate (smm->pending_disconnects[i], 0);
_vec_len (smm->pending_disconnects[i]) = 0;
+ if (num_threads > 1)
+ {
+ clib_spinlock_init (&smm->peekers_readers_locks[i]);
+ clib_spinlock_init (&smm->peekers_write_locks[i]);
+ }
}
#if SESSION_DBG
diff --git a/src/vnet/udp/udp.c b/src/vnet/udp/udp.c
index c12e837a74a..70091655211 100644
--- a/src/vnet/udp/udp.c
+++ b/src/vnet/udp/udp.c
@@ -334,6 +334,7 @@ udp_init (vlib_main_t * vm)
u32 num_threads;
clib_error_t *error = 0;
ip_protocol_info_t *pi;
+ int i;
if ((error = vlib_call_init_function (vm, ip_main_init)))
return error;
@@ -367,6 +368,13 @@ udp_init (vlib_main_t * vm)
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]);
+ }
return error;
}