From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id 487E8A05D3 for ; Mon, 20 May 2019 07:52:34 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 207C22BF3; Mon, 20 May 2019 07:52:33 +0200 (CEST) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id CCE4AA49 for ; Mon, 20 May 2019 07:52:31 +0200 (CEST) X-Amp-Result: UNSCANNABLE X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 19 May 2019 22:52:30 -0700 X-ExtLoop1: 1 Received: from npg-dpdk-virtio-tbie-2.sh.intel.com (HELO ___) ([10.67.104.151]) by fmsmga001.fm.intel.com with ESMTP; 19 May 2019 22:52:29 -0700 Date: Mon, 20 May 2019 13:51:32 +0800 From: Tiwei Bie To: Maxime Coquelin Cc: dev@dpdk.org, jfreimann@redhat.com, zhihong.wang@intel.com, bruce.richardson@intel.com, konstantin.ananyev@intel.com, david.marchand@redhat.com Message-ID: <20190520055132.GA19612@___> References: <20190517150613.13310-1-maxime.coquelin@redhat.com> <20190517150613.13310-4-maxime.coquelin@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20190517150613.13310-4-maxime.coquelin@redhat.com> User-Agent: Mutt/1.9.4 (2018-02-28) Subject: Re: [dpdk-dev] [PATCH v2 3/5] vhost: do not inline unlikely fragmented buffers code 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On Fri, May 17, 2019 at 05:06:11PM +0200, Maxime Coquelin wrote: [...] > > +static void > +copy_vnet_hdr_from_desc(struct virtio_net_hdr *hdr, > + struct buf_vector *buf_vec) > +{ > + uint64_t len; > + uint64_t remain = sizeof(struct virtio_net_hdr); > + uint64_t src; > + uint64_t dst = (uint64_t)(uintptr_t)&hdr; typo: s/&hdr/hdr/ > + > + /* > + * No luck, the virtio-net header doesn't fit > + * in a contiguous virtual area. > + */ > + while (remain) { > + len = RTE_MIN(remain, buf_vec->buf_len); > + src = buf_vec->buf_addr; > + rte_memcpy((void *)(uintptr_t)dst, > + (void *)(uintptr_t)src, len); > + > + remain -= len; > + dst += len; > + buf_vec++; > + } > +} > + > static __rte_always_inline int > copy_desc_to_mbuf(struct virtio_net *dev, struct vhost_virtqueue *vq, > struct buf_vector *buf_vec, uint16_t nr_vec, > @@ -1094,28 +1126,7 @@ copy_desc_to_mbuf(struct virtio_net *dev, struct vhost_virtqueue *vq, > > if (virtio_net_with_host_offload(dev)) { > if (unlikely(buf_len < sizeof(struct virtio_net_hdr))) { > - uint64_t len; > - uint64_t remain = sizeof(struct virtio_net_hdr); > - uint64_t src; > - uint64_t dst = (uint64_t)(uintptr_t)&tmp_hdr; > - uint16_t hdr_vec_idx = 0; > - > - /* > - * No luck, the virtio-net header doesn't fit > - * in a contiguous virtual area. > - */ It's better to not move above comments. For the rest, Reviewed-by: Tiwei Bie > - while (remain) { > - len = RTE_MIN(remain, > - buf_vec[hdr_vec_idx].buf_len); > - src = buf_vec[hdr_vec_idx].buf_addr; > - rte_memcpy((void *)(uintptr_t)dst, > - (void *)(uintptr_t)src, len); > - > - remain -= len; > - dst += len; > - hdr_vec_idx++; > - } > - > + copy_vnet_hdr_from_desc(&tmp_hdr, buf_vec); > hdr = &tmp_hdr; > } else { > hdr = (struct virtio_net_hdr *)((uintptr_t)buf_addr); > -- > 2.21.0 >