[dpdk-dev] [PATCH 3/4] virtio: use indirect ring elements

Stephen Hemminger stephen at networkplumber.org
Sun Sep 6 20:43:55 CEST 2015


On Sun, 6 Sep 2015 08:40:44 +0000
"Ouyang, Changchun" <changchun.ouyang at intel.com> wrote:

> > @@ -220,11 +221,26 @@ virtqueue_enqueue_xmit(struct virtqueue *txvq,
> > struct rte_mbuf *cookie)
> >  	dxp = &txvq->vq_descx[idx];
> >  	dxp->cookie = (void *)cookie;
> >  	dxp->ndescs = needed;
> > -
> >  	start_dp = txvq->vq_ring.desc;
> > -	start_dp[idx].addr =
> > -		txvq->virtio_net_hdr_mem + idx * head_size;
> > -	start_dp[idx].len = (uint32_t)head_size;
> > +
> > +	if (use_indirect) {
> > +		offs = offsetof(struct virtio_tx_region, tx_indir)
> > +			+ idx * sizeof(struct virtio_tx_region);
> > +
> > +		start_dp[idx].addr = txvq->virtio_net_hdr_mem + offs;
> > +		start_dp[idx].len = sizeof(struct vring_desc);  
> 
> Should the length be N * sizeof(struct vring_desc)?

Yes.


More information about the dev mailing list