aboutsummaryrefslogtreecommitdiffstats
path: root/src/vcl/vcl_private.c
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2020-09-08 22:43:47 -0700
committerFlorin Coras <florin.coras@gmail.com>2020-09-14 14:33:50 +0000
commit935ce75cb060da34991e6b02bec5680445f85323 (patch)
tree1afceb3650b40c60ae9a83937e1ae839c9aee40a /src/vcl/vcl_private.c
parentb88de908101081f870d94e1415659326b589b9ce (diff)
vcl: add support for app socket api
To enable add "app-socket-api /path/to/socket" to vcl.conf. On vpp side, add use-app-socket-api to session stanza in startup.conf VPP allocates a socket per application namespace which it places in the app_ns_sockets subfolder of the run folder (default /var/run/vpp). The socket used implicitly selects the app namespace for the vcl app. Type: feature Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: Ifc14b93dcbf6ef9bed1852d46cd069f4855b92ef
Diffstat (limited to 'src/vcl/vcl_private.c')
-rw-r--r--src/vcl/vcl_private.c22
1 files changed, 20 insertions, 2 deletions
diff --git a/src/vcl/vcl_private.c b/src/vcl/vcl_private.c
index a07e0b165ec..fd35db0b678 100644
--- a/src/vcl/vcl_private.c
+++ b/src/vcl/vcl_private.c
@@ -101,12 +101,30 @@ vcl_worker_free (vcl_worker_t * wrk)
pool_put (vcm->workers, wrk);
}
+int
+vcl_api_app_worker_add (void)
+{
+ if (vcm->cfg.vpp_app_socket_api)
+ return vcl_sapi_app_worker_add ();
+
+ return vcl_bapi_app_worker_add ();
+}
+
+void
+vcl_api_app_worker_del (vcl_worker_t * wrk)
+{
+ if (vcm->cfg.vpp_app_socket_api)
+ return vcl_sapi_app_worker_del (wrk);
+
+ vcl_bapi_app_worker_del (wrk);
+}
+
void
vcl_worker_cleanup (vcl_worker_t * wrk, u8 notify_vpp)
{
clib_spinlock_lock (&vcm->workers_lock);
if (notify_vpp)
- vcl_bapi_app_worker_del (wrk);
+ vcl_api_app_worker_del (wrk);
if (wrk->mqs_epfd > 0)
close (wrk->mqs_epfd);
@@ -184,7 +202,7 @@ vcl_worker_register_with_vpp (void)
clib_spinlock_lock (&vcm->workers_lock);
- if (vcl_bapi_app_worker_add ())
+ if (vcl_api_app_worker_add ())
{
VDBG (0, "failed to add worker to vpp");
clib_spinlock_unlock (&vcm->workers_lock);