aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/plugins/unittest/session_test.c4
-rw-r--r--src/svm/svm_fifo.c1
-rw-r--r--src/svm/svm_fifo.h2
-rw-r--r--src/svm/svm_fifo_segment.c4
-rw-r--r--src/tests/vnet/session/udp_echo.c22
-rw-r--r--src/vcl/vcl_bapi.c3
-rw-r--r--src/vnet/session-apps/echo_client.c2
-rw-r--r--src/vnet/session-apps/echo_server.c2
-rw-r--r--src/vnet/session-apps/http_server.c2
-rw-r--r--src/vnet/session-apps/proxy.c2
-rw-r--r--src/vnet/session/application.c19
-rw-r--r--src/vnet/session/application.h10
-rw-r--r--src/vnet/session/application_interface.h2
-rw-r--r--src/vnet/session/segment_manager.c42
-rw-r--r--src/vnet/session/segment_manager.h14
-rw-r--r--src/vnet/session/session.api11
-rw-r--r--src/vnet/session/session.h8
-rwxr-xr-xsrc/vnet/session/session_api.c18
-rw-r--r--src/vnet/tls/tls.c4
19 files changed, 122 insertions, 50 deletions
diff --git a/src/plugins/unittest/session_test.c b/src/plugins/unittest/session_test.c
index c1622d17fa2..5a3c9fbc35e 100644
--- a/src/plugins/unittest/session_test.c
+++ b/src/plugins/unittest/session_test.c
@@ -63,14 +63,14 @@ dummy_session_connected_callback (u32 app_index, u32 api_context,
static u32 dummy_segment_count;
int
-dummy_add_segment_callback (u32 client_index, const ssvm_private_t * fs)
+dummy_add_segment_callback (u32 client_index, u64 segment_handle)
{
dummy_segment_count = 1;
return 0;
}
int
-dummy_del_segment_callback (u32 client_index, const ssvm_private_t * fs)
+dummy_del_segment_callback (u32 client_index, u64 segment_handle)
{
dummy_segment_count = 0;
return 0;
diff --git a/src/svm/svm_fifo.c b/src/svm/svm_fifo.c
index 4397ef8413e..e7a1188d591 100644
--- a/src/svm/svm_fifo.c
+++ b/src/svm/svm_fifo.c
@@ -218,6 +218,7 @@ svm_fifo_create (u32 data_size_in_bytes)
f->nitems = data_size_in_bytes;
f->ooos_list_head = OOO_SEGMENT_INVALID_INDEX;
f->ct_session_index = SVM_FIFO_INVALID_SESSION_INDEX;
+ f->segment_index = SVM_FIFO_INVALID_INDEX;
f->refcnt = 1;
return (f);
}
diff --git a/src/svm/svm_fifo.h b/src/svm/svm_fifo.h
index 791b513a4a6..9bba85fddf4 100644
--- a/src/svm/svm_fifo.h
+++ b/src/svm/svm_fifo.h
@@ -39,6 +39,7 @@ format_function_t format_ooo_list;
#define SVM_FIFO_TRACE (0)
#define OOO_SEGMENT_INVALID_INDEX ((u32)~0)
#define SVM_FIFO_INVALID_SESSION_INDEX ((u32)~0)
+#define SVM_FIFO_INVALID_INDEX ((u32)~0)
typedef struct
{
@@ -61,6 +62,7 @@ typedef struct _svm_fifo
u8 master_thread_index;
u8 client_thread_index;
u32 segment_manager;
+ u32 segment_index;
u32 ct_session_index; /**< Local session index for vpp */
CLIB_CACHE_LINE_ALIGN_MARK (end_shared);
u32 head;
diff --git a/src/svm/svm_fifo_segment.c b/src/svm/svm_fifo_segment.c
index a42225c8345..6cb402f1a6b 100644
--- a/src/svm/svm_fifo_segment.c
+++ b/src/svm/svm_fifo_segment.c
@@ -337,7 +337,7 @@ svm_fifo_segment_delete (svm_fifo_segment_private_t * s)
* Allocate fifo in svm segment
*/
svm_fifo_t *
-svm_fifo_segment_alloc_fifo (svm_fifo_segment_private_t * s,
+svm_fifo_segment_alloc_fifo (svm_fifo_segment_private_t * fs,
u32 data_size_in_bytes,
svm_fifo_segment_freelist_t list_index)
{
@@ -361,7 +361,7 @@ svm_fifo_segment_alloc_fifo (svm_fifo_segment_private_t * s,
freelist_index = max_log2 (data_size_in_bytes)
- max_log2 (FIFO_SEGMENT_MIN_FIFO_SIZE);
- sh = s->ssvm.sh;
+ sh = fs->ssvm.sh;
ssvm_lock_non_recursive (sh, 1);
fsh = (svm_fifo_segment_header_t *) sh->opaque[0];
diff --git a/src/tests/vnet/session/udp_echo.c b/src/tests/vnet/session/udp_echo.c
index 3c928965c02..ea68ee162d1 100644
--- a/src/tests/vnet/session/udp_echo.c
+++ b/src/tests/vnet/session/udp_echo.c
@@ -915,7 +915,6 @@ vl_api_map_another_segment_t_handler (vl_api_map_another_segment_t * mp)
udp_echo_main_t *utm = &udp_echo_main;
svm_fifo_segment_create_args_t _a, *a = &_a;
svm_fifo_segment_private_t *seg;
- u8 *seg_name;
int rv;
clib_memset (a, 0, sizeof (*a));
@@ -932,9 +931,8 @@ vl_api_map_another_segment_t_handler (vl_api_map_another_segment_t * mp)
seg = svm_fifo_segment_get_segment (a->new_segment_indices[0]);
clib_warning ("Mapped new segment '%s' size %d", seg->ssvm.name,
seg->ssvm.ssvm_size);
- seg_name = format (0, "%s", (char *) mp->segment_name);
- hash_set_mem (utm->segments_table, seg_name, a->new_segment_indices[0]);
- vec_free (seg_name);
+ hash_set (utm->segments_table, clib_net_to_host_u64 (mp->segment_handle),
+ a->new_segment_indices[0]);
}
static void
@@ -942,22 +940,19 @@ vl_api_unmap_segment_t_handler (vl_api_unmap_segment_t * mp)
{
udp_echo_main_t *utm = &udp_echo_main;
svm_fifo_segment_private_t *seg;
- u64 *seg_indexp;
- u8 *seg_name;
+ u64 *seg_indexp, segment_handle;
-
- seg_name = format (0, "%s", mp->segment_name);
- seg_indexp = hash_get_mem (utm->segments_table, seg_name);
+ segment_handle = clib_net_to_host_u64 (mp->segment_handle);
+ seg_indexp = hash_get (utm->segments_table, segment_handle);
if (!seg_indexp)
{
- clib_warning ("segment not mapped: %s", seg_name);
+ clib_warning ("segment not mapped: %s", segment_handle);
return;
}
- hash_unset_mem (utm->segments_table, seg_name);
+ hash_unset (utm->segments_table, segment_handle);
seg = svm_fifo_segment_get_segment ((u32) seg_indexp[0]);
svm_fifo_segment_delete (seg);
- clib_warning ("Unmapped segment '%s'", seg_name);
- vec_free (seg_name);
+ clib_warning ("Unmapped segment '%s'", segment_handle);
}
static void
@@ -1228,7 +1223,6 @@ main (int argc, char **argv)
utm->session_index_by_vpp_handles = hash_create (0, sizeof (uword));
utm->my_pid = getpid ();
utm->configured_segment_size = 1 << 20;
- utm->segments_table = hash_create_vec (0, sizeof (u8), sizeof (u64));
utm->have_return = 1;
utm->bytes_to_send = 1024;
utm->fifo_size = 128 << 10;
diff --git a/src/vcl/vcl_bapi.c b/src/vcl/vcl_bapi.c
index 93ba0ab6c4d..7f3a5741af3 100644
--- a/src/vcl/vcl_bapi.c
+++ b/src/vcl/vcl_bapi.c
@@ -244,7 +244,8 @@ vl_api_unmap_segment_t_handler (vl_api_unmap_segment_t * mp)
* XXX - have sessionID by handle hash currently
*/
- VDBG (1, "Unmapped segment '%s'", mp->segment_name);
+ VDBG (1, "Unmapped segment '%s'",
+ clib_net_to_host_u64 (mp->segment_handle));
}
static void
diff --git a/src/vnet/session-apps/echo_client.c b/src/vnet/session-apps/echo_client.c
index faf8521ce8c..51a85c068f8 100644
--- a/src/vnet/session-apps/echo_client.c
+++ b/src/vnet/session-apps/echo_client.c
@@ -483,7 +483,7 @@ echo_clients_rx_callback (stream_session_t * s)
}
int
-echo_client_add_segment_callback (u32 client_index, const ssvm_private_t * sp)
+echo_client_add_segment_callback (u32 client_index, u64 segment_handle)
{
/* New heaps may be added */
return 0;
diff --git a/src/vnet/session-apps/echo_server.c b/src/vnet/session-apps/echo_server.c
index a4afc5d512f..e79e8380fe5 100644
--- a/src/vnet/session-apps/echo_server.c
+++ b/src/vnet/session-apps/echo_server.c
@@ -96,7 +96,7 @@ echo_server_session_connected_callback (u32 app_index, u32 api_context,
}
int
-echo_server_add_segment_callback (u32 client_index, const ssvm_private_t * sp)
+echo_server_add_segment_callback (u32 client_index, u64 segment_handle)
{
/* New heaps may be added */
return 0;
diff --git a/src/vnet/session-apps/http_server.c b/src/vnet/session-apps/http_server.c
index 79c2d4a7bfc..37441bb2188 100644
--- a/src/vnet/session-apps/http_server.c
+++ b/src/vnet/session-apps/http_server.c
@@ -458,7 +458,7 @@ http_server_session_connected_callback (u32 app_index, u32 api_context,
}
static int
-http_server_add_segment_callback (u32 client_index, const ssvm_private_t * sp)
+http_server_add_segment_callback (u32 client_index, u64 segment_handle)
{
clib_warning ("called...");
return -1;
diff --git a/src/vnet/session-apps/proxy.c b/src/vnet/session-apps/proxy.c
index 0b2baa7697c..06c095440bc 100644
--- a/src/vnet/session-apps/proxy.c
+++ b/src/vnet/session-apps/proxy.c
@@ -176,7 +176,7 @@ proxy_connected_callback (u32 app_index, u32 api_context,
}
static int
-proxy_add_segment_callback (u32 client_index, const ssvm_private_t * sp)
+proxy_add_segment_callback (u32 client_index, u64 segment_handle)
{
clib_warning ("called...");
return -1;
diff --git a/src/vnet/session/application.c b/src/vnet/session/application.c
index 380c960bdaf..69f33290a73 100644
--- a/src/vnet/session/application.c
+++ b/src/vnet/session/application.c
@@ -924,6 +924,7 @@ vnet_app_worker_add_del (vnet_app_worker_add_del_args_t * a)
sm = segment_manager_get (app_wrk->first_segment_manager);
fs = segment_manager_get_segment_w_lock (sm, 0);
a->segment = &fs->ssvm;
+ a->segment_handle = segment_manager_segment_handle (sm, fs);
segment_manager_segment_reader_unlock (sm);
a->evt_q = app_wrk->event_queue;
a->wrk_map_index = app_wrk->wrk_map_index;
@@ -1007,11 +1008,12 @@ application_use_mq_for_ctrl (application_t * app)
* Send an API message to the external app, to map new segment
*/
int
-app_worker_add_segment_notify (u32 app_wrk_index, ssvm_private_t * fs)
+app_worker_add_segment_notify (u32 app_wrk_index, u64 segment_handle)
{
app_worker_t *app_wrk = app_worker_get (app_wrk_index);
application_t *app = application_get (app_wrk->app_index);
- return app->cb_fns.add_segment_callback (app_wrk->api_client_index, fs);
+ return app->cb_fns.add_segment_callback (app_wrk->api_client_index,
+ segment_handle);
}
u32
@@ -1597,6 +1599,7 @@ application_local_session_connect (app_worker_t * client_wrk,
segment_manager_t *sm;
local_session_t *ls;
svm_msg_q_t *sq, *cq;
+ u64 segment_handle;
ls = application_local_session_alloc (server_wrk);
server = application_get (server_wrk->app_index);
@@ -1660,8 +1663,9 @@ application_local_session_connect (app_worker_t * client_wrk,
ls->listener_session_type = ll->session_type;
ls->session_state = SESSION_STATE_READY;
+ segment_handle = segment_manager_segment_handle (sm, seg);
if ((rv = server->cb_fns.add_segment_callback (server_wrk->api_client_index,
- &seg->ssvm)))
+ segment_handle)))
{
clib_warning ("failed to notify server of new segment");
segment_manager_segment_reader_unlock (sm);
@@ -1706,6 +1710,7 @@ application_local_session_connect_notify (local_session_t * ls)
segment_manager_t *sm;
application_t *client;
int rv, is_fail = 0;
+ u64 segment_handle;
uword client_key;
client_wrk = app_worker_get (ls->client_wrk_index);
@@ -1714,8 +1719,9 @@ application_local_session_connect_notify (local_session_t * ls)
sm = application_get_local_segment_manager_w_session (server_wrk, ls);
seg = segment_manager_get_segment_w_lock (sm, ls->svm_segment_index);
+ segment_handle = segment_manager_segment_handle (sm, seg);
if ((rv = client->cb_fns.add_segment_callback (client_wrk->api_client_index,
- &seg->ssvm)))
+ segment_handle)))
{
clib_warning ("failed to notify client %u of new segment",
ls->client_wrk_index);
@@ -1770,13 +1776,14 @@ application_local_session_cleanup (app_worker_t * client_wrk,
if (!has_transport)
{
application_t *server = application_get (server_wrk->app_index);
+ u64 segment_handle = segment_manager_segment_handle (sm, seg);
server->cb_fns.del_segment_callback (server_wrk->api_client_index,
- &seg->ssvm);
+ segment_handle);
if (client_wrk)
{
application_t *client = application_get (client_wrk->app_index);
client->cb_fns.del_segment_callback (client_wrk->api_client_index,
- &seg->ssvm);
+ segment_handle);
}
segment_manager_del_segment (sm, seg);
}
diff --git a/src/vnet/session/application.h b/src/vnet/session/application.h
index 0ac2b25e081..e33f2ff797e 100644
--- a/src/vnet/session/application.h
+++ b/src/vnet/session/application.h
@@ -31,11 +31,10 @@
typedef struct _stream_session_cb_vft
{
/** Notify server of new segment */
- int (*add_segment_callback) (u32 api_client_index,
- const ssvm_private_t * ssvm_seg);
+ int (*add_segment_callback) (u32 api_client_index, u64 segment_handle);
+
/** Notify server of new segment */
- int (*del_segment_callback) (u32 api_client_index,
- const ssvm_private_t * ssvm_seg);
+ int (*del_segment_callback) (u32 api_client_index, u64 segment_handle);
/** Notify server of newly accepted session */
int (*session_accept_callback) (stream_session_t * new_session);
@@ -212,6 +211,7 @@ typedef struct _vnet_app_worker_add_del_args
u32 wrk_map_index; /**< Index to delete or return value if add */
u32 api_client_index; /**< Binary API client index */
ssvm_private_t *segment; /**< First segment in segment manager */
+ u64 segment_handle; /**< Handle for the segment */
svm_msg_q_t *evt_q; /**< Worker message queue */
u8 is_add; /**< Flag set if addition */
} vnet_app_worker_add_del_args_t;
@@ -232,7 +232,7 @@ segment_manager_t *app_worker_get_listen_segment_manager (app_worker_t *,
stream_session_t *);
segment_manager_t *app_worker_get_connect_segment_manager (app_worker_t *);
int app_worker_alloc_connects_segment_manager (app_worker_t * app);
-int app_worker_add_segment_notify (u32 app_or_wrk, ssvm_private_t * fs);
+int app_worker_add_segment_notify (u32 app_or_wrk, u64 segment_handle);
u32 app_worker_n_listeners (app_worker_t * app);
stream_session_t *app_worker_first_listener (app_worker_t * app,
u8 fib_proto,
diff --git a/src/vnet/session/application_interface.h b/src/vnet/session/application_interface.h
index 10edfdef35a..ecd99d8755b 100644
--- a/src/vnet/session/application_interface.h
+++ b/src/vnet/session/application_interface.h
@@ -234,6 +234,7 @@ typedef struct session_accepted_msg_
u64 handle;
u64 server_rx_fifo;
u64 server_tx_fifo;
+ u64 segment_handle;
u64 vpp_event_queue_address;
u64 server_event_queue_address;
u64 client_event_queue_address;
@@ -260,6 +261,7 @@ typedef struct session_connected_msg_
u64 handle;
u64 server_rx_fifo;
u64 server_tx_fifo;
+ u64 segment_handle;
u64 vpp_event_queue_address;
u64 client_event_queue_address;
u64 server_event_queue_address;
diff --git a/src/vnet/session/segment_manager.c b/src/vnet/session/segment_manager.c
index 6386645a974..47704a7178b 100644
--- a/src/vnet/session/segment_manager.c
+++ b/src/vnet/session/segment_manager.c
@@ -117,6 +117,36 @@ segment_manager_get_segment (segment_manager_t * sm, u32 segment_index)
return pool_elt_at_index (sm->segments, segment_index);
}
+u64
+segment_manager_segment_handle (segment_manager_t * sm,
+ svm_fifo_segment_private_t * segment)
+{
+ u32 segment_index = segment_manager_segment_index (sm, segment);
+ return (((u64) segment_manager_index (sm) << 32) | segment_index);
+}
+
+void
+segment_manager_parse_segment_handle (u64 segment_handle, u32 * sm_index,
+ u32 * segment_index)
+{
+ *sm_index = segment_handle >> 32;
+ *segment_index = segment_handle & 0xFFFFFFFF;
+}
+
+svm_fifo_segment_private_t *
+segment_manager_get_segment_w_handle (u64 segment_handle)
+{
+ u32 sm_index, segment_index;
+ segment_manager_t *sm;
+
+ segment_manager_parse_segment_handle (segment_handle, &sm_index,
+ &segment_index);
+ sm = segment_manager_get (sm_index);
+ if (!sm || pool_is_free_index (sm->segments, segment_index))
+ return 0;
+ return pool_elt_at_index (sm->segments, segment_index);
+}
+
/**
* Reads a segment from the segment manager's pool and acquires reader lock
*
@@ -484,6 +514,7 @@ segment_manager_alloc_session_fifos (segment_manager_t * sm,
int alloc_fail = 1, rv = 0, new_fs_index;
segment_manager_properties_t *props;
u8 added_a_segment = 0;
+ u64 segment_handle;
u32 sm_index;
props = segment_manager_properties_get (sm);
@@ -513,13 +544,18 @@ alloc_check:
ASSERT (rx_fifo && tx_fifo);
sm_index = segment_manager_index (sm);
+ *fifo_segment_index = segment_manager_segment_index (sm, fifo_segment);
(*tx_fifo)->segment_manager = sm_index;
(*rx_fifo)->segment_manager = sm_index;
- *fifo_segment_index = segment_manager_segment_index (sm, fifo_segment);
+ (*tx_fifo)->segment_index = *fifo_segment_index;
+ (*rx_fifo)->segment_index = *fifo_segment_index;
if (added_a_segment)
- rv = app_worker_add_segment_notify (sm->app_wrk_index,
- &fifo_segment->ssvm);
+ {
+ segment_handle = segment_manager_segment_handle (sm, fifo_segment);
+ rv = app_worker_add_segment_notify (sm->app_wrk_index,
+ segment_handle);
+ }
/* Drop the lock after app is notified */
segment_manager_segment_reader_unlock (sm);
return rv;
diff --git a/src/vnet/session/segment_manager.h b/src/vnet/session/segment_manager.h
index 0e5f62414e5..657a1fcc231 100644
--- a/src/vnet/session/segment_manager.h
+++ b/src/vnet/session/segment_manager.h
@@ -117,13 +117,23 @@ segment_manager_event_queue (segment_manager_t * sm)
return sm->event_queue;
}
+always_inline u64
+segment_manager_make_segment_handle (u32 segment_manager_index,
+ u32 segment_index)
+{
+ return (((u64) segment_manager_index << 32) | segment_index);
+}
+
+u64 segment_manager_segment_handle (segment_manager_t * sm,
+ svm_fifo_segment_private_t * segment);
+
segment_manager_t *segment_manager_new ();
int segment_manager_init (segment_manager_t * sm, u32 first_seg_size,
u32 prealloc_fifo_pairs);
-svm_fifo_segment_private_t *segment_manager_get_segment (segment_manager_t *
- sm,
+svm_fifo_segment_private_t *segment_manager_get_segment (segment_manager_t *,
u32 segment_index);
+svm_fifo_segment_private_t *segment_manager_get_segment_w_handle (u64);
svm_fifo_segment_private_t
* segment_manager_get_segment_w_lock (segment_manager_t * sm,
u32 segment_index);
diff --git a/src/vnet/session/session.api b/src/vnet/session/session.api
index eced1d47770..3dc0cc8d360 100644
--- a/src/vnet/session/session.api
+++ b/src/vnet/session/session.api
@@ -13,7 +13,7 @@
* limitations under the License.
*/
-option version = "1.3.0";
+option version = "1.4.0";
/** \brief client->vpp, attach application to session layer
@param client_index - opaque cookie to identify the sender
@@ -103,6 +103,7 @@ autoreply define application_detach {
socket transport available
@param segment_size - size of the segment to be mapped
@param segment_name - name of the segment to be mapped
+ @param segment_handle - unique identifier for segment
*/
autoreply define map_another_segment {
u32 client_index;
@@ -110,17 +111,19 @@ autoreply define map_another_segment {
u8 fd_flags;
u32 segment_size;
u8 segment_name[128];
+ u64 segment_handle;
};
/** \brief vpp->client unmap shared memory segment
@param client_index - opaque cookie to identify the sender
@param context - sender context, to match reply w/ request
- @param segment_name -
+ @param segment_name - segment name
+ @param segment_handle - handle of the segment to be unmapped
*/
autoreply define unmap_segment {
u32 client_index;
u32 context;
- u8 segment_name[128];
+ u64 segment_handle;
};
/** \brief Bind to a given URI
@@ -462,6 +465,7 @@ define app_worker_add_del
over the socket (set only if socket transport available)
@param segment_name_length - length of segment name
@param segment_name - name of segment client needs to attach to
+ @param segment_handle - handle for segment
*/
define app_worker_add_del_reply
{
@@ -473,6 +477,7 @@ define app_worker_add_del_reply
u8 fd_flags;
u8 segment_name_length;
u8 segment_name[128];
+ u64 segment_handle;
u8 is_add;
};
diff --git a/src/vnet/session/session.h b/src/vnet/session/session.h
index ea21464ee54..d5f040edc59 100644
--- a/src/vnet/session/session.h
+++ b/src/vnet/session/session.h
@@ -441,6 +441,14 @@ session_type_from_proto_and_ip (transport_proto_t proto, u8 is_ip4)
return (proto << 1 | is_ip4);
}
+always_inline u64
+session_segment_handle (stream_session_t * s)
+{
+ svm_fifo_t *f = s->server_rx_fifo;
+ return segment_manager_make_segment_handle (f->segment_manager,
+ f->segment_index);
+}
+
always_inline u8
session_has_transport (stream_session_t * s)
{
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))
diff --git a/src/vnet/tls/tls.c b/src/vnet/tls/tls.c
index 7378093bd04..0fdd68c7d38 100644
--- a/src/vnet/tls/tls.c
+++ b/src/vnet/tls/tls.c
@@ -367,14 +367,14 @@ tls_session_reset_callback (stream_session_t * s)
}
int
-tls_add_segment_callback (u32 client_index, const ssvm_private_t * fs)
+tls_add_segment_callback (u32 client_index, u64 segment_handle)
{
/* No-op for builtin */
return 0;
}
int
-tls_del_segment_callback (u32 client_index, const ssvm_private_t * fs)
+tls_del_segment_callback (u32 client_index, u64 segment_handle)
{
return 0;
}