svm: more fifo refactor/cleanup
Change-Id: Ie76c69641c8598164d0d00fd498018037258fd86 Signed-off-by: Florin Coras <fcoras@cisco.com>
This commit is contained in:
committed by
Dave Barach
parent
c6eb5bc967
commit
87b15cebda
@@ -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? */
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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]);
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
+392
-390
File diff suppressed because it is too large
Load Diff
+484
-240
File diff suppressed because it is too large
Load Diff
@@ -447,10 +447,9 @@ cut_through_thread_fn (void *arg)
|
||||
{
|
||||
/* We read from the tx fifo and write to the rx fifo */
|
||||
if (utm->have_return || do_dequeue)
|
||||
actual_transfer = svm_fifo_dequeue_nowait (rx_fifo,
|
||||
vec_len
|
||||
(my_copy_buffer),
|
||||
my_copy_buffer);
|
||||
actual_transfer = svm_fifo_dequeue (rx_fifo,
|
||||
vec_len (my_copy_buffer),
|
||||
my_copy_buffer);
|
||||
else
|
||||
{
|
||||
/* We don't do anything with the data, drop it */
|
||||
@@ -467,8 +466,8 @@ cut_through_thread_fn (void *arg)
|
||||
buffer_offset = 0;
|
||||
while (actual_transfer > 0)
|
||||
{
|
||||
rv = svm_fifo_enqueue_nowait (tx_fifo, actual_transfer,
|
||||
my_copy_buffer + buffer_offset);
|
||||
rv = svm_fifo_enqueue (tx_fifo, actual_transfer,
|
||||
my_copy_buffer + buffer_offset);
|
||||
if (rv > 0)
|
||||
{
|
||||
actual_transfer -= rv;
|
||||
|
||||
@@ -97,7 +97,7 @@ send_data_chunk (echo_client_main_t * ecm, eclient_session_t * s)
|
||||
clib_memcpy_fast (&hdr.lcl_ip, &at->lcl_ip,
|
||||
sizeof (ip46_address_t));
|
||||
hdr.lcl_port = at->lcl_port;
|
||||
svm_fifo_enqueue_nowait (f, sizeof (hdr), (u8 *) & hdr);
|
||||
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,
|
||||
|
||||
@@ -310,7 +310,7 @@ send_data (http_session_t * hs, u8 * data)
|
||||
{
|
||||
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? */
|
||||
|
||||
@@ -469,10 +469,10 @@ app_send_dgram_raw (svm_fifo_t * f, app_session_transport_t * at,
|
||||
hdr.rmt_port = at->rmt_port;
|
||||
clib_memcpy_fast (&hdr.lcl_ip, &at->lcl_ip, sizeof (ip46_address_t));
|
||||
hdr.lcl_port = at->lcl_port;
|
||||
rv = svm_fifo_enqueue_nowait (f, sizeof (hdr), (u8 *) & hdr);
|
||||
rv = svm_fifo_enqueue (f, sizeof (hdr), (u8 *) & hdr);
|
||||
ASSERT (rv == sizeof (hdr));
|
||||
|
||||
rv = svm_fifo_enqueue_nowait (f, actual_write, data);
|
||||
rv = svm_fifo_enqueue (f, actual_write, data);
|
||||
if (do_evt)
|
||||
{
|
||||
if (rv > 0 && svm_fifo_set_event (f))
|
||||
@@ -497,7 +497,7 @@ app_send_stream_raw (svm_fifo_t * f, svm_msg_q_t * vpp_evt_q, u8 * data,
|
||||
{
|
||||
int rv;
|
||||
|
||||
rv = svm_fifo_enqueue_nowait (f, len, data);
|
||||
rv = svm_fifo_enqueue (f, len, data);
|
||||
if (do_evt)
|
||||
{
|
||||
if (rv > 0 && svm_fifo_set_event (f))
|
||||
@@ -572,7 +572,7 @@ app_recv_stream_raw (svm_fifo_t * f, u8 * buf, u32 len, u8 clear_evt, u8 peek)
|
||||
if (peek)
|
||||
return svm_fifo_peek (f, 0, len, buf);
|
||||
|
||||
return svm_fifo_dequeue_nowait (f, len, buf);
|
||||
return svm_fifo_dequeue (f, len, buf);
|
||||
}
|
||||
|
||||
always_inline int
|
||||
|
||||
@@ -296,7 +296,7 @@ session_enqueue_chain_tail (session_t * s, vlib_buffer_t * b,
|
||||
continue;
|
||||
if (is_in_order)
|
||||
{
|
||||
rv = svm_fifo_enqueue_nowait (s->rx_fifo, len, data);
|
||||
rv = svm_fifo_enqueue (s->rx_fifo, len, data);
|
||||
if (rv == len)
|
||||
{
|
||||
written += rv;
|
||||
@@ -363,9 +363,9 @@ session_enqueue_stream_connection (transport_connection_t * tc,
|
||||
|
||||
if (is_in_order)
|
||||
{
|
||||
enqueued = svm_fifo_enqueue_nowait (s->rx_fifo,
|
||||
b->current_length,
|
||||
vlib_buffer_get_current (b));
|
||||
enqueued = svm_fifo_enqueue (s->rx_fifo,
|
||||
b->current_length,
|
||||
vlib_buffer_get_current (b));
|
||||
if (PREDICT_FALSE ((b->flags & VLIB_BUFFER_NEXT_PRESENT)
|
||||
&& enqueued >= 0))
|
||||
{
|
||||
@@ -414,10 +414,9 @@ session_enqueue_dgram_connection (session_t * s,
|
||||
ASSERT (svm_fifo_max_enqueue_prod (s->rx_fifo)
|
||||
>= b->current_length + sizeof (*hdr));
|
||||
|
||||
svm_fifo_enqueue_nowait (s->rx_fifo, sizeof (session_dgram_hdr_t),
|
||||
(u8 *) hdr);
|
||||
enqueued = svm_fifo_enqueue_nowait (s->rx_fifo, b->current_length,
|
||||
vlib_buffer_get_current (b));
|
||||
svm_fifo_enqueue (s->rx_fifo, sizeof (session_dgram_hdr_t), (u8 *) hdr);
|
||||
enqueued = svm_fifo_enqueue (s->rx_fifo, b->current_length,
|
||||
vlib_buffer_get_current (b));
|
||||
if (PREDICT_FALSE ((b->flags & VLIB_BUFFER_NEXT_PRESENT) && enqueued >= 0))
|
||||
{
|
||||
in_order_off = enqueued > b->current_length ? enqueued : 0;
|
||||
|
||||
@@ -414,8 +414,8 @@ session_tx_fifo_chain_tail (vlib_main_t * vm, session_tx_context_t * ctx,
|
||||
}
|
||||
}
|
||||
else
|
||||
n_bytes_read = svm_fifo_dequeue_nowait (ctx->s->tx_fifo,
|
||||
len_to_deq, data);
|
||||
n_bytes_read = svm_fifo_dequeue (ctx->s->tx_fifo,
|
||||
len_to_deq, data);
|
||||
}
|
||||
ASSERT (n_bytes_read == len_to_deq);
|
||||
chain_b->current_length = n_bytes_read;
|
||||
@@ -494,8 +494,8 @@ session_tx_fill_buffer (vlib_main_t * vm, session_tx_context_t * ctx,
|
||||
}
|
||||
else
|
||||
{
|
||||
n_bytes_read = svm_fifo_dequeue_nowait (ctx->s->tx_fifo,
|
||||
len_to_deq, data0);
|
||||
n_bytes_read = svm_fifo_dequeue (ctx->s->tx_fifo,
|
||||
len_to_deq, data0);
|
||||
ASSERT (n_bytes_read > 0);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user