diff options
author | Florin Coras <fcoras@cisco.com> | 2019-10-16 22:35:18 -0700 |
---|---|---|
committer | Andrew Yourtchenko <ayourtch@gmail.com> | 2019-11-18 13:49:06 +0000 |
commit | 7dfe1ac660b75e6da5a95af385fb4d1eebfdb44e (patch) | |
tree | 024bf784b0902681616c05f0304158ee7e9a9826 /src/vnet | |
parent | aa35702743f147aef85cf70960be253a410e9cb1 (diff) |
session: unify buffer tx dispatching
Type: refactor
Use pending tx buffer vector to postpone dispatching of all buffers,
i.e., either generated as a result of tx events or custom tx event.
Change-Id: Ic5894c4653c338cfb04555d20857f954b245ee83
Signed-off-by: Florin Coras <fcoras@cisco.com>
(cherry picked from commit 8a754f1a55fb16a4d42efd5c606e5a07b4afffe9)
Diffstat (limited to 'src/vnet')
-rw-r--r-- | src/vnet/session/session_node.c | 37 |
1 files changed, 11 insertions, 26 deletions
diff --git a/src/vnet/session/session_node.c b/src/vnet/session/session_node.c index 1ace416c802..c4e7a71e183 100644 --- a/src/vnet/session/session_node.c +++ b/src/vnet/session/session_node.c @@ -815,8 +815,7 @@ session_tx_fifo_read_and_snd_i (session_worker_t * wrk, session_evt_elt_t * elt, int *n_tx_packets, u8 peek_data) { - u32 next_index, next0, next1, *to_next, n_left_to_next, max_burst; - u32 n_trace, n_bufs_needed = 0, n_left, pbi; + u32 n_trace, n_bufs_needed = 0, n_left, pbi, next_index, max_burst; session_tx_context_t *ctx = &wrk->ctx; session_main_t *smm = &session_main; session_event_t *e = &elt->evt; @@ -833,7 +832,6 @@ session_tx_fifo_read_and_snd_i (session_worker_t * wrk, } next_index = smm->session_type_to_next[ctx->s->session_type]; - next0 = next1 = next_index; max_burst = VLIB_FRAME_SIZE - *n_tx_packets; tp = session_get_transport_proto (ctx->s); @@ -912,15 +910,6 @@ session_tx_fifo_read_and_snd_i (session_worker_t * wrk, return SESSION_TX_NO_BUFFERS; } - /* - * Write until we fill up a frame - */ - vlib_get_next_frame (vm, node, next_index, to_next, n_left_to_next); - if (PREDICT_FALSE (ctx->n_segs_per_evt > n_left_to_next)) - { - ctx->n_segs_per_evt = n_left_to_next; - ctx->max_len_to_snd = ctx->snd_mss * n_left_to_next; - } ctx->left_to_snd = ctx->max_len_to_snd; n_left = ctx->n_segs_per_evt; @@ -936,8 +925,8 @@ session_tx_fifo_read_and_snd_i (session_worker_t * wrk, pb = vlib_get_buffer (vm, pbi); vlib_prefetch_buffer_header (pb, STORE); - to_next[0] = bi0 = wrk->tx_buffers[--n_bufs]; - to_next[1] = bi1 = wrk->tx_buffers[--n_bufs]; + bi0 = wrk->tx_buffers[--n_bufs]; + bi1 = wrk->tx_buffers[--n_bufs]; b0 = vlib_get_buffer (vm, bi0); b1 = vlib_get_buffer (vm, bi1); @@ -948,16 +937,15 @@ session_tx_fifo_read_and_snd_i (session_worker_t * wrk, ctx->transport_vft->push_header (ctx->tc, b0); ctx->transport_vft->push_header (ctx->tc, b1); - to_next += 2; - n_left_to_next -= 2; n_left -= 2; VLIB_BUFFER_TRACE_TRAJECTORY_INIT (b0); VLIB_BUFFER_TRACE_TRAJECTORY_INIT (b1); - vlib_validate_buffer_enqueue_x2 (vm, node, next_index, to_next, - n_left_to_next, bi0, bi1, next0, - next1); + vec_add1 (wrk->pending_tx_buffers, bi0); + vec_add1 (wrk->pending_tx_buffers, bi1); + vec_add1 (wrk->pending_tx_nexts, next_index); + vec_add1 (wrk->pending_tx_nexts, next_index); } while (n_left) { @@ -971,7 +959,7 @@ session_tx_fifo_read_and_snd_i (session_worker_t * wrk, vlib_prefetch_buffer_header (pb, STORE); } - to_next[0] = bi0 = wrk->tx_buffers[--n_bufs]; + bi0 = wrk->tx_buffers[--n_bufs]; b0 = vlib_get_buffer (vm, bi0); session_tx_fill_buffer (vm, ctx, b0, &n_bufs, peek_data); @@ -979,18 +967,16 @@ session_tx_fifo_read_and_snd_i (session_worker_t * wrk, * total_length_not_including_first_buffer are updated */ ctx->transport_vft->push_header (ctx->tc, b0); - to_next += 1; - n_left_to_next -= 1; n_left -= 1; VLIB_BUFFER_TRACE_TRAJECTORY_INIT (b0); - vlib_validate_buffer_enqueue_x1 (vm, node, next_index, to_next, - n_left_to_next, bi0, next0); + vec_add1 (wrk->pending_tx_buffers, bi0); + vec_add1 (wrk->pending_tx_nexts, next_index); } if (PREDICT_FALSE ((n_trace = vlib_get_trace_count (vm, node)) > 0)) - session_tx_trace_frame (vm, node, next_index, to_next, + session_tx_trace_frame (vm, node, next_index, wrk->pending_tx_buffers, ctx->n_segs_per_evt, ctx->s, n_trace); if (PREDICT_FALSE (n_bufs)) @@ -998,7 +984,6 @@ session_tx_fifo_read_and_snd_i (session_worker_t * wrk, *n_tx_packets += ctx->n_segs_per_evt; transport_connection_update_tx_bytes (ctx->tc, ctx->max_len_to_snd); - vlib_put_next_frame (vm, node, next_index, n_left_to_next); SESSION_EVT (SESSION_EVT_DEQ, ctx->s, ctx->max_len_to_snd, ctx->max_dequeue, ctx->s->tx_fifo->has_event, wrk->last_vlib_time); |