summaryrefslogtreecommitdiffstats
path: root/src/vlib/threads.c
diff options
context:
space:
mode:
authorDamjan Marion <damarion@cisco.com>2021-05-11 09:39:24 +0200
committerFlorin Coras <florin.coras@gmail.com>2021-05-27 20:54:20 +0000
commitc0d9ca7fe1db7a6bd55972364d4292a9668b7c24 (patch)
treedc63abfea96cd7f5eb03875d085c57c39df8cb7b /src/vlib/threads.c
parent7cf80af582a12fba4b547b1f2b01c27b8295f84c (diff)
vlib: handoff rework
Type: improvement Change-Id: I1e199ae31e969154319e94c5cd286b8d8adc6660 Signed-off-by: Damjan Marion <damarion@cisco.com>
Diffstat (limited to 'src/vlib/threads.c')
-rw-r--r--src/vlib/threads.c31
1 files changed, 4 insertions, 27 deletions
diff --git a/src/vlib/threads.c b/src/vlib/threads.c
index b02271bf310..a33e70ab8d4 100644
--- a/src/vlib/threads.c
+++ b/src/vlib/threads.c
@@ -346,26 +346,13 @@ vlib_frame_queue_alloc (int nelts)
fq = clib_mem_alloc_aligned (sizeof (*fq), CLIB_CACHE_LINE_BYTES);
clib_memset (fq, 0, sizeof (*fq));
fq->nelts = nelts;
- fq->vector_threshold = 128; // packets
+ fq->vector_threshold = 2 * VLIB_FRAME_SIZE;
vec_validate_aligned (fq->elts, nelts - 1, CLIB_CACHE_LINE_BYTES);
- if (1)
+ if (nelts & (nelts - 1))
{
- if (((uword) & fq->tail) & (CLIB_CACHE_LINE_BYTES - 1))
- fformat (stderr, "WARNING: fq->tail unaligned\n");
- if (((uword) & fq->head) & (CLIB_CACHE_LINE_BYTES - 1))
- fformat (stderr, "WARNING: fq->head unaligned\n");
- if (((uword) fq->elts) & (CLIB_CACHE_LINE_BYTES - 1))
- fformat (stderr, "WARNING: fq->elts unaligned\n");
-
- if (sizeof (fq->elts[0]) % CLIB_CACHE_LINE_BYTES)
- fformat (stderr, "WARNING: fq->elts[0] size %d\n",
- sizeof (fq->elts[0]));
- if (nelts & (nelts - 1))
- {
- fformat (stderr, "FATAL: nelts MUST be a power of 2\n");
- abort ();
- }
+ fformat (stderr, "FATAL: nelts MUST be a power of 2\n");
+ abort ();
}
return (fq);
@@ -1587,23 +1574,13 @@ vlib_frame_queue_main_init (u32 node_index, u32 frame_queue_nelts)
fqm->node_index = node_index;
fqm->frame_queue_nelts = frame_queue_nelts;
- fqm->queue_hi_thresh = frame_queue_nelts - num_threads;
vec_validate (fqm->vlib_frame_queues, tm->n_vlib_mains - 1);
- vec_validate (fqm->per_thread_data, tm->n_vlib_mains - 1);
_vec_len (fqm->vlib_frame_queues) = 0;
for (i = 0; i < tm->n_vlib_mains; i++)
{
- vlib_frame_queue_per_thread_data_t *ptd;
fq = vlib_frame_queue_alloc (frame_queue_nelts);
vec_add1 (fqm->vlib_frame_queues, fq);
-
- ptd = vec_elt_at_index (fqm->per_thread_data, i);
- vec_validate (ptd->handoff_queue_elt_by_thread_index,
- tm->n_vlib_mains - 1);
- vec_validate_init_empty (ptd->congested_handoff_queue_by_thread_index,
- tm->n_vlib_mains - 1,
- (vlib_frame_queue_t *) (~0));
}
return (fqm - tm->frame_queue_mains);