Skip to contentSkip to conversation

crypto/virtio: fix iv offset

PATCH Superseded Fan Zhang 3 participants 5 messages Apr 5, 2019 – Apr 17, 2019

Subsystems (3)
lore
Share & tools
lore

Fan Zhang

author
#0 lore raw

PATCH 1/1 crypto/virtio: fix iv offset

This patch fixes the incorrect iv offset calculation.

Fixes b063e843fa03 ("crypto/virtio: fix IV physical address")
---
 drivers/crypto/virtio/virtio_rxtx.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/crypto/virtio/virtio_rxtx.c +2 -2
index e32a1ecd6..dcb0055b4 100644
@@ -203,8 +203,8 @@ 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 = indirect_vring_addr_offset +
-			sizeof(struct vring_desc) * NUM_ENTRY_VIRTIO_CRYPTO_OP;
+	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_sym_session_private_data(
Signature · 1 line
2.14.5
author
#1 lore raw

PATCH v2 1/1 crypto/virtio: fix iv offset

This patch fixes the incorrect iv offset calculation.

Fixes b063e843fa03 ("crypto/virtio: fix IV physical address")

---
v2:
fixed a typo

 drivers/crypto/virtio/virtio_rxtx.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/crypto/virtio/virtio_rxtx.c +2 -2
index e32a1ecd6..e9a63cb5a 100644
@@ -203,8 +203,8 @@ 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 = indirect_vring_addr_offset +
-			sizeof(struct vring_desc) * NUM_ENTRY_VIRTIO_CRYPTO_OP;
+	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_sym_session_private_data(
Signature · 1 line
2.14.5
Acked-by on v2 1/1
#2 lore raw
Quoted 28 lines

-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Fan Zhang
Sent: Friday, April 5, 2019 5:04 PM
To: [email protected]
Cc: [email protected]; Zhang, Roy Fan <[email protected]>; [email protected]
Subject: [dpdk-dev] [PATCH v2] crypto/virtio: fix iv offset

This patch fixes the incorrect iv offset calculation.

Fixes b063e843fa03 ("crypto/virtio: fix IV physical address")

---
v2:
fixed a typo

 drivers/crypto/virtio/virtio_rxtx.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/crypto/virtio/virtio_rxtx.c +0 -0
index e32a1ecd6..e9a63cb5a 100644
@@ -203,8 +203,8 @@ virtqueue_crypto_sym_enqueue_xmit(
 	uint16_t req_data_len = sizeof(struct virtio_crypto_op_data_req);

drivers/crypto/virtio/virtio_rxtx.c virtqueue_crypto_sym_enqueue_xmit(

Quoted 10 lines
drivers/crypto/virtio/virtio_rxtx.c +2 -3
 	uint32_t indirect_vring_addr_offset = req_data_len +
 		sizeof(struct virtio_crypto_inhdr);
-	uint32_t indirect_iv_addr_offset = indirect_vring_addr_offset +
-			sizeof(struct vring_desc) * NUM_ENTRY_VIRTIO_CRYPTO_OP;
+	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_sym_session_private_data(
--
Quoted 1 line

2.14.5