crypto-sw-scheduler: crypto-dispatch improvement 73/40373/2
authorNiyaz Murshed <niyaz.murshed@arm.com>
Wed, 21 Feb 2024 19:52:31 +0000 (19:52 +0000)
committerFan Zhang <fanzhang.oss@gmail.com>
Mon, 15 Apr 2024 23:30:55 +0000 (23:30 +0000)
Currently sw_scheduler runs interchangeably over queues of one selected
type either ENCRYPT or DECRYPT, then switches the type for the next run.
This runs perfectly when we have elements in both ENCRYPT and DECRYPT
queues, however, this leads to performance degradation when only one
of the queues have elements i.e either all traffic is to be encrypted or
decrypted.
If all operations are encryption, then 50% of the time, the loop exits
without dequeueing.With this change, that dequeueing happens on every
loop. This increases the performance of single mode operation (ecryption
or decryption) by over 15%.

This change was also added in commit https://github.com/FDio/vpp/commit/61cdc0981084f049067626b0123db700035120df
to fix similar performance issue when the crypto-dispatch node is in interrupt
node, however was removed by https://github.com/FDio/vpp/commit/9a9604b09f15691d7c4ddf29afd99a31e7e31eed
which has its own limitations.

Type: improvement
Change-Id: I15c1375427e06187e9c4faf2461ab79935830802
Signed-off-by: Niyaz Murshed <niyaz.murshed@arm.com>
src/plugins/crypto_sw_scheduler/main.c

index b32c8ae..73a158e 100644 (file)
@@ -455,7 +455,9 @@ crypto_sw_scheduler_dequeue (vlib_main_t *vm, u32 *nb_elts_processed,
   crypto_sw_scheduler_queue_t *current_queue = 0;
   u32 tail, head;
   u8 found = 0;
+  u8 recheck_queues = 1;
 
+run_next_queues:
   /* get a pending frame to process */
   if (ptd->self_crypto_enabled)
     {
@@ -565,6 +567,11 @@ crypto_sw_scheduler_dequeue (vlib_main_t *vm, u32 *nb_elts_processed,
       return f;
     }
 
+  if (!found && recheck_queues)
+    {
+      recheck_queues = 0;
+      goto run_next_queues;
+    }
   return 0;
 }