summaryrefslogtreecommitdiffstats
path: root/src/vcl/vcl_private.c
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2021-06-16 14:46:57 -0700
committerDave Barach <openvpp@barachs.net>2021-06-16 23:23:50 +0000
commit8eb8d50ecfd7507aae340cb05a0fb07a790e4303 (patch)
tree5799f08d5472c6093fc54a33288a4ae4f1567d6f /src/vcl/vcl_private.c
parentcba215dad3101c6b03483c5c40f806903de8460d (diff)
vcl: fix fifo sharing
Type: fix Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: Iec1fe8315a057214901250d5fb06d1c1e33dda46
Diffstat (limited to 'src/vcl/vcl_private.c')
-rw-r--r--src/vcl/vcl_private.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/vcl/vcl_private.c b/src/vcl/vcl_private.c
index 712c07049c6..95a45ffd099 100644
--- a/src/vcl/vcl_private.c
+++ b/src/vcl/vcl_private.c
@@ -569,6 +569,26 @@ vcl_segment_alloc_chunk (uword segment_handle, u32 slice_index, u32 size,
return c;
}
+int
+vcl_session_share_fifos (vcl_session_t *s, svm_fifo_t *rxf, svm_fifo_t *txf)
+{
+ vcl_worker_t *wrk = vcl_worker_get_current ();
+ fifo_segment_t *fs;
+
+ clib_rwlock_reader_lock (&vcm->segment_table_lock);
+
+ fs = fifo_segment_get_segment (&vcm->segment_main, rxf->segment_index);
+ s->rx_fifo = fifo_segment_duplicate_fifo (fs, rxf);
+ s->tx_fifo = fifo_segment_duplicate_fifo (fs, txf);
+
+ clib_rwlock_reader_unlock (&vcm->segment_table_lock);
+
+ svm_fifo_add_subscriber (s->rx_fifo, wrk->vpp_wrk_index);
+ svm_fifo_add_subscriber (s->tx_fifo, wrk->vpp_wrk_index);
+
+ return 0;
+}
+
/*
* fd.io coding-style-patch-verification: ON
*