aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/session
diff options
context:
space:
mode:
Diffstat (limited to 'src/vnet/session')
-rw-r--r--src/vnet/session/application.c156
-rw-r--r--src/vnet/session/application.h11
-rw-r--r--src/vnet/session/application_interface.c15
-rw-r--r--src/vnet/session/session.api8
-rwxr-xr-xsrc/vnet/session/session_api.c52
5 files changed, 91 insertions, 151 deletions
diff --git a/src/vnet/session/application.c b/src/vnet/session/application.c
index 72c57688e42..a70625a9bc5 100644
--- a/src/vnet/session/application.c
+++ b/src/vnet/session/application.c
@@ -97,26 +97,9 @@ app_worker_map_get (application_t * app, u32 map_index)
return pool_elt_at_index (app->worker_maps, map_index);
}
-static u8 *
-app_get_name_from_reg_index (application_t * app)
-{
- u8 *app_name;
-
- vl_api_registration_t *regp;
- regp = vl_api_client_index_to_registration (app->api_client_index);
- if (!regp)
- app_name = format (0, "builtin-%d%c", app->app_index, 0);
- else
- app_name = format (0, "%s%c", regp->name, 0);
-
- return app_name;
-}
-
static const u8 *
app_get_name (application_t * app)
{
- if (!app->name)
- app->name = app_get_name_from_reg_index (app);
return app->name;
}
@@ -155,24 +138,6 @@ application_local_listener_session_endpoint (local_session_t * ll,
sep->is_ip4 = ll->listener_session_type & 1;
}
-int
-application_api_queue_is_full (application_t * app)
-{
- svm_queue_t *q;
-
- /* builtin servers are always OK */
- if (app->api_client_index == ~0)
- return 0;
-
- q = vl_api_client_index_to_input_queue (app->api_client_index);
- if (!q)
- return 1;
-
- if (q->cursize == q->maxsize)
- return 1;
- return 0;
-}
-
/**
* Returns app name for app-index
*/
@@ -188,7 +153,8 @@ application_name_from_index (u32 app_index)
static void
application_api_table_add (u32 app_index, u32 api_client_index)
{
- hash_set (app_main.app_by_api_client_index, api_client_index, app_index);
+ if (api_client_index != APP_INVALID_INDEX)
+ hash_set (app_main.app_by_api_client_index, api_client_index, app_index);
}
static void
@@ -198,22 +164,15 @@ application_api_table_del (u32 api_client_index)
}
static void
-application_table_add (application_t * app)
+application_name_table_add (application_t * app)
{
- if (app->api_client_index != APP_INVALID_INDEX)
- hash_set (app_main.app_by_api_client_index, app->api_client_index,
- app->app_index);
- else if (app->name)
- hash_set_mem (app_main.app_by_name, app->name, app->app_index);
+ hash_set_mem (app_main.app_by_name, app->name, app->app_index);
}
static void
-application_table_del (application_t * app)
+application_name_table_del (application_t * app)
{
- if (app->api_client_index != APP_INVALID_INDEX)
- hash_unset (app_main.app_by_api_client_index, app->api_client_index);
- else if (app->name)
- hash_unset_mem (app_main.app_by_name, app->name);
+ hash_unset_mem (app_main.app_by_name, app->name);
}
application_t *
@@ -265,12 +224,6 @@ application_get_if_valid (u32 app_index)
return pool_elt_at_index (app_main.app_pool, app_index);
}
-u32
-application_index (application_t * app)
-{
- return app - app_main.app_pool;
-}
-
static void
application_verify_cb_fns (session_cb_vft_t * cb_fns)
{
@@ -350,7 +303,6 @@ application_alloc_and_init (app_init_args_t * a)
/* Check that the obvious things are properly set up */
application_verify_cb_fns (a->session_cb_vft);
- app->api_client_index = a->api_client_index;
app->flags = options[APP_OPTIONS_FLAGS];
app->cb_fns = *a->session_cb_vft;
app->ns_index = options[APP_OPTIONS_NAMESPACE];
@@ -384,8 +336,12 @@ application_alloc_and_init (app_init_args_t * a)
props->segment_type = seg_type;
/* Add app to lookup by api_client_index table */
- application_table_add (app);
- a->app_index = application_index (app);
+ if (!application_is_builtin (app))
+ application_api_table_add (app->app_index, a->api_client_index);
+ else
+ application_name_table_add (app);
+
+ a->app_index = app->app_index;
APP_DBG ("New app name: %v api index: %u index %u", app->name,
app->api_client_index, app->app_index);
@@ -442,7 +398,8 @@ application_free (application_t * app)
/*
* Cleanup remaining state
*/
- application_table_del (app);
+ if (application_is_builtin (app))
+ application_name_table_del (app);
vec_free (app->name);
vec_free (app->tls_cert);
vec_free (app->tls_key);
@@ -469,7 +426,7 @@ application_detach_process (application_t * app, u32 api_client_index)
/* *INDENT-OFF* */
pool_foreach (wrk_map, app->worker_maps, ({
app_wrk = app_worker_get (wrk_map->wrk_index);
- if (app_wrk->api_index == api_client_index)
+ if (app_wrk->api_client_index == api_client_index)
vec_add1 (wrks, app_wrk->wrk_index);
}));
/* *INDENT-ON* */
@@ -482,7 +439,7 @@ application_detach_process (application_t * app, u32 api_client_index)
}
args->app_index = app->app_index;
- args->api_index = api_client_index;
+ args->api_client_index = api_client_index;
vec_foreach (wrk_index, wrks)
{
app_wrk = app_worker_get (wrk_index[0]);
@@ -668,7 +625,6 @@ app_worker_alloc_and_init (application_t * app, app_worker_t ** wrk)
app_wrk->listeners_table = hash_create (0, sizeof (u64));
app_wrk->event_queue = segment_manager_event_queue (sm);
app_wrk->app_is_builtin = application_is_builtin (app);
- app_wrk->api_index = app->api_client_index;
/*
* Segment manager for local sessions
@@ -962,12 +918,8 @@ vnet_app_worker_add_del (vnet_app_worker_add_del_args_t * a)
return clib_error_return_code (0, rv, 0, "app wrk init: %d", rv);
/* Map worker api index to the app */
- if (a->api_index != app->api_client_index
- && app->api_client_index != APP_INVALID_INDEX)
- {
- app_wrk->api_index = a->api_index;
- application_api_table_add (app->app_index, a->api_index);
- }
+ app_wrk->api_client_index = a->api_client_index;
+ application_api_table_add (app->app_index, a->api_client_index);
sm = segment_manager_get (app_wrk->first_segment_manager);
fs = segment_manager_get_segment_w_lock (sm, 0);
@@ -987,8 +939,7 @@ vnet_app_worker_add_del (vnet_app_worker_add_del_args_t * a)
if (!app_wrk)
return clib_error_return_code (0, VNET_API_ERROR_INVALID_VALUE, 0,
"No worker %u", a->wrk_index);
- if (app->api_client_index != app_wrk->api_index)
- application_api_table_del (app_wrk->api_index);
+ application_api_table_del (app_wrk->api_client_index);
app_worker_free (app_wrk);
app_worker_map_free (app, wrk_map);
if (application_n_workers (app) == 0)
@@ -1060,7 +1011,7 @@ app_worker_add_segment_notify (u32 app_wrk_index, ssvm_private_t * fs)
{
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->api_client_index, fs);
+ return app->cb_fns.add_segment_callback (app_wrk->api_client_index, fs);
}
u32
@@ -1709,7 +1660,7 @@ application_local_session_connect (app_worker_t * client_wrk,
ls->listener_session_type = ll->session_type;
ls->session_state = SESSION_STATE_READY;
- if ((rv = server->cb_fns.add_segment_callback (server->api_client_index,
+ if ((rv = server->cb_fns.add_segment_callback (server_wrk->api_client_index,
&seg->ssvm)))
{
clib_warning ("failed to notify server of new segment");
@@ -1763,7 +1714,7 @@ 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);
- if ((rv = client->cb_fns.add_segment_callback (client->api_client_index,
+ if ((rv = client->cb_fns.add_segment_callback (client_wrk->api_client_index,
&seg->ssvm)))
{
clib_warning ("failed to notify client %u of new segment",
@@ -1819,12 +1770,12 @@ application_local_session_cleanup (app_worker_t * client_wrk,
if (!has_transport)
{
application_t *server = application_get (server_wrk->app_index);
- server->cb_fns.del_segment_callback (server->api_client_index,
+ server->cb_fns.del_segment_callback (server_wrk->api_client_index,
&seg->ssvm);
if (client_wrk)
{
application_t *client = application_get (client_wrk->app_index);
- client->cb_fns.del_segment_callback (client->api_client_index,
+ client->cb_fns.del_segment_callback (client_wrk->api_client_index,
&seg->ssvm);
}
segment_manager_del_segment (sm, seg);
@@ -1989,7 +1940,6 @@ format_app_worker_listener (u8 * s, va_list * args)
u32 sm_index = va_arg (*args, u32);
int verbose = va_arg (*args, int);
stream_session_t *listener;
- application_t *app;
const u8 *app_name;
u8 *str;
@@ -2004,8 +1954,7 @@ format_app_worker_listener (u8 * s, va_list * args)
return s;
}
- app = application_get (app_wrk->app_index);
- app_name = app_get_name (app);
+ app_name = application_name_from_index (app_wrk->app_index);
listener = listen_session_get_from_handle (handle);
str = format (0, "%U", format_stream_session, listener, verbose);
@@ -2014,7 +1963,7 @@ format_app_worker_listener (u8 * s, va_list * args)
char buf[32];
sprintf (buf, "%u(%u)", app_wrk->wrk_map_index, app_wrk->wrk_index);
s = format (s, "%-40s%-25s%=10s%-15u%-15u%-10u", str, app_name,
- buf, app->api_client_index, handle, sm_index);
+ buf, app_wrk->api_client_index, handle, sm_index);
}
else
s = format (s, "%-40s%-25s%=10u", str, app_name, app_wrk->wrk_map_index);
@@ -2058,7 +2007,6 @@ app_worker_format_connects (app_worker_t * app_wrk, int verbose)
vlib_main_t *vm = vlib_get_main ();
segment_manager_t *sm;
const u8 *app_name;
- application_t *app;
u8 *s = 0;
/* Header */
@@ -2072,11 +2020,10 @@ app_worker_format_connects (app_worker_t * app_wrk, int verbose)
return;
}
- app = application_get (app_wrk->app_index);
if (app_wrk->connects_seg_manager == (u32) ~ 0)
return;
- app_name = app_get_name (app);
+ app_name = application_name_from_index (app_wrk->app_index);
/* Across all fifo segments */
sm = segment_manager_get (app_wrk->connects_seg_manager);
@@ -2088,28 +2035,28 @@ app_worker_format_connects (app_worker_t * app_wrk, int verbose)
fifo = svm_fifo_segment_get_fifo_list (fifo_segment);
while (fifo)
- {
- u32 session_index, thread_index;
- stream_session_t *session;
+ {
+ u32 session_index, thread_index;
+ stream_session_t *session;
- session_index = fifo->master_session_index;
- thread_index = fifo->master_thread_index;
+ session_index = fifo->master_session_index;
+ thread_index = fifo->master_thread_index;
- session = session_get (session_index, thread_index);
- str = format (0, "%U", format_stream_session, session, verbose);
+ session = session_get (session_index, thread_index);
+ str = format (0, "%U", format_stream_session, session, verbose);
- if (verbose)
- s = format (s, "%-40s%-20s%-15u%-10u", str, app_name,
- app->api_client_index, app_wrk->connects_seg_manager);
- else
- s = format (s, "%-40s%-20s", str, app_name);
+ if (verbose)
+ s = format (s, "%-40s%-20s%-15u%-10u", str, app_name,
+ app_wrk->api_client_index, app_wrk->connects_seg_manager);
+ else
+ s = format (s, "%-40s%-20s", str, app_name);
- vlib_cli_output (vm, "%v", s);
- vec_reset_length (s);
- vec_free (str);
+ vlib_cli_output (vm, "%v", s);
+ vec_reset_length (s);
+ vec_free (str);
- fifo = fifo->next;
- }
+ fifo = fifo->next;
+ }
vec_free (s);
}));
/* *INDENT-ON* */
@@ -2279,12 +2226,10 @@ format_application (u8 * s, va_list * args)
if (app == 0)
{
if (verbose)
- s = format (s, "%-10s%-20s%-15s%-15s%-15s%-15s%-15s", "Index", "Name",
- "API Client", "Namespace", "Add seg size", "Rx-f size",
- "Tx-f size");
+ s = format (s, "%-10s%-20s%-15s%-15s%-15s%-15s", "Index", "Name",
+ "Namespace", "Add seg size", "Rx-f size", "Tx-f size");
else
- s = format (s, "%-10s%-20s%-15s%-40s", "Index", "Name", "API Client",
- "Namespace");
+ s = format (s, "%-10s%-20s%-40s", "Index", "Name", "Namespace");
return s;
}
@@ -2292,14 +2237,13 @@ format_application (u8 * s, va_list * args)
app_ns_name = app_namespace_id_from_index (app->ns_index);
props = application_segment_manager_properties (app);
if (verbose)
- s = format (s, "%-10u%-20s%-15d%-15u%-15U%-15U%-15U", app->app_index,
- app_name, app->api_client_index, app->ns_index,
+ s = format (s, "%-10u%-20s%-15u%-15U%-15U%-15U", app->app_index,
+ app_name, app->ns_index,
format_memory_size, props->add_segment_size,
format_memory_size, props->rx_fifo_size, format_memory_size,
props->tx_fifo_size);
else
- s = format (s, "%-10u%-20s%-15d%-40s", app->app_index, app_name,
- app->api_client_index, app_ns_name);
+ s = format (s, "%-10u%-20s%-40s", app->app_index, app_name, app_ns_name);
return s;
}
diff --git a/src/vnet/session/application.h b/src/vnet/session/application.h
index 9c68433d5e9..596b197a0f4 100644
--- a/src/vnet/session/application.h
+++ b/src/vnet/session/application.h
@@ -102,7 +102,7 @@ typedef struct app_worker_
uword *local_connects;
/** API index for the worker. Needed for multi-process apps */
- u32 api_index;
+ u32 api_client_index;
u8 app_is_builtin;
} app_worker_t;
@@ -124,10 +124,6 @@ typedef struct application_
/** App index in app pool */
u32 app_index;
- /** Binary API connection index of app process that created the app,
- * ~0 if internal */
- u32 api_client_index;
-
/** Flags */
u32 flags;
@@ -214,7 +210,7 @@ typedef struct _vnet_app_worker_add_del_args
{
u32 app_index; /**< App for which a new worker is requested */
u32 wrk_index; /**< Index to delete or return value if add */
- u32 api_index; /**< Binary API client index */
+ u32 api_client_index; /**< Binary API client index */
ssvm_private_t *segment; /**< First segment in segment manager */
svm_msg_q_t *evt_q; /**< Worker message queue */
u8 is_add; /**< Flag set if addition */
@@ -261,14 +257,11 @@ application_t *application_get (u32 index);
application_t *application_get_if_valid (u32 index);
application_t *application_lookup (u32 api_client_index);
application_t *application_lookup_name (const u8 * name);
-u32 application_index (application_t * app);
app_worker_t *application_get_worker (application_t * app, u32 wrk_index);
app_worker_t *application_get_default_worker (application_t * app);
app_worker_t *application_listener_select_worker (stream_session_t * ls,
u8 is_local);
-int application_api_queue_is_full (application_t * app);
-
int application_is_proxy (application_t * app);
int application_is_builtin (application_t * app);
int application_is_builtin_proxy (application_t * app);
diff --git a/src/vnet/session/application_interface.c b/src/vnet/session/application_interface.c
index 3cd8c2f5eb3..2a09909dbef 100644
--- a/src/vnet/session/application_interface.c
+++ b/src/vnet/session/application_interface.c
@@ -496,11 +496,21 @@ vnet_application_attach (vnet_app_attach_args_t * a)
app_worker_t *app_wrk;
segment_manager_t *sm;
u32 app_ns_index = 0;
+ u8 *app_name = 0;
u64 secret;
int rv;
if (a->api_client_index != APP_INVALID_INDEX)
- app = application_lookup (a->api_client_index);
+ {
+ app = application_lookup (a->api_client_index);
+ if (!app)
+ {
+ vl_api_registration_t *regp;
+ regp = vl_api_client_index_to_registration (a->api_client_index);
+ app_name = format (0, "%s%c", regp->name, 0);
+ a->name = app_name;
+ }
+ }
else if (a->name)
app = application_lookup_name (a->name);
else
@@ -524,6 +534,7 @@ vnet_application_attach (vnet_app_attach_args_t * a)
return clib_error_return_code (0, rv, 0, "app default wrk init: %d", rv);
a->app_evt_q = app_wrk->event_queue;
+ app_wrk->api_client_index = a->api_client_index;
sm = segment_manager_get (app_wrk->first_segment_manager);
fs = segment_manager_get_segment_w_lock (sm, 0);
@@ -534,7 +545,7 @@ vnet_application_attach (vnet_app_attach_args_t * a)
a->segment = &fs->ssvm;
segment_manager_segment_reader_unlock (sm);
-
+ vec_free (app_name);
return 0;
}
diff --git a/src/vnet/session/session.api b/src/vnet/session/session.api
index 64b82051da2..eced1d47770 100644
--- a/src/vnet/session/session.api
+++ b/src/vnet/session/session.api
@@ -13,7 +13,7 @@
* limitations under the License.
*/
-option version = "1.2.1";
+option version = "1.3.0";
/** \brief client->vpp, attach application to session layer
@param client_index - opaque cookie to identify the sender
@@ -44,6 +44,7 @@ option version = "1.2.1";
@param segment_size - size of first shm segment
@param segment_name_length - length of segment name
@param segment_name - name of segment client needs to attach to
+ @param app_index - index of the newly created app
*/
define application_attach_reply {
u32 context;
@@ -54,6 +55,7 @@ define application_attach_reply {
u32 segment_size;
u8 segment_name_length;
u8 segment_name[128];
+ u32 app_index;
};
/** \brief Application add TLS certificate
@@ -437,7 +439,7 @@ autoreply define app_cut_through_registration_add
@param client_index - opaque cookie to identify the sender
client to vpp direction only
@param context - sender context, to match reply w/ request
- @param app_api_index - explicit client api index
+ @param app_index - application index
@param wrk_index - worker index, if a delete
@param is_add - set if an add
*/
@@ -445,7 +447,7 @@ define app_worker_add_del
{
u32 client_index;
u32 context;
- u32 app_api_index;
+ u32 app_index;
u32 wrk_index;
u8 is_add;
};
diff --git a/src/vnet/session/session_api.c b/src/vnet/session/session_api.c
index 58877010326..d960792ee86 100755
--- a/src/vnet/session/session_api.c
+++ b/src/vnet/session/session_api.c
@@ -207,10 +207,11 @@ send_session_accept_callback (stream_session_t * s)
application_t *server;
server = application_get (server_wrk->app_index);
- reg = vl_mem_api_client_index_to_registration (server->api_client_index);
+ reg =
+ vl_mem_api_client_index_to_registration (server_wrk->api_client_index);
if (!reg)
{
- clib_warning ("no registration: %u", server->api_client_index);
+ clib_warning ("no registration: %u", server_wrk->api_client_index);
return -1;
}
@@ -284,13 +285,11 @@ send_session_disconnect_callback (stream_session_t * s)
app_worker_t *app_wrk = app_worker_get (s->app_wrk_index);
vl_api_disconnect_session_t *mp;
vl_api_registration_t *reg;
- application_t *app;
- app = application_get (app_wrk->app_index);
- reg = vl_mem_api_client_index_to_registration (app->api_client_index);
+ reg = vl_mem_api_client_index_to_registration (app_wrk->api_client_index);
if (!reg)
{
- clib_warning ("no registration: %u", app->api_client_index);
+ clib_warning ("no registration: %u", app_wrk->api_client_index);
return;
}
@@ -298,7 +297,7 @@ send_session_disconnect_callback (stream_session_t * s)
clib_memset (mp, 0, sizeof (*mp));
mp->_vl_msg_id = clib_host_to_net_u16 (VL_API_DISCONNECT_SESSION);
mp->handle = session_handle (s);
- mp->context = app->api_client_index;
+ mp->context = app_wrk->api_client_index;
vl_msg_api_send_shmem (reg->vl_input_queue, (u8 *) & mp);
}
@@ -308,13 +307,11 @@ send_session_reset_callback (stream_session_t * s)
app_worker_t *app_wrk = app_worker_get (s->app_wrk_index);
vl_api_registration_t *reg;
vl_api_reset_session_t *mp;
- application_t *app;
- app = application_get (app_wrk->app_index);
- reg = vl_mem_api_client_index_to_registration (app->api_client_index);
+ reg = vl_mem_api_client_index_to_registration (app_wrk->api_client_index);
if (!reg)
{
- clib_warning ("no registration: %u", app->api_client_index);
+ clib_warning ("no registration: %u", app_wrk->api_client_index);
return;
}
@@ -334,14 +331,12 @@ send_session_connected_callback (u32 app_wrk_index, u32 api_context,
vl_api_registration_t *reg;
svm_msg_q_t *vpp_queue;
app_worker_t *app_wrk;
- application_t *app;
app_wrk = app_worker_get (app_wrk_index);
- app = application_get (app_wrk->app_index);
- reg = vl_mem_api_client_index_to_registration (app->api_client_index);
+ reg = vl_mem_api_client_index_to_registration (app_wrk->api_client_index);
if (!reg)
{
- clib_warning ("no registration: %u", app->api_client_index);
+ clib_warning ("no registration: %u", app_wrk->api_client_index);
return -1;
}
@@ -467,7 +462,7 @@ mq_send_session_accepted_cb (stream_session_t * s)
local_session_t *ll;
u8 main_thread = vlib_num_workers ()? 1 : 0;
- send_app_cut_through_registration_add (app->api_client_index,
+ send_app_cut_through_registration_add (app_wrk->api_client_index,
app_wrk->wrk_map_index,
ls->server_evt_q,
ls->client_evt_q);
@@ -512,9 +507,7 @@ mq_send_session_disconnected_cb (stream_session_t * s)
session_disconnected_msg_t *mp;
svm_msg_q_t *app_mq;
session_event_t *evt;
- application_t *app;
- app = application_get (app_wrk->app_index);
app_mq = app_wrk->event_queue;
if (mq_try_lock_and_alloc_msg (app_mq, msg))
return;
@@ -523,7 +516,7 @@ mq_send_session_disconnected_cb (stream_session_t * s)
evt->event_type = SESSION_CTRL_EVT_DISCONNECTED;
mp = (session_disconnected_msg_t *) evt->data;
mp->handle = session_handle (s);
- mp->context = app->api_client_index;
+ mp->context = app_wrk->api_client_index;
svm_msg_q_add_and_unlock (app_mq, msg);
}
@@ -536,9 +529,7 @@ mq_send_local_session_disconnected_cb (u32 app_wrk_index,
session_disconnected_msg_t *mp;
svm_msg_q_t *app_mq;
session_event_t *evt;
- application_t *app;
- app = application_get (app_wrk->app_index);
app_mq = app_wrk->event_queue;
if (mq_try_lock_and_alloc_msg (app_mq, msg))
return;
@@ -547,7 +538,7 @@ mq_send_local_session_disconnected_cb (u32 app_wrk_index,
evt->event_type = SESSION_CTRL_EVT_DISCONNECTED;
mp = (session_disconnected_msg_t *) evt->data;
mp->handle = application_local_session_handle (ls);
- mp->context = app->api_client_index;
+ mp->context = app_wrk->api_client_index;
svm_msg_q_add_and_unlock (app_mq, msg);
}
@@ -581,15 +572,13 @@ mq_send_session_connected_cb (u32 app_wrk_index, u32 api_context,
transport_connection_t *tc;
app_worker_t *app_wrk;
session_event_t *evt;
- application_t *app;
app_wrk = app_worker_get (app_wrk_index);
- app = application_get (app_wrk->app_index);
app_mq = app_wrk->event_queue;
if (!app_mq)
{
- clib_warning ("app %u with api index: %u not attached", app->app_index,
- app->api_client_index);
+ clib_warning ("app %u with api index: %u not attached",
+ app_wrk->app_index, app_wrk->api_client_index);
return -1;
}
@@ -627,7 +616,7 @@ mq_send_session_connected_cb (u32 app_wrk_index, u32 api_context,
local_session_t *ls = (local_session_t *) s;
u8 main_thread = vlib_num_workers ()? 1 : 0;
- send_app_cut_through_registration_add (app->api_client_index,
+ send_app_cut_through_registration_add (app_wrk->api_client_index,
app_wrk->wrk_map_index,
ls->client_evt_q,
ls->server_evt_q);
@@ -668,8 +657,8 @@ mq_send_session_bound_cb (u32 app_wrk_index, u32 api_context,
app_mq = app_wrk->event_queue;
if (!app_mq)
{
- clib_warning ("app %u with api index: %u not attached", app->app_index,
- app->api_client_index);
+ clib_warning ("app %u with api index: %u not attached",
+ app_wrk->app_index, app_wrk->api_client_index);
return -1;
}
@@ -820,6 +809,7 @@ done:
if (!rv)
{
segp = a->segment;
+ rmp->app_index = clib_host_to_net_u32 (a->app_index);
rmp->segment_name_length = 0;
rmp->segment_size = segp->ssvm_size;
if (vec_len (segp->name))
@@ -1350,7 +1340,7 @@ vl_api_app_worker_add_del_t_handler (vl_api_app_worker_add_del_t * mp)
if (!reg)
return;
- app = application_lookup (clib_net_to_host_u32 (mp->app_api_index));
+ app = application_get_if_valid (clib_net_to_host_u32 (mp->app_index));
if (!app)
{
rv = VNET_API_ERROR_INVALID_VALUE;
@@ -1360,7 +1350,7 @@ vl_api_app_worker_add_del_t_handler (vl_api_app_worker_add_del_t * mp)
vnet_app_worker_add_del_args_t args = {
.app_index = app->app_index,
.wrk_index = clib_net_to_host_u32 (mp->wrk_index),
- .api_index = mp->client_index,
+ .api_client_index = mp->client_index,
.is_add = mp->is_add
};
error = vnet_app_worker_add_del (&args);