summaryrefslogtreecommitdiffstats
path: root/src/vnet
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2019-04-25 12:58:46 -0700
committerDamjan Marion <dmarion@me.com>2019-04-26 10:23:38 +0000
commitb095a3cd221a142f7d2b4897b812b2781de05d29 (patch)
tree87a1cdc9872c91d46c771cd9b224c62a35d6af7d /src/vnet
parent403e3ba1507750df463d7179494c14d03864b810 (diff)
svm: fifo segment support for chunk allocation
Change-Id: Ie96706b4d8bcb32d2d5f065bc765f95f4e9369e7 Signed-off-by: Florin Coras <fcoras@cisco.com>
Diffstat (limited to 'src/vnet')
-rw-r--r--src/vnet/session/segment_manager.c15
-rw-r--r--src/vnet/session/segment_manager.h13
2 files changed, 26 insertions, 2 deletions
diff --git a/src/vnet/session/segment_manager.c b/src/vnet/session/segment_manager.c
index 47c7f563542..9a8af3b42fc 100644
--- a/src/vnet/session/segment_manager.c
+++ b/src/vnet/session/segment_manager.c
@@ -627,8 +627,8 @@ alloc_check:
void
segment_manager_dealloc_fifos (svm_fifo_t * rx_fifo, svm_fifo_t * tx_fifo)
{
- fifo_segment_t *fs;
segment_manager_t *sm;
+ fifo_segment_t *fs;
u32 segment_index;
if (!rx_fifo || !tx_fifo)
@@ -669,6 +669,19 @@ segment_manager_dealloc_fifos (svm_fifo_t * rx_fifo, svm_fifo_t * tx_fifo)
segment_manager_segment_reader_unlock (sm);
}
+int
+segment_manager_grow_fifo (segment_manager_t * sm, svm_fifo_t * f, u32 size)
+{
+ fifo_segment_t *fs;
+ int rv;
+
+ fs = segment_manager_get_segment_w_lock (sm, f->segment_index);
+ rv = fifo_segment_grow_fifo (fs, f, size);
+ segment_manager_segment_reader_unlock (sm);
+
+ return rv;
+}
+
u32
segment_manager_evt_q_expected_size (u32 q_len)
{
diff --git a/src/vnet/session/segment_manager.h b/src/vnet/session/segment_manager.h
index 4f30b7a8d2c..cbf8e353522 100644
--- a/src/vnet/session/segment_manager.h
+++ b/src/vnet/session/segment_manager.h
@@ -94,7 +94,7 @@ void segment_manager_del_segment (segment_manager_t * sm,
fifo_segment_t *segment_manager_get_segment (segment_manager_t * sm,
u32 segment_index);
fifo_segment_t *segment_manager_get_segment_w_handle (u64 sh);
-fifo_segment_t *segment_manager_get_segment_w_lock (segment_manager_t *,
+fifo_segment_t *segment_manager_get_segment_w_lock (segment_manager_t * sm,
u32 segment_index);
int segment_manager_add_first_segment (segment_manager_t * sm,
u32 segment_size);
@@ -114,6 +114,17 @@ int segment_manager_try_alloc_fifos (fifo_segment_t * fs,
svm_fifo_t ** tx_fifo);
void segment_manager_dealloc_fifos (svm_fifo_t * rx_fifo,
svm_fifo_t * tx_fifo);
+
+/**
+ * Grows fifo owned by segment manager
+ *
+ * @param sm segment manager that owns the fifo
+ * @param f fifo to be grown
+ * @param size amount of bytes to add to fifo
+ * @return 0 on success, negative number otherwise
+ */
+int segment_manager_grow_fifo (segment_manager_t * sm, svm_fifo_t * f,
+ u32 size);
u8 segment_manager_has_fifos (segment_manager_t * sm);
svm_msg_q_t *segment_manager_alloc_queue (fifo_segment_t * fs,