dpdk: fix packet offset for GCM crypto ops 27/31827/2
authorRobert Shearman <robertshearman@gmail.com>
Tue, 30 Mar 2021 10:14:41 +0000 (11:14 +0100)
committerNeale Ranns <neale@graphiant.com>
Wed, 31 Mar 2021 18:26:31 +0000 (18:26 +0000)
The crypto op data offset passed into DPDK is relative to the mbuf
buffer address plus the mbuf data offset, therefore the mbuf data
offset needs to be set rather than left at whatever previous value it
was at, which is likely to be incorrect and result in the wrong
portion of the packet being encrypted/decrypted for GCM.

The fe->crypto_start_offset field is relative to the start of the vlib
buffer (as opposed to the current data pointer), so set the mbuf
data_off field to VLIB_BUFFER_PRE_DATA_SIZE when performing a GCM
crypto op enqueue to match the crypto_start_offset semantics. This
then matches the behaviour in the non-GCM case.

Type: fix
Change-Id: I0ac2a44139387158765a3e04cfcaa5ee6f11d395
Signed-off-by: Robert Shearman <robertshearman@gmail.com>
src/plugins/dpdk/cryptodev/cryptodev.c

index d87a16c..cd9d104 100644 (file)
@@ -684,6 +684,7 @@ cryptodev_frame_gcm_enqueue (vlib_main_t * vm,
        }
 
       sop->m_src = rte_mbuf_from_vlib_buffer (b);
+      sop->m_src->data_off = VLIB_BUFFER_PRE_DATA_SIZE;
       sop->m_dst = 0;
       /* mbuf prepend happens in the tx, but vlib_buffer happens in the nodes,
        * so we have to manually adjust mbuf data_off here so cryptodev can