session: add support for multiple app workers

Refactor session layer to support multiple workers per application.

Change-Id: Ie67354688d396449d14bbbb8c56050206e307cd8
Signed-off-by: Florin Coras <fcoras@cisco.com>
diff --git a/src/vnet/session/segment_manager.c b/src/vnet/session/segment_manager.c
index 6f149ad..158a8e8 100644
--- a/src/vnet/session/segment_manager.c
+++ b/src/vnet/session/segment_manager.c
@@ -34,7 +34,7 @@
 segment_manager_properties_t *
 segment_manager_properties_get (segment_manager_t * sm)
 {
-  return application_get_segment_manager_properties (sm->app_index);
+  return application_get_segment_manager_properties (sm->app_wrk_index);
 }
 
 segment_manager_properties_t *
@@ -50,13 +50,13 @@
 static u8
 segment_manager_app_detached (segment_manager_t * sm)
 {
-  return (sm->app_index == SEGMENT_MANAGER_INVALID_APP_INDEX);
+  return (sm->app_wrk_index == SEGMENT_MANAGER_INVALID_APP_INDEX);
 }
 
 void
 segment_manager_app_detach (segment_manager_t * sm)
 {
-  sm->app_index = SEGMENT_MANAGER_INVALID_APP_INDEX;
+  sm->app_wrk_index = SEGMENT_MANAGER_INVALID_APP_INDEX;
 }
 
 always_inline u32
@@ -369,7 +369,7 @@
 	if (fifo->master_thread_index == 255)
 	  {
 	    svm_fifo_t *next = fifo->next;
-	    application_local_session_disconnect_w_index (sm->app_index,
+	    application_local_session_disconnect_w_index (sm->app_wrk_index,
 	                                                  fifo->master_session_index);
 	    fifo = next;
 	    continue;
@@ -518,8 +518,8 @@
       *fifo_segment_index = segment_manager_segment_index (sm, fifo_segment);
 
       if (added_a_segment)
-	rv = application_add_segment_notify (sm->app_index,
-					     &fifo_segment->ssvm);
+	rv = app_worker_add_segment_notify (sm->app_wrk_index,
+					    &fifo_segment->ssvm);
       /* Drop the lock after app is notified */
       segment_manager_segment_reader_unlock (sm);
       return rv;
@@ -721,8 +721,8 @@
 
       /* *INDENT-OFF* */
       pool_foreach (sm, smm->segment_managers, ({
-	vlib_cli_output (vm, "%-10d%=15d%=12d", segment_manager_index(sm),
-			   sm->app_index, pool_elts (sm->segments));
+	vlib_cli_output (vm, "%-10d%=15d%=12d", segment_manager_index (sm),
+			   sm->app_wrk_index, pool_elts (sm->segments));
       }));
       /* *INDENT-ON* */