session: pass tx buffers in bulk to transports
Type: improvement
Signed-off-by: Florin Coras <fcoras@cisco.com>
Change-Id: I1025cccd784f80b557847f69c3ea1ada5c9de60d
diff --git a/src/vnet/session/session_node.c b/src/vnet/session/session_node.c
index bebabd3..403c28f 100644
--- a/src/vnet/session/session_node.c
+++ b/src/vnet/session/session_node.c
@@ -1319,6 +1319,8 @@
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_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 @@
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);