aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/session/segment_manager.c
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2021-06-17 15:53:38 -0700
committerFlorin Coras <fcoras@cisco.com>2021-06-18 16:51:42 -0700
commit6973c73131f68630bf5ede3a78583f3d69f0392e (patch)
tree957dd00c08bec0f4b31ec40996293dfb76a0f6c7 /src/vnet/session/segment_manager.c
parent5de9772c14462b584ebae90017a69c2ef88e9073 (diff)
session: improve ct locking with multiple workers
Type: improvement Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: Id91c3be57d49745cb3db6c768a8d5d14133f899e
Diffstat (limited to 'src/vnet/session/segment_manager.c')
-rw-r--r--src/vnet/session/segment_manager.c21
1 files changed, 18 insertions, 3 deletions
diff --git a/src/vnet/session/segment_manager.c b/src/vnet/session/segment_manager.c
index a7ce989e8e3..f711270a89a 100644
--- a/src/vnet/session/segment_manager.c
+++ b/src/vnet/session/segment_manager.c
@@ -87,9 +87,9 @@ segment_manager_segment_index (segment_manager_t * sm, fifo_segment_t * seg)
* If needed a writer's lock is acquired before allocating a new segment
* to avoid affecting any of the segments pool readers.
*/
-int
-segment_manager_add_segment (segment_manager_t *sm, uword segment_size,
- u8 notify_app)
+static inline int
+segment_manager_add_segment_inline (segment_manager_t *sm, uword segment_size,
+ u8 notify_app, u8 flags)
{
segment_manager_main_t *smm = &sm_main;
segment_manager_props_t *props;
@@ -161,6 +161,7 @@ segment_manager_add_segment (segment_manager_t *sm, uword segment_size,
fs->h->high_watermark = sm->high_watermark;
fs->h->low_watermark = sm->low_watermark;
fs->h->pct_first_alloc = props->pct_first_alloc;
+ fs->h->flags = flags;
fs->h->flags &= ~FIFO_SEGMENT_F_MEM_LIMIT;
if (notify_app)
@@ -181,6 +182,20 @@ done:
return fs_index;
}
+int
+segment_manager_add_segment (segment_manager_t *sm, uword segment_size,
+ u8 notify_app)
+{
+ return segment_manager_add_segment_inline (sm, segment_size, notify_app, 0);
+}
+
+int
+segment_manager_add_segment2 (segment_manager_t *sm, uword segment_size,
+ u8 flags)
+{
+ return segment_manager_add_segment_inline (sm, segment_size, 0, flags);
+}
+
/**
* Remove segment without lock
*/