crypto: fix ops flags in crypto sw scheduler 17/30917/3
authorBenoît Ganne <bganne@cisco.com>
Fri, 22 Jan 2021 17:11:37 +0000 (18:11 +0100)
committerDamjan Marion <dmarion@me.com>
Thu, 4 Mar 2021 11:08:36 +0000 (11:08 +0000)
The sw crypto scheduler converts crypto frames to individual crypto
operations. This is done by reusing per-thread vectors for crypto,
integrity and chained operations.
The crypto op flags must be reset to frame flags minus invalid values
depending of the operation.
The previous tentative also cleared the chained buffer flag, breaking
jumbo support.

Type: fix

Change-Id: Icce6887a9e0dae8c300c56e97b977e203e784713
Signed-off-by: Benoît Ganne <bganne@cisco.com>
src/plugins/crypto_sw_scheduler/main.c

index 980fa14..29f91b3 100644 (file)
@@ -148,8 +148,6 @@ cryptodev_sw_scheduler_sgl (vlib_main_t * vm,
   u32 n_chunks = 0;
   u32 chunk_index = vec_len (ptd->chunks);
 
-  op->flags |= VNET_CRYPTO_OP_FLAG_CHAINED_BUFFERS;
-
   while (len)
     {
       if (nb->current_data + nb->current_length > offset)
@@ -251,15 +249,12 @@ crypto_sw_scheduler_convert_link_crypto (vlib_main_t * vm,
   crypto_op->iv = fe->iv;
   crypto_op->key_index = key->index_crypto;
   crypto_op->user_data = 0;
+  crypto_op->flags = fe->flags & ~VNET_CRYPTO_OP_FLAG_HMAC_CHECK;
   integ_op->op = integ_op_id;
   integ_op->digest = fe->digest;
   integ_op->digest_len = digest_len;
   integ_op->key_index = key->index_integ;
-  crypto_op->flags = integ_op->flags = 0;
-  if (is_enc)
-    crypto_op->flags |= VNET_CRYPTO_OP_FLAG_INIT_IV;
-  else
-    integ_op->flags |= VNET_CRYPTO_OP_FLAG_HMAC_CHECK;
+  integ_op->flags = fe->flags & ~VNET_CRYPTO_OP_FLAG_INIT_IV;
   crypto_op->user_data = integ_op->user_data = index;
 }