diff options
author | Florin Coras <fcoras@cisco.com> | 2020-12-10 18:52:40 -0800 |
---|---|---|
committer | Florin Coras <florin.coras@gmail.com> | 2020-12-29 21:04:39 +0000 |
commit | 14f066e95100cfdcd5f0531e35ba84b7b859a00a (patch) | |
tree | 53118cd229784f7a38bc5a4d06f2f3591d43c996 /src/plugins/hs_apps/sapi/vpp_echo_bapi.c | |
parent | b462418890240b2e38dbf522f9dd0196b79e0fa8 (diff) |
svm vcl: allow random offsets for fifo segments in apps
Type: improvement
Signed-off-by: Florin Coras <fcoras@cisco.com>
Change-Id: I1658a9c19d8eae4c9a42c0a111d4ad343b8eb8a4
Diffstat (limited to 'src/plugins/hs_apps/sapi/vpp_echo_bapi.c')
-rw-r--r-- | src/plugins/hs_apps/sapi/vpp_echo_bapi.c | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/src/plugins/hs_apps/sapi/vpp_echo_bapi.c b/src/plugins/hs_apps/sapi/vpp_echo_bapi.c index 6ad825d7872..807ec62d951 100644 --- a/src/plugins/hs_apps/sapi/vpp_echo_bapi.c +++ b/src/plugins/hs_apps/sapi/vpp_echo_bapi.c @@ -266,7 +266,6 @@ int echo_attach_session (uword segment_handle, uword rxf_offset, uword txf_offset, uword mq_offset, echo_session_t *s) { - svm_fifo_shared_t *rx_fifo, *tx_fifo; echo_main_t *em = &echo_main; u32 fs_index, eqs_index; fifo_segment_t *fs; @@ -285,22 +284,19 @@ echo_attach_session (uword segment_handle, uword rxf_offset, uword txf_offset, ASSERT (eqs_index != (u32) ~0); } - rx_fifo = uword_to_pointer (rxf_offset, svm_fifo_shared_t *); - tx_fifo = uword_to_pointer (txf_offset, svm_fifo_shared_t *); - rx_fifo->client_session_index = s->session_index; - tx_fifo->client_session_index = s->session_index; - clib_spinlock_lock (&em->segment_handles_lock); fs = fifo_segment_get_segment (&em->segment_main, fs_index); - s->rx_fifo = fifo_segment_alloc_fifo_w_shared (fs, rx_fifo); - s->tx_fifo = fifo_segment_alloc_fifo_w_shared (fs, tx_fifo); + s->rx_fifo = fifo_segment_alloc_fifo_w_offset (fs, rxf_offset); + s->tx_fifo = fifo_segment_alloc_fifo_w_offset (fs, txf_offset); + s->rx_fifo->shr->client_session_index = s->session_index; + s->tx_fifo->shr->client_session_index = s->session_index; if (mq_offset != (uword) ~0) { fs = fifo_segment_get_segment (&em->segment_main, eqs_index); - s->vpp_evt_q = - fifo_segment_msg_q_attach (fs, mq_offset, rx_fifo->slice_index); + s->vpp_evt_q = fifo_segment_msg_q_attach (fs, mq_offset, + s->rx_fifo->shr->slice_index); } clib_spinlock_unlock (&em->segment_handles_lock); |