From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id BE6E31B39B for ; Wed, 20 Jun 2018 09:44:40 +0200 (CEST) X-Amp-Result: UNSCANNABLE X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 20 Jun 2018 00:44:39 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,246,1526367600"; d="scan'208";a="68472672" Received: from debian.sh.intel.com (HELO debian) ([10.67.104.228]) by orsmga002.jf.intel.com with ESMTP; 20 Jun 2018 00:44:38 -0700 Date: Wed, 20 Jun 2018 15:44:42 +0800 From: Tiwei Bie To: Marvin Liu Cc: maxime.coquelin@redhat.com, zhihong.wang@intel.com, dev@dpdk.org Message-ID: <20180620074442.GB4686@debian> References: <20180608090724.20855-1-yong.liu@intel.com> <20180608090724.20855-7-yong.liu@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20180608090724.20855-7-yong.liu@intel.com> User-Agent: Mutt/1.9.5 (2018-04-13) Subject: Re: [dpdk-dev] [PATCH 6/7] net/virtio: add IN_ORDER Rx/Tx into selection 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: Wed, 20 Jun 2018 07:44:41 -0000 On Fri, Jun 08, 2018 at 05:07:23PM +0800, Marvin Liu wrote: [...] > > @@ -634,6 +634,24 @@ virtio_dev_rx_queue_setup_finish(struct rte_eth_dev *dev, uint16_t queue_idx) > virtio_rxq_rearm_vec(rxvq); > nbufs += RTE_VIRTIO_VPMD_RX_REARM_THRESH; > } > + } else if (hw->use_inorder_rx) { > + if ((!virtqueue_full(vq))) { > + uint16_t free_cnt = vq->vq_free_cnt; > + struct rte_mbuf *pkts[free_cnt]; > + > + if (!rte_pktmbuf_alloc_bulk(rxvq->mpool, pkts, free_cnt)) { > + error = virtqueue_enqueue_inorder_refill(vq, > + pkts, > + free_cnt); > + if (unlikely(error)) { > + for (i = 0; i < free_cnt; i++) > + rte_pktmbuf_free(pkts[i]); > + } > + } > + > + nbufs += free_cnt; > + vq_update_avail_idx(vq); It looks a bit weird to introduce above code in this patch. > + } > } else { > while (!virtqueue_full(vq)) { > m = rte_mbuf_raw_alloc(rxvq->mpool); > diff --git a/drivers/net/virtio/virtqueue.c b/drivers/net/virtio/virtqueue.c > index a7d0a9cbe..56a77cc71 100644 > --- a/drivers/net/virtio/virtqueue.c > +++ b/drivers/net/virtio/virtqueue.c > @@ -74,6 +74,14 @@ virtqueue_rxvq_flush(struct virtqueue *vq) > desc_idx = used_idx; > rte_pktmbuf_free(vq->sw_ring[desc_idx]); > vq->vq_free_cnt++; > + } else if (hw->use_inorder_rx) { > + desc_idx = (uint16_t)uep->id; > + dxp = &vq->vq_descx[desc_idx]; > + if (dxp->cookie != NULL) { > + rte_pktmbuf_free(dxp->cookie); > + dxp->cookie = NULL; > + } Ditto. > + vq_ring_free_inorder(vq, desc_idx, 1); > } else { > desc_idx = (uint16_t)uep->id; > dxp = &vq->vq_descx[desc_idx]; > -- > 2.17.0 >