aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/hs_apps/echo_client.c21
-rw-r--r--src/plugins/hs_apps/proxy.c6
-rw-r--r--src/plugins/hs_apps/sapi/vpp_echo.c48
-rw-r--r--src/plugins/hs_apps/sapi/vpp_echo_bapi.c33
-rw-r--r--src/plugins/hs_apps/sapi/vpp_echo_common.h2
-rw-r--r--src/plugins/hs_apps/sapi/vpp_echo_proto_udp.c16
-rw-r--r--src/plugins/unittest/segment_manager_test.c4
-rw-r--r--src/plugins/unittest/session_test.c2
-rw-r--r--src/plugins/unittest/svm_fifo_test.c94
9 files changed, 124 insertions, 102 deletions
diff --git a/src/plugins/hs_apps/echo_client.c b/src/plugins/hs_apps/echo_client.c
index 072d767fa6e..50d815748a5 100644
--- a/src/plugins/hs_apps/echo_client.c
+++ b/src/plugins/hs_apps/echo_client.c
@@ -65,9 +65,8 @@ send_data_chunk (echo_client_main_t * ecm, eclient_session_t * s)
svm_fifo_t *f = s->data.tx_fifo;
rv = clib_min (svm_fifo_max_enqueue_prod (f), bytes_this_chunk);
svm_fifo_enqueue_nocopy (f, rv);
- session_send_io_evt_to_thread_custom (&f->master_session_index,
- s->thread_index,
- SESSION_IO_EVT_TX);
+ session_send_io_evt_to_thread_custom (
+ &f->shr->master_session_index, s->thread_index, SESSION_IO_EVT_TX);
}
else
rv = app_send_stream (&s->data, test_data + test_buf_offset,
@@ -101,9 +100,8 @@ send_data_chunk (echo_client_main_t * ecm, eclient_session_t * s)
hdr.lcl_port = at->lcl_port;
svm_fifo_enqueue (f, sizeof (hdr), (u8 *) & hdr);
svm_fifo_enqueue_nocopy (f, rv);
- session_send_io_evt_to_thread_custom (&f->master_session_index,
- s->thread_index,
- SESSION_IO_EVT_TX);
+ session_send_io_evt_to_thread_custom (
+ &f->shr->master_session_index, s->thread_index, SESSION_IO_EVT_TX);
}
else
{
@@ -441,9 +439,9 @@ quic_echo_clients_session_connected_callback (u32 app_index, u32 api_context,
session->bytes_to_send = ecm->bytes_to_send;
session->bytes_to_receive = ecm->no_return ? 0ULL : ecm->bytes_to_send;
session->data.rx_fifo = s->rx_fifo;
- session->data.rx_fifo->client_session_index = session_index;
+ session->data.rx_fifo->shr->client_session_index = session_index;
session->data.tx_fifo = s->tx_fifo;
- session->data.tx_fifo->client_session_index = session_index;
+ session->data.tx_fifo->shr->client_session_index = session_index;
session->data.vpp_evt_q = ecm->vpp_event_queue[thread_index];
session->vpp_session_handle = session_handle (s);
@@ -508,9 +506,9 @@ echo_clients_session_connected_callback (u32 app_index, u32 api_context,
session->bytes_to_send = ecm->bytes_to_send;
session->bytes_to_receive = ecm->no_return ? 0ULL : ecm->bytes_to_send;
session->data.rx_fifo = s->rx_fifo;
- session->data.rx_fifo->client_session_index = session_index;
+ session->data.rx_fifo->shr->client_session_index = session_index;
session->data.tx_fifo = s->tx_fifo;
- session->data.tx_fifo->client_session_index = session_index;
+ session->data.tx_fifo->shr->client_session_index = session_index;
session->data.vpp_evt_q = ecm->vpp_event_queue[thread_index];
session->vpp_session_handle = session_handle (s);
@@ -589,7 +587,8 @@ echo_clients_rx_callback (session_t * s)
return -1;
}
- sp = pool_elt_at_index (ecm->sessions, s->rx_fifo->client_session_index);
+ sp =
+ pool_elt_at_index (ecm->sessions, s->rx_fifo->shr->client_session_index);
receive_data_chunk (ecm, sp);
if (svm_fifo_max_dequeue_cons (s->rx_fifo))
diff --git a/src/plugins/hs_apps/proxy.c b/src/plugins/hs_apps/proxy.c
index fc66286a803..834d03f8dbd 100644
--- a/src/plugins/hs_apps/proxy.c
+++ b/src/plugins/hs_apps/proxy.c
@@ -309,7 +309,7 @@ proxy_rx_callback (session_t * s)
if (svm_fifo_set_event (ao_tx_fifo))
{
u32 ao_thread_index = ao_tx_fifo->master_thread_index;
- u32 ao_session_index = ao_tx_fifo->master_session_index;
+ u32 ao_session_index = ao_tx_fifo->shr->master_session_index;
if (session_send_io_evt_to_thread_custom (&ao_session_index,
ao_thread_index,
SESSION_IO_EVT_TX))
@@ -475,7 +475,7 @@ active_open_connected_callback (u32 app_index, u32 opaque,
* Reset the active-open tx-fifo master indices so the active-open session
* will receive data, etc.
*/
- s->tx_fifo->master_session_index = s->session_index;
+ s->tx_fifo->shr->master_session_index = s->session_index;
s->tx_fifo->master_thread_index = s->thread_index;
/*
@@ -532,7 +532,7 @@ active_open_rx_callback (session_t * s)
if (svm_fifo_set_event (proxy_tx_fifo))
{
u8 thread_index = proxy_tx_fifo->master_thread_index;
- u32 session_index = proxy_tx_fifo->master_session_index;
+ u32 session_index = proxy_tx_fifo->shr->master_session_index;
return session_send_io_evt_to_thread_custom (&session_index,
thread_index,
SESSION_IO_EVT_TX);
diff --git a/src/plugins/hs_apps/sapi/vpp_echo.c b/src/plugins/hs_apps/sapi/vpp_echo.c
index 4cce41edf95..a47a4d455d8 100644
--- a/src/plugins/hs_apps/sapi/vpp_echo.c
+++ b/src/plugins/hs_apps/sapi/vpp_echo.c
@@ -69,9 +69,9 @@ echo_session_dequeue_notify (echo_session_t * s)
int rv;
if (!svm_fifo_set_event (s->rx_fifo))
return;
- if ((rv =
- app_send_io_evt_to_vpp (s->vpp_evt_q, s->rx_fifo->master_session_index,
- SESSION_IO_EVT_RX, SVM_Q_WAIT)))
+ if ((rv = app_send_io_evt_to_vpp (s->vpp_evt_q,
+ s->rx_fifo->shr->master_session_index,
+ SESSION_IO_EVT_RX, SVM_Q_WAIT)))
ECHO_FAIL (ECHO_FAIL_SEND_IO_EVT, "app_send_io_evt_to_vpp errored %d",
rv);
svm_fifo_clear_deq_ntf (s->rx_fifo);
@@ -542,7 +542,6 @@ session_accepted_handler (session_accepted_msg_t * mp)
{
app_session_evt_t _app_evt, *app_evt = &_app_evt;
session_accepted_reply_msg_t *rmp;
- svm_fifo_t *rx_fifo, *tx_fifo;
echo_main_t *em = &echo_main;
echo_session_t *session, *ls;
@@ -552,24 +551,22 @@ session_accepted_handler (session_accepted_msg_t * mp)
"Unknown listener handle 0x%lx", mp->listener_handle);
return;
}
- if (echo_segment_lookup (mp->segment_handle) == ~0)
+
+ /* Allocate local session and set it up */
+ session = echo_session_new (em);
+
+ if (echo_attach_session (mp->segment_handle, mp->server_rx_fifo,
+ mp->server_tx_fifo, session))
{
ECHO_FAIL (ECHO_FAIL_ACCEPTED_WAIT_FOR_SEG_ALLOC,
"accepted wait_for_segment_allocation errored");
return;
}
- /* Allocate local session and set it up */
- session = echo_session_new (em);
- session->vpp_session_handle = mp->handle;
-
- rx_fifo = uword_to_pointer (mp->server_rx_fifo, svm_fifo_t *);
- rx_fifo->client_session_index = session->session_index;
- tx_fifo = uword_to_pointer (mp->server_tx_fifo, svm_fifo_t *);
- tx_fifo->client_session_index = session->session_index;
+ session->vpp_evt_q =
+ uword_to_pointer (mp->vpp_event_queue_address, svm_msg_q_t *);
- session->rx_fifo = rx_fifo;
- session->tx_fifo = tx_fifo;
+ session->vpp_session_handle = mp->handle;
/* session->transport needed by app_send_dgram */
clib_memcpy_fast (&session->transport.rmt_ip, &mp->rmt.ip,
@@ -581,10 +578,8 @@ session_accepted_handler (session_accepted_msg_t * mp)
session->transport.lcl_port = em->uri_elts.port;
session->vpp_session_handle = mp->handle;
- session->start = clib_time_now (&em->clib_time);
- session->vpp_evt_q = uword_to_pointer (mp->vpp_event_queue_address,
- svm_msg_q_t *);
session->listener_index = ls->session_index;
+ session->start = clib_time_now (&em->clib_time);
/* Add it to lookup table */
ECHO_LOG (2, "Accepted session 0x%lx S[%u] -> 0x%lx S[%u]",
@@ -607,7 +602,6 @@ session_connected_handler (session_connected_msg_t * mp)
echo_main_t *em = &echo_main;
echo_session_t *session;
u32 listener_index = htonl (mp->context);
- svm_fifo_t *rx_fifo, *tx_fifo;
clib_atomic_add_fetch (&em->max_sim_connects, 1);
@@ -621,24 +615,18 @@ session_connected_handler (session_connected_msg_t * mp)
}
session = echo_session_new (em);
- if (echo_segment_lookup (mp->segment_handle) == ~0)
+
+ if (echo_attach_session (mp->segment_handle, mp->server_rx_fifo,
+ mp->server_tx_fifo, session))
{
ECHO_FAIL (ECHO_FAIL_CONNECTED_WAIT_FOR_SEG_ALLOC,
"connected wait_for_segment_allocation errored");
return;
}
-
- rx_fifo = uword_to_pointer (mp->server_rx_fifo, svm_fifo_t *);
- rx_fifo->client_session_index = session->session_index;
- tx_fifo = uword_to_pointer (mp->server_tx_fifo, svm_fifo_t *);
- tx_fifo->client_session_index = session->session_index;
-
- session->rx_fifo = rx_fifo;
- session->tx_fifo = tx_fifo;
- session->vpp_session_handle = mp->handle;
- session->start = clib_time_now (&em->clib_time);
session->vpp_evt_q = uword_to_pointer (mp->vpp_event_queue_address,
svm_msg_q_t *);
+ session->vpp_session_handle = mp->handle;
+ session->start = clib_time_now (&em->clib_time);
session->listener_index = listener_index;
/* session->transport needed by app_send_dgram */
clib_memcpy_fast (&session->transport.lcl_ip, &mp->lcl.ip,
diff --git a/src/plugins/hs_apps/sapi/vpp_echo_bapi.c b/src/plugins/hs_apps/sapi/vpp_echo_bapi.c
index e71c0e9adba..c643cec2ce3 100644
--- a/src/plugins/hs_apps/sapi/vpp_echo_bapi.c
+++ b/src/plugins/hs_apps/sapi/vpp_echo_bapi.c
@@ -262,6 +262,39 @@ echo_segment_detach (u64 segment_handle)
clib_spinlock_unlock (&em->segment_handles_lock);
}
+int
+echo_attach_session (uword segment_handle, uword rxf_offset, uword txf_offset,
+ echo_session_t *s)
+{
+ svm_fifo_shared_t *rx_fifo, *tx_fifo;
+ echo_main_t *em = &echo_main;
+ fifo_segment_t *fs;
+ u32 fs_index;
+
+ fs_index = echo_segment_lookup (segment_handle);
+ if (fs_index == (u32) ~0)
+ {
+ ECHO_LOG (0, "ERROR: segment for session %u is not mounted!",
+ s->session_index);
+ return -1;
+ }
+
+ 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);
+
+ clib_spinlock_unlock (&em->segment_handles_lock);
+
+ return 0;
+}
+
/*
*
* Binary API callbacks
diff --git a/src/plugins/hs_apps/sapi/vpp_echo_common.h b/src/plugins/hs_apps/sapi/vpp_echo_common.h
index 0def7adab36..cd2bbb6038c 100644
--- a/src/plugins/hs_apps/sapi/vpp_echo_common.h
+++ b/src/plugins/hs_apps/sapi/vpp_echo_common.h
@@ -443,6 +443,8 @@ int echo_segment_attach (u64 segment_handle, char *name,
ssvm_segment_type_t type, int fd);
u32 echo_segment_lookup (u64 segment_handle);
void echo_segment_detach (u64 segment_handle);
+int echo_attach_session (uword segment_handle, uword rxf_offset,
+ uword txf_offset, echo_session_t *s);
/* Binary API */
diff --git a/src/plugins/hs_apps/sapi/vpp_echo_proto_udp.c b/src/plugins/hs_apps/sapi/vpp_echo_proto_udp.c
index 456113cdd7d..9689a83d76b 100644
--- a/src/plugins/hs_apps/sapi/vpp_echo_proto_udp.c
+++ b/src/plugins/hs_apps/sapi/vpp_echo_proto_udp.c
@@ -126,24 +126,24 @@ udp_echo_reset_cb (session_reset_msg_t * mp, echo_session_t * s)
static void
udp_echo_bound_uri_cb (session_bound_msg_t * mp, echo_session_t * session)
{
- svm_fifo_t *rx_fifo, *tx_fifo;
echo_main_t *em = &echo_main;
u32 session_index = session->session_index;
if (!em->i_am_master || em->uri_elts.transport_proto != TRANSPORT_PROTO_UDP)
return;
- rx_fifo = uword_to_pointer (mp->rx_fifo, svm_fifo_t *);
- tx_fifo = uword_to_pointer (mp->tx_fifo, svm_fifo_t *);
- rx_fifo->client_session_index = session_index;
- tx_fifo->client_session_index = session_index;
+ if (echo_attach_session (mp->segment_handle, mp->rx_fifo, mp->tx_fifo,
+ session))
+ {
+ ECHO_FAIL (ECHO_FAIL_ACCEPTED_WAIT_FOR_SEG_ALLOC,
+ "accepted wait_for_segment_allocation errored");
+ return;
+ }
- session->rx_fifo = rx_fifo;
- session->tx_fifo = tx_fifo;
+ session->vpp_evt_q = uword_to_pointer (mp->vpp_evt_q, svm_msg_q_t *);
session->transport.is_ip4 = mp->lcl_is_ip4;
clib_memcpy_fast (&session->transport.lcl_ip, mp->lcl_ip,
sizeof (ip46_address_t));
session->transport.lcl_port = mp->lcl_port;
- session->vpp_evt_q = uword_to_pointer (mp->vpp_evt_q, svm_msg_q_t *);
echo_notify_event (em, ECHO_EVT_FIRST_QCONNECT);
session->session_type = ECHO_SESSION_TYPE_STREAM;
diff --git a/src/plugins/unittest/segment_manager_test.c b/src/plugins/unittest/segment_manager_test.c
index 2e8261e1c90..c6f52972e51 100644
--- a/src/plugins/unittest/segment_manager_test.c
+++ b/src/plugins/unittest/segment_manager_test.c
@@ -670,8 +670,8 @@ segment_manager_test_fifo_ops (vlib_main_t * vm, unformat_input_t * input)
"fifo_segment_get_mem_status %s", states_str[rv]);
/* (virtual) fifo size is still large as it is not updated */
- SEG_MGR_TEST ((rx_fifo->size == most_grown), "rx_fifo->size %u",
- rx_fifo->size);
+ SEG_MGR_TEST ((rx_fifo->shr->size == most_grown), "rx_fifo->size %u",
+ rx_fifo->shr->size);
vnet_app_detach_args_t detach_args = {
.app_index = attach_args.app_index,
diff --git a/src/plugins/unittest/session_test.c b/src/plugins/unittest/session_test.c
index d3a4e091647..862d81f4acb 100644
--- a/src/plugins/unittest/session_test.c
+++ b/src/plugins/unittest/session_test.c
@@ -1850,7 +1850,7 @@ session_test_mq_speed (vlib_main_t * vm, unformat_input_t * input)
s.rx_fifo = rx_fifo;
s.tx_fifo = tx_fifo;
s.session_state = SESSION_STATE_READY;
- counter = (u64 *) rx_fifo->head_chunk->data;
+ counter = (u64 *) rx_fifo->shr->head_chunk->data;
start = vlib_time_now (vm);
pid = fork ();
diff --git a/src/plugins/unittest/svm_fifo_test.c b/src/plugins/unittest/svm_fifo_test.c
index 6adba7e8e59..978dc10ff99 100644
--- a/src/plugins/unittest/svm_fifo_test.c
+++ b/src/plugins/unittest/svm_fifo_test.c
@@ -256,7 +256,7 @@ sfifo_test_fifo1 (vlib_main_t * vm, unformat_input_t * input)
*/
rv = svm_fifo_enqueue (f, sizeof (u32), (u8 *) test_data);
SFIFO_TEST ((rv == sizeof (u32)), "enqueued %d", rv);
- SFIFO_TEST ((f->tail == 4), "fifo tail %u", f->tail);
+ SFIFO_TEST ((f->shr->tail == 4), "fifo tail %u", f->shr->tail);
/*
* Create 3 chunks in the future. The offsets are relative
@@ -264,7 +264,7 @@ sfifo_test_fifo1 (vlib_main_t * vm, unformat_input_t * input)
*/
for (i = 0; i < 3; i++)
{
- offset = (2 * i + 1) * sizeof (u32) - f->tail;
+ offset = (2 * i + 1) * sizeof (u32) - f->shr->tail;
data = (u8 *) (test_data + (2 * i + 1));
if (i == 0)
{
@@ -286,14 +286,14 @@ sfifo_test_fifo1 (vlib_main_t * vm, unformat_input_t * input)
if (verbose)
vlib_cli_output (vm, "fifo after odd segs: %U", format_svm_fifo, f, 1);
- SFIFO_TEST ((f->tail == 8), "fifo tail %u", f->tail);
+ SFIFO_TEST ((f->shr->tail == 8), "fifo tail %u", f->shr->tail);
SFIFO_TEST ((svm_fifo_n_ooo_segments (f) == 2),
"number of ooo segments %u", svm_fifo_n_ooo_segments (f));
/*
* Try adding a completely overlapped segment
*/
- offset = 3 * sizeof (u32) - f->tail;
+ offset = 3 * sizeof (u32) - f->shr->tail;
data = (u8 *) (test_data + 3);
rv = svm_fifo_enqueue_with_offset (f, offset, sizeof (u32), data);
if (rv)
@@ -319,7 +319,7 @@ sfifo_test_fifo1 (vlib_main_t * vm, unformat_input_t * input)
*/
for (i = 3; i > 1; i--)
{
- offset = (2 * i + 0) * sizeof (u32) - f->tail;
+ offset = (2 * i + 0) * sizeof (u32) - f->shr->tail;
data = (u8 *) (test_data + (2 * i + 0));
rv = svm_fifo_enqueue_with_offset (f, offset, sizeof (u32), data);
if (verbose)
@@ -381,7 +381,7 @@ sfifo_test_fifo1 (vlib_main_t * vm, unformat_input_t * input)
for (i = 0; i < 4; i++)
{
- offset = (2 * i + 1) * sizeof (u32) - f->tail;
+ offset = (2 * i + 1) * sizeof (u32) - f->shr->tail;
data = (u8 *) (test_data + (2 * i + 1));
rv = svm_fifo_enqueue_with_offset (f, offset, sizeof (u32), data);
if (verbose)
@@ -394,7 +394,7 @@ sfifo_test_fifo1 (vlib_main_t * vm, unformat_input_t * input)
}
}
- rv = svm_fifo_enqueue_with_offset (f, 8 - f->tail, 21, data);
+ rv = svm_fifo_enqueue_with_offset (f, 8 - f->shr->tail, 21, data);
SFIFO_TEST ((rv == 0), "ooo enqueued %u", rv);
SFIFO_TEST ((svm_fifo_n_ooo_segments (f) == 1),
"number of ooo segments %u", svm_fifo_n_ooo_segments (f));
@@ -422,7 +422,7 @@ sfifo_test_fifo1 (vlib_main_t * vm, unformat_input_t * input)
for (i = 0; i < 4; i++)
{
- offset = (2 * i + 1) * sizeof (u32) - f->tail;
+ offset = (2 * i + 1) * sizeof (u32) - f->shr->tail;
data = (u8 *) (test_data + (2 * i + 1));
rv = svm_fifo_enqueue_with_offset (f, offset, sizeof (u32), data);
if (verbose)
@@ -500,8 +500,8 @@ sfifo_test_fifo2 (vlib_main_t * vm)
{
tp = vp + i;
data64 = tp->offset;
- svm_fifo_enqueue_with_offset (f, tp->offset - f->tail, tp->len,
- (u8 *) & data64);
+ svm_fifo_enqueue_with_offset (f, tp->offset - f->shr->tail, tp->len,
+ (u8 *) &data64);
}
/* Expected result: one big fat chunk at offset 4 */
@@ -530,8 +530,8 @@ sfifo_test_fifo2 (vlib_main_t * vm)
{
tp = &test_data[i];
data64 = tp->offset;
- rv = svm_fifo_enqueue_with_offset (f, tp->offset - f->tail, tp->len,
- (u8 *) & data64);
+ rv = svm_fifo_enqueue_with_offset (f, tp->offset - f->shr->tail, tp->len,
+ (u8 *) &data64);
if (rv)
{
clib_warning ("enqueue returned %d", rv);
@@ -704,10 +704,9 @@ sfifo_test_fifo3 (vlib_main_t * vm, unformat_input_t * input)
for (i = !randomize; i < vec_len (generate); i++)
{
tp = generate + i;
- svm_fifo_enqueue_with_offset (f,
- fifo_initial_offset + tp->offset -
- f->tail, tp->len,
- (u8 *) data_pattern + tp->offset);
+ svm_fifo_enqueue_with_offset (
+ f, fifo_initial_offset + tp->offset - f->shr->tail, tp->len,
+ (u8 *) data_pattern + tp->offset);
}
/* Add the first segment in order for non random data */
@@ -823,8 +822,8 @@ sfifo_test_fifo4 (vlib_main_t * vm, unformat_input_t * input)
for (i = test_n_bytes - 1; i > 0; i--)
{
- rv = svm_fifo_enqueue_with_offset (f, fifo_initial_offset + i - f->tail,
- sizeof (u8), &test_data[i]);
+ rv = svm_fifo_enqueue_with_offset (
+ f, fifo_initial_offset + i - f->shr->tail, sizeof (u8), &test_data[i]);
if (verbose)
vlib_cli_output (vm, "add [%d] [%d, %d]", i, i, i + sizeof (u8));
if (rv)
@@ -1150,7 +1149,8 @@ sfifo_test_fifo7 (vlib_main_t * vm, unformat_input_t * input)
if (compare_data (data_buf, test_data, 0, n_test_bytes, (u32 *) & j))
SFIFO_TEST (0, "[%d] dequeued %u expected %u", j, data_buf[j],
test_data[j]);
- svm_fifo_init_pointers (f, (~0 - i) % f->size, (~0 - i) % f->size);
+ svm_fifo_init_pointers (f, (~0 - i) % f->shr->size,
+ (~0 - i) % f->shr->size);
}
SFIFO_TEST (1, "passed multiple ooo enqueue/dequeue");
@@ -1412,13 +1412,13 @@ sfifo_test_fifo_grow (vlib_main_t * vm, unformat_input_t * input)
SFIFO_TEST (rv == 2, "should have 2 chunks has %u", rv);
SFIFO_TEST (svm_fifo_is_sane (f), "fifo should be sane");
- c = f->head_chunk;
+ c = f->shr->head_chunk;
SFIFO_TEST (c->start_byte == 0, "head start byte should be %u", 0);
SFIFO_TEST (c->length == 4096, "head chunk length should be %u", 4096);
- SFIFO_TEST (f->tail_chunk == 0, "no tail chunk");
+ SFIFO_TEST (f->shr->tail_chunk == 0, "no tail chunk");
SFIFO_TEST (f->ooo_enq == 0, "should have no ooo enq chunk");
SFIFO_TEST (f->ooo_deq == 0, "should have no ooo deq chunk");
- c = f->end_chunk;
+ c = f->shr->end_chunk;
SFIFO_TEST (c->start_byte == last_start_byte, "end chunk start byte should"
" be %u", last_start_byte);
SFIFO_TEST (c->length == 4096, "end chunk length should be %u", 4096);
@@ -1438,8 +1438,8 @@ sfifo_test_fifo_grow (vlib_main_t * vm, unformat_input_t * input)
vlib_cli_output (vm, "[%d] dequeued %u expected %u", i, data_buf[i],
test_data[i]);
SFIFO_TEST ((rv == 0), "dequeued compared to original returned %d", rv);
- SFIFO_TEST (f->head_chunk == 0, "head chunk should be 0");
- SFIFO_TEST (f->tail_chunk == 0, "tail chunk should be 0");
+ SFIFO_TEST (f->shr->head_chunk == 0, "head chunk should be 0");
+ SFIFO_TEST (f->shr->tail_chunk == 0, "tail chunk should be 0");
SFIFO_TEST (f->ooo_deq == 0, "should have no ooo deq chunk");
SFIFO_TEST (svm_fifo_is_sane (f), "fifo should be sane");
@@ -1461,12 +1461,12 @@ sfifo_test_fifo_grow (vlib_main_t * vm, unformat_input_t * input)
SFIFO_TEST (rv == 2, "should have %u chunks has %u", 2, rv);
SFIFO_TEST (svm_fifo_is_sane (f), "fifo should be sane");
- SFIFO_TEST (f->head_chunk == 0, "should have no head chunk");
+ SFIFO_TEST (f->shr->head_chunk == 0, "should have no head chunk");
/* When new fifo chunks are allocated, tail is initialized */
- SFIFO_TEST (f->tail_chunk != 0, "should have no tail chunk");
+ SFIFO_TEST (f->shr->tail_chunk != 0, "should have no tail chunk");
SFIFO_TEST (f->ooo_enq != 0, "should have an ooo enq chunk");
- c = f->end_chunk;
+ c = f->shr->end_chunk;
SFIFO_TEST (c->start_byte == last_start_byte,
"end chunk should start at %u", last_start_byte);
SFIFO_TEST (c->length == 8192, "end chunk length should be %u", 8192);
@@ -1483,9 +1483,9 @@ sfifo_test_fifo_grow (vlib_main_t * vm, unformat_input_t * input)
SFIFO_TEST (rv == 2, "should have %u chunks has %u", 2, rv);
SFIFO_TEST (svm_fifo_is_sane (f), "fifo should be sane");
- SFIFO_TEST (f->head_chunk == 0, "should have no head chunk");
+ SFIFO_TEST (f->shr->head_chunk == 0, "should have no head chunk");
/* Fifo is full so tail and ooo_enq should be 0 */
- SFIFO_TEST (f->tail_chunk == 0, "should have no tail chunk");
+ SFIFO_TEST (f->shr->tail_chunk == 0, "should have no tail chunk");
SFIFO_TEST (f->ooo_enq == 0, "should have no ooo enq chunk");
/*
@@ -1542,8 +1542,8 @@ sfifo_test_fifo_grow (vlib_main_t * vm, unformat_input_t * input)
last_start_byte += 8192;
SFIFO_TEST (svm_fifo_is_sane (f), "fifo should be sane");
- SFIFO_TEST (f->head_chunk == 0, "should have no head chunk");
- SFIFO_TEST (f->tail_chunk == 0, "should have no tail chunk");
+ SFIFO_TEST (f->shr->head_chunk == 0, "should have no head chunk");
+ SFIFO_TEST (f->shr->tail_chunk == 0, "should have no tail chunk");
/* We don't remove the last chunk even when the fifo goes empty */
rv = svm_fifo_n_chunks (f);
@@ -1575,12 +1575,12 @@ sfifo_test_fifo_grow (vlib_main_t * vm, unformat_input_t * input)
SFIFO_TEST (rv == 2, "should have %u chunks has %u", 2, rv);
SFIFO_TEST (svm_fifo_is_sane (f), "fifo should be sane");
- SFIFO_TEST (f->head_chunk == 0, "should have no head chunk");
+ SFIFO_TEST (f->shr->head_chunk == 0, "should have no head chunk");
/* When new fifo chunks are allocated, tail is initialized */
- SFIFO_TEST (f->tail_chunk != 0, "should have no tail chunk");
+ SFIFO_TEST (f->shr->tail_chunk != 0, "should have no tail chunk");
SFIFO_TEST (f->ooo_enq != 0, "should have an ooo enq chunk");
- c = f->end_chunk;
+ c = f->shr->end_chunk;
SFIFO_TEST (c->start_byte == last_start_byte,
"end chunk should start at %u", last_start_byte);
SFIFO_TEST (c->length == 16384, "end chunk length should be %u", 16384);
@@ -1623,7 +1623,7 @@ sfifo_test_fifo_grow (vlib_main_t * vm, unformat_input_t * input)
SFIFO_TEST (svm_fifo_is_sane (f), "fifo should be sane");
last_start_byte += 16384;
- c = f->end_chunk;
+ c = f->shr->end_chunk;
SFIFO_TEST (c->start_byte == last_start_byte,
"end chunk should start at %u", last_start_byte);
SFIFO_TEST (c->length == 4096, "end chunk length should be %u", 4096);
@@ -1647,8 +1647,8 @@ sfifo_test_fifo_grow (vlib_main_t * vm, unformat_input_t * input)
SFIFO_TEST (svm_fifo_is_sane (f), "fifo should be sane");
/* fifo does not end on chunk boundary because of the - 100 */
- SFIFO_TEST (f->head_chunk != 0, "should have head chunk");
- SFIFO_TEST (f->tail_chunk != 0, "should have tail chunk");
+ SFIFO_TEST (f->shr->head_chunk != 0, "should have head chunk");
+ SFIFO_TEST (f->shr->tail_chunk != 0, "should have tail chunk");
/*
* Enqueue and dequeue byte-by-byte ooo
@@ -1673,7 +1673,7 @@ sfifo_test_fifo_grow (vlib_main_t * vm, unformat_input_t * input)
SFIFO_TEST (svm_fifo_is_sane (f), "fifo should be sane");
last_start_byte += 4096;
- c = f->end_chunk;
+ c = f->shr->end_chunk;
SFIFO_TEST (c->start_byte == last_start_byte,
"end chunk should start at %u", last_start_byte);
SFIFO_TEST (c->length == 16384, "end chunk length should be %u", 16384);
@@ -1688,8 +1688,8 @@ sfifo_test_fifo_grow (vlib_main_t * vm, unformat_input_t * input)
SFIFO_TEST ((rv == fifo_size), "all bytes should be dropped %u", rv);
SFIFO_TEST (svm_fifo_is_sane (f), "fifo should be sane");
- SFIFO_TEST (f->head_chunk != 0, "should have head chunk");
- SFIFO_TEST (f->tail_chunk != 0, "should have tail chunk");
+ SFIFO_TEST (f->shr->head_chunk != 0, "should have head chunk");
+ SFIFO_TEST (f->shr->tail_chunk != 0, "should have tail chunk");
/* We don't remove the last chunk even when the fifo goes empty */
rv = svm_fifo_n_chunks (f);
@@ -1941,7 +1941,7 @@ sfifo_test_fifo_indirect (vlib_main_t * vm, unformat_input_t * input)
svm_fifo_set_size (f, fifo_size);
validate_test_and_buf_vecs (&test_data, &data_buf, fifo_size);
- c = f->start_chunk;
+ c = f->shr->start_chunk;
SFIFO_TEST (c->next == 0, "no next");
svm_fifo_fill_chunk_list (f);
@@ -1958,7 +1958,7 @@ sfifo_test_fifo_indirect (vlib_main_t * vm, unformat_input_t * input)
SFIFO_TEST (svm_fifo_is_sane (f), "fifo should be sane");
c = svm_fifo_tail_chunk (f);
- SFIFO_TEST (c == f->end_chunk, "tail is end chunk");
+ SFIFO_TEST (c == f->shr->end_chunk, "tail is end chunk");
/* Initialize head chunk */
rv = svm_fifo_max_read_chunk (f);
@@ -1972,7 +1972,7 @@ sfifo_test_fifo_indirect (vlib_main_t * vm, unformat_input_t * input)
SFIFO_TEST (rv == 4096, "dequeue should work");
c = svm_fifo_head_chunk (f);
- SFIFO_TEST (c == f->end_chunk, "head chunk should be last");
+ SFIFO_TEST (c == f->shr->end_chunk, "head chunk should be last");
rv = svm_fifo_max_read_chunk (f);
SFIFO_TEST (rv == 0, "max read chunk %u", rv);
@@ -2409,13 +2409,13 @@ sfifo_test_fifo_segment_slave (int verbose)
svm_fifo_dequeue (f, vec_len (retrieved_data), retrieved_data);
if (memcmp (retrieved_data, test_data, vec_len (retrieved_data)))
{
- result = (u32 *) f->head_chunk->data;
+ result = (u32 *) f->shr->head_chunk->data;
*result = 1;
_exit (0);
}
}
- result = (u32 *) f->head_chunk->data;
+ result = (u32 *) f->shr->head_chunk->data;
*result = 0;
vec_free (test_data);
@@ -2469,7 +2469,7 @@ sfifo_test_fifo_segment_master_slave (int verbose)
usleep (1e3);
- result = (u32 *) f->head_chunk->data;
+ result = (u32 *) f->shr->head_chunk->data;
SFIFO_TEST (*result == 0, "slave reported no error");
vec_free (a->new_segment_indices);
@@ -2597,7 +2597,7 @@ sfifo_test_fifo_segment_prealloc (int verbose)
rv = fifo_segment_num_free_fifos (fs);
SFIFO_TEST (rv == 50, "prealloc fifo hdrs expected %u is %u", 50, rv);
rv = fifo_segment_free_bytes (fs);
- free_space -= sizeof (svm_fifo_t) * 50;
+ free_space -= sizeof (svm_fifo_shared_t) * 50;
/* Memory alloc alignment accounts for the difference */
SFIFO_TEST (approx_leq (free_space, rv, 128), "free space expected %u is %u",
free_space, rv);