session: api to add new transport types
[vpp.git] / src / vnet / session / application.c
index 8d8e17c..7923d2d 100644 (file)
@@ -115,7 +115,7 @@ app_listener_lookup (application_t * app, session_endpoint_cfg_t * sep_ext)
     }
 
   fib_proto = session_endpoint_fib_proto (sep);
-  table_index = application_session_table (app, fib_proto);
+  table_index = session_lookup_get_index_for_fib (fib_proto, sep->fib_index);
   handle = session_lookup_endpoint_listener (table_index, sep, 1);
   if (handle != SESSION_INVALID_HANDLE)
     {
@@ -133,10 +133,10 @@ app_listener_alloc_and_init (application_t * app,
 {
   app_listener_t *app_listener;
   transport_connection_t *tc;
+  u32 al_index, table_index;
   session_handle_t lh;
   session_type_t st;
   session_t *ls = 0;
-  u32 al_index;
   int rv;
 
   app_listener = app_listener_alloc (app);
@@ -151,7 +151,6 @@ app_listener_alloc_and_init (application_t * app,
       && session_endpoint_is_local ((session_endpoint_t *) sep))
     {
       session_type_t local_st;
-      u32 table_index;
 
       local_st = session_type_from_proto_and_ip (TRANSPORT_PROTO_NONE,
                                                 sep->is_ip4);
@@ -213,7 +212,16 @@ app_listener_alloc_and_init (application_t * app,
        * connections */
       tc = session_get_transport (ls);
       if (!(tc->flags & TRANSPORT_CONNECTION_F_NO_LOOKUP))
-       session_lookup_add_connection (tc, lh);
+       {
+         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);
+         session_lookup_add_session_endpoint (table_index,
+                                              (session_endpoint_t *) sep,
+                                              lh);
+       }
     }
 
   if (!ls)
@@ -542,6 +550,14 @@ application_alloc_and_init (app_init_args_t * a)
     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];
   props->segment_type = seg_type;
 
   /* Add app to lookup by api_client_index table */
@@ -690,8 +706,7 @@ application_alloc_worker_and_init (application_t * app, app_worker_t ** wrk)
   sm = segment_manager_alloc ();
   sm->app_wrk_index = app_wrk->wrk_index;
 
-  if ((rv = segment_manager_init (sm, app->sm_properties.segment_size,
-                                 app->sm_properties.prealloc_fifos)))
+  if ((rv = segment_manager_init (sm)))
     {
       app_worker_free (app_wrk);
       return rv;