summaryrefslogtreecommitdiffstats
path: root/src/plugins/tlsopenssl/tls_openssl.c
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2020-02-27 04:32:51 +0000
committerDave Barach <openvpp@barachs.net>2020-04-04 17:34:13 +0000
commited8db52539a8d8239a9a43bea53328d25eb47f0d (patch)
treef0bd25f356fa2f10aaab8e51eff3dfc3fd7637ec /src/plugins/tlsopenssl/tls_openssl.c
parent3e07a4a1e843267892dc291a833d93bd70597011 (diff)
session tls: improve app transports tx scheduling
Type: improvement - allow apps to request rescheduling of tx events via SESSION_F_CUSTOM_TX flag - limit max burst per session custom tx dispatch In tls - use the new infra to reschedule tx events - use max burst bytes as upper limit to number of bytes to be encrypted Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: I544a5a3337af7ebdff3406b776adf30cf96ebf3c
Diffstat (limited to 'src/plugins/tlsopenssl/tls_openssl.c')
-rw-r--r--src/plugins/tlsopenssl/tls_openssl.c17
1 files changed, 7 insertions, 10 deletions
diff --git a/src/plugins/tlsopenssl/tls_openssl.c b/src/plugins/tlsopenssl/tls_openssl.c
index 43bb13ff967..935e0147e30 100644
--- a/src/plugins/tlsopenssl/tls_openssl.c
+++ b/src/plugins/tlsopenssl/tls_openssl.c
@@ -413,7 +413,7 @@ openssl_confirm_app_close (tls_ctx_t * ctx)
}
static inline int
-openssl_ctx_write (tls_ctx_t * ctx, session_t * app_session)
+openssl_ctx_write (tls_ctx_t * ctx, session_t * app_session, u32 max_write)
{
openssl_ctx_t *oc = (openssl_ctx_t *) ctx;
int wrote = 0, read, max_buf = 4 * TLS_CHUNK_SIZE, max_space;
@@ -427,6 +427,8 @@ openssl_ctx_write (tls_ctx_t * ctx, session_t * app_session)
if (!deq_max)
goto check_tls_fifo;
+ deq_max = clib_min (deq_max, max_write);
+
/* Figure out how much data to write */
max_space = max_buf - BIO_ctrl_pending (oc->rbio);
max_space = (max_space < 0) ? 0 : max_space;
@@ -434,17 +436,11 @@ openssl_ctx_write (tls_ctx_t * ctx, session_t * app_session)
wrote = openssl_write_from_fifo_into_ssl (f, oc->ssl, to_write);
if (!wrote)
- {
- tls_add_vpp_q_builtin_tx_evt (app_session);
- goto check_tls_fifo;
- }
+ goto check_tls_fifo;
if (svm_fifo_needs_deq_ntf (f, wrote))
session_dequeue_notify (app_session);
- if (svm_fifo_max_dequeue_cons (f))
- tls_add_vpp_q_builtin_tx_evt (app_session);
-
check_tls_fifo:
if (BIO_ctrl_pending (oc->rbio) <= 0)
@@ -455,14 +451,15 @@ check_tls_fifo:
read = openssl_read_from_bio_into_fifo (tls_session->tx_fifo, oc->rbio);
if (!read)
{
- tls_add_vpp_q_builtin_tx_evt (app_session);
+ /* Request tx reschedule of the app session */
+ app_session->flags |= SESSION_F_CUSTOM_TX;
return wrote;
}
tls_add_vpp_q_tx_evt (tls_session);
if (BIO_ctrl_pending (oc->rbio) > 0)
- tls_add_vpp_q_builtin_tx_evt (app_session);
+ app_session->flags |= SESSION_F_CUSTOM_TX;
else if (ctx->app_closed)
openssl_confirm_app_close (ctx);