aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2019-04-28 21:16:30 -0700
committerDave Barach <openvpp@barachs.net>2019-04-30 16:59:49 +0000
commit87b15cebdaca21f6725637abeceec0f19f4eec51 (patch)
tree3b6063188bc64972bdc359526dd8c0823bcd9fc9 /src/plugins
parentc6eb5bc967d3d70016b4e4e182b3d68b1e558f60 (diff)
svm: more fifo refactor/cleanup
Change-Id: Ie76c69641c8598164d0d00fd498018037258fd86 Signed-off-by: Florin Coras <fcoras@cisco.com>
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/http_static/static_server.c2
-rw-r--r--src/plugins/quic/quic.c6
-rw-r--r--src/plugins/tlsmbedtls/tls_mbedtls.c8
-rw-r--r--src/plugins/unittest/svm_fifo_test.c166
4 files changed, 91 insertions, 91 deletions
diff --git a/src/plugins/http_static/static_server.c b/src/plugins/http_static/static_server.c
index ac07f6f5534..860e03997bd 100644
--- a/src/plugins/http_static/static_server.c
+++ b/src/plugins/http_static/static_server.c
@@ -379,7 +379,7 @@ static_send_data (http_session_t * hs, u8 * data, u32 length, u32 offset)
{
int actual_transfer;
- actual_transfer = svm_fifo_enqueue_nowait
+ actual_transfer = svm_fifo_enqueue
(hs->tx_fifo, bytes_to_send, data + offset);
/* Made any progress? */
diff --git a/src/plugins/quic/quic.c b/src/plugins/quic/quic.c
index 5ff962d8102..e2c2514858c 100644
--- a/src/plugins/quic/quic.c
+++ b/src/plugins/quic/quic.c
@@ -138,9 +138,9 @@ quic_send_datagram (session_t * udp_session, quicly_datagram_t * packet)
clib_memcpy (&hdr.rmt_ip.ip6, &sa6->sin6_addr, 16);
}
- rv = svm_fifo_enqueue_nowait (f, sizeof (hdr), (u8 *) & hdr);
+ rv = svm_fifo_enqueue (f, sizeof (hdr), (u8 *) & hdr);
ASSERT (rv == sizeof (hdr));
- if (svm_fifo_enqueue_nowait (f, len, packet->data.base) != len)
+ if (svm_fifo_enqueue (f, len, packet->data.base) != len)
return 1;
return 0;
}
@@ -242,7 +242,7 @@ quic_on_receive (quicly_stream_t * stream, size_t off, const void *src,
to_enqueue = len;
// TODO what happens to the excess bytes?
- svm_fifo_enqueue_nowait (rx_fifo, to_enqueue, src);
+ svm_fifo_enqueue (rx_fifo, to_enqueue, src);
// Notify app
app_wrk = app_worker_get_if_valid (stream_session->app_wrk_index);
diff --git a/src/plugins/tlsmbedtls/tls_mbedtls.c b/src/plugins/tlsmbedtls/tls_mbedtls.c
index c54d17cd121..294f7126c87 100644
--- a/src/plugins/tlsmbedtls/tls_mbedtls.c
+++ b/src/plugins/tlsmbedtls/tls_mbedtls.c
@@ -167,7 +167,7 @@ tls_net_send (void *ctx_indexp, const unsigned char *buf, size_t len)
ctx_index = pointer_to_uword (ctx_indexp);
ctx = mbedtls_ctx_get (ctx_index);
tls_session = session_get_from_handle (ctx->tls_session_handle);
- rv = svm_fifo_enqueue_nowait (tls_session->tx_fifo, len, buf);
+ rv = svm_fifo_enqueue (tls_session->tx_fifo, len, buf);
if (rv < 0)
return MBEDTLS_ERR_SSL_WANT_WRITE;
tls_add_vpp_q_tx_evt (tls_session);
@@ -185,7 +185,7 @@ tls_net_recv (void *ctx_indexp, unsigned char *buf, size_t len)
ctx_index = pointer_to_uword (ctx_indexp);
ctx = mbedtls_ctx_get (ctx_index);
tls_session = session_get_from_handle (ctx->tls_session_handle);
- rv = svm_fifo_dequeue_nowait (tls_session->rx_fifo, len, buf);
+ rv = svm_fifo_dequeue (tls_session->rx_fifo, len, buf);
return (rv < 0) ? 0 : rv;
}
@@ -516,8 +516,8 @@ mbedtls_ctx_read (tls_ctx_t * ctx, session_t * tls_session)
return 0;
}
- enq = svm_fifo_enqueue_nowait (app_session->rx_fifo, read,
- mm->rx_bufs[thread_index]);
+ enq = svm_fifo_enqueue (app_session->rx_fifo, read,
+ mm->rx_bufs[thread_index]);
ASSERT (enq == read);
vec_reset_length (mm->rx_bufs[thread_index]);
diff --git a/src/plugins/unittest/svm_fifo_test.c b/src/plugins/unittest/svm_fifo_test.c
index 9e834a1a056..99f0e5044d6 100644
--- a/src/plugins/unittest/svm_fifo_test.c
+++ b/src/plugins/unittest/svm_fifo_test.c
@@ -214,7 +214,7 @@ sfifo_test_fifo1 (vlib_main_t * vm, unformat_input_t * input)
/*
* Enqueue an initial (un-dequeued) chunk
*/
- rv = svm_fifo_enqueue_nowait (f, sizeof (u32), (u8 *) test_data);
+ 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);
@@ -228,7 +228,7 @@ sfifo_test_fifo1 (vlib_main_t * vm, unformat_input_t * input)
data = (u8 *) (test_data + (2 * i + 1));
if (i == 0)
{
- rv = svm_fifo_enqueue_nowait (f, sizeof (u32), data);
+ rv = svm_fifo_enqueue (f, sizeof (u32), data);
rv = rv > 0 ? 0 : rv;
}
else
@@ -247,8 +247,8 @@ sfifo_test_fifo1 (vlib_main_t * vm, unformat_input_t * input)
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 ((svm_fifo_number_ooo_segments (f) == 2),
- "number of ooo segments %u", svm_fifo_number_ooo_segments (f));
+ 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
@@ -265,8 +265,8 @@ sfifo_test_fifo1 (vlib_main_t * vm, unformat_input_t * input)
if (verbose)
vlib_cli_output (vm, "fifo after overlap seg: %U", format_svm_fifo, f, 1);
- SFIFO_TEST ((svm_fifo_number_ooo_segments (f) == 2),
- "number of ooo segments %u", svm_fifo_number_ooo_segments (f));
+ SFIFO_TEST ((svm_fifo_n_ooo_segments (f) == 2),
+ "number of ooo segments %u", svm_fifo_n_ooo_segments (f));
/*
* Make sure format functions are not buggy
@@ -295,8 +295,8 @@ sfifo_test_fifo1 (vlib_main_t * vm, unformat_input_t * input)
if (verbose)
vlib_cli_output (vm, "fifo before missing link: %U", format_svm_fifo, f,
1);
- SFIFO_TEST ((svm_fifo_number_ooo_segments (f) == 1),
- "number of ooo segments %u", svm_fifo_number_ooo_segments (f));
+ SFIFO_TEST ((svm_fifo_n_ooo_segments (f) == 1),
+ "number of ooo segments %u", svm_fifo_n_ooo_segments (f));
ooo_seg = svm_fifo_first_ooo_segment (f);
SFIFO_TEST ((ooo_seg->start == 12),
"first ooo seg position %u", ooo_seg->start);
@@ -306,20 +306,20 @@ sfifo_test_fifo1 (vlib_main_t * vm, unformat_input_t * input)
/*
* Enqueue the missing u32
*/
- rv = svm_fifo_enqueue_nowait (f, sizeof (u32), (u8 *) (test_data + 2));
+ rv = svm_fifo_enqueue (f, sizeof (u32), (u8 *) (test_data + 2));
if (verbose)
vlib_cli_output (vm, "fifo after missing link: %U", format_svm_fifo, f,
1);
SFIFO_TEST ((rv == 20), "bytes to be enqueued %u", rv);
- SFIFO_TEST ((svm_fifo_number_ooo_segments (f) == 0),
- "number of ooo segments %u", svm_fifo_number_ooo_segments (f));
+ SFIFO_TEST ((svm_fifo_n_ooo_segments (f) == 0),
+ "number of ooo segments %u", svm_fifo_n_ooo_segments (f));
/*
* Collect results
*/
for (i = 0; i < 7; i++)
{
- rv = svm_fifo_dequeue_nowait (f, sizeof (u32), (u8 *) & data_word);
+ rv = svm_fifo_dequeue (f, sizeof (u32), (u8 *) & data_word);
if (rv != sizeof (u32))
{
clib_warning ("bytes dequeues %u", rv);
@@ -356,14 +356,14 @@ sfifo_test_fifo1 (vlib_main_t * vm, unformat_input_t * input)
rv = svm_fifo_enqueue_with_offset (f, 8 - f->tail, 21, data);
SFIFO_TEST ((rv == 0), "ooo enqueued %u", rv);
- SFIFO_TEST ((svm_fifo_number_ooo_segments (f) == 1),
- "number of ooo segments %u", svm_fifo_number_ooo_segments (f));
+ SFIFO_TEST ((svm_fifo_n_ooo_segments (f) == 1),
+ "number of ooo segments %u", svm_fifo_n_ooo_segments (f));
/* add missing data to be able to dequeue something */
- rv = svm_fifo_enqueue_nowait (f, 4, data);
+ rv = svm_fifo_enqueue (f, 4, data);
SFIFO_TEST ((rv == 32), "enqueued %u", rv);
- SFIFO_TEST ((svm_fifo_number_ooo_segments (f) == 0),
- "number of ooo segments %u", svm_fifo_number_ooo_segments (f));
+ SFIFO_TEST ((svm_fifo_n_ooo_segments (f) == 0),
+ "number of ooo segments %u", svm_fifo_n_ooo_segments (f));
vec_validate (data_buf, vec_len (test_data));
svm_fifo_peek (f, 0, 4, data_buf);
@@ -398,13 +398,13 @@ sfifo_test_fifo1 (vlib_main_t * vm, unformat_input_t * input)
if (verbose)
vlib_cli_output (vm, "fifo after enqueue: %U", format_svm_fifo, f, 1);
- rv = svm_fifo_enqueue_nowait (f, 29, data);
+ rv = svm_fifo_enqueue (f, 29, data);
if (verbose)
vlib_cli_output (vm, "fifo after enqueueing 29: %U", format_svm_fifo, f,
1);
SFIFO_TEST ((rv == 32), "ooo enqueued %u", rv);
- SFIFO_TEST ((svm_fifo_number_ooo_segments (f) == 0),
- "number of ooo segments %u", svm_fifo_number_ooo_segments (f));
+ SFIFO_TEST ((svm_fifo_n_ooo_segments (f) == 0),
+ "number of ooo segments %u", svm_fifo_n_ooo_segments (f));
vec_validate (data_buf, vec_len (data));
svm_fifo_peek (f, 0, vec_len (data), data_buf);
@@ -459,8 +459,8 @@ sfifo_test_fifo2 (vlib_main_t * vm)
}
/* Expected result: one big fat chunk at offset 4 */
- SFIFO_TEST ((svm_fifo_number_ooo_segments (f) == 1),
- "number of ooo segments %u", svm_fifo_number_ooo_segments (f));
+ SFIFO_TEST ((svm_fifo_n_ooo_segments (f) == 1),
+ "number of ooo segments %u", svm_fifo_n_ooo_segments (f));
ooo_seg = svm_fifo_first_ooo_segment (f);
SFIFO_TEST ((ooo_seg->start == 4),
"first ooo seg position %u", ooo_seg->start);
@@ -468,7 +468,7 @@ sfifo_test_fifo2 (vlib_main_t * vm)
"first ooo seg length %u", ooo_seg->length);
data64 = 0;
- rv = svm_fifo_enqueue_nowait (f, sizeof (u32), (u8 *) & data64);
+ rv = svm_fifo_enqueue (f, sizeof (u32), (u8 *) & data64);
SFIFO_TEST ((rv == 3000), "bytes to be enqueued %u", rv);
svm_fifo_free (f);
@@ -493,8 +493,8 @@ sfifo_test_fifo2 (vlib_main_t * vm)
}
/* Expecting the same result: one big fat chunk at offset 4 */
- SFIFO_TEST ((svm_fifo_number_ooo_segments (f) == 1),
- "number of ooo segments %u", svm_fifo_number_ooo_segments (f));
+ SFIFO_TEST ((svm_fifo_n_ooo_segments (f) == 1),
+ "number of ooo segments %u", svm_fifo_n_ooo_segments (f));
ooo_seg = svm_fifo_first_ooo_segment (f);
SFIFO_TEST ((ooo_seg->start == 4),
"first ooo seg position %u", ooo_seg->start);
@@ -502,7 +502,7 @@ sfifo_test_fifo2 (vlib_main_t * vm)
"first ooo seg length %u", ooo_seg->length);
data64 = 0;
- rv = svm_fifo_enqueue_nowait (f, sizeof (u32), (u8 *) & data64);
+ rv = svm_fifo_enqueue (f, sizeof (u32), (u8 *) & data64);
SFIFO_TEST ((rv == 3000), "bytes to be enqueued %u", rv);
@@ -665,7 +665,7 @@ sfifo_test_fifo3 (vlib_main_t * vm, unformat_input_t * input)
/* Add the first segment in order for non random data */
if (!randomize)
- svm_fifo_enqueue_nowait (f, generate[0].len, (u8 *) data_pattern);
+ svm_fifo_enqueue (f, generate[0].len, (u8 *) data_pattern);
/*
* Expected result: one big fat chunk at offset 1 if randomize == 1
@@ -683,7 +683,7 @@ sfifo_test_fifo3 (vlib_main_t * vm, unformat_input_t * input)
u32 bytes_to_enq = 1;
if (in_seq_all)
bytes_to_enq = total_size;
- rv = svm_fifo_enqueue_nowait (f, bytes_to_enq, data_pattern + 0);
+ rv = svm_fifo_enqueue (f, bytes_to_enq, data_pattern + 0);
if (verbose)
vlib_cli_output (vm, "in-order enqueue returned %d", rv);
@@ -694,7 +694,7 @@ sfifo_test_fifo3 (vlib_main_t * vm, unformat_input_t * input)
}
SFIFO_TEST ((svm_fifo_has_ooo_data (f) == 0), "number of ooo segments %u",
- svm_fifo_number_ooo_segments (f));
+ svm_fifo_n_ooo_segments (f));
/*
* Test if peeked data is the same as original data
@@ -717,7 +717,7 @@ sfifo_test_fifo3 (vlib_main_t * vm, unformat_input_t * input)
}
else
{
- svm_fifo_dequeue_nowait (f, vec_len (data_pattern), data_buf);
+ svm_fifo_dequeue (f, vec_len (data_pattern), data_buf);
if (compare_data
(data_buf, data_pattern, 0, vec_len (data_pattern), &j))
{
@@ -787,11 +787,11 @@ sfifo_test_fifo4 (vlib_main_t * vm, unformat_input_t * input)
}
}
- svm_fifo_enqueue_nowait (f, sizeof (u8), &test_data[0]);
+ svm_fifo_enqueue (f, sizeof (u8), &test_data[0]);
vec_validate (data_buf, vec_len (test_data));
- svm_fifo_dequeue_nowait (f, vec_len (test_data), data_buf);
+ svm_fifo_dequeue (f, vec_len (test_data), data_buf);
rv = compare_data (data_buf, test_data, 0, vec_len (test_data), &j);
if (rv)
vlib_cli_output (vm, "[%d] dequeued %u expected %u", j, data_buf[j],
@@ -853,8 +853,8 @@ sfifo_test_fifo5 (vlib_main_t * vm, unformat_input_t * input)
svm_fifo_enqueue_with_offset (f, 100, 100, &test_data[100]);
svm_fifo_enqueue_with_offset (f, 300, 100, &test_data[300]);
- SFIFO_TEST ((svm_fifo_number_ooo_segments (f) == 2),
- "number of ooo segments %u", svm_fifo_number_ooo_segments (f));
+ SFIFO_TEST ((svm_fifo_n_ooo_segments (f) == 2),
+ "number of ooo segments %u", svm_fifo_n_ooo_segments (f));
SFIFO_TEST ((f->ooos_newest == 1), "newest %u", f->ooos_newest);
if (verbose)
vlib_cli_output (vm, "fifo after [100, 200] and [300, 400] : %U",
@@ -868,8 +868,8 @@ sfifo_test_fifo5 (vlib_main_t * vm, unformat_input_t * input)
if (verbose)
vlib_cli_output (vm, "fifo after [225, 275] : %U",
format_svm_fifo, f, 2 /* verbose */ );
- SFIFO_TEST ((svm_fifo_number_ooo_segments (f) == 3),
- "number of ooo segments %u", svm_fifo_number_ooo_segments (f));
+ SFIFO_TEST ((svm_fifo_n_ooo_segments (f) == 3),
+ "number of ooo segments %u", svm_fifo_n_ooo_segments (f));
ooo_seg = svm_fifo_first_ooo_segment (f);
SFIFO_TEST ((ooo_seg->start == fifo_pos (f, 100 + offset)),
"first seg start %u expected %u", ooo_seg->start,
@@ -896,8 +896,8 @@ sfifo_test_fifo5 (vlib_main_t * vm, unformat_input_t * input)
if (verbose)
vlib_cli_output (vm, "fifo after [190, 310] : %U",
format_svm_fifo, f, 1 /* verbose */ );
- SFIFO_TEST ((svm_fifo_number_ooo_segments (f) == 1),
- "number of ooo segments %u", svm_fifo_number_ooo_segments (f));
+ SFIFO_TEST ((svm_fifo_n_ooo_segments (f) == 1),
+ "number of ooo segments %u", svm_fifo_n_ooo_segments (f));
ooo_seg = svm_fifo_first_ooo_segment (f);
SFIFO_TEST ((ooo_seg->start == fifo_pos (f, offset + 100)),
"first seg start %u expected %u",
@@ -908,15 +908,15 @@ sfifo_test_fifo5 (vlib_main_t * vm, unformat_input_t * input)
/*
* Add [0, 150]
*/
- rv = svm_fifo_enqueue_nowait (f, 150, test_data);
+ rv = svm_fifo_enqueue (f, 150, test_data);
if (verbose)
vlib_cli_output (vm, "fifo after [0 150] : %U", format_svm_fifo, f,
2 /* verbose */ );
SFIFO_TEST ((rv == 400), "managed to enqueue %u expected %u", rv, 400);
- SFIFO_TEST ((svm_fifo_number_ooo_segments (f) == 0),
- "number of ooo segments %u", svm_fifo_number_ooo_segments (f));
+ SFIFO_TEST ((svm_fifo_n_ooo_segments (f) == 0),
+ "number of ooo segments %u", svm_fifo_n_ooo_segments (f));
vec_validate (data_buf, 399);
svm_fifo_peek (f, 0, 400, data_buf);
@@ -934,8 +934,8 @@ sfifo_test_fifo5 (vlib_main_t * vm, unformat_input_t * input)
svm_fifo_enqueue_with_offset (f, 100, 100, &test_data[100]);
svm_fifo_enqueue_with_offset (f, 50, 200, &test_data[50]);
- SFIFO_TEST ((svm_fifo_number_ooo_segments (f) == 1),
- "number of ooo segments %u", svm_fifo_number_ooo_segments (f));
+ SFIFO_TEST ((svm_fifo_n_ooo_segments (f) == 1),
+ "number of ooo segments %u", svm_fifo_n_ooo_segments (f));
ooo_seg = svm_fifo_first_ooo_segment (f);
SFIFO_TEST ((ooo_seg->start == 50), "first seg start %u expected %u",
ooo_seg->start, 50);
@@ -984,20 +984,20 @@ sfifo_test_fifo6 (vlib_main_t * vm, unformat_input_t * input)
/*
* |0|---[start]--(len5)-->|0|--(len6)-->[end]---|0|
*/
- rv = ooo_segment_distance_to_tail (f, ~0 - 5, 5);
+ rv = f_distance_from (f, ~0 - 5, 5);
SFIFO_TEST (rv == 11, "distance to tail should be %u is %u", 11, rv);
- rv = ooo_segment_distance_from_tail (f, ~0 - 5, 5);
+ rv = f_distance_to (f, ~0 - 5, 5);
SFIFO_TEST (rv == f->size - 11, "distance from tail should be %u is %u",
f->size - 11, rv);
/*
* |0|---[end]--(len5)-->|0|--(len6)-->[start]---|0|
*/
- rv = ooo_segment_distance_from_tail (f, 5, ~0 - 5);
+ rv = f_distance_to (f, 5, ~0 - 5);
SFIFO_TEST (rv == 11, "distance from tail should be %u is %u", 11, rv);
- rv = ooo_segment_distance_to_tail (f, 5, ~0 - 5);
+ rv = f_distance_from (f, 5, ~0 - 5);
SFIFO_TEST (rv == f->size - 11, "distance to tail should be %u is %u",
f->size - 11, rv);
@@ -1006,15 +1006,15 @@ sfifo_test_fifo6 (vlib_main_t * vm, unformat_input_t * input)
*/
svm_fifo_init_pointers (f, ~0, ~0);
svm_fifo_enqueue_with_offset (f, 10, 10, &test_data[10]);
- SFIFO_TEST ((svm_fifo_number_ooo_segments (f) == 1),
- "number of ooo segments %u", svm_fifo_number_ooo_segments (f));
+ SFIFO_TEST ((svm_fifo_n_ooo_segments (f) == 1),
+ "number of ooo segments %u", svm_fifo_n_ooo_segments (f));
ooo_seg = svm_fifo_first_ooo_segment (f);
rv = ooo_segment_offset_prod (f, ooo_seg);
SFIFO_TEST (rv == 10, "offset should be %u is %u", 10, rv);
- svm_fifo_enqueue_nowait (f, 10, test_data);
- SFIFO_TEST ((svm_fifo_number_ooo_segments (f) == 0),
- "number of ooo segments %u", svm_fifo_number_ooo_segments (f));
+ svm_fifo_enqueue (f, 10, test_data);
+ SFIFO_TEST ((svm_fifo_n_ooo_segments (f) == 0),
+ "number of ooo segments %u", svm_fifo_n_ooo_segments (f));
SFIFO_TEST (f->ooos_list_head == OOO_SEGMENT_INVALID_INDEX,
"there should be no ooo seg");
@@ -1023,7 +1023,7 @@ sfifo_test_fifo6 (vlib_main_t * vm, unformat_input_t * input)
SFIFO_TEST (0, "[%d] dequeued %u expected %u", j, data_buf[j],
test_data[j]);
- svm_fifo_dequeue_nowait (f, 20, data_buf);
+ svm_fifo_dequeue (f, 20, data_buf);
if (compare_data (data_buf, test_data, 0, 20, (u32 *) & j))
SFIFO_TEST (0, "[%d] dequeued %u expected %u", j, data_buf[j],
test_data[j]);
@@ -1033,14 +1033,14 @@ sfifo_test_fifo6 (vlib_main_t * vm, unformat_input_t * input)
*/
svm_fifo_init_pointers (f, ~0 - 10, ~0 - 10);
svm_fifo_enqueue_with_offset (f, 5, 15, &test_data[5]);
- svm_fifo_enqueue_nowait (f, 12, test_data);
+ svm_fifo_enqueue (f, 12, test_data);
- SFIFO_TEST ((svm_fifo_number_ooo_segments (f) == 0),
- "number of ooo segments %u", svm_fifo_number_ooo_segments (f));
+ SFIFO_TEST ((svm_fifo_n_ooo_segments (f) == 0),
+ "number of ooo segments %u", svm_fifo_n_ooo_segments (f));
SFIFO_TEST (f->ooos_list_head == OOO_SEGMENT_INVALID_INDEX,
"there should be no ooo seg");
- svm_fifo_dequeue_nowait (f, 20, data_buf);
+ svm_fifo_dequeue (f, 20, data_buf);
if (compare_data (data_buf, test_data, 0, 20, (u32 *) & j))
SFIFO_TEST (0, "[%d] dequeued %u expected %u", j, data_buf[j],
test_data[j]);
@@ -1097,23 +1097,23 @@ sfifo_test_fifo7 (vlib_main_t * vm, unformat_input_t * input)
for (j = n_test_bytes - 1; j > 0; j -= 2)
{
svm_fifo_enqueue_with_offset (f, j, 1, &test_data[j]);
- rv = svm_fifo_number_ooo_segments (f);
+ rv = svm_fifo_n_ooo_segments (f);
if (rv != (n_test_bytes - j) / 2 + 1)
SFIFO_TEST (0, "number of ooo segments expected %u is %u",
(n_test_bytes - j) / 2 + 1, rv);
}
svm_fifo_enqueue_with_offset (f, 1, n_test_bytes - 1, &test_data[1]);
- rv = svm_fifo_number_ooo_segments (f);
+ rv = svm_fifo_n_ooo_segments (f);
if (rv != 1)
SFIFO_TEST (0, "number of ooo segments %u", rv);
- svm_fifo_enqueue_nowait (f, 1, test_data);
- rv = svm_fifo_number_ooo_segments (f);
+ svm_fifo_enqueue (f, 1, test_data);
+ rv = svm_fifo_n_ooo_segments (f);
if (rv != 0)
SFIFO_TEST (0, "number of ooo segments %u", rv);
- svm_fifo_dequeue_nowait (f, n_test_bytes, data_buf);
+ svm_fifo_dequeue (f, n_test_bytes, data_buf);
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]);
@@ -1171,11 +1171,11 @@ sfifo_test_fifo_large (vlib_main_t * vm, unformat_input_t * input)
for (i = 0; i < n_iterations; i++)
{
svm_fifo_enqueue_with_offset (f, half, half, &test_data[half]);
- svm_fifo_enqueue_nowait (f, half, test_data);
- rv = svm_fifo_number_ooo_segments (f);
+ svm_fifo_enqueue (f, half, test_data);
+ rv = svm_fifo_n_ooo_segments (f);
if (rv != 0)
SFIFO_TEST (0, "number of ooo segments %u", rv);
- svm_fifo_dequeue_nowait (f, n_bytes_per_iter, data_buf);
+ svm_fifo_dequeue (f, n_bytes_per_iter, data_buf);
if (compare_data (data_buf, test_data, 0, n_bytes_per_iter,
(u32 *) & j))
SFIFO_TEST (0, "[%d][%d] dequeued %u expected %u", i, j, data_buf[j],
@@ -1247,7 +1247,7 @@ sfifo_test_fifo_grow (vlib_main_t * vm, unformat_input_t * input)
* Unwrap fifo
*/
vec_validate (data_buf, 200);
- svm_fifo_dequeue_nowait (f, 201, data_buf);
+ svm_fifo_dequeue (f, 201, data_buf);
SFIFO_TEST (f->end_chunk == c, "tail chunk should be updated");
SFIFO_TEST (f->size == fifo_size + 200, "size expected %u is %u",
@@ -1288,7 +1288,7 @@ sfifo_test_fifo_grow (vlib_main_t * vm, unformat_input_t * input)
SFIFO_TEST (f->size == fifo_size + 200, "size expected %u is %u",
fifo_size + 200, f->size);
- svm_fifo_dequeue_nowait (f, 201, data_buf);
+ svm_fifo_dequeue (f, 201, data_buf);
SFIFO_TEST (f->size == fifo_size + 200 + 10 * 100, "size expected %u is %u",
fifo_size + 200 + 10 * 100, f->size);
@@ -1312,11 +1312,11 @@ sfifo_test_fifo_grow (vlib_main_t * vm, unformat_input_t * input)
SFIFO_TEST (f->tail_chunk->start_byte == 201, "start byte expected %u is "
"%u", 201, f->tail_chunk->start_byte);
- svm_fifo_enqueue_nowait (f, 200, test_data);
+ svm_fifo_enqueue (f, 200, test_data);
SFIFO_TEST (f->tail_chunk->start_byte == 401, "start byte expected %u is "
"%u", 401, f->tail_chunk->start_byte);
- svm_fifo_dequeue_nowait (f, 200, data_buf);
+ svm_fifo_dequeue (f, 200, data_buf);
SFIFO_TEST (f->head_chunk->start_byte == 401, "start byte expected %u is "
"%u", 401, f->head_chunk->start_byte);
@@ -1326,7 +1326,7 @@ sfifo_test_fifo_grow (vlib_main_t * vm, unformat_input_t * input)
svm_fifo_init_pointers (f, f->nitems / 2, f->nitems / 2);
for (i = 0; i < test_n_bytes; i++)
{
- rv = svm_fifo_enqueue_nowait (f, sizeof (u8), &test_data[i]);
+ rv = svm_fifo_enqueue (f, sizeof (u8), &test_data[i]);
if (rv < 0)
{
clib_warning ("enqueue returned %d", rv);
@@ -1338,7 +1338,7 @@ sfifo_test_fifo_grow (vlib_main_t * vm, unformat_input_t * input)
"is %u", test_n_bytes, svm_fifo_max_dequeue (f));
for (i = 0; i < test_n_bytes; i++)
- svm_fifo_dequeue_nowait (f, 1, &data_buf[i]);
+ svm_fifo_dequeue (f, 1, &data_buf[i]);
rv = compare_data (data_buf, test_data, 0, vec_len (test_data),
(u32 *) & j);
@@ -1352,7 +1352,7 @@ sfifo_test_fifo_grow (vlib_main_t * vm, unformat_input_t * input)
*/
for (i = 0; i <= n_enqs; i++)
{
- rv = svm_fifo_enqueue_nowait (f, enq_bytes, test_data + i * enq_bytes);
+ rv = svm_fifo_enqueue (f, enq_bytes, test_data + i * enq_bytes);
if (rv < 0)
{
clib_warning ("enqueue returned %d", rv);
@@ -1364,7 +1364,7 @@ sfifo_test_fifo_grow (vlib_main_t * vm, unformat_input_t * input)
"is %u", test_n_bytes, svm_fifo_max_dequeue (f));
for (i = 0; i <= n_deqs; i++)
- svm_fifo_dequeue_nowait (f, deq_bytes, data_buf + i * deq_bytes);
+ svm_fifo_dequeue (f, deq_bytes, data_buf + i * deq_bytes);
rv = compare_data (data_buf, test_data, 0, vec_len (test_data),
(u32 *) & j);
@@ -1391,11 +1391,11 @@ sfifo_test_fifo_grow (vlib_main_t * vm, unformat_input_t * input)
SFIFO_TEST (svm_fifo_max_dequeue (f) == 0, "max deq expected %u is %u",
0, svm_fifo_max_dequeue (f));
- svm_fifo_enqueue_nowait (f, sizeof (u8), &test_data[0]);
+ svm_fifo_enqueue (f, sizeof (u8), &test_data[0]);
memset (data_buf, 0, vec_len (data_buf));
for (i = 0; i <= n_deqs; i++)
- svm_fifo_dequeue_nowait (f, deq_bytes, data_buf + i * deq_bytes);
+ svm_fifo_dequeue (f, deq_bytes, data_buf + i * deq_bytes);
rv = compare_data (data_buf, test_data, 0, vec_len (test_data),
(u32 *) & j);
@@ -1423,11 +1423,11 @@ sfifo_test_fifo_grow (vlib_main_t * vm, unformat_input_t * input)
}
}
- svm_fifo_enqueue_nowait (f, enq_bytes, &test_data[0]);
+ svm_fifo_enqueue (f, enq_bytes, &test_data[0]);
memset (data_buf, 0, vec_len (data_buf));
for (i = 0; i <= n_deqs; i++)
- svm_fifo_dequeue_nowait (f, deq_bytes, data_buf + i * deq_bytes);
+ svm_fifo_dequeue (f, deq_bytes, data_buf + i * deq_bytes);
rv = compare_data (data_buf, test_data, 0, vec_len (test_data),
(u32 *) & j);
@@ -1520,16 +1520,16 @@ sfifo_test_fifo_segment_hello_world (int verbose)
vec_validate (retrieved_data, vec_len (test_data) - 1);
while (svm_fifo_max_enqueue (f) >= vec_len (test_data))
- svm_fifo_enqueue_nowait (f, vec_len (test_data), test_data);
+ svm_fifo_enqueue (f, vec_len (test_data), test_data);
while (svm_fifo_max_dequeue (f) >= vec_len (test_data))
- svm_fifo_dequeue_nowait (f, vec_len (retrieved_data), retrieved_data);
+ svm_fifo_dequeue (f, vec_len (retrieved_data), retrieved_data);
while (svm_fifo_max_enqueue (f) >= vec_len (test_data))
- svm_fifo_enqueue_nowait (f, vec_len (test_data), test_data);
+ svm_fifo_enqueue (f, vec_len (test_data), test_data);
while (svm_fifo_max_dequeue (f) >= vec_len (test_data))
- svm_fifo_dequeue_nowait (f, vec_len (retrieved_data), retrieved_data);
+ svm_fifo_dequeue (f, vec_len (retrieved_data), retrieved_data);
SFIFO_TEST (!memcmp (retrieved_data, test_data, vec_len (test_data)),
"data should be identical");
@@ -1657,7 +1657,7 @@ sfifo_test_fifo_segment_slave (int verbose)
for (i = 0; i < 1000; i++)
{
- svm_fifo_dequeue_nowait (f, vec_len (retrieved_data), retrieved_data);
+ 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;
@@ -1711,7 +1711,7 @@ sfifo_test_fifo_segment_master_slave (int verbose)
usleep (200e3);
for (i = 0; i < 1000; i++)
- svm_fifo_enqueue_nowait (f, vec_len (test_data), test_data);
+ svm_fifo_enqueue (f, vec_len (test_data), test_data);
/* Wait for slave */
i = 0;