From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by dpdk.org (Postfix) with ESMTP id C3D9C4C73 for ; Mon, 19 Mar 2018 11:17:26 +0100 (CET) X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 19 Mar 2018 03:17:25 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.48,330,1517904000"; d="scan'208";a="43298874" Received: from debian.sh.intel.com (HELO debian) ([10.67.104.164]) by orsmga002.jf.intel.com with ESMTP; 19 Mar 2018 03:17:23 -0700 Date: Mon, 19 Mar 2018 18:15:49 +0800 From: Tiwei Bie To: Jens Freimann Cc: dev@dpdk.org, yliu@fridaylinux.org, maxime.coquelin@redhat.com, mst@redhat.com Message-ID: <20180319101549.tkkqth45tqdf6q7j@debian> References: <20180316152120.13199-1-jfreimann@redhat.com> <20180316152120.13199-9-jfreimann@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20180316152120.13199-9-jfreimann@redhat.com> User-Agent: NeoMutt/20170113 (1.7.2) Subject: Re: [dpdk-dev] [PATCH 08/17] net/virtio: implement receive 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: Mon, 19 Mar 2018 10:17:27 -0000 On Fri, Mar 16, 2018 at 04:21:11PM +0100, Jens Freimann wrote: [...] > diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c > index 722a2cd..888cc49 100644 > --- a/drivers/net/virtio/virtio_ethdev.c > +++ b/drivers/net/virtio/virtio_ethdev.c > @@ -1352,6 +1352,8 @@ static int virtio_dev_xstats_get_names(struct rte_eth_dev *dev, > PMD_INIT_LOG(INFO, "virtio: using simple Rx path on port %u", > eth_dev->data->port_id); > eth_dev->rx_pkt_burst = virtio_recv_pkts_vec; > + } else if (vtpci_packed_queue(hw)) { > + eth_dev->rx_pkt_burst = &virtio_recv_pkts_packed; If MRG_RXBUF isn't supported at this point, then we will need to make sure that RING_PACKED and MRG_RXBUF won't be negotiated at the same time. Otherwise this commit will break the driver. > } else if (vtpci_with_feature(hw, VIRTIO_NET_F_MRG_RXBUF)) { > PMD_INIT_LOG(INFO, > "virtio: using mergeable buffer Rx path on port %u", > @@ -1507,7 +1509,8 @@ static int virtio_dev_xstats_get_names(struct rte_eth_dev *dev, > > /* Setting up rx_header size for the device */ > if (vtpci_with_feature(hw, VIRTIO_NET_F_MRG_RXBUF) || > - vtpci_with_feature(hw, VIRTIO_F_VERSION_1)) > + vtpci_with_feature(hw, VIRTIO_F_VERSION_1) || > + vtpci_with_feature(hw, VIRTIO_F_RING_PACKED)) > hw->vtnet_hdr_size = sizeof(struct virtio_net_hdr_mrg_rxbuf); > else > hw->vtnet_hdr_size = sizeof(struct virtio_net_hdr); [...] > #ifdef RTE_LIBRTE_VIRTIO_DEBUG_DUMP > #define VIRTIO_DUMP_PACKET(m, len) rte_pktmbuf_dump(stdout, m, len) > @@ -428,6 +429,34 @@ > > PMD_INIT_FUNC_TRACE(); > > + if (vtpci_packed_queue(hw)) { > + struct vring_desc_packed *desc; > + struct vq_desc_extra *dxp; > + > + for (desc_idx = 0; desc_idx < vq->vq_nentries; > + desc_idx++) { > + m = rte_mbuf_raw_alloc(rxvq->mpool); > + if (unlikely(m == NULL)) > + return -ENOMEM; > + > + dxp = &vq->vq_descx[desc_idx]; > + dxp->cookie = m; > + dxp->ndescs = 1; > + > + desc = &vq->vq_ring.desc_packed[desc_idx]; > + desc->addr = VIRTIO_MBUF_ADDR(m, vq) + > + RTE_PKTMBUF_HEADROOM - hw->vtnet_hdr_size; > + desc->len = m->buf_len - RTE_PKTMBUF_HEADROOM + > + hw->vtnet_hdr_size; > + desc->flags |= VRING_DESC_F_WRITE; > + rte_smp_wmb(); > + set_desc_avail(&vq->vq_ring, desc); > + } > + toggle_wrap_counter(&vq->vq_ring); > + > + return 0; Maybe it's better to give the debug code (which is at the end of this function) a chance to run. Thanks