vcl: remove support for shm api connections

Session layer only supports bapi with socket transport or app socket api
attachements. Going forward this will be further restricted to the
latter.

Type: improvement

Signed-off-by: Florin Coras <fcoras@cisco.com>
Change-Id: Ib368cf2ce92bbca192cca977664800879cd4058e
diff --git a/src/vcl/vcl_bapi.c b/src/vcl/vcl_bapi.c
index 2e17dab..06947c6 100644
--- a/src/vcl/vcl_bapi.c
+++ b/src/vcl/vcl_bapi.c
@@ -473,47 +473,30 @@
   vcl_bapi_cleanup ();
 
   vlibapi_set_main (&wrk->bapi_api_ctx);
-  vlibapi_set_memory_client_main (&wrk->bapi_shm_ctx);
   vcl_bapi_hookup ();
 
-  if (vcl_cfg->vpp_bapi_socket_name)
+  if (!vcl_cfg->vpp_bapi_socket_name)
     {
-      if (vl_socket_client_connect2 (&wrk->bapi_sock_ctx,
-				     (char *) vcl_cfg->vpp_bapi_socket_name,
-				     (char *) wrk_name,
-				     0 /* default rx/tx buffer */ ))
-	{
-	  VERR ("app (%s) socket connect failed!", wrk_name);
-	  rv = VPPCOM_ECONNREFUSED;
-	  goto error;
-	}
-
-      if (vl_socket_client_init_shm2 (&wrk->bapi_sock_ctx, 0,
-				      1 /* want_pthread */ ))
-	{
-	  VERR ("app (%s) init shm failed!", wrk_name);
-	  rv = VPPCOM_ECONNREFUSED;
-	  goto error;
-	}
+      rv = VPPCOM_EINVAL;
+      goto error;
     }
-  else
+
+  if (vl_socket_client_connect2 (&wrk->bapi_sock_ctx,
+				 (char *) vcl_cfg->vpp_bapi_socket_name,
+				 (char *) wrk_name,
+				 0 /* default rx/tx buffer */ ))
     {
-      if (!vcl_cfg->vpp_bapi_filename)
-	vcl_cfg->vpp_bapi_filename = format (0, "/vpe-api%c", 0);
+      VERR ("app (%s) socket connect failed!", wrk_name);
+      rv = VPPCOM_ECONNREFUSED;
+      goto error;
+    }
 
-      vl_set_memory_root_path ((char *) vcl_cfg->vpp_bapi_chroot);
-
-      VDBG (0, "app (%s) connecting to VPP api (%s)...",
-	    wrk_name, vcl_cfg->vpp_bapi_filename);
-
-      if (vl_client_connect_to_vlib ((char *) vcl_cfg->vpp_bapi_filename,
-				     (char *) wrk_name,
-				     vcm->cfg.vpp_api_q_length) < 0)
-	{
-	  VERR ("app (%s) connect failed!", wrk_name);
-	  rv = VPPCOM_ECONNREFUSED;
-	  goto error;
-	}
+  if (vl_socket_client_init_shm2 (&wrk->bapi_sock_ctx, 0,
+				  1 /* want_pthread */ ))
+    {
+      VERR ("app (%s) init shm failed!", wrk_name);
+      rv = VPPCOM_ECONNREFUSED;
+      goto error;
     }
 
   am = vlibapi_get_main ();
diff --git a/src/vcl/vcl_cfg.c b/src/vcl/vcl_cfg.c
index 3fdda9c..5fea1db 100644
--- a/src/vcl/vcl_cfg.c
+++ b/src/vcl/vcl_cfg.c
@@ -282,13 +282,6 @@
 	      VCFG_DBG (0, "VCL<%d>: configured max-workers %u", getpid (),
 			vcl_cfg->max_workers);
 	    }
-	  else if (unformat (line_input, "api-prefix %s",
-			     &vcl_cfg->vpp_bapi_chroot))
-	    {
-	      vec_terminate_c_string (vcl_cfg->vpp_bapi_chroot);
-	      VCFG_DBG (0, "VCL<%d>: configured api-prefix (%s) ", getpid (),
-			vcl_cfg->vpp_bapi_chroot);
-	    }
 	  else if (unformat (line_input, "api-socket-name %s",
 			     &vcl_cfg->vpp_bapi_socket_name))
 	    {
@@ -571,14 +564,6 @@
 
   /* Regrab cfg after heap initialization */
   vcl_cfg = &vcm->cfg;
-  env_var_str = getenv (VPPCOM_ENV_API_PREFIX);
-  if (env_var_str)
-    {
-      vcl_cfg->vpp_bapi_chroot = format (0, "%s", env_var_str);
-      vec_terminate_c_string (vcl_cfg->vpp_bapi_chroot);
-      VCFG_DBG (0, "VCL<%d>: configured api prefix (%s) from "
-		VPPCOM_ENV_API_PREFIX "!", getpid (), env_var_str);
-    }
   env_var_str = getenv (VPPCOM_ENV_APP_NAMESPACE_ID);
   if (env_var_str)
     {
@@ -645,6 +630,13 @@
       VCFG_DBG (0, "VCL<%d>: configured api-socket-name (%s)", getpid (),
 		vcl_cfg->vpp_bapi_socket_name);
     }
+  env_var_str = getenv (VPPCOM_ENV_VPP_SAPI_SOCKET);
+  if (env_var_str)
+    {
+      vcm->cfg.vpp_app_socket_api = format (0, "%s%c", env_var_str, 0);
+      VCFG_DBG (0, "VCL<%d>: configured app-socket-api (%s)", getpid (),
+		vcl_cfg->vpp_app_socket_api);
+    }
 }
 
 /*
diff --git a/src/vcl/vcl_private.h b/src/vcl/vcl_private.h
index 647532d..202c3e7 100644
--- a/src/vcl/vcl_private.h
+++ b/src/vcl/vcl_private.h
@@ -197,9 +197,7 @@
   u32 event_ring_size;
   char *event_log_path;
   u8 *vpp_app_socket_api;	/**< app socket api socket file name */
-  u8 *vpp_bapi_filename;	/**< bapi shm transport file name */
   u8 *vpp_bapi_socket_name;	/**< bapi socket transport socket name */
-  u8 *vpp_bapi_chroot;
   u32 tls_engine;
   u8 mt_wrk_supported;
 } vppcom_cfg_t;
@@ -290,7 +288,6 @@
 
   clib_socket_t app_api_sock;
   socket_client_main_t bapi_sock_ctx;
-  memory_client_main_t bapi_shm_ctx;
   api_main_t bapi_api_ctx;
 
   /** vcl needs next epoll_create to go to libc_epoll */
diff --git a/src/vcl/vppcom.h b/src/vcl/vppcom.h
index f438668..0930300 100644
--- a/src/vcl/vppcom.h
+++ b/src/vcl/vppcom.h
@@ -36,7 +36,6 @@
 #define VPPCOM_CONF_DEFAULT                  	"/etc/vpp/vcl.conf"
 #define VPPCOM_ENV_CONF                      	"VCL_CONFIG"
 #define VPPCOM_ENV_DEBUG                     	"VCL_DEBUG"
-#define VPPCOM_ENV_API_PREFIX                	"VCL_API_PREFIX"
 #define VPPCOM_ENV_APP_PROXY_TRANSPORT_TCP   	"VCL_APP_PROXY_TRANSPORT_TCP"
 #define VPPCOM_ENV_APP_PROXY_TRANSPORT_UDP   	"VCL_APP_PROXY_TRANSPORT_UDP"
 #define VPPCOM_ENV_APP_NAMESPACE_ID          	"VCL_APP_NAMESPACE_ID"
@@ -44,6 +43,7 @@
 #define VPPCOM_ENV_APP_SCOPE_LOCAL           	"VCL_APP_SCOPE_LOCAL"
 #define VPPCOM_ENV_APP_SCOPE_GLOBAL          	"VCL_APP_SCOPE_GLOBAL"
 #define VPPCOM_ENV_VPP_API_SOCKET           	"VCL_VPP_API_SOCKET"
+#define VPPCOM_ENV_VPP_SAPI_SOCKET		"VCL_VPP_SAPI_SOCKET"
 
 typedef enum
 {