From mboxrd@z Thu Jan 1 00:00:00 1970 From: Tiwei Bie Subject: Re: [PATCH v8 5/8] net/virtio: implement transmit path for packed queues Date: Thu, 18 Oct 2018 12:43:20 +0800 Message-ID: <20181018044320.GA15631@debian> References: <20181016090134.29448-1-jfreimann@redhat.com> <20181016090134.29448-6-jfreimann@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Cc: dev@dpdk.org, maxime.coquelin@redhat.com, Gavin.Hu@arm.com, zhihong.wang@intel.com To: Jens Freimann Return-path: Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by dpdk.org (Postfix) with ESMTP id 32B5B4C96 for ; Thu, 18 Oct 2018 06:44:43 +0200 (CEST) Content-Disposition: inline In-Reply-To: <20181016090134.29448-6-jfreimann@redhat.com> List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On Tue, Oct 16, 2018 at 11:01:31AM +0200, Jens Freimann wrote: [...] > +void > +vq_ring_free_chain_packed(struct virtqueue *vq, uint16_t desc_idx) > +{ > + struct vring_desc_packed *dp; > + struct vq_desc_extra *dxp = NULL, *dxp_tail = NULL; > + uint16_t desc_idx_last = desc_idx; > + > + dp = &vq->vq_ring.desc_packed[desc_idx]; > + dxp = &vq->vq_descx[desc_idx]; In the out-of-order case, we can't assume the desc and desc_extra have the same index. > + vq->vq_free_cnt = (uint16_t)(vq->vq_free_cnt + dxp->ndescs); > + if ((dp->flags & VRING_DESC_F_INDIRECT) == 0) { > + while (dp->flags & VRING_DESC_F_NEXT) { https://github.com/oasis-tcs/virtio-spec/blob/89dd55f5e606/packed-ring.tex#L222-L226 The device only writes out a single used descriptor for the whole list. It then skips forward according to the number of descriptors in the list. The driver needs to keep track of the size of the list corresponding to each buffer ID, to be able to skip to where the next used descriptor is written by the device. IOW, we can't use the VRING_DESC_F_NEXT here. > + desc_idx_last = dxp->next; > + dp = &vq->vq_ring.desc_packed[dxp->next]; > + dxp = &vq->vq_descx[dxp->next]; > + } > + }