[dpdk-dev] Question about vhost user interrupt mode

Yifeng Sun pkusunyifeng at gmail.com
Tue Feb 25 21:44:48 CET 2020


+ Tiwei and Maxime

Thanks,
Yifeng

On Fri, Feb 21, 2020 at 2:32 PM Yifeng Sun <pkusunyifeng at gmail.com> wrote:
>
> Hi all,
>
> Right now on OVS, dpdkvhostuser can only run in polling mode (please
> correct me if I am wrong). We are trying to enable interrupt mode of
> dpdkvhostuser type port on OVS. We found that, with changes below, OVS
> can poll&block on exposed kickfd and vhostuser is working under
> interrupt mode without consuming 2 CPUs.
>
> My question is, is this the correct direction to do so, or is there a
> better way? Thanks!
>
> --- a/lib/librte_vhost/vhost.h
> +++ b/lib/librte_vhost/vhost.h
> @@ -318,7 +318,6 @@ struct vring_packed_desc_event {
>                                 (1ULL << VIRTIO_NET_F_GUEST_UFO) | \
>                                 (1ULL << VIRTIO_NET_F_GUEST_ECN) | \
>                                 (1ULL << VIRTIO_RING_F_INDIRECT_DESC) | \
> -                               (1ULL << VIRTIO_RING_F_EVENT_IDX) | \
>                                 (1ULL << VIRTIO_NET_F_MTU)  | \
>                                 (1ULL << VIRTIO_F_IN_ORDER) | \
>                                 (1ULL << VIRTIO_F_IOMMU_PLATFORM) | \
>
> +int rte_vhost_get_kickfd(int vid, uint16_t queue_id)
> +{
> +       struct virtio_net *dev;
> +       struct vhost_virtqueue *vq;
> +
> +       dev = get_device(vid);
> +       if (!dev)
> +               return -1;
> +
> +       if (unlikely(!(dev->flags & VIRTIO_DEV_BUILTIN_VIRTIO_NET))) {
> +               //  vhost net backend is disabled.
> +               return -1;
> +       }
> +
> +       if (unlikely(!is_valid_virt_queue_idx(queue_id, 1, dev->nr_vring))) {
> +               return -1;
> +       }
> +
> +       vq = dev->virtqueue[queue_id];
> +       // XXX lock?
> +       return vq->kickfd;
> +}
>
> Best,
> Yifeng Sun


More information about the dev mailing list