summaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/quic/quic.c2
-rw-r--r--src/plugins/tlsmbedtls/tls_mbedtls.c5
-rw-r--r--src/plugins/tlsopenssl/tls_openssl.c58
-rw-r--r--src/plugins/tlspicotls/tls_picotls.c5
4 files changed, 43 insertions, 27 deletions
diff --git a/src/plugins/quic/quic.c b/src/plugins/quic/quic.c
index 4d809446130..de0e4e46892 100644
--- a/src/plugins/quic/quic.c
+++ b/src/plugins/quic/quic.c
@@ -1928,7 +1928,7 @@ quic_custom_app_rx_callback (transport_connection_t * tc)
}
static int
-quic_custom_tx_callback (void *s, u32 max_burst_size)
+quic_custom_tx_callback (void *s, transport_send_params_t * sp)
{
session_t *stream_session = (session_t *) s;
quic_stream_data_t *stream_data;
diff --git a/src/plugins/tlsmbedtls/tls_mbedtls.c b/src/plugins/tlsmbedtls/tls_mbedtls.c
index 8ac736ae6f3..3fccba2ec5a 100644
--- a/src/plugins/tlsmbedtls/tls_mbedtls.c
+++ b/src/plugins/tlsmbedtls/tls_mbedtls.c
@@ -431,7 +431,8 @@ mbedtls_ctx_handshake_rx (tls_ctx_t * ctx)
}
static int
-mbedtls_ctx_write (tls_ctx_t * ctx, session_t * app_session, u32 max_write)
+mbedtls_ctx_write (tls_ctx_t * ctx, session_t * app_session,
+ transport_send_params_t * sp)
{
mbedtls_ctx_t *mc = (mbedtls_ctx_t *) ctx;
u8 thread_index = ctx->c_thread_index;
@@ -446,7 +447,7 @@ mbedtls_ctx_write (tls_ctx_t * ctx, session_t * app_session, u32 max_write)
if (!deq_max)
return 0;
- deq_max = clib_min (deq_max, max_write);
+ deq_max = clib_min (deq_max, sp->max_burst_size);
tls_session = session_get_from_handle (ctx->tls_session_handle);
enq_max = svm_fifo_max_enqueue_prod (tls_session->tx_fifo);
deq_now = clib_min (deq_max, TLS_CHUNK_SIZE);
diff --git a/src/plugins/tlsopenssl/tls_openssl.c b/src/plugins/tlsopenssl/tls_openssl.c
index 935e0147e30..669a503487f 100644
--- a/src/plugins/tlsopenssl/tls_openssl.c
+++ b/src/plugins/tlsopenssl/tls_openssl.c
@@ -110,15 +110,11 @@ openssl_lctx_get (u32 lctx_index)
}
static int
-openssl_read_from_bio_into_fifo (svm_fifo_t * f, BIO * bio)
+openssl_read_from_bio_into_fifo (svm_fifo_t * f, BIO * bio, u32 enq_max)
{
- u32 enq_now, enq_max;
svm_fifo_chunk_t *c;
int read, rv;
-
- enq_max = svm_fifo_max_enqueue_prod (f);
- if (!enq_max)
- return 0;
+ u32 enq_now;
svm_fifo_fill_chunk_list (f);
@@ -256,12 +252,17 @@ openssl_try_handshake_read (openssl_ctx_t * oc, session_t * tls_session)
static int
openssl_try_handshake_write (openssl_ctx_t * oc, session_t * tls_session)
{
- u32 read;
+ u32 read, enq_max;
if (BIO_ctrl_pending (oc->rbio) <= 0)
return 0;
- read = openssl_read_from_bio_into_fifo (tls_session->tx_fifo, oc->rbio);
+ enq_max = svm_fifo_max_enqueue_prod (tls_session->tx_fifo);
+ if (!enq_max)
+ return 0;
+
+ read = openssl_read_from_bio_into_fifo (tls_session->tx_fifo, oc->rbio,
+ enq_max);
if (read)
tls_add_vpp_q_tx_evt (tls_session);
@@ -413,11 +414,12 @@ openssl_confirm_app_close (tls_ctx_t * ctx)
}
static inline int
-openssl_ctx_write (tls_ctx_t * ctx, session_t * app_session, u32 max_write)
+openssl_ctx_write (tls_ctx_t * ctx, session_t * app_session,
+ transport_send_params_t * sp)
{
openssl_ctx_t *oc = (openssl_ctx_t *) ctx;
- int wrote = 0, read, max_buf = 4 * TLS_CHUNK_SIZE, max_space;
- u32 deq_max, to_write;
+ int wrote = 0, read, max_buf = 4 * TLS_CHUNK_SIZE, max_space, n_pending;
+ u32 deq_max, to_write, enq_max;
session_t *tls_session;
svm_fifo_t *f;
@@ -427,7 +429,7 @@ openssl_ctx_write (tls_ctx_t * ctx, session_t * app_session, u32 max_write)
if (!deq_max)
goto check_tls_fifo;
- deq_max = clib_min (deq_max, max_write);
+ deq_max = clib_min (deq_max, sp->max_burst_size);
/* Figure out how much data to write */
max_space = max_buf - BIO_ctrl_pending (oc->rbio);
@@ -443,26 +445,38 @@ openssl_ctx_write (tls_ctx_t * ctx, session_t * app_session, u32 max_write)
check_tls_fifo:
- if (BIO_ctrl_pending (oc->rbio) <= 0)
+ if ((n_pending = BIO_ctrl_pending (oc->rbio)) <= 0)
return wrote;
tls_session = session_get_from_handle (ctx->tls_session_handle);
- read = openssl_read_from_bio_into_fifo (tls_session->tx_fifo, oc->rbio);
+ enq_max = svm_fifo_max_enqueue_prod (tls_session->tx_fifo);
+ if (!enq_max)
+ goto maybe_reschedule;
+
+ read = openssl_read_from_bio_into_fifo (tls_session->tx_fifo, oc->rbio,
+ enq_max);
if (!read)
- {
- /* Request tx reschedule of the app session */
- app_session->flags |= SESSION_F_CUSTOM_TX;
- return wrote;
- }
+ goto maybe_reschedule;
tls_add_vpp_q_tx_evt (tls_session);
- if (BIO_ctrl_pending (oc->rbio) > 0)
- app_session->flags |= SESSION_F_CUSTOM_TX;
- else if (ctx->app_closed)
+ if (PREDICT_FALSE (ctx->app_closed && !BIO_ctrl_pending (oc->rbio)))
openssl_confirm_app_close (ctx);
+maybe_reschedule:
+
+ if (!svm_fifo_max_enqueue_prod (tls_session->tx_fifo))
+ {
+ svm_fifo_add_want_deq_ntf (tls_session->tx_fifo,
+ SVM_FIFO_WANT_DEQ_NOTIF);
+ transport_connection_deschedule (&ctx->connection);
+ sp->flags |= TRANSPORT_SND_F_DESCHED;
+ }
+ else
+ /* Request tx reschedule of the app session */
+ app_session->flags |= SESSION_F_CUSTOM_TX;
+
return wrote;
}
diff --git a/src/plugins/tlspicotls/tls_picotls.c b/src/plugins/tlspicotls/tls_picotls.c
index a9eea333779..a8944bc299a 100644
--- a/src/plugins/tlspicotls/tls_picotls.c
+++ b/src/plugins/tlspicotls/tls_picotls.c
@@ -410,7 +410,8 @@ picotls_content_process (picotls_ctx_t * ptls_ctx, svm_fifo_t * src_fifo,
}
static inline int
-picotls_ctx_write (tls_ctx_t * ctx, session_t * app_session, u32 max_write)
+picotls_ctx_write (tls_ctx_t * ctx, session_t * app_session,
+ transport_send_params_t * sp)
{
picotls_ctx_t *ptls_ctx = (picotls_ctx_t *) ctx;
u32 deq_max, deq_now;
@@ -458,7 +459,7 @@ picotls_ctx_write (tls_ctx_t * ctx, session_t * app_session, u32 max_write)
if (!deq_max)
return deq_max;
- deq_max = clib_min (deq_max, max_write);
+ deq_max = clib_min (deq_max, sp->max_burst_size);
deq_now = clib_min (deq_max, svm_fifo_max_read_chunk (app_tx_fifo));
enq_max = svm_fifo_max_enqueue_prod (tls_tx_fifo);