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 836CC2583 for ; Mon, 28 May 2018 20:33:22 +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 B55407D83F; Mon, 28 May 2018 18:33:21 +0000 (UTC) Received: from [10.36.112.45] (ovpn-112-45.ams2.redhat.com [10.36.112.45]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 097DD1C73A; Mon, 28 May 2018 18:33:20 +0000 (UTC) To: dev@dpdk.org, tiwei.bie@intel.com, zhihong.wang@intel.com References: <20180528162338.4511-1-maxime.coquelin@redhat.com> <20180528162338.4511-2-maxime.coquelin@redhat.com> From: Maxime Coquelin Message-ID: <9c088b2d-0a5b-eb16-910e-378dad84a43d@redhat.com> Date: Mon, 28 May 2018 20:33:19 +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: <20180528162338.4511-2-maxime.coquelin@redhat.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.2]); Mon, 28 May 2018 18:33:21 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Mon, 28 May 2018 18:33:21 +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 1/2] vhost: unify Rx mergeable and non-mergeable paths 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: Mon, 28 May 2018 18:33:22 -0000 On 05/28/2018 06:23 PM, Maxime Coquelin wrote: > @@ -602,7 +297,7 @@ reserve_avail_buf_mergeable(struct virtio_net *dev, struct vhost_virtqueue *vq, Just notice I forgot to remove "mergeable" from the functions names here and below. I'll fix this in next revision after having collected some feedback. > { > uint16_t cur_idx; > uint32_t vec_idx = 0; > - uint16_t tries = 0; > + uint16_t max_tries, tries = 0; > > uint16_t head_idx = 0; > uint16_t len = 0; > @@ -610,6 +305,11 @@ reserve_avail_buf_mergeable(struct virtio_net *dev, struct vhost_virtqueue *vq, > *num_buffers = 0; > cur_idx = vq->last_avail_idx; > > + if (rxvq_is_mergeable(dev)) > + max_tries = vq->size; > + else > + max_tries = 1; > + > while (size > 0) { > if (unlikely(cur_idx == avail_head)) > return -1; > @@ -630,7 +330,7 @@ reserve_avail_buf_mergeable(struct virtio_net *dev, struct vhost_virtqueue *vq, > * can't get enough buf, it means something abnormal > * happened. > */ > - if (unlikely(tries >= vq->size)) > + if (unlikely(tries > max_tries)) > return -1; > } > > @@ -748,7 +448,9 @@ copy_mbuf_to_desc_mergeable(struct virtio_net *dev, struct vhost_virtqueue *vq, > > if (hdr_addr) { > virtio_enqueue_offload(hdr_mbuf, &hdr->hdr); > - ASSIGN_UNLESS_EQUAL(hdr->num_buffers, num_buffers); > + if (rxvq_is_mergeable(dev)) > + ASSIGN_UNLESS_EQUAL(hdr->num_buffers, > + num_buffers); > > if (unlikely(hdr == &tmp_hdr)) { > uint64_t len; > @@ -923,10 +625,7 @@ rte_vhost_enqueue_burst(int vid, uint16_t queue_id, > return 0; > } > > - if (dev->features & (1 << VIRTIO_NET_F_MRG_RXBUF)) > - return virtio_dev_merge_rx(dev, queue_id, pkts, count); > - else > - return virtio_dev_rx(dev, queue_id, pkts, count); > + return virtio_dev_merge_rx(dev, queue_id, pkts, count); > } > > static inline bool > -- 2.14.3