DPDK patches and discussions
 help / color / mirror / Atom feed
From: Maxime Coquelin <maxime.coquelin@redhat.com>
To: dev@dpdk.org, tiwei.bie@intel.com, zhihong.wang@intel.com
Subject: Re: [dpdk-dev] [PATCH 1/2] vhost: unify Rx mergeable and non-mergeable paths
Date: Mon, 28 May 2018 20:33:19 +0200	[thread overview]
Message-ID: <9c088b2d-0a5b-eb16-910e-378dad84a43d@redhat.com> (raw)
In-Reply-To: <20180528162338.4511-2-maxime.coquelin@redhat.com>



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

  reply	other threads:[~2018-05-28 18:33 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-28 16:23 [dpdk-dev] [PATCH 0/2] Vhost: unitfy receive paths Maxime Coquelin
2018-05-28 16:23 ` [dpdk-dev] [PATCH 1/2] vhost: unify Rx mergeable and non-mergeable paths Maxime Coquelin
2018-05-28 18:33   ` Maxime Coquelin [this message]
2018-05-28 16:23 ` [dpdk-dev] [PATCH 2/2] vhost: improve batched copies performance Maxime Coquelin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9c088b2d-0a5b-eb16-910e-378dad84a43d@redhat.com \
    --to=maxime.coquelin@redhat.com \
    --cc=dev@dpdk.org \
    --cc=tiwei.bie@intel.com \
    --cc=zhihong.wang@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).