[dpdk-dev] [PATCH 13/17] vhost: packed queue enqueue path

Tiwei Bie tiwei.bie at intel.com
Wed Mar 21 09:58:46 CET 2018


On Wed, Mar 21, 2018 at 09:45:59AM +0100, Jens Freimann wrote:
> On Mon, Mar 19, 2018 at 07:02:56PM +0800, Tiwei Bie wrote:
> > On Fri, Mar 16, 2018 at 04:21:16PM +0100, Jens Freimann wrote:
> > [...]
> > > +static inline uint32_t __attribute__((always_inline))
> > > +vhost_enqueue_burst_packed(struct virtio_net *dev, uint16_t queue_id,
> > > +	      struct rte_mbuf **pkts, uint32_t count)
> > > +{
> > > +	struct vhost_virtqueue *vq;
> > > +	struct vring_desc_packed *descs;
> > > +	uint16_t idx;
> > > +	uint16_t mask;
> > > +	uint16_t i;
> > > +
> > > +	vq = dev->virtqueue[queue_id];
> > > +
> > > +	rte_spinlock_lock(&vq->access_lock);
> > > +
> > > +	if (unlikely(vq->enabled == 0)) {
> > > +		i = 0;
> > > +		goto out_access_unlock;
> > > +	}
> > > +
> > > +	if (dev->features & (1ULL << VIRTIO_F_IOMMU_PLATFORM))
> > > +		vhost_user_iotlb_rd_lock(vq);
> > > +
> > > +	descs = vq->desc_packed;
> > > +	mask = vq->size - 1;
> > 
> > Queue size may not be a power of 2 in packed ring.
> 
> yes, you are right. my patches don't support this yet, but I plan to
> add it in the next version.

Yeah, thanks. Otherwise, because this is vhost code, and
the vq->size is set by virtio driver. So when above code
works with a virtio driver which uses a ring size that's
not a power of 2, such assumption will cause problems.

Thanks

> 
> Thanks for the review!
> 
> regards,
> Jens


More information about the dev mailing list