X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=src%2Fvnet%2Fsession%2Fapplication.c;h=d3e598ca271818fe05eaf07fb31190b57a4e2377;hb=98078ab88d93de4e44427c018cd3a74fc0ce8234;hp=e0c87b96928279582e2d36806ebe0340aa6528f5;hpb=89a9f61dfcd76cdbfd7c731b823cb4a3a7e8d1cf;p=vpp.git diff --git a/src/vnet/session/application.c b/src/vnet/session/application.c index e0c87b96928..d3e598ca271 100644 --- a/src/vnet/session/application.c +++ b/src/vnet/session/application.c @@ -241,9 +241,9 @@ app_listener_alloc_and_init (application_t * app, { fib_protocol_t fib_proto; fib_proto = session_endpoint_fib_proto ((session_endpoint_t *) sep); - table_index = session_lookup_get_index_for_fib (fib_proto, - sep->fib_index); - ASSERT (table_index != SESSION_TABLE_INVALID_INDEX); + /* Assume namespace vetted previously so make sure table exists */ + table_index = session_lookup_get_or_alloc_index_for_fib ( + fib_proto, sep->fib_index); session_lookup_add_session_endpoint (table_index, (session_endpoint_t *) sep, lh); @@ -769,18 +769,19 @@ application_alloc_and_init (app_init_args_t * a) ssvm_segment_type_t seg_type = SSVM_SEGMENT_MEMFD; segment_manager_props_t *props; application_t *app; - u64 *options; + u64 *opts; app = application_alloc (); - options = a->options; + opts = a->options; /* * Make sure we support the requested configuration */ - if (options[APP_OPTIONS_FLAGS] & APP_OPTIONS_FLAGS_IS_BUILTIN) + if ((opts[APP_OPTIONS_FLAGS] & APP_OPTIONS_FLAGS_IS_BUILTIN) && + !(opts[APP_OPTIONS_FLAGS] & APP_OPTIONS_FLAGS_MEMFD_FOR_BUILTIN)) seg_type = SSVM_SEGMENT_PRIVATE; - if ((options[APP_OPTIONS_FLAGS] & APP_OPTIONS_FLAGS_EVT_MQ_USE_EVENTFD) - && seg_type != SSVM_SEGMENT_MEMFD) + if ((opts[APP_OPTIONS_FLAGS] & APP_OPTIONS_FLAGS_EVT_MQ_USE_EVENTFD) && + seg_type != SSVM_SEGMENT_MEMFD) { clib_warning ("mq eventfds can only be used if socket transport is " "used for binary api"); @@ -790,17 +791,17 @@ application_alloc_and_init (app_init_args_t * a) if (!application_verify_cfg (seg_type)) return VNET_API_ERROR_APP_UNSUPPORTED_CFG; - if (options[APP_OPTIONS_PREALLOC_FIFO_PAIRS] - && options[APP_OPTIONS_PREALLOC_FIFO_HDRS]) + if (opts[APP_OPTIONS_PREALLOC_FIFO_PAIRS] && + opts[APP_OPTIONS_PREALLOC_FIFO_HDRS]) return VNET_API_ERROR_APP_UNSUPPORTED_CFG; /* Check that the obvious things are properly set up */ application_verify_cb_fns (a->session_cb_vft); - app->flags = options[APP_OPTIONS_FLAGS]; + app->flags = opts[APP_OPTIONS_FLAGS]; app->cb_fns = *a->session_cb_vft; - app->ns_index = options[APP_OPTIONS_NAMESPACE]; - app->proxied_transports = options[APP_OPTIONS_PROXY_TRANSPORT]; + app->ns_index = opts[APP_OPTIONS_NAMESPACE]; + app->proxied_transports = opts[APP_OPTIONS_PROXY_TRANSPORT]; app->name = vec_dup (a->name); /* If no scope enabled, default to global */ @@ -810,32 +811,32 @@ application_alloc_and_init (app_init_args_t * a) props = application_segment_manager_properties (app); segment_manager_props_init (props); - props->segment_size = options[APP_OPTIONS_SEGMENT_SIZE]; - props->prealloc_fifos = options[APP_OPTIONS_PREALLOC_FIFO_PAIRS]; - props->prealloc_fifo_hdrs = options[APP_OPTIONS_PREALLOC_FIFO_HDRS]; - if (options[APP_OPTIONS_ADD_SEGMENT_SIZE]) + props->segment_size = opts[APP_OPTIONS_SEGMENT_SIZE]; + props->prealloc_fifos = opts[APP_OPTIONS_PREALLOC_FIFO_PAIRS]; + props->prealloc_fifo_hdrs = opts[APP_OPTIONS_PREALLOC_FIFO_HDRS]; + if (opts[APP_OPTIONS_ADD_SEGMENT_SIZE]) { - props->add_segment_size = options[APP_OPTIONS_ADD_SEGMENT_SIZE]; + props->add_segment_size = opts[APP_OPTIONS_ADD_SEGMENT_SIZE]; props->add_segment = 1; } - if (options[APP_OPTIONS_RX_FIFO_SIZE]) - props->rx_fifo_size = options[APP_OPTIONS_RX_FIFO_SIZE]; - if (options[APP_OPTIONS_TX_FIFO_SIZE]) - props->tx_fifo_size = options[APP_OPTIONS_TX_FIFO_SIZE]; - if (options[APP_OPTIONS_EVT_QUEUE_SIZE]) - props->evt_q_size = options[APP_OPTIONS_EVT_QUEUE_SIZE]; - if (options[APP_OPTIONS_FLAGS] & APP_OPTIONS_FLAGS_EVT_MQ_USE_EVENTFD) + if (opts[APP_OPTIONS_RX_FIFO_SIZE]) + props->rx_fifo_size = opts[APP_OPTIONS_RX_FIFO_SIZE]; + if (opts[APP_OPTIONS_TX_FIFO_SIZE]) + props->tx_fifo_size = opts[APP_OPTIONS_TX_FIFO_SIZE]; + if (opts[APP_OPTIONS_EVT_QUEUE_SIZE]) + props->evt_q_size = opts[APP_OPTIONS_EVT_QUEUE_SIZE]; + if (opts[APP_OPTIONS_FLAGS] & APP_OPTIONS_FLAGS_EVT_MQ_USE_EVENTFD) props->use_mq_eventfd = 1; - if (options[APP_OPTIONS_TLS_ENGINE]) - app->tls_engine = options[APP_OPTIONS_TLS_ENGINE]; - if (options[APP_OPTIONS_MAX_FIFO_SIZE]) - props->max_fifo_size = options[APP_OPTIONS_MAX_FIFO_SIZE]; - if (options[APP_OPTIONS_HIGH_WATERMARK]) - props->high_watermark = options[APP_OPTIONS_HIGH_WATERMARK]; - if (options[APP_OPTIONS_LOW_WATERMARK]) - props->low_watermark = options[APP_OPTIONS_LOW_WATERMARK]; - if (options[APP_OPTIONS_PCT_FIRST_ALLOC]) - props->pct_first_alloc = options[APP_OPTIONS_PCT_FIRST_ALLOC]; + if (opts[APP_OPTIONS_TLS_ENGINE]) + app->tls_engine = opts[APP_OPTIONS_TLS_ENGINE]; + if (opts[APP_OPTIONS_MAX_FIFO_SIZE]) + props->max_fifo_size = opts[APP_OPTIONS_MAX_FIFO_SIZE]; + if (opts[APP_OPTIONS_HIGH_WATERMARK]) + props->high_watermark = opts[APP_OPTIONS_HIGH_WATERMARK]; + if (opts[APP_OPTIONS_LOW_WATERMARK]) + props->low_watermark = opts[APP_OPTIONS_LOW_WATERMARK]; + if (opts[APP_OPTIONS_PCT_FIRST_ALLOC]) + props->pct_first_alloc = opts[APP_OPTIONS_PCT_FIRST_ALLOC]; props->segment_type = seg_type; /* Add app to lookup by api_client_index table */ @@ -1060,6 +1061,8 @@ vnet_app_worker_add_del (vnet_app_worker_add_del_args_t * a) return VNET_API_ERROR_INVALID_VALUE; application_api_table_del (app_wrk->api_client_index); + if (appns_sapi_enabled ()) + sapi_socket_close_w_handle (app_wrk->api_client_index); app_worker_free (app_wrk); app_worker_map_free (app, wrk_map); if (application_n_workers (app) == 0) @@ -1345,9 +1348,9 @@ vnet_connect (vnet_connect_args_t * a) a->sep_ext.original_tp = a->sep_ext.transport_proto; a->sep_ext.transport_proto = TRANSPORT_PROTO_NONE; rv = app_worker_connect_session (client_wrk, &a->sep_ext, &a->sh); - if (rv <= 0) - return rv; a->sep_ext.transport_proto = a->sep_ext.original_tp; + if (!rv || rv != SESSION_E_LOCAL_CONNECT) + return rv; } /* * Not connecting to a local server, propagate to transport