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/vnet/session | |
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/vnet/session')
-rw-r--r-- | src/vnet/session/session_node.c | 30 | ||||
-rw-r--r-- | src/vnet/session/transport.h | 1 |
2 files changed, 27 insertions, 4 deletions
diff --git a/src/vnet/session/session_node.c b/src/vnet/session/session_node.c index c2a6ec921af..30eca1e6577 100644 --- a/src/vnet/session/session_node.c +++ b/src/vnet/session/session_node.c @@ -1066,15 +1066,37 @@ session_tx_fifo_dequeue_and_snd (session_worker_t * wrk, int session_tx_fifo_dequeue_internal (session_worker_t * wrk, vlib_node_runtime_t * node, - session_evt_elt_t * e, int *n_tx_packets) + session_evt_elt_t * elt, int *n_tx_packets) { session_t *s = wrk->ctx.s; + u32 n_packets, max_pkts; if (PREDICT_FALSE (s->session_state >= SESSION_STATE_TRANSPORT_CLOSED)) return 0; - svm_fifo_unset_event (s->tx_fifo); - return transport_custom_tx (session_get_transport_proto (s), s, - VLIB_FRAME_SIZE - *n_tx_packets); + + /* Clear custom-tx flag used to request reschedule for tx */ + s->flags &= ~SESSION_F_CUSTOM_TX; + + max_pkts = clib_min (VLIB_FRAME_SIZE - *n_tx_packets, + TRANSPORT_PACER_MAX_BURST_PKTS); + n_packets = transport_custom_tx (session_get_transport_proto (s), s, + max_pkts); + *n_tx_packets -= n_packets; + + if (svm_fifo_max_dequeue_cons (s->tx_fifo) + || (s->flags & SESSION_F_CUSTOM_TX)) + { + session_evt_add_old (wrk, elt); + } + else + { + svm_fifo_unset_event (s->tx_fifo); + if (svm_fifo_max_dequeue_cons (s->tx_fifo)) + if (svm_fifo_set_event (s->tx_fifo)) + session_evt_add_head_old (wrk, elt); + } + + return n_packets; } always_inline session_t * diff --git a/src/vnet/session/transport.h b/src/vnet/session/transport.h index 53a0dd6c14e..6dc6984cdf4 100644 --- a/src/vnet/session/transport.h +++ b/src/vnet/session/transport.h @@ -22,6 +22,7 @@ #define TRANSPORT_PACER_MIN_MSS 1460 #define TRANSPORT_PACER_MIN_BURST TRANSPORT_PACER_MIN_MSS #define TRANSPORT_PACER_MAX_BURST (43 * TRANSPORT_PACER_MIN_MSS) +#define TRANSPORT_PACER_MAX_BURST_PKTS 43 #define TRANSPORT_PACER_MIN_IDLE 100 #define TRANSPORT_PACER_IDLE_FACTOR 0.05 |