vcl: support for eventfd mq signaling
[vpp.git] / src / vnet / session / application_interface.c
index ecdbe16..524e7b5 100644 (file)
@@ -475,7 +475,7 @@ vnet_application_attach (vnet_app_attach_args_t * a)
                              a->session_cb_vft)))
     return clib_error_return_code (0, rv, 0, "app init: %d", rv);
 
-  a->app_event_queue_address = pointer_to_uword (app->event_queue);
+  a->app_evt_q = app->event_queue;
   sm = segment_manager_get (app->first_segment_manager);
   fs = segment_manager_get_segment_w_lock (sm, 0);
 
@@ -528,14 +528,18 @@ vnet_unbind_uri (vnet_unbind_args_t * a)
 {
   session_endpoint_extended_t sep = SESSION_ENDPOINT_EXT_NULL;
   stream_session_t *listener;
+  u32 table_index;
   int rv;
 
   rv = parse_uri (a->uri, &sep);
   if (rv)
     return rv;
 
-  /* NOTE: only default table supported for uri */
-  listener = session_lookup_listener (0, (session_endpoint_t *) & sep);
+  /* NOTE: only default fib tables supported for uri apis */
+  table_index = session_lookup_get_index_for_fib (fib_ip_proto (!sep.is_ip4),
+                                                 0);
+  listener = session_lookup_listener (table_index,
+                                     (session_endpoint_t *) & sep);
   if (!listener)
     return VNET_API_ERROR_ADDRESS_NOT_IN_USE;
 
@@ -565,7 +569,18 @@ vnet_disconnect_session (vnet_disconnect_args_t * a)
   if (session_handle_is_local (a->handle))
     {
       local_session_t *ls;
-      ls = application_get_local_session_from_handle (a->handle);
+
+      /* Disconnect reply came to worker 1 not main thread */
+      if (vlib_get_thread_index () == 1)
+       {
+         vlib_rpc_call_main_thread (vnet_disconnect_session, (u8 *) a,
+                                    sizeof (*a));
+         return 0;
+       }
+
+      if (!(ls = application_get_local_session_from_handle (a->handle)))
+       return 0;
+
       if (ls->app_index != a->app_index && ls->client_index != a->app_index)
        {
          clib_warning ("app %u is neither client nor server for session %u",
@@ -594,7 +609,7 @@ vnet_bind (vnet_bind_args_t * a)
 {
   int rv;
   if ((rv = vnet_bind_i (a->app_index, &a->sep, &a->handle)))
-    return clib_error_return_code (0, rv, 0, "bind failed");
+    return clib_error_return_code (0, rv, 0, "bind failed: %d", rv);
   return 0;
 }
 
@@ -603,7 +618,7 @@ vnet_unbind (vnet_unbind_args_t * a)
 {
   int rv;
   if ((rv = vnet_unbind_i (a->app_index, a->handle)))
-    return clib_error_return_code (0, rv, 0, "unbind failed");
+    return clib_error_return_code (0, rv, 0, "unbind failed: %d", rv);
   return 0;
 }
 
@@ -614,7 +629,7 @@ vnet_connect (vnet_connect_args_t * a)
   int rv;
 
   if ((rv = application_connect (a->app_index, a->api_context, sep)))
-    return clib_error_return_code (0, rv, 0, "connect failed");
+    return clib_error_return_code (0, rv, 0, "connect failed: %d", rv);
   return 0;
 }