diff options
author | Florin Coras <fcoras@cisco.com> | 2019-11-02 14:32:52 -0700 |
---|---|---|
committer | Andrew Yourtchenko <ayourtch@gmail.com> | 2019-11-18 13:15:56 +0000 |
commit | 89ab1762d7a01bd009cbdd454604d2a15f99b6cd (patch) | |
tree | db224b5432d7cab3fe1bea12774b779bd6bc397d /src | |
parent | ccdd73e636e634c21ff83b7e757c21c4dfb9b59d (diff) |
session: reschedule asap when snd space constrained
Type: feature
Improves fairness for sessions that are snd space or pacer constrained.
Change-Id: Ida5f523090f1dcbfb17bf5116bc7917747ac8593
Signed-off-by: Florin Coras <fcoras@cisco.com>
(cherry picked from commit dd97a48d9fac91c7f16a31aa661dd6c968c3b760)
Diffstat (limited to 'src')
-rw-r--r-- | src/vnet/session/session.h | 8 | ||||
-rw-r--r-- | src/vnet/session/session_node.c | 27 |
2 files changed, 28 insertions, 7 deletions
diff --git a/src/vnet/session/session.h b/src/vnet/session/session.h index f738f3957e2..9fe35b19b25 100644 --- a/src/vnet/session/session.h +++ b/src/vnet/session/session.h @@ -221,6 +221,14 @@ session_evt_add_old (session_worker_t * wrk, session_evt_elt_t * elt) pool_elt_at_index (wrk->event_elts, wrk->old_head)); } +static inline void +session_evt_add_head_old (session_worker_t * wrk, session_evt_elt_t * elt) +{ + clib_llist_add (wrk->event_elts, evt_list, elt, + pool_elt_at_index (wrk->event_elts, wrk->old_head)); +} + + static inline u32 session_evt_ctrl_data_alloc (session_worker_t * wrk) { diff --git a/src/vnet/session/session_node.c b/src/vnet/session/session_node.c index d4470e0b283..1ace416c802 100644 --- a/src/vnet/session/session_node.c +++ b/src/vnet/session/session_node.c @@ -865,14 +865,22 @@ session_tx_fifo_read_and_snd_i (session_worker_t * wrk, } ctx->snd_mss = ctx->transport_vft->send_mss (ctx->tc); + if (PREDICT_FALSE (ctx->snd_mss == 0)) + { + session_evt_add_old (wrk, elt); + return SESSION_TX_NO_DATA; + } + ctx->snd_space = transport_connection_snd_space (ctx->tc, vm->clib_time. last_cpu_time, ctx->snd_mss); - if (ctx->snd_space == 0 || ctx->snd_mss == 0) + /* This flow queue is "empty" so it should be re-evaluated before + * the ones that have data to send. */ + if (ctx->snd_space == 0) { - session_evt_add_old (wrk, elt); + session_evt_add_head_old (wrk, elt); return SESSION_TX_NO_DATA; } @@ -898,7 +906,7 @@ session_tx_fifo_read_and_snd_i (session_worker_t * wrk, { if (n_bufs) vlib_buffer_free (vm, wrk->tx_buffers, n_bufs); - session_evt_add_old (wrk, elt); + session_evt_add_head_old (wrk, elt); vlib_node_increment_counter (wrk->vm, node->node_index, SESSION_QUEUE_ERROR_NO_BUFFER, 1); return SESSION_TX_NO_BUFFERS; @@ -1334,19 +1342,24 @@ session_queue_node_fn (vlib_main_t * vm, vlib_node_runtime_t * node, if (old_ti != wrk->old_head) { + clib_llist_index_t ei, next_ei; + old_he = pool_elt_at_index (wrk->event_elts, wrk->old_head); + ei = clib_llist_next_index (old_he, evt_list); + while (n_tx_packets < VLIB_FRAME_SIZE) { - clib_llist_index_t ei; + elt = pool_elt_at_index (wrk->event_elts, ei); + next_ei = clib_llist_next_index (elt, evt_list); + clib_llist_remove (wrk->event_elts, evt_list, elt); - clib_llist_pop_first (wrk->event_elts, evt_list, elt, old_he); - ei = clib_llist_entry_index (wrk->event_elts, elt); session_event_dispatch_io (wrk, node, elt, thread_index, &n_tx_packets); - old_he = pool_elt_at_index (wrk->event_elts, wrk->old_head); if (ei == old_ti) break; + + ei = next_ei; }; } |