From nobody Mon Feb 9 02:27:42 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1509954495612447.1740280398059; Sun, 5 Nov 2017 23:48:15 -0800 (PST) Received: from localhost ([::1]:46847 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eBc8f-0006JY-ND for importer@patchew.org; Mon, 06 Nov 2017 02:48:09 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37917) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eBc3u-0003Cy-01 for qemu-devel@nongnu.org; Mon, 06 Nov 2017 02:43:15 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eBc3p-0003oZ-Ar for qemu-devel@nongnu.org; Mon, 06 Nov 2017 02:43:14 -0500 Received: from [45.249.212.32] (port=41892 helo=huawei.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eBc3o-0003oF-Ur for qemu-devel@nongnu.org; Mon, 06 Nov 2017 02:43:09 -0500 Received: from DGGEMS405-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id 3037210C9DC5C; Mon, 6 Nov 2017 14:57:13 +0800 (CST) Received: from localhost (10.177.246.209) by DGGEMS405-HUB.china.huawei.com (10.3.19.205) with Microsoft SMTP Server id 14.3.361.1; Mon, 6 Nov 2017 14:57:08 +0800 From: "Longpeng(Mike)" To: , Date: Mon, 6 Nov 2017 14:56:57 +0800 Message-ID: <1509951422-20060-6-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-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 45.249.212.32 Subject: [Qemu-devel] [RFC 05/10] virtio-crypto: add dataq operation logic for mux mode 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Adds dataq operation support for MUX mode. Signed-off-by: Longpeng(Mike) --- hw/virtio/virtio-crypto.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/hw/virtio/virtio-crypto.c b/hw/virtio/virtio-crypto.c index 828d7ef..10a0c35 100644 --- a/hw/virtio/virtio-crypto.c +++ b/hw/virtio/virtio-crypto.c @@ -663,6 +663,9 @@ virtio_crypto_handle_request(VirtIOCryptoReq *request) opcode =3D ldl_le_p(&hdr.opcode); session_id =3D ldq_le_p(&hdr.session_id); =20 +#define data_req_payload_size(vdev, req) \ + (virtio_crypto_in_mux_mode((vdev)) ? sizeof((req)) : \ + VIRTIO_CRYPTO_DATA_REQ_PAYLOAD_SIZE_NONMUX) switch (opcode) { case VIRTIO_CRYPTO_CIPHER_ENCRYPT: case VIRTIO_CRYPTO_CIPHER_DECRYPT: @@ -671,7 +674,7 @@ virtio_crypto_handle_request(VirtIOCryptoReq *request) =20 iov_to_buf(out_iov, out_num, 0, &req, sizeof(req)); /* The unused part of the req will be ingored */ - s =3D VIRTIO_CRYPTO_DATA_REQ_PAYLOAD_SIZE_NONMUX; + s =3D data_req_payload_size(vdev, req); if (unlikely(s !=3D iov_discard_front(&out_iov, &out_num, s))) { virtio_error(vdev, "virtio-crypto request additional " "parameters too short"); @@ -718,6 +721,7 @@ virtio_crypto_handle_request(VirtIOCryptoReq *request) virtio_crypto_req_complete(request, VIRTIO_CRYPTO_NOTSUPP); virtio_crypto_free_request(request); } +#undef data_req_payload_size =20 return 0; } --=20 1.8.3.1