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 AB8931BEF4 for ; Wed, 4 Jul 2018 18:18:58 +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 4E7ECDFE1; Wed, 4 Jul 2018 16:18:58 +0000 (UTC) Received: from [10.36.112.34] (ovpn-112-34.ams2.redhat.com [10.36.112.34]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 38E177C57; Wed, 4 Jul 2018 16:18:53 +0000 (UTC) To: Tiwei Bie Cc: zhihong.wang@intel.com, jfreimann@redhat.com, dev@dpdk.org, mst@redhat.com, jasowang@redhat.com, wexu@redhat.com References: <20180702081629.29258-1-maxime.coquelin@redhat.com> <20180702081629.29258-11-maxime.coquelin@redhat.com> <20180704055630.GE28826@debian> From: Maxime Coquelin Message-ID: Date: Wed, 4 Jul 2018 18:18:51 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: <20180704055630.GE28826@debian> 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.2]); Wed, 04 Jul 2018 16:18:58 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Wed, 04 Jul 2018 16:18:58 +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 v6 10/15] vhost: create descriptor mapping function 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, 04 Jul 2018 16:18:58 -0000 On 07/04/2018 07:56 AM, Tiwei Bie wrote: > On Mon, Jul 02, 2018 at 10:16:24AM +0200, Maxime Coquelin wrote: >> Signed-off-by: Maxime Coquelin >> --- >> lib/librte_vhost/virtio_net.c | 61 ++++++++++++++++++++++++++----------------- >> 1 file changed, 37 insertions(+), 24 deletions(-) >> >> diff --git a/lib/librte_vhost/virtio_net.c b/lib/librte_vhost/virtio_net.c >> index f0e2e6a1f..64664b7de 100644 >> --- a/lib/librte_vhost/virtio_net.c >> +++ b/lib/librte_vhost/virtio_net.c >> @@ -292,6 +292,37 @@ virtio_enqueue_offload(struct rte_mbuf *m_buf, struct virtio_net_hdr *net_hdr) >> } >> } >> >> +static __rte_always_inline int >> +map_one_desc(struct virtio_net *dev, struct vhost_virtqueue *vq, >> + struct buf_vector *buf_vec, uint16_t *vec_idx, >> + uint64_t desc_iova, uint64_t desc_len, uint8_t perm) >> +{ >> + uint16_t vec_id = *vec_idx; >> + >> + while (desc_len) { >> + uint64_t desc_addr; >> + uint64_t desc_chunck_len = desc_len; >> + >> + desc_addr = vhost_iova_to_vva(dev, vq, >> + desc_iova, >> + &desc_chunck_len, >> + perm); >> + if (unlikely(!desc_addr)) >> + return -1; >> + >> + buf_vec[vec_id].buf_iova = desc_iova; >> + buf_vec[vec_id].buf_addr = desc_addr; >> + buf_vec[vec_id].buf_len = desc_chunck_len; >> + >> + desc_len -= desc_chunck_len; >> + desc_iova += desc_chunck_len; >> + vec_id++; > > FYI, a rebase on top of the latest "vhost: generalize > buffer vectors" series is needed to make sure that > access buf_vec[vec_id] won't cause overflow. Right, this is fixed now that I rebased. Thanks, Maxime >> + } >> + *vec_idx = vec_id; >> + >> + return 0; >> +} >> + > [...] >