[dpdk-dev] [PATCH v6] vhost: support virtqueue interrupt/notification suppression
Yuanhan Liu
yliu at fridaylinux.org
Mon Jan 8 15:06:59 CET 2018
On Tue, Dec 26, 2017 at 12:43:10PM -0500, Junjie Chen wrote:
> The driver can suppress interrupt when VIRTIO_F_EVENT_IDX feature bit is
> negotiated. The driver set vring flags to 0, and MAY use used_event in
> available ring to advise device interrupt util reach an index specified
> by used_event. The device ignore the lower bit of vring flags, and send
> an interrupt when index reach used_event.
>
> The device can suppress notification in a manner analogous to the ways
> driver suppress interrupt. The device manipulates flags or avail_event in
> the used ring in the same way the driver manipulates flags or used_event in
> available ring.
>
> This patch is to enable this feature in vhost.
>
> Signed-off-by: Junjie Chen <junjie.j.chen at intel.com>
You need put "---" before the change log. Otherwise, it will be tracked in
the commit log.
> +#define vhost_used_event(vr) \
> + (*(volatile uint16_t*)&(vr)->avail->ring[(vr)->size])
> +
> +static __rte_always_inline void
> +vhost_notify(struct virtio_net *dev, struct vhost_virtqueue *vq)
> +{
> + /* Don't notify guest if we don't reach index specified by guest. */
> + if (dev->features & (1ULL << VIRTIO_RING_F_EVENT_IDX)) {
> + uint16_t old = vq->signalled_used;
> + uint16_t new = vq->last_used_idx;
> +
> + LOG_DEBUG(VHOST_DATA, "%s: used_event_idx=%d, old=%d, new=%d\n",
> + __func__,
> + vhost_used_event(vq),
> + old, new);
> + if (vring_need_event(vhost_used_event(vq), new, old)
It's a bit weird that you use one from the standard linux header file
(vring_need_event), while you define you own one (vhost_used_event).
Note that the system header file also has "vring_used_event()" defined.
Besides that, I have few more comments (and some requirements):
- It'd be much better if there is a Tested-by tag. Expeclitly,
I'm asking a test with Linux kernel virtio-net driver in guest.
- I also hope you could have done a build test on some old distributions.
AFAIK, the two macros (vring_need_event and vring_used_event) come
from kernel 3.0 (or above). Any kernel older than that would fail
the build.
- I'd be great if you could make a new one based on top of my latest
tree: I have just applied a patchset that should conflict with this
one.
--yliu
More information about the dev
mailing list