X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=drivers%2Fcrypto%2Fvirtio%2Fvirtio_rxtx.c;h=a65524a306ef7845319c9311e8bb7e180f31783f;hb=af668035f7f492424b2e199f155690815944a8ca;hp=4503928438f9a583797d6e216171afe413f70294;hpb=82adb12a1fce1a8a45da2f8d72a56ba1f640c9d6;p=dpdk.git diff --git a/drivers/crypto/virtio/virtio_rxtx.c b/drivers/crypto/virtio/virtio_rxtx.c index 4503928438..a65524a306 100644 --- a/drivers/crypto/virtio/virtio_rxtx.c +++ b/drivers/crypto/virtio/virtio_rxtx.c @@ -1,7 +1,7 @@ /* SPDX-License-Identifier: BSD-3-Clause * Copyright(c) 2018 HUAWEI TECHNOLOGIES CO., LTD. */ -#include +#include #include "virtqueue.h" #include "virtio_cryptodev.h" @@ -203,9 +203,11 @@ virtqueue_crypto_sym_enqueue_xmit( uint16_t req_data_len = sizeof(struct virtio_crypto_op_data_req); uint32_t indirect_vring_addr_offset = req_data_len + sizeof(struct virtio_crypto_inhdr); + uint32_t indirect_iv_addr_offset = + offsetof(struct virtio_crypto_op_cookie, iv); struct rte_crypto_sym_op *sym_op = cop->sym; struct virtio_crypto_session *session = - (struct virtio_crypto_session *)get_session_private_data( + (struct virtio_crypto_session *)get_sym_session_private_data( cop->sym->session, cryptodev_virtio_driver_id); struct virtio_crypto_op_data_req *op_data_req; uint32_t hash_result_len = 0; @@ -259,7 +261,17 @@ virtqueue_crypto_sym_enqueue_xmit( /* indirect vring: iv of cipher */ if (session->iv.length) { - desc[idx].addr = cop->phys_addr + session->iv.offset; + if (cop->phys_addr) + desc[idx].addr = cop->phys_addr + session->iv.offset; + else { + rte_memcpy(crypto_op_cookie->iv, + rte_crypto_op_ctod_offset(cop, + uint8_t *, session->iv.offset), + session->iv.length); + desc[idx].addr = indirect_op_data_req_phys_addr + + indirect_iv_addr_offset; + } + desc[idx].len = session->iv.length; desc[idx++].flags = VRING_DESC_F_NEXT; } @@ -272,18 +284,18 @@ virtqueue_crypto_sym_enqueue_xmit( } /* indirect vring: src data */ - desc[idx].addr = rte_pktmbuf_mtophys_offset(sym_op->m_src, 0); + 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++].flags = VRING_DESC_F_NEXT; /* indirect vring: dst data */ if (sym_op->m_dst) { - desc[idx].addr = rte_pktmbuf_mtophys_offset(sym_op->m_dst, 0); + 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); } else { - desc[idx].addr = rte_pktmbuf_mtophys_offset(sym_op->m_src, 0); + 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); }