From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx1.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by dpdk.org (Postfix) with ESMTP id 487331B3CF for ; Wed, 16 May 2018 11:46:27 +0200 (CEST) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8ACDA40201A0; Wed, 16 May 2018 09:46:26 +0000 (UTC) Received: from [10.36.112.25] (ovpn-112-25.ams2.redhat.com [10.36.112.25]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 064216B5AB; Wed, 16 May 2018 09:46:25 +0000 (UTC) To: Fan Zhang , dev@dpdk.org References: <20180510154122.85407-1-roy.fan.zhang@intel.com> From: Maxime Coquelin Message-ID: <7a8e99e2-de29-2cd6-0df5-faf64aaff8fa@redhat.com> Date: Wed, 16 May 2018 11:46:24 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: <20180510154122.85407-1-roy.fan.zhang@intel.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Wed, 16 May 2018 09:46:26 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Wed, 16 May 2018 09:46:26 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'maxime.coquelin@redhat.com' RCPT:'' Subject: Re: [dpdk-dev] [PATCH] vhost/crypto: handle virtually non-contiguous buffers X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 May 2018 09:46:27 -0000 On 05/10/2018 05:41 PM, Fan Zhang wrote: > This patch enables the handling of buffers non-contiguous in > virtual address space in the vhost_crypto. Instead of using > rte_vhost_va_from_guest_pa(), the host virtual address is > converted by vhost_iova_to_vva() for wider use cases. > > For copy mode, the copy length is limited to the chunck size, > next chuncks VAs being fetched afterward. > > Signed-off-by: Fan Zhang > --- > lib/librte_vhost/vhost_crypto.c | 201 ++++++++++++++++++++++++++-------------- > 1 file changed, 129 insertions(+), 72 deletions(-) ... > + req = get_data_ptr(vc_req, &desc, sizeof(*req), VHOST_ACCESS_RO); > + if (unlikely(req == NULL)) Adding braces around the switch would be less error prone IMHO. > + switch (vcrypto->option) { > + case RTE_VHOST_CRYPTO_ZERO_COPY_ENABLE: > + err = VIRTIO_CRYPTO_BADMSG; > + VC_LOG_ERR("Invalid descriptor"); > + goto error_exit; > + case RTE_VHOST_CRYPTO_ZERO_COPY_DISABLE: > + req = &tmp_req; > + if (unlikely(copy_data(req, vc_req, &desc, sizeof(*req)) > + < 0)) { > + err = VIRTIO_CRYPTO_BADMSG; > + VC_LOG_ERR("Invalid descriptor"); > + goto error_exit; > + } > + break; > + default: > + err = VIRTIO_CRYPTO_ERR; > + VC_LOG_ERR("Invalid option"); > + goto error_exit; > + } > Other than than, it looks good to me. Reviewed-by: Maxime Coquelin I will add the braces when applying. Thanks, Maxime