From mboxrd@z Thu Jan 1 00:00:00 1970 From: Maxime Coquelin Subject: Re: [PATCH v13 05/10] net/virtio: implement transmit path for packed queues Date: Mon, 17 Dec 2018 17:35:19 +0100 Message-ID: <66061ea8-a880-974e-9236-f0c60bf49e2c@redhat.com> References: <20181214155916.1142-1-jfreimann@redhat.com> <20181214155916.1142-6-jfreimann@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Cc: tiwei.bie@intel.com, Gavin.Hu@arm.com To: Jens Freimann , dev@dpdk.org Return-path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by dpdk.org (Postfix) with ESMTP id 9D74D4CB5 for ; Mon, 17 Dec 2018 17:35:26 +0100 (CET) In-Reply-To: <20181214155916.1142-6-jfreimann@redhat.com> Content-Language: en-US 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 12/14/18 4:59 PM, Jens Freimann wrote: > This implements the transmit path for devices with > support for packed virtqueues. > > Signed-off-by: Jens Freiman > Signed-off-by: Tiwei Bie > --- > drivers/net/virtio/virtio_ethdev.c | 57 ++++--- > drivers/net/virtio/virtio_ethdev.h | 2 + > drivers/net/virtio/virtio_rxtx.c | 236 ++++++++++++++++++++++++++++- > drivers/net/virtio/virtqueue.h | 20 ++- > 4 files changed, 293 insertions(+), 22 deletions(-) > > diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c > index e6ba1282b..9f1b72e56 100644 > --- a/drivers/net/virtio/virtio_ethdev.c > +++ b/drivers/net/virtio/virtio_ethdev.c > @@ -390,6 +390,9 @@ virtio_init_queue(struct rte_eth_dev *dev, uint16_t vtpci_queue_idx) > if (vtpci_packed_queue(hw)) { > vq->avail_wrap_counter = 1; > vq->used_wrap_counter = 1; > + vq->avail_used_flags = > + VRING_DESC_F_AVAIL(vq->avail_wrap_counter) | > + VRING_DESC_F_USED(!vq->avail_wrap_counter); > } > > /* > @@ -497,17 +500,26 @@ virtio_init_queue(struct rte_eth_dev *dev, uint16_t vtpci_queue_idx) > memset(txr, 0, vq_size * sizeof(*txr)); > for (i = 0; i < vq_size; i++) { > struct vring_desc *start_dp = txr[i].tx_indir; > - > - vring_desc_init_split(start_dp, > - RTE_DIM(txr[i].tx_indir)); > + struct vring_packed_desc *start_dp_packed = > + txr[i].tx_indir_pq; > > /* first indirect descriptor is always the tx header */ > - start_dp->addr = txvq->virtio_net_hdr_mem > - + i * sizeof(*txr) > - + offsetof(struct virtio_tx_region, tx_hdr); > - > - start_dp->len = hw->vtnet_hdr_size; > - start_dp->flags = VRING_DESC_F_NEXT; > + if (vtpci_packed_queue(hw)) { > + start_dp_packed->addr = txvq->virtio_net_hdr_mem > + + i * sizeof(*txr) > + + offsetof(struct virtio_tx_region, > + tx_hdr); > + start_dp_packed->len = hw->vtnet_hdr_size; > + } else { > + vring_desc_init_split(start_dp, > + RTE_DIM(txr[i].tx_indir)); > + start_dp->addr = txvq->virtio_net_hdr_mem > + + i * sizeof(*txr) > + + offsetof(struct virtio_tx_region, > + tx_hdr); > + start_dp->len = hw->vtnet_hdr_size; > + start_dp->flags = VRING_DESC_F_NEXT; > + } > } > } > > @@ -1336,6 +1348,23 @@ set_rxtx_funcs(struct rte_eth_dev *eth_dev) > { > struct virtio_hw *hw = eth_dev->data->dev_private; > > + if (vtpci_packed_queue(hw)) { > + PMD_INIT_LOG(INFO, > + "virtio: using packed ring standard Tx path on port %u", > + eth_dev->data->port_id); > + eth_dev->tx_pkt_burst = virtio_xmit_pkts_packed; > + } else { > + if (hw->use_inorder_tx) { > + PMD_INIT_LOG(INFO, "virtio: using inorder Tx path on port %u", > + eth_dev->data->port_id); > + eth_dev->tx_pkt_burst = virtio_xmit_pkts_inorder; > + } else { > + PMD_INIT_LOG(INFO, "virtio: using standard Tx path on port %u", > + eth_dev->data->port_id); > + eth_dev->tx_pkt_burst = virtio_xmit_pkts; > + } > + } > + > if (hw->use_simple_rx) { > PMD_INIT_LOG(INFO, "virtio: using simple Rx path on port %u", > eth_dev->data->port_id); > @@ -1356,15 +1385,7 @@ set_rxtx_funcs(struct rte_eth_dev *eth_dev) > eth_dev->rx_pkt_burst = &virtio_recv_pkts; > } > > - if (hw->use_inorder_tx) { > - PMD_INIT_LOG(INFO, "virtio: using inorder Tx path on port %u", > - eth_dev->data->port_id); > - eth_dev->tx_pkt_burst = virtio_xmit_pkts_inorder; > - } else { > - PMD_INIT_LOG(INFO, "virtio: using standard Tx path on port %u", > - eth_dev->data->port_id); > - eth_dev->tx_pkt_burst = virtio_xmit_pkts; > - } > + Trailing new line? Apart from that, it looks good to me: Reviewed-by: Maxime coquelin Thanks, Maxime