aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2017-11-30 16:07:39 -0500
committerDave Wallace <dwallacelf@gmail.com>2017-12-01 17:50:54 +0000
commit7a2e1bd6c7137552399d7e0cfb414e0d59b3f98f (patch)
tree55fbffa431362434228436c7712ae19731774df3
parent7a64019a768438cfca4cc9e34d9d8e4c34f54d47 (diff)
session: allocate cb messages from client ring
Change-Id: Ib644a1840c5f24203b6968561f467fbe5e255055 Signed-off-by: Florin Coras <fcoras@cisco.com>
-rw-r--r--src/vlibmemory/memory_shared.c2
-rwxr-xr-xsrc/vnet/session/session_api.c10
2 files changed, 7 insertions, 5 deletions
diff --git a/src/vlibmemory/memory_shared.c b/src/vlibmemory/memory_shared.c
index 021c54ef953..7af2433b44e 100644
--- a/src/vlibmemory/memory_shared.c
+++ b/src/vlibmemory/memory_shared.c
@@ -60,6 +60,8 @@ vl_msg_api_alloc_internal (int nbytes, int pool, int may_return_null)
nbytes += 4;
#endif
+ ASSERT (pool == 0 || vlib_get_thread_index () == 0);
+
if (shmem_hdr == 0)
{
clib_warning ("shared memory header NULL");
diff --git a/src/vnet/session/session_api.c b/src/vnet/session/session_api.c
index c54e635d534..7f1e69b058e 100755
--- a/src/vnet/session/session_api.c
+++ b/src/vnet/session/session_api.c
@@ -69,7 +69,7 @@ send_add_segment_callback (u32 api_client_index, const u8 * segment_name,
if (!q)
return -1;
- mp = vl_msg_api_alloc (sizeof (*mp));
+ mp = vl_msg_api_alloc_as_if_client (sizeof (*mp));
memset (mp, 0, sizeof (*mp));
mp->_vl_msg_id = clib_host_to_net_u16 (VL_API_MAP_ANOTHER_SEGMENT);
mp->segment_size = segment_size;
@@ -97,7 +97,7 @@ send_session_accept_callback (stream_session_t * s)
if (!q)
return -1;
- mp = vl_msg_api_alloc (sizeof (*mp));
+ mp = vl_msg_api_alloc_as_if_client (sizeof (*mp));
memset (mp, 0, sizeof (*mp));
mp->_vl_msg_id = clib_host_to_net_u16 (VL_API_ACCEPT_SESSION);
@@ -140,7 +140,7 @@ send_session_disconnect_callback (stream_session_t * s)
if (!q)
return;
- mp = vl_msg_api_alloc (sizeof (*mp));
+ mp = vl_msg_api_alloc_as_if_client (sizeof (*mp));
memset (mp, 0, sizeof (*mp));
mp->_vl_msg_id = clib_host_to_net_u16 (VL_API_DISCONNECT_SESSION);
mp->handle = session_handle (s);
@@ -159,7 +159,7 @@ send_session_reset_callback (stream_session_t * s)
if (!q)
return;
- mp = vl_msg_api_alloc (sizeof (*mp));
+ mp = vl_msg_api_alloc_as_if_client (sizeof (*mp));
memset (mp, 0, sizeof (*mp));
mp->_vl_msg_id = clib_host_to_net_u16 (VL_API_RESET_SESSION);
mp->handle = session_handle (s);
@@ -182,7 +182,7 @@ send_session_connected_callback (u32 app_index, u32 api_context,
if (!q)
return -1;
- mp = vl_msg_api_alloc (sizeof (*mp));
+ mp = vl_msg_api_alloc_as_if_client (sizeof (*mp));
mp->_vl_msg_id = clib_host_to_net_u16 (VL_API_CONNECT_SESSION_REPLY);
mp->context = api_context;