From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id 0B7122C47 for ; Mon, 7 Mar 2016 04:02:09 +0100 (CET) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga103.fm.intel.com with ESMTP; 06 Mar 2016 19:02:07 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.22,549,1449561600"; d="scan'208";a="928215080" Received: from fmsmsx104.amr.corp.intel.com ([10.18.124.202]) by orsmga002.jf.intel.com with ESMTP; 06 Mar 2016 19:02:08 -0800 Received: from shsmsx104.ccr.corp.intel.com (10.239.4.70) by fmsmsx104.amr.corp.intel.com (10.18.124.202) with Microsoft SMTP Server (TLS) id 14.3.248.2; Sun, 6 Mar 2016 19:02:06 -0800 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.136]) by SHSMSX104.ccr.corp.intel.com ([169.254.5.132]) with mapi id 14.03.0248.002; Mon, 7 Mar 2016 11:02:05 +0800 From: "Xie, Huawei" To: Yuanhan Liu Thread-Topic: [PATCH v2 1/7] vhost: refactor rte_vhost_dequeue_burst Thread-Index: AdF1c74dclXhimYJTx2/yKoyh8rOiw== Date: Mon, 7 Mar 2016 03:02:04 +0000 Message-ID: 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> <20160304023205.GV14300@yliu-dev.sh.intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 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: Mon, 07 Mar 2016 03:02:10 -0000 On 3/4/2016 10:30 AM, Yuanhan Liu wrote:=0A= > On Thu, Mar 03, 2016 at 05:40:14PM +0000, Xie, Huawei wrote:=0A= >> On 2/18/2016 9:48 PM, Yuanhan Liu wrote:=0A= >>> The current rte_vhost_dequeue_burst() implementation is a bit messy=0A= >> [...]=0A= >>> +=0A= >>> uint16_t=0A= >>> rte_vhost_dequeue_burst(struct virtio_net *dev, uint16_t queue_id,=0A= >>> struct rte_mempool *mbuf_pool, struct rte_mbuf **pkts, uint16_t count= )=0A= >>> {=0A= >>> - struct rte_mbuf *m, *prev;=0A= >>> struct vhost_virtqueue *vq;=0A= >>> - struct vring_desc *desc;=0A= >>> - uint64_t vb_addr =3D 0;=0A= >>> - uint64_t vb_net_hdr_addr =3D 0;=0A= >>> - uint32_t head[MAX_PKT_BURST];=0A= >>> + uint32_t desc_indexes[MAX_PKT_BURST];=0A= >> indices=0A= > http://dictionary.reference.com/browse/index=0A= >=0A= > index=0A= > noun, plural indexes, indices =0A= =0A= ok, i see both two are used.=0A= =0A= =0A= >>=0A= >>> uint32_t used_idx;=0A= >>> uint32_t i;=0A= >>> - uint16_t free_entries, entry_success =3D 0;=0A= >>> + uint16_t free_entries;=0A= >>> uint16_t avail_idx;=0A= >>> - struct virtio_net_hdr *hdr =3D NULL;=0A= >>> + struct rte_mbuf *m;=0A= >>> =0A= >>> if (unlikely(!is_valid_virt_queue_idx(queue_id, 1, dev->virt_qp_nb)))= {=0A= >>> RTE_LOG(ERR, VHOST_DATA,=0A= >>> @@ -730,197 +813,49 @@ rte_vhost_dequeue_burst(struct virtio_net *dev, = uint16_t queue_id,=0A= >>> return 0;=0A= >>> =0A= >>> - if (entry_success < (free_entries - 1)) {=0A= >>> - /* Prefetch descriptor index. */=0A= >>> - rte_prefetch0(&vq->desc[head[entry_success+1]]);=0A= >>> - rte_prefetch0(&vq->used->ring[(used_idx + 1) & (vq->size - 1)]);=0A= >>> - }=0A= >> Why is this prefetch silently dropped in the patch?=0A= > Oops, good catching. Will fix it. Thanks.=0A= >=0A= >=0A= >>> break;=0A= >>> + pkts[i] =3D m;=0A= >>> =0A= >>> - m->nb_segs =3D seg_num;=0A= >>> - if ((hdr->flags !=3D 0) || (hdr->gso_type !=3D VIRTIO_NET_HDR_GSO_NO= NE))=0A= >>> - vhost_dequeue_offload(hdr, m);=0A= >>> -=0A= >>> - pkts[entry_success] =3D m;=0A= >>> - vq->last_used_idx++;=0A= >>> - entry_success++;=0A= >>> + used_idx =3D vq->last_used_idx++ & (vq->size - 1);=0A= >>> + vq->used->ring[used_idx].id =3D desc_indexes[i];=0A= >>> + vq->used->ring[used_idx].len =3D 0;=0A= >> What is the correct value for ring[used_idx].len, the packet length or = 0?=0A= > Good question. I didn't notice that before. Sounds buggy to me. However,= =0A= > that's from the old code. Will check it.=0A= =0A= Yes, i knew it is in old code also. Thanks.=0A= =0A= > --yliu=0A= >=0A= =0A=