aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/crypto_sw_scheduler/main.c
diff options
context:
space:
mode:
authorVratko Polak <vrpolak@cisco.com>2023-07-31 17:08:21 +0200
committerFan Zhang <fanzhang.oss@gmail.com>2023-08-10 11:33:17 +0000
commit11af9e6bfe3daa0e8f97a5424cafeccad77ad484 (patch)
tree2f480275b1a4c5d481d1d96040d4b76adc4b3dd6 /src/plugins/crypto_sw_scheduler/main.c
parent2faac91f67205b323f9d9a2736a9b073a6ee25e8 (diff)
crypto-sw-scheduler: avoid crypto work on vpp_main
+ Checkstyle demanded indentation edits. Type: fix Ticket: VPP-2083 Fixes: 9a9604b09f15691d7c4ddf29afd99a31e7e31eed Change-Id: Ie2d33d290330247d36435a073675b732bb64ae93 Signed-off-by: Vratko Polak <vrpolak@cisco.com>
Diffstat (limited to 'src/plugins/crypto_sw_scheduler/main.c')
-rw-r--r--src/plugins/crypto_sw_scheduler/main.c34
1 files changed, 18 insertions, 16 deletions
diff --git a/src/plugins/crypto_sw_scheduler/main.c b/src/plugins/crypto_sw_scheduler/main.c
index 1cc7a08ca11..2b08cba6dbc 100644
--- a/src/plugins/crypto_sw_scheduler/main.c
+++ b/src/plugins/crypto_sw_scheduler/main.c
@@ -689,31 +689,33 @@ crypto_sw_scheduler_init (vlib_main_t * vm)
vlib_thread_main_t *tm = vlib_get_thread_main ();
clib_error_t *error = 0;
crypto_sw_scheduler_per_thread_data_t *ptd;
+ u32 i;
vec_validate_aligned (cm->per_thread_data, tm->n_vlib_mains - 1,
CLIB_CACHE_LINE_BYTES);
- vec_foreach (ptd, cm->per_thread_data)
- {
- ptd->self_crypto_enabled = 1;
+ for (i = 0; i < tm->n_vlib_mains; i++)
+ {
+ ptd = cm->per_thread_data + i;
+ ptd->self_crypto_enabled = i > 0 || vlib_num_workers () < 1;
- ptd->queue[CRYPTO_SW_SCHED_QUEUE_TYPE_DECRYPT].head = 0;
- ptd->queue[CRYPTO_SW_SCHED_QUEUE_TYPE_DECRYPT].tail = 0;
+ ptd->queue[CRYPTO_SW_SCHED_QUEUE_TYPE_DECRYPT].head = 0;
+ ptd->queue[CRYPTO_SW_SCHED_QUEUE_TYPE_DECRYPT].tail = 0;
- vec_validate_aligned (ptd->queue[CRYPTO_SW_SCHED_QUEUE_TYPE_DECRYPT].jobs,
- CRYPTO_SW_SCHEDULER_QUEUE_SIZE - 1,
- CLIB_CACHE_LINE_BYTES);
+ vec_validate_aligned (
+ ptd->queue[CRYPTO_SW_SCHED_QUEUE_TYPE_DECRYPT].jobs,
+ CRYPTO_SW_SCHEDULER_QUEUE_SIZE - 1, CLIB_CACHE_LINE_BYTES);
- ptd->queue[CRYPTO_SW_SCHED_QUEUE_TYPE_ENCRYPT].head = 0;
- ptd->queue[CRYPTO_SW_SCHED_QUEUE_TYPE_ENCRYPT].tail = 0;
+ ptd->queue[CRYPTO_SW_SCHED_QUEUE_TYPE_ENCRYPT].head = 0;
+ ptd->queue[CRYPTO_SW_SCHED_QUEUE_TYPE_ENCRYPT].tail = 0;
- ptd->last_serve_encrypt = 0;
- ptd->last_return_queue = 0;
+ ptd->last_serve_encrypt = 0;
+ ptd->last_return_queue = 0;
- vec_validate_aligned (ptd->queue[CRYPTO_SW_SCHED_QUEUE_TYPE_ENCRYPT].jobs,
- CRYPTO_SW_SCHEDULER_QUEUE_SIZE - 1,
- CLIB_CACHE_LINE_BYTES);
- }
+ vec_validate_aligned (
+ ptd->queue[CRYPTO_SW_SCHED_QUEUE_TYPE_ENCRYPT].jobs,
+ CRYPTO_SW_SCHEDULER_QUEUE_SIZE - 1, CLIB_CACHE_LINE_BYTES);
+ }
cm->crypto_engine_index =
vnet_crypto_register_engine (vm, "sw_scheduler", 100,