session: separate local session logic
[vpp.git] / src / vnet / session / segment_manager.c
index 2b8a732..8e6c281 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017 Cisco and/or its affiliates.
+ * Copyright (c) 2017-2019 Cisco and/or its affiliates.
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at:
@@ -16,6 +16,7 @@
 #include <vnet/session/segment_manager.h>
 #include <vnet/session/session.h>
 #include <vnet/session/application.h>
+#include <vnet/session/application_local.h>
 
 segment_manager_main_t segment_manager_main;
 
@@ -186,7 +187,7 @@ segment_manager_add_segment (segment_manager_t * sm, u32 segment_size)
   segment_manager_main_t *smm = &segment_manager_main;
   u32 rnd_margin = 128 << 10, seg_index, page_size;
   segment_manager_properties_t *props;
-  uword baseva = (u64) ~ 0, alloc_size;
+  uword baseva = (uword) ~ 0ULL, alloc_size;
   svm_fifo_segment_private_t *seg;
   u8 *seg_name;
   int rv;
@@ -379,7 +380,7 @@ void
 segment_manager_del_sessions (segment_manager_t * sm)
 {
   svm_fifo_segment_private_t *fifo_segment;
-  stream_session_t *session;
+  session_t *session;
   svm_fifo_t *fifo;
 
   ASSERT (pool_elts (sm->segments) != 0);
@@ -399,7 +400,7 @@ segment_manager_del_sessions (segment_manager_t * sm)
        if (fifo->ct_session_index != SVM_FIFO_INVALID_SESSION_INDEX)
          {
            svm_fifo_t *next = fifo->next;
-           application_local_session_disconnect_w_index (sm->app_wrk_index,
+           app_worker_local_session_disconnect_w_index (sm->app_wrk_index,
                                                          fifo->ct_session_index);
            fifo = next;
            continue;
@@ -599,6 +600,9 @@ segment_manager_dealloc_fifos (u32 segment_index, svm_fifo_t * rx_fifo,
   svm_fifo_segment_private_t *fifo_segment;
   segment_manager_t *sm;
 
+  if (!rx_fifo || !tx_fifo)
+    return;
+
   /* It's possible to have no segment manager if the session was removed
    * as result of a detach. */
   if (!(sm = segment_manager_get_if_valid (rx_fifo->segment_manager)))
@@ -735,8 +739,8 @@ segment_manager_show_fn (vlib_main_t * vm, unformat_input_t * input,
   svm_fifo_segment_private_t *seg;
   segment_manager_t *sm;
   u8 show_segments = 0, verbose = 0;
-  uword address;
-  u64 size;
+  char *address;
+  size_t size;
   u32 active_fifos;
   u32 free_fifos;