From mboxrd@z Thu Jan 1 00:00:00 1970 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) X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 17 Oct 2018 21:44:42 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,395,1534834800"; d="scan'208";a="82369592" Received: from btwcube1.sh.intel.com (HELO debian) ([10.67.104.158]) by orsmga008.jf.intel.com with ESMTP; 17 Oct 2018 21:44:41 -0700 Date: Thu, 18 Oct 2018 12:43:20 +0800 From: Tiwei Bie To: Jens Freimann Cc: dev@dpdk.org, maxime.coquelin@redhat.com, Gavin.Hu@arm.com, zhihong.wang@intel.com 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 Content-Disposition: inline In-Reply-To: <20181016090134.29448-6-jfreimann@redhat.com> User-Agent: Mutt/1.10.1 (2018-07-13) Subject: Re: [dpdk-dev] [PATCH v8 5/8] net/virtio: implement transmit path for packed queues X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Oct 2018 04:44:45 -0000 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]; > + } > + }