aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/session/session_api.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/vnet/session/session_api.c')
-rwxr-xr-xsrc/vnet/session/session_api.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/src/vnet/session/session_api.c b/src/vnet/session/session_api.c
index 7d3ff31031d..d37b3c995d0 100755
--- a/src/vnet/session/session_api.c
+++ b/src/vnet/session/session_api.c
@@ -79,20 +79,24 @@ session_send_fds (vl_api_registration_t * reg, int fds[], int n_fds)
}
static int
-send_add_segment_callback (u32 api_client_index, const ssvm_private_t * sp)
+send_add_segment_callback (u32 api_client_index, u64 segment_handle)
{
int fds[SESSION_N_FD_TYPE], n_fds = 0;
vl_api_map_another_segment_t *mp;
+ svm_fifo_segment_private_t *fs;
vl_api_registration_t *reg;
+ ssvm_private_t *sp;
u8 fd_flags = 0;
reg = vl_mem_api_client_index_to_registration (api_client_index);
if (!reg)
{
- clib_warning ("no registration: %u", api_client_index);
+ clib_warning ("no api registration for client: %u", api_client_index);
return -1;
}
+ fs = segment_manager_get_segment_w_handle (segment_handle);
+ sp = &fs->ssvm;
if (ssvm_type (sp) == SSVM_SEGMENT_MEMFD)
{
if (vl_api_registration_file_index (reg) == VL_API_INVALID_FI)
@@ -111,6 +115,7 @@ send_add_segment_callback (u32 api_client_index, const ssvm_private_t * sp)
mp->_vl_msg_id = clib_host_to_net_u16 (VL_API_MAP_ANOTHER_SEGMENT);
mp->segment_size = sp->ssvm_size;
mp->fd_flags = fd_flags;
+ mp->segment_handle = clib_host_to_net_u64 (segment_handle);
strncpy ((char *) mp->segment_name, (char *) sp->name,
sizeof (mp->segment_name) - 1);
@@ -123,7 +128,7 @@ send_add_segment_callback (u32 api_client_index, const ssvm_private_t * sp)
}
static int
-send_del_segment_callback (u32 api_client_index, const ssvm_private_t * fs)
+send_del_segment_callback (u32 api_client_index, u64 segment_handle)
{
vl_api_unmap_segment_t *mp;
vl_api_registration_t *reg;
@@ -138,9 +143,7 @@ send_del_segment_callback (u32 api_client_index, const ssvm_private_t * fs)
mp = vl_mem_api_alloc_as_if_client_w_reg (reg, sizeof (*mp));
clib_memset (mp, 0, sizeof (*mp));
mp->_vl_msg_id = clib_host_to_net_u16 (VL_API_UNMAP_SEGMENT);
- strncpy ((char *) mp->segment_name, (char *) fs->name,
- sizeof (mp->segment_name) - 1);
-
+ mp->segment_handle = clib_host_to_net_u64 (segment_handle);
vl_msg_api_send_shmem (reg->vl_input_queue, (u8 *) & mp);
return 0;
@@ -434,6 +437,7 @@ mq_send_session_accepted_cb (stream_session_t * s)
mp->context = app->app_index;
mp->server_rx_fifo = pointer_to_uword (s->server_rx_fifo);
mp->server_tx_fifo = pointer_to_uword (s->server_tx_fifo);
+ mp->segment_handle = session_segment_handle (s);
if (session_has_transport (s))
{
@@ -589,6 +593,7 @@ mq_send_session_connected_cb (u32 app_wrk_index, u32 api_context,
evt->event_type = SESSION_CTRL_EVT_CONNECTED;
mp = (session_connected_msg_t *) evt->data;
mp->context = api_context;
+ mp->segment_handle = session_segment_handle (s);
if (is_fail)
goto done;
@@ -1383,6 +1388,7 @@ done:
REPLY_MACRO2 (VL_API_APP_WORKER_ADD_DEL_REPLY, ({
rmp->is_add = mp->is_add;
rmp->wrk_index = clib_host_to_net_u32 (args.wrk_map_index);
+ rmp->segment_handle = clib_host_to_net_u64 (args.segment_handle);
if (!rv && mp->is_add)
{
if (vec_len (args.segment->name))