summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2018-10-04 19:03:05 -0700
committerDave Barach <openvpp@barachs.net>2018-10-05 11:40:58 +0000
commit326b81e30e63a8296df51d85e6514356cd737225 (patch)
treebd5104903cecdd87bbad233adbd76c447b7c7d4c
parentb3f90503313949e23528495ca12a525be7c5ad9f (diff)
session: fix local session tagging and cleanup
Change-Id: I0d42a0c71fea7dd669fb1fe5ded7e6e944245c7d Signed-off-by: Florin Coras <fcoras@cisco.com>
-rw-r--r--src/svm/svm_fifo.c1
-rw-r--r--src/svm/svm_fifo.h6
-rw-r--r--src/svm/svm_fifo_segment.c1
-rw-r--r--src/vnet/session/application.c6
-rw-r--r--src/vnet/session/segment_manager.c4
-rw-r--r--src/vnet/session/session_node.c2
6 files changed, 11 insertions, 9 deletions
diff --git a/src/svm/svm_fifo.c b/src/svm/svm_fifo.c
index ac368dddb2c..4eae0a1c7e6 100644
--- a/src/svm/svm_fifo.c
+++ b/src/svm/svm_fifo.c
@@ -212,6 +212,7 @@ svm_fifo_create (u32 data_size_in_bytes)
memset (f, 0, sizeof (*f));
f->nitems = data_size_in_bytes;
f->ooos_list_head = OOO_SEGMENT_INVALID_INDEX;
+ f->ct_session_index = SVM_FIFO_INVALID_SESSION_INDEX;
f->refcnt = 1;
return (f);
}
diff --git a/src/svm/svm_fifo.h b/src/svm/svm_fifo.h
index 1ac5b6363cd..d7852a79b32 100644
--- a/src/svm/svm_fifo.h
+++ b/src/svm/svm_fifo.h
@@ -36,8 +36,9 @@ typedef struct
format_function_t format_ooo_segment;
format_function_t format_ooo_list;
-#define SVM_FIFO_TRACE (0)
-#define OOO_SEGMENT_INVALID_INDEX ((u32)~0)
+#define SVM_FIFO_TRACE (0)
+#define OOO_SEGMENT_INVALID_INDEX ((u32)~0)
+#define SVM_FIFO_INVALID_SESSION_INDEX ((u32)~0)
typedef struct
{
@@ -60,6 +61,7 @@ typedef struct _svm_fifo
u8 master_thread_index;
u8 client_thread_index;
u32 segment_manager;
+ u32 ct_session_index; /**< Local session index for vpp */
CLIB_CACHE_LINE_ALIGN_MARK (end_shared);
u32 head;
volatile u32 want_tx_evt; /**< producer wants nudge */
diff --git a/src/svm/svm_fifo_segment.c b/src/svm/svm_fifo_segment.c
index a3181ee1e28..dcfc0dffb80 100644
--- a/src/svm/svm_fifo_segment.c
+++ b/src/svm/svm_fifo_segment.c
@@ -390,6 +390,7 @@ svm_fifo_segment_alloc_fifo (svm_fifo_segment_private_t * s,
memset (f, 0, sizeof (*f));
f->nitems = data_size_in_bytes;
f->ooos_list_head = OOO_SEGMENT_INVALID_INDEX;
+ f->ct_session_index = SVM_FIFO_INVALID_SESSION_INDEX;
f->refcnt = 1;
f->freelist_index = freelist_index;
goto found;
diff --git a/src/vnet/session/application.c b/src/vnet/session/application.c
index 61909660ad6..fad3e1c2292 100644
--- a/src/vnet/session/application.c
+++ b/src/vnet/session/application.c
@@ -1626,10 +1626,8 @@ application_local_session_connect (app_worker_t * client_wrk,
segment_manager_segment_reader_unlock (sm);
goto failed;
}
- ls->server_rx_fifo->master_session_index = ls->session_index;
- ls->server_tx_fifo->master_session_index = ls->session_index;
- ls->server_rx_fifo->master_thread_index = ~0;
- ls->server_tx_fifo->master_thread_index = ~0;
+ ls->server_rx_fifo->ct_session_index = ls->session_index;
+ ls->server_tx_fifo->ct_session_index = ls->session_index;
ls->svm_segment_index = seg_index;
ls->listener_index = ll->session_index;
ls->client_wrk_index = client_wrk->wrk_index;
diff --git a/src/vnet/session/segment_manager.c b/src/vnet/session/segment_manager.c
index bf62040271f..8dd72928ec4 100644
--- a/src/vnet/session/segment_manager.c
+++ b/src/vnet/session/segment_manager.c
@@ -366,11 +366,11 @@ segment_manager_del_sessions (segment_manager_t * sm)
*/
while (fifo)
{
- if (fifo->master_thread_index == 255)
+ 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,
- fifo->master_session_index);
+ fifo->ct_session_index);
fifo = next;
continue;
}
diff --git a/src/vnet/session/session_node.c b/src/vnet/session/session_node.c
index 9a954bb127b..281622bcc9b 100644
--- a/src/vnet/session/session_node.c
+++ b/src/vnet/session/session_node.c
@@ -835,7 +835,7 @@ skip_dequeue:
s = session_event_get_session (e, thread_index);
if (PREDICT_FALSE (!s))
{
- clib_warning ("It's dead, Jim!");
+ clib_warning ("session was freed!");
continue;
}