svm: split fifo into private and shared structs
[vpp.git] / src / vnet / session / session.c
index 1f24805..962df55 100644 (file)
@@ -78,7 +78,7 @@ session_send_evt_to_thread (void *data, void *args, u32 thread_index,
 int
 session_send_io_evt_to_thread (svm_fifo_t * f, session_evt_type_t evt_type)
 {
-  return session_send_evt_to_thread (&f->master_session_index, 0,
+  return session_send_evt_to_thread (&f->shr->master_session_index, 0,
                                     f->master_thread_index, evt_type);
 }
 
@@ -436,8 +436,8 @@ session_fifo_tuning (session_t * s, svm_fifo_t * f,
        {
          segment_manager_t *sm;
          sm = segment_manager_get (f->segment_manager);
-         ASSERT (f->size >= 4096);
-         ASSERT (f->size <= sm->max_fifo_size);
+         ASSERT (f->shr->size >= 4096);
+         ASSERT (f->shr->size <= sm->max_fifo_size);
        }
     }
 }
@@ -611,9 +611,9 @@ session_notify_subscribers (u32 app_index, session_t * s,
   if (!app)
     return -1;
 
-  for (i = 0; i < f->n_subscribers; i++)
+  for (i = 0; i < f->shr->n_subscribers; i++)
     {
-      app_wrk = application_get_worker (app, f->subscribers[i]);
+      app_wrk = application_get_worker (app, f->shr->subscribers[i]);
       if (!app_wrk)
        continue;
       if (app_worker_lock_and_send_event (app_wrk, s, evt_type))
@@ -723,7 +723,7 @@ session_dequeue_notify (session_t * s)
                                                     SESSION_IO_EVT_TX)))
     return -1;
 
-  if (PREDICT_FALSE (s->tx_fifo->n_subscribers))
+  if (PREDICT_FALSE (s->tx_fifo->shr->n_subscribers))
     return session_notify_subscribers (app_wrk->app_index, s,
                                       s->tx_fifo, SESSION_IO_EVT_TX);
 
@@ -1780,8 +1780,8 @@ session_node_enable_disable (u8 is_en)
                                          session_queue_process_node.index,
                                          SESSION_Q_PROCESS_STOP, 0);
          }
-
-       continue;
+       if (!session_main.poll_main)
+         continue;
       }
     vlib_node_set_state (this_vlib_main, session_queue_node.index,
                          state);
@@ -1818,6 +1818,7 @@ session_main_init (vlib_main_t * vm)
 
   smm->is_enabled = 0;
   smm->session_enable_asap = 0;
+  smm->poll_main = 0;
   smm->session_baseva = HIGH_SEGMENT_BASEVA;
 
 #if (HIGH_SEGMENT_BASEVA > (4ULL << 30))
@@ -1935,6 +1936,8 @@ session_config_fn (vlib_main_t * vm, unformat_input_t * input)
        ;
       else if (unformat (input, "use-app-socket-api"))
        appns_sapi_enable ();
+      else if (unformat (input, "poll-main"))
+       smm->poll_main = 1;
       else
        return clib_error_return (0, "unknown input `%U'",
                                  format_unformat_error, input);