In symmetric algorithm chaining, we need to consider both cipher and auth data length for cipher source.
Fixes: 82adb12a1fce ("crypto/virtio: support burst enqueue/dequeue") Signed-off-by: Rajesh Mudimadugula <rmudimadu...@marvell.com> --- drivers/crypto/virtio/virtio_rxtx.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/drivers/crypto/virtio/virtio_rxtx.c b/drivers/crypto/virtio/virtio_rxtx.c index 0cc904485c..a7f1bd9753 100644 --- a/drivers/crypto/virtio/virtio_rxtx.c +++ b/drivers/crypto/virtio/virtio_rxtx.c @@ -243,8 +243,10 @@ virtqueue_crypto_sym_pkt_header_arrange( req_data->u.sym_req.u.chain.para.aad_len = session->aad.length; req_data->u.sym_req.u.chain.para.src_data_len = - (sym_op->cipher.data.length + - sym_op->cipher.data.offset); + RTE_MAX((sym_op->cipher.data.length + + sym_op->cipher.data.offset), + (sym_op->auth.data.length + + sym_op->auth.data.offset)); req_data->u.sym_req.u.chain.para.dst_data_len = req_data->u.sym_req.u.chain.para.src_data_len; req_data->u.sym_req.u.chain.para.cipher_start_src_offset = @@ -298,6 +300,7 @@ virtqueue_crypto_sym_enqueue_xmit_split( uint32_t hash_result_len = 0; struct virtio_crypto_op_cookie *crypto_op_cookie; struct virtio_crypto_alg_chain_session_para *para; + uint32_t src_len; if (unlikely(sym_op->m_src->nb_segs != 1)) return -EMSGSIZE; @@ -371,21 +374,22 @@ virtqueue_crypto_sym_enqueue_xmit_split( desc[idx++].flags = VRING_DESC_F_NEXT; } + src_len = RTE_MAX((sym_op->cipher.data.offset + + sym_op->cipher.data.length), + (sym_op->auth.data.length + + sym_op->auth.data.offset)); /* indirect vring: src data */ desc[idx].addr = rte_pktmbuf_iova_offset(sym_op->m_src, 0); - desc[idx].len = (sym_op->cipher.data.offset - + sym_op->cipher.data.length); + desc[idx].len = src_len; desc[idx++].flags = VRING_DESC_F_NEXT; /* indirect vring: dst data */ if (sym_op->m_dst) { desc[idx].addr = rte_pktmbuf_iova_offset(sym_op->m_dst, 0); - desc[idx].len = (sym_op->cipher.data.offset - + sym_op->cipher.data.length); + desc[idx].len = src_len; } else { desc[idx].addr = rte_pktmbuf_iova_offset(sym_op->m_src, 0); - desc[idx].len = (sym_op->cipher.data.offset - + sym_op->cipher.data.length); + desc[idx].len = src_len; } desc[idx++].flags = VRING_DESC_F_WRITE | VRING_DESC_F_NEXT; -- 2.34.1