diff options
author | Florin Coras <fcoras@cisco.com> | 2019-11-02 14:32:52 -0700 |
---|---|---|
committer | Florin Coras <fcoras@cisco.com> | 2019-11-02 15:17:46 -0700 |
commit | dd97a48d9fac91c7f16a31aa661dd6c968c3b760 (patch) | |
tree | 069f36122d0811f05b75ce3628f2b725e558f609 /src/vnet/session/session_node.c | |
parent | a1f5a956e5b2cfeb591dcdfb34d23ebed84d0bca (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>
Diffstat (limited to 'src/vnet/session/session_node.c')
-rw-r--r-- | src/vnet/session/session_node.c | 27 |
1 files changed, 20 insertions, 7 deletions
diff --git a/src/vnet/session/session_node.c b/src/vnet/session/session_node.c index b4b384fc617..3bfc80eca66 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; @@ -1321,19 +1329,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; }; } |