From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id B0F402BD3 for ; Fri, 4 Mar 2016 03:30:31 +0100 (CET) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga101.fm.intel.com with ESMTP; 03 Mar 2016 18:30:30 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.22,534,1449561600"; d="scan'208";a="916567654" Received: from yliu-dev.sh.intel.com (HELO yliu-dev) ([10.239.66.49]) by fmsmga001.fm.intel.com with ESMTP; 03 Mar 2016 18:30:29 -0800 Date: Fri, 4 Mar 2016 10:32:05 +0800 From: Yuanhan Liu To: "Xie, Huawei" Message-ID: <20160304023205.GV14300@yliu-dev.sh.intel.com> References: <1449122773-25510-1-git-send-email-yuanhan.liu@linux.intel.com> <1455803352-5518-1-git-send-email-yuanhan.liu@linux.intel.com> <1455803352-5518-2-git-send-email-yuanhan.liu@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) Cc: "Michael S. Tsirkin" , "dev@dpdk.org" , Victor Kaplansky Subject: Re: [dpdk-dev] [PATCH v2 1/7] vhost: refactor rte_vhost_dequeue_burst X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Mar 2016 02:30:32 -0000 On Thu, Mar 03, 2016 at 05:40:14PM +0000, Xie, Huawei wrote: > On 2/18/2016 9:48 PM, Yuanhan Liu wrote: > > The current rte_vhost_dequeue_burst() implementation is a bit messy > [...] > > + > > uint16_t > > rte_vhost_dequeue_burst(struct virtio_net *dev, uint16_t queue_id, > > struct rte_mempool *mbuf_pool, struct rte_mbuf **pkts, uint16_t count) > > { > > - struct rte_mbuf *m, *prev; > > struct vhost_virtqueue *vq; > > - struct vring_desc *desc; > > - uint64_t vb_addr = 0; > > - uint64_t vb_net_hdr_addr = 0; > > - uint32_t head[MAX_PKT_BURST]; > > + uint32_t desc_indexes[MAX_PKT_BURST]; > > indices http://dictionary.reference.com/browse/index index noun, plural indexes, indices > > > > uint32_t used_idx; > > uint32_t i; > > - uint16_t free_entries, entry_success = 0; > > + uint16_t free_entries; > > uint16_t avail_idx; > > - struct virtio_net_hdr *hdr = NULL; > > + struct rte_mbuf *m; > > > > if (unlikely(!is_valid_virt_queue_idx(queue_id, 1, dev->virt_qp_nb))) { > > RTE_LOG(ERR, VHOST_DATA, > > @@ -730,197 +813,49 @@ rte_vhost_dequeue_burst(struct virtio_net *dev, uint16_t queue_id, > > return 0; > > > > - if (entry_success < (free_entries - 1)) { > > - /* Prefetch descriptor index. */ > > - rte_prefetch0(&vq->desc[head[entry_success+1]]); > > - rte_prefetch0(&vq->used->ring[(used_idx + 1) & (vq->size - 1)]); > > - } > > Why is this prefetch silently dropped in the patch? Oops, good catching. Will fix it. Thanks. > > break; > > + pkts[i] = m; > > > > - m->nb_segs = seg_num; > > - if ((hdr->flags != 0) || (hdr->gso_type != VIRTIO_NET_HDR_GSO_NONE)) > > - vhost_dequeue_offload(hdr, m); > > - > > - pkts[entry_success] = m; > > - vq->last_used_idx++; > > - entry_success++; > > + used_idx = vq->last_used_idx++ & (vq->size - 1); > > + vq->used->ring[used_idx].id = desc_indexes[i]; > > + vq->used->ring[used_idx].len = 0; > > What is the correct value for ring[used_idx].len, the packet length or 0? Good question. I didn't notice that before. Sounds buggy to me. However, that's from the old code. Will check it. --yliu