aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/tls
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/vnet/tls
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/vnet/tls')
-rw-r--r--src/vnet/tls/tls.c22
-rw-r--r--src/vnet/tls/tls.h2
2 files changed, 10 insertions, 14 deletions
diff --git a/src/vnet/tls/tls.c b/src/vnet/tls/tls.c
index 7a172b88928..d0552dc6f3b 100644
--- a/src/vnet/tls/tls.c
+++ b/src/vnet/tls/tls.c
@@ -74,15 +74,6 @@ tls_add_vpp_q_tx_evt (session_t * s)
return 0;
}
-int
-tls_add_vpp_q_builtin_tx_evt (session_t * s)
-{
- if (svm_fifo_set_event (s->tx_fifo))
- session_send_io_evt_to_thread_custom (s, s->thread_index,
- SESSION_IO_EVT_BUILTIN_TX);
- return 0;
-}
-
static inline int
tls_add_app_q_evt (app_worker_t * app, session_t * app_session)
{
@@ -316,9 +307,14 @@ tls_ctx_init_client (tls_ctx_t * ctx)
}
static inline int
-tls_ctx_write (tls_ctx_t * ctx, session_t * app_session)
+tls_ctx_write (tls_ctx_t * ctx, session_t * app_session, u32 max_burst_size)
{
- return tls_vfts[ctx->tls_ctx_engine].ctx_write (ctx, app_session);
+ u32 max_write, n_wrote;
+
+ max_write = max_burst_size * TRANSPORT_PACER_MIN_MSS;
+ n_wrote = tls_vfts[ctx->tls_ctx_engine].ctx_write (ctx, app_session,
+ max_write);
+ return n_wrote > 0 ? clib_max (n_wrote / TRANSPORT_PACER_MIN_MSS, 1) : 0;
}
static inline int
@@ -726,7 +722,7 @@ tls_custom_tx_callback (void *session, u32 max_burst_size)
return 0;
ctx = tls_ctx_get (app_session->connection_index);
- tls_ctx_write (ctx, app_session);
+ tls_ctx_write (ctx, app_session, max_burst_size);
return 0;
}
@@ -890,7 +886,7 @@ tls_init (vlib_main_t * vm)
{
u32 add_segment_size = 256 << 20, first_seg_size = 32 << 20;
vlib_thread_main_t *vtm = vlib_get_thread_main ();
- u32 num_threads, fifo_size = 128 << 10;
+ u32 num_threads, fifo_size = 128 << 12;
vnet_app_attach_args_t _a, *a = &_a;
u64 options[APP_OPTIONS_N_OPTIONS];
tls_main_t *tm = &tls_main;
diff --git a/src/vnet/tls/tls.h b/src/vnet/tls/tls.h
index 1281e3d62c9..2d09b291aa7 100644
--- a/src/vnet/tls/tls.h
+++ b/src/vnet/tls/tls.h
@@ -110,7 +110,7 @@ typedef struct tls_engine_vft_
int (*ctx_init_client) (tls_ctx_t * ctx);
int (*ctx_init_server) (tls_ctx_t * ctx);
int (*ctx_read) (tls_ctx_t * ctx, session_t * tls_session);
- int (*ctx_write) (tls_ctx_t * ctx, session_t * app_session);
+ int (*ctx_write) (tls_ctx_t * ctx, session_t * app_session, u32 max_write);
u8 (*ctx_handshake_is_over) (tls_ctx_t * ctx);
int (*ctx_start_listen) (tls_ctx_t * ctx);
int (*ctx_stop_listen) (tls_ctx_t * ctx);