summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2021-05-17 23:44:53 -0700
committerFlorin Coras <florin.coras@gmail.com>2021-05-18 06:39:27 +0000
commit1d7a663f4b86f1d14b77fef13672a17fb02d6144 (patch)
treee6ebc5d04da72f76cf01f30e2187f47945b25d1c
parentbaedaf374d5a060e418d1548bac4db1e0f443532 (diff)
session: move tx-buffers to tx ctx
Type: refactor Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: I10ec410fb7f3acb47128dda23510162dc13b20d0
-rw-r--r--src/vnet/session/session.h6
-rw-r--r--src/vnet/session/session_node.c24
2 files changed, 14 insertions, 16 deletions
diff --git a/src/vnet/session/session.h b/src/vnet/session/session.h
index 245ec25f135..7bf1b7d8b30 100644
--- a/src/vnet/session/session.h
+++ b/src/vnet/session/session.h
@@ -56,6 +56,9 @@ typedef struct session_tx_context_
u8 n_bufs_per_seg;
CLIB_CACHE_LINE_ALIGN_MARK (cacheline1);
session_dgram_hdr_t hdr;
+
+ /** Vector of tx buffer free lists */
+ u32 *tx_buffers;
} session_tx_context_t;
typedef struct session_evt_elt
@@ -115,9 +118,6 @@ typedef struct session_worker_
/** Context for session tx */
session_tx_context_t ctx;
- /** Vector of tx buffer free lists */
- u32 *tx_buffers;
-
/** Pool of session event list elements */
session_evt_elt_t *event_elts;
diff --git a/src/vnet/session/session_node.c b/src/vnet/session/session_node.c
index bd60bd7056b..fa66119abe2 100644
--- a/src/vnet/session/session_node.c
+++ b/src/vnet/session/session_node.c
@@ -756,11 +756,9 @@ session_tx_fifo_chain_tail (vlib_main_t * vm, session_tx_context_t * ctx,
{
vlib_buffer_t *chain_b, *prev_b;
u32 chain_bi0, to_deq, left_from_seg;
- session_worker_t *wrk;
u16 len_to_deq, n_bytes_read;
u8 *data, j;
- wrk = session_main_get_worker (ctx->s->thread_index);
b->flags |= VLIB_BUFFER_TOTAL_LENGTH_VALID;
b->total_length_not_including_first_buffer = 0;
@@ -774,7 +772,7 @@ session_tx_fifo_chain_tail (vlib_main_t * vm, session_tx_context_t * ctx,
len_to_deq = clib_min (to_deq, ctx->deq_per_buf);
*n_bufs -= 1;
- chain_bi0 = wrk->tx_buffers[*n_bufs];
+ chain_bi0 = ctx->tx_buffers[*n_bufs];
chain_b = vlib_get_buffer (vm, chain_bi0);
chain_b->current_data = 0;
data = vlib_buffer_get_current (chain_b);
@@ -1188,13 +1186,13 @@ session_tx_fifo_read_and_snd_i (session_worker_t * wrk,
return SESSION_TX_NO_DATA;
}
- vec_validate_aligned (wrk->tx_buffers, ctx->n_bufs_needed - 1,
+ vec_validate_aligned (ctx->tx_buffers, ctx->n_bufs_needed - 1,
CLIB_CACHE_LINE_BYTES);
- n_bufs = vlib_buffer_alloc (vm, wrk->tx_buffers, ctx->n_bufs_needed);
+ n_bufs = vlib_buffer_alloc (vm, ctx->tx_buffers, ctx->n_bufs_needed);
if (PREDICT_FALSE (n_bufs < ctx->n_bufs_needed))
{
if (n_bufs)
- vlib_buffer_free (vm, wrk->tx_buffers, n_bufs);
+ vlib_buffer_free (vm, ctx->tx_buffers, n_bufs);
session_evt_add_head_old (wrk, elt);
vlib_node_increment_counter (wrk->vm, node->node_index,
SESSION_QUEUE_ERROR_NO_BUFFER, 1);
@@ -1212,15 +1210,15 @@ session_tx_fifo_read_and_snd_i (session_worker_t * wrk,
vlib_buffer_t *b0, *b1;
u32 bi0, bi1;
- pbi = wrk->tx_buffers[n_bufs - 3];
+ pbi = ctx->tx_buffers[n_bufs - 3];
pb = vlib_get_buffer (vm, pbi);
vlib_prefetch_buffer_header (pb, STORE);
- pbi = wrk->tx_buffers[n_bufs - 4];
+ pbi = ctx->tx_buffers[n_bufs - 4];
pb = vlib_get_buffer (vm, pbi);
vlib_prefetch_buffer_header (pb, STORE);
- bi0 = wrk->tx_buffers[--n_bufs];
- bi1 = wrk->tx_buffers[--n_bufs];
+ bi0 = ctx->tx_buffers[--n_bufs];
+ bi1 = ctx->tx_buffers[--n_bufs];
b0 = vlib_get_buffer (vm, bi0);
b1 = vlib_get_buffer (vm, bi1);
@@ -1245,12 +1243,12 @@ session_tx_fifo_read_and_snd_i (session_worker_t * wrk,
if (n_left > 1)
{
- pbi = wrk->tx_buffers[n_bufs - 2];
+ pbi = ctx->tx_buffers[n_bufs - 2];
pb = vlib_get_buffer (vm, pbi);
vlib_prefetch_buffer_header (pb, STORE);
}
- bi0 = wrk->tx_buffers[--n_bufs];
+ bi0 = ctx->tx_buffers[--n_bufs];
b0 = vlib_get_buffer (vm, bi0);
session_tx_fill_buffer (vm, ctx, b0, &n_bufs, peek_data);
@@ -1269,7 +1267,7 @@ session_tx_fifo_read_and_snd_i (session_worker_t * wrk,
ctx->n_segs_per_evt, ctx->s, n_trace);
if (PREDICT_FALSE (n_bufs))
- vlib_buffer_free (vm, wrk->tx_buffers, n_bufs);
+ vlib_buffer_free (vm, ctx->tx_buffers, n_bufs);
*n_tx_packets += ctx->n_segs_per_evt;