From mboxrd@z Thu Jan 1 00:00:00 1970 From: Maxime Coquelin Subject: Re: [PATCH 1/2] vhost: unify Rx mergeable and non-mergeable paths Date: Mon, 28 May 2018 20:33:19 +0200 Message-ID: <9c088b2d-0a5b-eb16-910e-378dad84a43d@redhat.com> References: <20180528162338.4511-1-maxime.coquelin@redhat.com> <20180528162338.4511-2-maxime.coquelin@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit To: dev@dpdk.org, tiwei.bie@intel.com, zhihong.wang@intel.com 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) In-Reply-To: <20180528162338.4511-2-maxime.coquelin@redhat.com> Content-Language: en-US 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 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