session: init size and watermarks on all seg managers 59/29159/3
authorFlorin Coras <fcoras@cisco.com>
Wed, 30 Sep 2020 02:18:46 +0000 (19:18 -0700)
committerFlorin Coras <florin.coras@gmail.com>
Wed, 30 Sep 2020 22:02:56 +0000 (22:02 +0000)
Type: fix

Signed-off-by: Florin Coras <fcoras@cisco.com>
Change-Id: I0cfe04277d80d9c81499651f893fb2d126ac8c85

src/vnet/session/application.c
src/vnet/session/application_worker.c
src/vnet/session/segment_manager.c
src/vnet/session/segment_manager.h

index 0b5c951..c62496e 100644 (file)
@@ -711,7 +711,7 @@ application_alloc_worker_and_init (application_t * app, app_worker_t ** wrk)
   sm = segment_manager_alloc ();
   sm->app_wrk_index = app_wrk->wrk_index;
 
-  if ((rv = segment_manager_init (sm)))
+  if ((rv = segment_manager_init_first (sm)))
     {
       app_worker_free (app_wrk);
       return rv;
index 2b2cc34..c332f19 100644 (file)
@@ -186,6 +186,7 @@ app_worker_alloc_segment_manager (app_worker_t * app_wrk)
       sm = segment_manager_alloc ();
     }
   sm->app_wrk_index = app_wrk->wrk_index;
+  segment_manager_init (sm);
   return sm;
 }
 
index d734d64..53be0bf 100644 (file)
@@ -333,21 +333,12 @@ segment_manager_alloc (void)
   return sm;
 }
 
-/**
- * Initializes segment manager based on options provided.
- * Returns error if ssvm segment(s) allocation fails.
- */
 int
 segment_manager_init (segment_manager_t * sm)
 {
   segment_manager_props_t *props;
-  uword first_seg_size;
-  fifo_segment_t *fs;
-  int fs_index, i;
 
   props = segment_manager_properties_get (sm);
-  first_seg_size = clib_max (props->segment_size,
-                            sm_main.default_segment_size);
 
   sm->max_fifo_size = props->max_fifo_size ?
     props->max_fifo_size : sm_main.default_max_fifo_size;
@@ -356,6 +347,25 @@ segment_manager_init (segment_manager_t * sm)
   segment_manager_set_watermarks (sm,
                                  props->high_watermark,
                                  props->low_watermark);
+  return 0;
+}
+
+/**
+ * Initializes segment manager based on options provided.
+ * Returns error if ssvm segment(s) allocation fails.
+ */
+int
+segment_manager_init_first (segment_manager_t * sm)
+{
+  segment_manager_props_t *props;
+  uword first_seg_size;
+  fifo_segment_t *fs;
+  int fs_index, i;
+
+  segment_manager_init (sm);
+  props = segment_manager_properties_get (sm);
+  first_seg_size = clib_max (props->segment_size,
+                            sm_main.default_segment_size);
 
   if (props->prealloc_fifos)
     {
index 1e6b14d..f4dacdd 100644 (file)
@@ -88,6 +88,7 @@ typedef struct segment_manager_main_init_args_
 
 segment_manager_t *segment_manager_alloc (void);
 int segment_manager_init (segment_manager_t * sm);
+int segment_manager_init_first (segment_manager_t * sm);
 
 /**
  * Cleanup segment manager