summaryrefslogtreecommitdiffstats
path: root/src/vnet/session/segment_manager.h
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2018-02-08 15:10:09 -0800
committerFlorin Coras <fcoras@cisco.com>2018-02-14 00:54:43 -0800
commitf8f516a8b0ccab2f5d9796f90419bf2661c750af (patch)
treef02f6c01ed1bf33aeb4ebb5714af470e537f87c2 /src/vnet/session/segment_manager.h
parent7758bf68a03a32f17c07154172157f5bdf30e684 (diff)
session: support local sessions and deprecate redirects
Memfd backed shared memory segments can only be negotiated over sockets. For such scenarios, the existing redirect mechanism that establishes cut-through sessions does not work anymore as the two peer application do not share such a socket. This patch adds support for local sessions, as opposed to sessions backed by a transport connection, in a way that is almost transparent to the two applications by reusing the existing binary api messages. Moreover, all segment allocations are now entirely done through the segment manager valloc, so segment overlaps due to independent allocations previously required for redirects are completely avoided. The one notable characteristic of local sessions (cut-through from app perspective) notification messages is that they carry pointers to two event queues, one for each app peer, instead of one. For transport-backed sessions one of the queues can be inferred but for local session they cannot. Change-Id: Ia443fb63e2d9d8e43490275062a708f039038175 Signed-off-by: Florin Coras <fcoras@cisco.com>
Diffstat (limited to 'src/vnet/session/segment_manager.h')
-rw-r--r--src/vnet/session/segment_manager.h31
1 files changed, 16 insertions, 15 deletions
diff --git a/src/vnet/session/segment_manager.h b/src/vnet/session/segment_manager.h
index 9b1d4cd0c06..62e5e97e703 100644
--- a/src/vnet/session/segment_manager.h
+++ b/src/vnet/session/segment_manager.h
@@ -27,9 +27,7 @@ typedef struct _segment_manager_properties
/** Session fifo sizes. */
u32 rx_fifo_size;
u32 tx_fifo_size;
-
- /** Preallocated pool sizes */
-// u32 preallocated_fifo_pairs;
+ u32 evt_q_size;
/** Configured additional segment size */
u32 add_segment_size;
@@ -40,8 +38,6 @@ typedef struct _segment_manager_properties
/** Segment type: if set to SSVM_N_TYPES, private segments are used */
ssvm_segment_type_t segment_type;
- /** Use one or more private mheaps, instead of the global heap */
-// u32 private_segment_count;
} segment_manager_properties_t;
typedef struct _segment_manager
@@ -126,7 +122,7 @@ segment_manager_event_queue (segment_manager_t * sm)
segment_manager_t *segment_manager_new ();
int segment_manager_init (segment_manager_t * sm, u32 first_seg_size,
- u32 evt_q_size, u32 prealloc_fifo_pairs);
+ u32 prealloc_fifo_pairs);
svm_fifo_segment_private_t *segment_manager_get_segment (segment_manager_t *
sm,
@@ -134,6 +130,9 @@ svm_fifo_segment_private_t *segment_manager_get_segment (segment_manager_t *
svm_fifo_segment_private_t
* segment_manager_get_segment_w_lock (segment_manager_t * sm,
u32 segment_index);
+int segment_manager_add_segment (segment_manager_t * sm, u32 segment_size);
+void segment_manager_del_segment (segment_manager_t * sm,
+ svm_fifo_segment_private_t * fs);
void segment_manager_segment_reader_unlock (segment_manager_t * sm);
void segment_manager_segment_writer_unlock (segment_manager_t * sm);
@@ -143,15 +142,17 @@ void segment_manager_del_sessions (segment_manager_t * sm);
void segment_manager_del (segment_manager_t * sm);
void segment_manager_init_del (segment_manager_t * sm);
u8 segment_manager_has_fifos (segment_manager_t * sm);
-int
-segment_manager_alloc_session_fifos (segment_manager_t * sm,
- svm_fifo_t ** server_rx_fifo,
- svm_fifo_t ** server_tx_fifo,
- u32 * fifo_segment_index);
-void
-segment_manager_dealloc_fifos (u32 svm_segment_index, svm_fifo_t * rx_fifo,
- svm_fifo_t * tx_fifo);
-svm_queue_t *segment_manager_alloc_queue (segment_manager_t * sm,
+int segment_manager_alloc_session_fifos (segment_manager_t * sm,
+ svm_fifo_t ** server_rx_fifo,
+ svm_fifo_t ** server_tx_fifo,
+ u32 * fifo_segment_index);
+int segment_manager_try_alloc_fifos (svm_fifo_segment_private_t * fs,
+ u32 rx_fifo_size, u32 tx_fifo_size,
+ svm_fifo_t ** rx_fifo,
+ svm_fifo_t ** tx_fifo);
+void segment_manager_dealloc_fifos (u32 segment_index, svm_fifo_t * rx_fifo,
+ svm_fifo_t * tx_fifo);
+svm_queue_t *segment_manager_alloc_queue (svm_fifo_segment_private_t * fs,
u32 queue_size);
void segment_manager_dealloc_queue (segment_manager_t * sm, svm_queue_t * q);
void segment_manager_app_detach (segment_manager_t * sm);