aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/session/segment_manager.c
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2020-05-14 05:32:18 +0000
committerFlorin Coras <fcoras@cisco.com>2020-05-15 16:14:12 +0000
commitc8e812f6fb88dcd537e4de9333b5acf32e6f1ca0 (patch)
tree29af036ec3954aad763dd1e5b407f4496e8f7e6d /src/vnet/session/segment_manager.c
parent18a86c6e6069cbc9a0d2294ebb7f7cca5f616f84 (diff)
session: track detached listener segment managers
Type: fix Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: Iae734a526d2e7befd9738054d028df0062b67000
Diffstat (limited to 'src/vnet/session/segment_manager.c')
-rw-r--r--src/vnet/session/segment_manager.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/src/vnet/session/segment_manager.c b/src/vnet/session/segment_manager.c
index 7734a3eef81..4c4f0b4b3cf 100644
--- a/src/vnet/session/segment_manager.c
+++ b/src/vnet/session/segment_manager.c
@@ -67,13 +67,13 @@ segment_manager_props_init (segment_manager_props_t * props)
u8
segment_manager_app_detached (segment_manager_t * sm)
{
- return (sm->app_wrk_index == SEGMENT_MANAGER_INVALID_APP_INDEX);
+ return (sm->flags & SEG_MANAGER_F_DETACHED);
}
void
segment_manager_app_detach (segment_manager_t * sm)
{
- sm->app_wrk_index = SEGMENT_MANAGER_INVALID_APP_INDEX;
+ sm->flags |= SEG_MANAGER_F_DETACHED;
}
always_inline u32
@@ -425,6 +425,18 @@ segment_manager_init (segment_manager_t * sm)
return 0;
}
+void
+segment_manager_cleanup_detached_listener (segment_manager_t * sm)
+{
+ app_worker_t *app_wrk;
+
+ app_wrk = app_worker_get_if_valid (sm->app_wrk_index);
+ if (!app_wrk)
+ return;
+
+ app_worker_del_detached_sm (app_wrk, segment_manager_index (sm));
+}
+
/**
* Cleanup segment manager.
*/
@@ -437,6 +449,9 @@ segment_manager_free (segment_manager_t * sm)
ASSERT (!segment_manager_has_fifos (sm)
&& segment_manager_app_detached (sm));
+ if (sm->flags & SEG_MANAGER_F_DETACHED_LISTENER)
+ segment_manager_cleanup_detached_listener (sm);
+
/* If we have empty preallocated segments that haven't been removed, remove
* them now. Apart from that, the first segment in the first segment manager
* is not removed when all fifos are removed. It can only be removed when