DPDK patches and discussions
 help / color / mirror / Atom feed
From: Maxime Coquelin <maxime.coquelin@redhat.com>
To: Stefan Hajnoczi <stefanha@redhat.com>, dev@dpdk.org
Cc: Yuanhan Liu <yliu@fridaylinux.org>, Tetsuya Mukawa <mtetsuyah@gmail.com>
Subject: Re: [dpdk-dev] [PATCH] vhost: introduce rte_vhost_vring_call()
Date: Thu, 21 Dec 2017 22:30:56 +0100	[thread overview]
Message-ID: <95c9797f-3571-6843-0a79-7d3d1ed1a5c1@redhat.com> (raw)
In-Reply-To: <20171221164128.20001-1-stefanha@redhat.com>

Hi Stefan,

On 12/21/2017 05:41 PM, Stefan Hajnoczi wrote:
> +int
> +rte_vhost_vring_call(int vid, uint16_t vring_idx)
> +{
> +	struct virtio_net *dev;
> +	struct vhost_virtqueue *vq;
> +
> +	dev = get_device(vid);
> +	if (!dev)
> +		return -1;
> +
> +	if (vring_idx >= VHOST_MAX_VRING)
> +		return -1;
> +
> +	vq = dev->virtqueue[vring_idx];
> +	if (!vq)
> +		return -1;
> +
> +	/* flush used->idx update before we read avail->flags. */
> +	rte_mb();
> +
> +	/* Kick the guest if necessary. */
> +	if (!(vq->avail->flags & VRING_AVAIL_F_NO_INTERRUPT)
> +			&& (vq->callfd >= 0))
> +		eventfd_write(vq->callfd, (eventfd_t)1);
> +	return 0;
> +}

I think it may be better to have an internal function that just take the
vq as argument to avoid getting again the vq from the vid & vring index
in the hot path.

Also, this internal function could be tagged as always inlined.

Thanks,
Maxime

      reply	other threads:[~2017-12-21 21:31 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-21 16:41 Stefan Hajnoczi
2017-12-21 21:30 ` Maxime Coquelin [this message]

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=95c9797f-3571-6843-0a79-7d3d1ed1a5c1@redhat.com \
    --to=maxime.coquelin@redhat.com \
    --cc=dev@dpdk.org \
    --cc=mtetsuyah@gmail.com \
    --cc=stefanha@redhat.com \
    --cc=yliu@fridaylinux.org \
    /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).