diff options
author | Florin Coras <fcoras@cisco.com> | 2021-04-08 19:10:07 -0700 |
---|---|---|
committer | Florin Coras <fcoras@cisco.com> | 2022-01-12 08:42:32 -0800 |
commit | f66cc80b94de0b9e910bb66aa69d98ba69f53b73 (patch) | |
tree | a77d5c4ac5f4e18abf11dd38ee8835bd132afe42 /src/vnet/session | |
parent | b2bf388b81c62ce4dfe3a98f099a0440c6a987aa (diff) |
session: pass tx buffers in bulk to transports
Type: improvement
Signed-off-by: Florin Coras <fcoras@cisco.com>
Change-Id: I1025cccd784f80b557847f69c3ea1ada5c9de60d
Diffstat (limited to 'src/vnet/session')
-rw-r--r-- | src/vnet/session/session.h | 1 | ||||
-rw-r--r-- | src/vnet/session/session_node.c | 16 | ||||
-rw-r--r-- | src/vnet/session/transport.h | 3 |
3 files changed, 12 insertions, 8 deletions
diff --git a/src/vnet/session/session.h b/src/vnet/session/session.h index e549da588e9..9d6c945bb4d 100644 --- a/src/vnet/session/session.h +++ b/src/vnet/session/session.h @@ -59,6 +59,7 @@ typedef struct session_tx_context_ /** Vector of tx buffer free lists */ u32 *tx_buffers; + vlib_buffer_t **transport_pending_bufs; } session_tx_context_t; typedef struct session_evt_elt diff --git a/src/vnet/session/session_node.c b/src/vnet/session/session_node.c index bebabd3d68e..403c28f28ce 100644 --- a/src/vnet/session/session_node.c +++ b/src/vnet/session/session_node.c @@ -1319,6 +1319,8 @@ session_tx_fifo_read_and_snd_i (session_worker_t * wrk, ctx->left_to_snd = ctx->max_len_to_snd; n_left = ctx->n_segs_per_evt; + vec_validate (ctx->transport_pending_bufs, n_left); + while (n_left >= 4) { vlib_buffer_t *b0, *b1; @@ -1340,9 +1342,8 @@ session_tx_fifo_read_and_snd_i (session_worker_t * wrk, session_tx_fill_buffer (vm, ctx, b0, &n_bufs, peek_data); session_tx_fill_buffer (vm, ctx, b1, &n_bufs, peek_data); - ctx->transport_vft->push_header (ctx->tc, b0); - ctx->transport_vft->push_header (ctx->tc, b1); - + ctx->transport_pending_bufs[ctx->n_segs_per_evt - n_left] = b0; + ctx->transport_pending_bufs[ctx->n_segs_per_evt - n_left + 1] = b1; n_left -= 2; vec_add1 (wrk->pending_tx_buffers, bi0); @@ -1366,16 +1367,17 @@ session_tx_fifo_read_and_snd_i (session_worker_t * wrk, b0 = vlib_get_buffer (vm, bi0); session_tx_fill_buffer (vm, ctx, b0, &n_bufs, peek_data); - /* Ask transport to push header after current_length and - * total_length_not_including_first_buffer are updated */ - ctx->transport_vft->push_header (ctx->tc, b0); - + ctx->transport_pending_bufs[ctx->n_segs_per_evt - n_left] = b0; n_left -= 1; vec_add1 (wrk->pending_tx_buffers, bi0); vec_add1 (wrk->pending_tx_nexts, next_index); } + /* Ask transport to push headers */ + ctx->transport_vft->push_header (ctx->tc, ctx->transport_pending_bufs, + ctx->n_segs_per_evt); + if (PREDICT_FALSE ((n_trace = vlib_get_trace_count (vm, node)) > 0)) session_tx_trace_frame (vm, node, next_index, wrk->pending_tx_buffers, ctx->n_segs_per_evt, ctx->s, n_trace); diff --git a/src/vnet/session/transport.h b/src/vnet/session/transport.h index 549f17957cc..4edc281ff9c 100644 --- a/src/vnet/session/transport.h +++ b/src/vnet/session/transport.h @@ -85,7 +85,8 @@ typedef struct _transport_proto_vft * Transmission */ - u32 (*push_header) (transport_connection_t * tconn, vlib_buffer_t * b); + u32 (*push_header) (transport_connection_t *tconn, vlib_buffer_t **b, + u32 n_bufs); int (*send_params) (transport_connection_t * tconn, transport_send_params_t *sp); void (*update_time) (f64 time_now, u8 thread_index); |