diff options
author | Florin Coras <fcoras@cisco.com> | 2020-02-27 04:32:51 +0000 |
---|---|---|
committer | Dave Barach <openvpp@barachs.net> | 2020-04-04 17:34:13 +0000 |
commit | ed8db52539a8d8239a9a43bea53328d25eb47f0d (patch) | |
tree | f0bd25f356fa2f10aaab8e51eff3dfc3fd7637ec /src/plugins/tlsmbedtls/tls_mbedtls.c | |
parent | 3e07a4a1e843267892dc291a833d93bd70597011 (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/tlsmbedtls/tls_mbedtls.c')
-rw-r--r-- | src/plugins/tlsmbedtls/tls_mbedtls.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/plugins/tlsmbedtls/tls_mbedtls.c b/src/plugins/tlsmbedtls/tls_mbedtls.c index 7b722faf822..8ac736ae6f3 100644 --- a/src/plugins/tlsmbedtls/tls_mbedtls.c +++ b/src/plugins/tlsmbedtls/tls_mbedtls.c @@ -431,7 +431,7 @@ mbedtls_ctx_handshake_rx (tls_ctx_t * ctx) } static int -mbedtls_ctx_write (tls_ctx_t * ctx, session_t * app_session) +mbedtls_ctx_write (tls_ctx_t * ctx, session_t * app_session, u32 max_write) { mbedtls_ctx_t *mc = (mbedtls_ctx_t *) ctx; u8 thread_index = ctx->c_thread_index; @@ -446,13 +446,14 @@ mbedtls_ctx_write (tls_ctx_t * ctx, session_t * app_session) if (!deq_max) return 0; + deq_max = clib_min (deq_max, max_write); 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); if (PREDICT_FALSE (enq_max == 0)) { - tls_add_vpp_q_builtin_tx_evt (app_session); + app_session->flags |= SESSION_F_CUSTOM_TX; return 0; } @@ -462,7 +463,7 @@ mbedtls_ctx_write (tls_ctx_t * ctx, session_t * app_session) wrote = mbedtls_ssl_write (&mc->ssl, mm->tx_bufs[thread_index], deq_now); if (wrote <= 0) { - tls_add_vpp_q_builtin_tx_evt (app_session); + app_session->flags |= SESSION_F_CUSTOM_TX; return 0; } @@ -471,7 +472,7 @@ mbedtls_ctx_write (tls_ctx_t * ctx, session_t * app_session) tls_add_vpp_q_tx_evt (tls_session); if (deq_now < deq_max) - tls_add_vpp_q_builtin_tx_evt (app_session); + app_session->flags |= SESSION_F_CUSTOM_TX; return 0; } |