Hi Tiwei,

Thanks a lot for your comment. I will take a look at rte_vhost_get_vhost_vring.

Best,
Yifeng

On Tue, Feb 25, 2020 at 5:51 PM Tiwei Bie <tiwei....@intel.com> wrote:
>
> On Tue, Feb 25, 2020 at 12:44:48PM -0800, Yifeng Sun wrote:
> > >
> > > +int rte_vhost_get_kickfd(int vid, uint16_t queue_id)
>
> Introducing rte_vhost_get_kickfd() may not help much, we already
> have rte_vhost_get_vhost_vring() to do that.
>
> https://github.com/DPDK/dpdk/blob/d7142fbae16f/drivers/net/vhost/rte_eth_vhost.c#L628-L644
>
> > > +{
> > > +       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

Reply via email to