> -----Original Message-----
> From: Jason Wang [mailto:jasow...@redhat.com]
> Sent: Thursday, July 11, 2019 4:35 PM
> To: Liu, Yong <yong....@intel.com>; Bie, Tiwei <tiwei....@intel.com>;
> maxime.coque...@redhat.com; dev@dpdk.org
> Subject: Re: [dpdk-dev] [RFC PATCH 02/13] add vhost packed ring fast enqueue
> function
> 
> 
> On 2019/7/9 上午1:13, Marvin Liu wrote:
> > In fast enqueue function, will first check whether descriptors are
> > cache aligned. Fast enqueue function will check prerequisites in the
> > beginning. Fast enqueue function do not support chained mbufs, normal
> > function will handle that.
> >
> > Signed-off-by: Marvin Liu<yong....@intel.com>
> >
> > +   len = descs[avail_idx].len;
> > +   len1 = descs[avail_idx + 1].len;
> > +   len2 = descs[avail_idx + 2].len;
> > +   len3 = descs[avail_idx + 3].len;
> > +
> > +   if (unlikely((pkts[0]->pkt_len > (len - buf_offset)) |
> > +           (pkts[1]->pkt_len > (len1 - buf_offset)) |
> > +           (pkts[2]->pkt_len > (len2 - buf_offset)) |
> > +           (pkts[3]->pkt_len > (len3 - buf_offset))))
> > +           return -1;
> > +
> > +   desc_addr = vhost_iova_to_vva(dev, vq,
> > +                   descs[avail_idx].addr,
> > +                   &len,
> > +                   VHOST_ACCESS_RW);
> > +
> > +   desc_addr1 = vhost_iova_to_vva(dev, vq,
> > +                   descs[avail_idx + 1].addr,
> > +                   &len1,
> > +                   VHOST_ACCESS_RW);
> > +
> > +   desc_addr2 = vhost_iova_to_vva(dev, vq,
> > +                   descs[avail_idx + 2].addr,
> > +                   &len2,
> > +                   VHOST_ACCESS_RW);
> > +
> > +   desc_addr3 = vhost_iova_to_vva(dev, vq,
> > +                   descs[avail_idx + 3].addr,
> > +                   &len3,
> > +                   VHOST_ACCESS_RW);
> 
> 
> How can you guarantee that len3 is zero after this?
> 

Jason,
Here just guarantee host mapped length of desc is same as value in desc.
If value of len matched, data can be directly copied. 

If anything wrong in address conversion, value of len will be mismatched. 
This case will be handled by normal path.

Thanks,
Marvin

> Thanks

Reply via email to