From patchwork Mon Nov 6 06:56:55 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Longpeng(Mike)" X-Patchwork-Id: 10042645 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id C9C11601EB for ; Mon, 6 Nov 2017 06:58:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B9BD7298D6 for ; Mon, 6 Nov 2017 06:58:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AE7E6298EA; Mon, 6 Nov 2017 06:58:51 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 30D5B298D6 for ; Mon, 6 Nov 2017 06:58:51 +0000 (UTC) Received: from localhost ([::1]:46708 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eBbMw-0006GK-CP for patchwork-qemu-devel@patchwork.kernel.org; Mon, 06 Nov 2017 01:58:50 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49745) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eBbLW-0006FG-Fz for qemu-devel@nongnu.org; Mon, 06 Nov 2017 01:57:23 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eBbLR-00084d-Pj for qemu-devel@nongnu.org; Mon, 06 Nov 2017 01:57:22 -0500 Received: from szxga05-in.huawei.com ([45.249.212.191]:2276) by eggs.gnu.org with esmtps (TLS1.0:RSA_ARCFOUR_SHA1:16) (Exim 4.71) (envelope-from ) id 1eBbLR-00080O-6W for qemu-devel@nongnu.org; Mon, 06 Nov 2017 01:57:17 -0500 Received: from 172.30.72.59 (EHLO DGGEMS409-HUB.china.huawei.com) ([172.30.72.59]) by dggrg05-dlp.huawei.com (MOS 4.4.6-GA FastPath queued) with ESMTP id DKL32606; Mon, 06 Nov 2017 14:57:13 +0800 (CST) Received: from localhost (10.177.246.209) by DGGEMS409-HUB.china.huawei.com (10.3.19.209) with Microsoft SMTP Server id 14.3.361.1; Mon, 6 Nov 2017 14:57:06 +0800 From: "Longpeng(Mike)" To: , Date: Mon, 6 Nov 2017 14:56:55 +0800 Message-ID: <1509951422-20060-4-git-send-email-longpeng2@huawei.com> X-Mailer: git-send-email 1.8.4.msysgit.0 In-Reply-To: <1509951422-20060-1-git-send-email-longpeng2@huawei.com> References: <1509951422-20060-1-git-send-email-longpeng2@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.177.246.209] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A020201.5A0007C9.0047, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0, ip=0.0.0.0, so=2014-11-16 11:51:01, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: 260f5bd255ac14fe316b8376c252f479 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] [fuzzy] X-Received-From: 45.249.212.191 Subject: [Qemu-devel] [RFC 03/10] virtio-crypto: remove queue_id field in ctrl header X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: wangxinxin.wang@huawei.com, "Longpeng\(Mike\)" , weidong.huang@huawei.com, qemu-devel@nongnu.org, jianjay.zhou@huawei.com Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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) --- 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 {