Session layer improvements

Among others:
- Moved app event queue to shared memory segment
- Use private memory segment for builtin apps
- Remove pid from svm fifo
- Protect session fifo (de)allocation
- Use fifo event for session disconnects
- Have session queue node poll in all wk threads

Change-Id: I89dbf7fdfebef12f5ef2b34ba3ef3c2c07f49ff2
Signed-off-by: Florin Coras <fcoras@cisco.com>
diff --git a/src/vnet/udp/builtin_server.c b/src/vnet/udp/builtin_server.c
index 8565f04..18684d5 100644
--- a/src/vnet/udp/builtin_server.c
+++ b/src/vnet/udp/builtin_server.c
@@ -59,10 +59,10 @@
   vec_validate (my_copy_buffer, this_transfer - 1);
   _vec_len (my_copy_buffer) = this_transfer;
 
-  actual_transfer = svm_fifo_dequeue_nowait (rx_fifo, 0, this_transfer,
+  actual_transfer = svm_fifo_dequeue_nowait (rx_fifo, this_transfer,
 					     my_copy_buffer);
   ASSERT (actual_transfer == this_transfer);
-  actual_transfer = svm_fifo_enqueue_nowait (tx_fifo, 0, this_transfer,
+  actual_transfer = svm_fifo_enqueue_nowait (tx_fifo, this_transfer,
 					     my_copy_buffer);
   ASSERT (actual_transfer == this_transfer);
 
@@ -72,7 +72,7 @@
     {
       /* Fabricate TX event, send to ourselves */
       evt.fifo = tx_fifo;
-      evt.event_type = FIFO_EVENT_SERVER_TX;
+      evt.event_type = FIFO_EVENT_APP_TX;
       evt.event_id = 0;
       q = session_manager_get_vpp_event_queue (s->thread_index);
       unix_shared_memory_queue_add (q, (u8 *) & evt,
@@ -110,6 +110,8 @@
 
   options[SESSION_OPTIONS_ACCEPT_COOKIE] = 0x12345678;
   options[SESSION_OPTIONS_SEGMENT_SIZE] = (2 << 30);	/*$$$$ config / arg */
+  options[APP_OPTIONS_FLAGS] = APP_OPTIONS_FLAGS_BUILTIN_APP;
+
   a->options = options;
 
   return vnet_application_attach (a);
diff --git a/src/vnet/udp/udp_input.c b/src/vnet/udp/udp_input.c
index 810278e..e6b4f8f 100644
--- a/src/vnet/udp/udp_input.c
+++ b/src/vnet/udp/udp_input.c
@@ -145,8 +145,7 @@
 		  goto trace0;
 		}
 
-	      svm_fifo_enqueue_nowait (f0, 0 /* pid */ ,
-				       udp_len0 - sizeof (*udp0),
+	      svm_fifo_enqueue_nowait (f0, udp_len0 - sizeof (*udp0),
 				       (u8 *) (udp0 + 1));
 
 	      b0->error = node->errors[SESSION_ERROR_ENQUEUED];
@@ -255,7 +254,7 @@
 	{
 	  /* Fabricate event */
 	  evt.fifo = s0->server_rx_fifo;
-	  evt.event_type = FIFO_EVENT_SERVER_RX;
+	  evt.event_type = FIFO_EVENT_APP_RX;
 	  evt.event_id = serial_number++;
 
 	  /* Add event to server's event queue */