DPDK patches and discussions
 help / color / mirror / Atom feed
From: Fan Zhang <roy.fan.zhang@intel.com>
To: dev@dpdk.org
Cc: roy.fan.zhang@intel.com, maxime.coquelin@redhat.com,
	ferruh.yigit@intel.com
Subject: [dpdk-dev] [PATCH] vhost/crypto: fix desc moving for copy mode
Date: Wed, 11 Apr 2018 11:09:07 +0100	[thread overview]
Message-ID: <20180411100907.39057-1-roy.fan.zhang@intel.com> (raw)

Fixes: cd39f8e4fd2a ("vhost/crypto: add request handler")

This patch fixes the descriptor moving for copy mode by adding
the missing moving step after destination data parsing.

Signed-off-by: Fan Zhang <roy.fan.zhang@intel.com>
---
 lib/librte_vhost/vhost_crypto.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/lib/librte_vhost/vhost_crypto.c b/lib/librte_vhost/vhost_crypto.c
index ab75db0b1..363a034cb 100644
--- a/lib/librte_vhost/vhost_crypto.c
+++ b/lib/librte_vhost/vhost_crypto.c
@@ -694,6 +694,10 @@ prepare_sym_cipher_op(struct vhost_crypto *vcrypto, struct rte_crypto_op *op,
 	case RTE_VHOST_CRYPTO_ZERO_COPY_DISABLE:
 		vc_req->wb_desc = desc;
 		vc_req->wb_len = cipher->para.dst_data_len;
+		if (unlikely(move_desc(head, &desc, vc_req->wb_len) < 0)) {
+			ret = VIRTIO_CRYPTO_ERR;
+			goto error_exit;
+		}
 		break;
 	default:
 		ret = VIRTIO_CRYPTO_BADMSG;
@@ -840,6 +844,11 @@ prepare_sym_chain_op(struct vhost_crypto *vcrypto, struct rte_crypto_op *op,
 		op->sym->auth.digest.data = digest_addr;
 		op->sym->auth.digest.phys_addr = rte_pktmbuf_iova_offset(m_dst,
 				digest_offset);
+		if (unlikely(move_desc(head, &desc,
+				chain->para.hash_result_len) < 0)) {
+			ret = VIRTIO_CRYPTO_ERR;
+			goto error_exit;
+		}
 		break;
 	default:
 		ret = VIRTIO_CRYPTO_BADMSG;
-- 
2.13.6

             reply	other threads:[~2018-04-11 10:16 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-11 10:09 Fan Zhang [this message]
2018-04-11 14:38 ` Maxime Coquelin
2018-04-11 14:41 ` Maxime Coquelin
2018-04-11 17:36   ` Ferruh Yigit

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180411100907.39057-1-roy.fan.zhang@intel.com \
    --to=roy.fan.zhang@intel.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    --cc=maxime.coquelin@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).