qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Longpeng(Mike)" <longpeng2@huawei.com>
To: arei.gonglei@huawei.com, pasic@linux.vnet.ibm.com
Cc: weidong.huang@huawei.com, wangxinxin.wang@huawei.com,
	jianjay.zhou@huawei.com, qemu-devel@nongnu.org,
	"Longpeng(Mike)" <longpeng2@huawei.com>
Subject: [Qemu-devel] [RFC 03/10] virtio-crypto: remove queue_id field in ctrl header
Date: Mon, 6 Nov 2017 14:56:55 +0800	[thread overview]
Message-ID: <1509951422-20060-4-git-send-email-longpeng2@huawei.com> (raw)
In-Reply-To: <1509951422-20060-1-git-send-email-longpeng2@huawei.com>

The queue_id is needless bacause we can get the info from
VirtQueue->queue_index.

For existing frontend driver, this field is always zero,
so we can just mark this field as reserved and ingore its
value.

Signed-off-by: Longpeng(Mike) <longpeng2@huawei.com>
---
 hw/virtio/virtio-crypto.c                      | 8 +++-----
 include/standard-headers/linux/virtio_crypto.h | 3 +--
 2 files changed, 4 insertions(+), 7 deletions(-)

diff --git a/hw/virtio/virtio-crypto.c b/hw/virtio/virtio-crypto.c
index 04c34d8..9ffe26d 100644
--- a/hw/virtio/virtio-crypto.c
+++ b/hw/virtio/virtio-crypto.c
@@ -221,7 +221,6 @@ static void virtio_crypto_handle_ctrl(VirtIODevice *vdev, VirtQueue *vq)
     struct iovec *out_iov;
     unsigned in_num;
     unsigned out_num;
-    uint32_t queue_id;
     uint32_t opcode;
     struct virtio_crypto_session_input input;
     int64_t session_id;
@@ -258,7 +257,6 @@ static void virtio_crypto_handle_ctrl(VirtIODevice *vdev, VirtQueue *vq)
         iov_discard_front(&out_iov, &out_num, s);
 
         opcode = ldl_le_p(&hdr.opcode);
-        queue_id = ldl_le_p(&hdr.queue_id);
 
         switch (opcode) {
         case VIRTIO_CRYPTO_CIPHER_CREATE_SESSION:
@@ -277,8 +275,8 @@ static void virtio_crypto_handle_ctrl(VirtIODevice *vdev, VirtQueue *vq)
 
             memset(&input, 0, sizeof(input));
             session_id = virtio_crypto_create_sym_session(vcrypto,
-                                            &req, queue_id, opcode,
-                                            out_iov, out_num);
+                                            &req, virtio_get_queue_index(vq),
+                                            opcode, out_iov, out_num);
             /* Serious errors, need to reset virtio crypto device */
             if (session_id == -EFAULT) {
                 virtqueue_detach_element(vq, elem, 0);
@@ -321,7 +319,7 @@ static void virtio_crypto_handle_ctrl(VirtIODevice *vdev, VirtQueue *vq)
             }
 
             status = virtio_crypto_handle_close_session(vcrypto,
-                                                &req, queue_id);
+                                         &req, virtio_get_queue_index(vq));
             /* The status only occupy one byte, we can directly use it */
             s = iov_from_buf(in_iov, in_num, 0, &status, sizeof(status));
             if (unlikely(s != sizeof(status))) {
diff --git a/include/standard-headers/linux/virtio_crypto.h b/include/standard-headers/linux/virtio_crypto.h
index 8793be6..5e586e5 100644
--- a/include/standard-headers/linux/virtio_crypto.h
+++ b/include/standard-headers/linux/virtio_crypto.h
@@ -67,8 +67,7 @@ struct virtio_crypto_ctrl_header {
 	uint32_t opcode;
 	uint32_t algo;
 	uint32_t flag;
-	/* data virtqueue id */
-	uint32_t queue_id;
+	uint32_t reserved;
 };
 
 struct virtio_crypto_cipher_session_para {
-- 
1.8.3.1

  parent reply	other threads:[~2017-11-06  6:57 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-06  6:56 [Qemu-devel] [RFC 00/10] virtio-crypto: add multiplexing mode support Longpeng(Mike)
2017-11-06  6:56 ` [Qemu-devel] [RFC 01/10] virtio-crypto: remove virtio_crypto_op_ctrl_req structure Longpeng(Mike)
2017-11-06  6:56 ` [Qemu-devel] [RFC 02/10] virtio-crypto: add session creation logic for mux mode Longpeng(Mike)
2017-11-06  6:56 ` Longpeng(Mike) [this message]
2017-11-06  6:56 ` [Qemu-devel] [RFC 04/10] virtio-crypto: remove virtio_crypto_op_data_req structure Longpeng(Mike)
2017-11-06  6:56 ` [Qemu-devel] [RFC 05/10] virtio-crypto: add dataq operation logic for mux mode Longpeng(Mike)
2017-11-06  6:56 ` [Qemu-devel] [RFC 06/10] cryptodev: add stateless mode cipher support Longpeng(Mike)
2017-11-06  6:56 ` [Qemu-devel] [RFC 07/10] virtio-crypto: add stateless crypto request handler Longpeng(Mike)
2017-11-06  6:57 ` [Qemu-devel] [RFC 08/10] cryptodev: extract one util function Longpeng(Mike)
2017-11-06  6:57 ` [Qemu-devel] [RFC 09/10] cryptodev-builtin: add stateless cipher support Longpeng(Mike)
2017-11-06  6:57 ` [Qemu-devel] [RFC 10/10] virtio-crypto: add host feature bits support Longpeng(Mike)
2017-11-06  7:57 ` [Qemu-devel] [RFC 00/10] virtio-crypto: add multiplexing mode support no-reply

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=1509951422-20060-4-git-send-email-longpeng2@huawei.com \
    --to=longpeng2@huawei.com \
    --cc=arei.gonglei@huawei.com \
    --cc=jianjay.zhou@huawei.com \
    --cc=pasic@linux.vnet.ibm.com \
    --cc=qemu-devel@nongnu.org \
    --cc=wangxinxin.wang@huawei.com \
    --cc=weidong.huang@huawei.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).